Classes | Namespaces | Defines | Functions

iparamb2.h File Reference

This reference page is linked to from the following overview topics: ParamBlockDesc2 Flags, General Best Practices, Parameter Block UI, Creating a Parameter Block, Parameter Block Flags, Parameter Block UI Specification Arguments, Parameter Flags, Parameter Tags, Sub-Texture Map Parameters, Using Multiple Roll-ups, Parameter/Result Types, Creating Parameter Blocks, Adding and Deleting Parameters, Supporting Save to Previous.


#include "PB2Export.h"
#include "maxheap.h"
#include "iparamb.h"
#include "iparamm.h"
#include "assetmanagement\AssetType.h"
#include "assetmanagement\AssetId.h"
#include "strbasic.h"
#include "iparamb2Typedefs.h"
#include "TabTypes.h"
#include "paramtype.h"

Go to the source code of this file.

Classes

struct   PB2Value
struct   ParamAlias
class   IParamBlock2
class   PBValidator
class   PBAccessor
struct   ParamDef
class   ClassDesc2
class   ParamBlockDesc2
struct   ParamBlockDesc2::map_spec
class   ParamBlock2PLCB
class   IParamBlock2PostLoadInfo
  Informational class about ParamBlock2 objects loaded from file. More...

Namespaces

namespace   MaxSDK
namespace   MaxSDK::AssetManagement

Defines

#define  P_CLASS_PARAMS   0x0001
  this block holds class-level parameters, attached to ClassDesc
#define  P_AUTO_CONSTRUCT   0x0002
  instructs ClassDesc2 to autoconstuct this block & wire it in, requires pblock refno
#define  P_AUTO_UI   0x0004
  this block support automatic UI rollout managements, requires rollout template res ID, etc.
#define  P_USE_PARAMS   0x0008
  this block shares (exactly) the paramdefs from another descriptor, requires address of source descriptor
#define  P_INCLUDE_PARAMS   0x0010
  this block loads in a copy the paramdefs from another descriptor, requires address of source descriptor
#define  P_MULTIMAP   0x0020
  indicates this block as mulitple parameter maps ### move me
#define  P_CALLSETS_ON_LOAD   0x0040
  causes CallSets() to be called during load PLCB for this block
#define  P_HASCATEGORY   0x0080
  indicates, that category field is defined for rollup (after rollupproc)
#define  P_TEMPLATE_UI   0x0100
  indicates that dialog templates will be provided or constructed
#define  P_VERSION   0x0200
  Indicates a parameter block version number is specified.
#define  P_SCRIPTED_CLASS   0x1000
  belongs to a scripted plug-in class
#define  P_TEMPORARY   0x2000
  temporary descriptor built during scene load to support schema migration
#define  P_ANIMATABLE   0x00000001
  animatable param
#define  P_TRANSIENT   0x00000002
  do not store actual value, PBAccessor-derived
#define  P_NO_INIT   0x00000004
  do not initialize
#define  P_COMPUTED_NAME   0x00000008
  call compute name fn to get name
#define  P_INVISIBLE   0x00000010
  not visible in track view (if an animatable)
#define  P_RESET_DEFAULT   0x00000020
  do not make create params sticky, reset to defaults always
#define  P_SUBANIM   0x00000040
  non-animatable reference param is still a subanim (makes it visible in TV)
#define  P_TV_SHOW_ALL   0x00000080
  for Tab<> animatables, show all entries even if no controller assigned
#define  P_NO_REF   0x00000100
  for reftarg params do not maintain Reference automatically
#define  P_OWNERS_REF   0x00000200
  reference param maintained by owner, specify owner's reference number via the p_refno tag
#define  P_CAN_CONVERT   0x00000400
  indicates the p_classid validator is is in a CanConvertoTo() call, rather than as exact class
#define  P_SUBTEX   0x00000800
  indicates texmap param is kept by owner using MtlBase::xSubTexmap protocol, give subtex # in p_subtexno
#define  P_VARIABLE_SIZE   0x00001000
  Tab<> param is variable size allowing scripted changes.
#define  P_NO_AUTO_LABELS   0x00002000
  don't auto-set map & mtl names for associated button UI controls
#define  P_SHORT_LABELS   0x00004000
  use short auto names for associated button UI controls
#define  P_READ_ONLY   0x00008000
  this parameter is not assignable through MAXScript (allows try-and-buy 3rd-party plugins)
#define  P_OBSOLETE   0x40000000
  Indicates parameter is obsolete.
#define  P_READ_SECOND_FLAG_VALUE   0x80000000
  Indicates that a second per param constructor-specifiable flag value follows the first in the ParamBlockDesc2.
#define  P_USE_ACCESSOR_ONLY   0x00000001
  Indicates whether or not when doing a get or set on a param2 value that we only go through the accessor if one is available.
#define  P_IS_REF   0x0000000000010000
  is a reftarget param
#define  P_HAS_DEFAULT   0x0000000000020000
  has accessor function => a virtual param
#define  P_HAS_CUR_DEFAULT   0x0000000000040000
  has a snapshotted current default value
#define  P_HAS_MS_DEFAULT   0x0000000000080000
  has a MAXScript default
#define  P_HAS_RANGE   0x0000000000100000
  has a range specified
#define  P_HAS_CLASS_ID   0x0000000000200000
  a classID validator was given
#define  P_HAS_SCLASS_ID   0x0000000000400000
  an SClassID validator was given
#define  P_UI_ENABLED   0x0000000000800000
  indicates whether UI controls are initially enabled or diabled
#define  P_HAS_PROMPT   0x0000000001000000
  has status line prompt string res ID for various picker buttons
#define  P_HAS_CAPTION   0x0000000002000000
  has caption string res ID for open/save file dlgs
#define  P_HAS_FILETYPES   0x0000000004000000
  has file types string res ID for open/save file dlgs (in MAXScript type: form)
#define  P_HAS_REFNO   0x0000000008000000
  has refno supplied
#define  P_HAS_SUBTEXNO   0x0000000010000000
  has subtexno supplied
#define  P_INCLUDED   0x0000000020000000
  [INTERNAL ONLY] Sets a ParamDef as included from another descriptor.
#define  P_HAS_TOOLTIP   0x0001000000000000
  has ToolTip string
#define  P_HAS_ASSETTYPE   0x0002000000000000
  has asset type
#define  P_HAS_ASSETTYPENAME   0x0004000000000000
  has asset type name
#define  base_type(t)   ((ParamType2)((t) & ~(TYPE_TAB)))
  get base type ignoring Tab flag
#define  root_type(t)   ((ParamType2)((t) & ~(TYPE_TAB | TYPE_BY_VAL | TYPE_BY_REF | TYPE_BY_PTR)))
  get base type ignoring all flags
#define  is_tab(t)   ((t) & TYPE_TAB)
  is this param a table?
#define  is_by_val(t)   ((t) & TYPE_BY_VAL)
  is this param passed by value? (only for FnPub)
#define  is_by_ref(t)   ((t) & TYPE_BY_REF)
  is this param passed by reference? (only for FnPub)
#define  is_by_ptr(t)   ((t) & TYPE_BY_PTR)
  is this param passed by pointer? (only for FnPub)
#define  is_ref(d)   (((d).flags & (P_IS_REF | P_NO_REF | P_OWNERS_REF)) == P_IS_REF)
  is this param a true local refmaker?
#define  has_ui(d)   ((d).ctrl_count > 0)
  this param has UI info defined
#define  reftarg_type(t)
#define  IPARAMBLOCK2POSTLOADINFO_ID   Interface_ID(0x6c7b290a, 0x7c56423c)

Functions

PB2Export IParamBlock2 CreateParameterBlock2 (ParamBlockDesc2 *pdesc, ReferenceMaker *iowner)
PB2Export void  SetPB2MacroRecorderInterface (MacroRecorder *mri)
PB2Export IParamBlock2 UpdateParameterBlock2 (ParamBlockDescID *pdescOld, int oldCount, IParamBlock *oldPB, ParamBlockDesc2 *pdescNew, IParamBlock2 *newPB=NULL)
PB2Export int  CopyParamBlock2ToParamBlock (IParamBlock2 *pb2, IParamBlock *pb1, ParamBlockDescID *pdescPB1, int pb1Count)
PB2Export bool  IsParamTypeAnimatable (const ParamType2 t)

Define Documentation

#define P_CLASS_PARAMS   0x0001

this block holds class-level parameters, attached to ClassDesc

Definition at line 38 of file iparamb2.h.

#define P_AUTO_CONSTRUCT   0x0002

instructs ClassDesc2 to autoconstuct this block & wire it in, requires pblock refno

Definition at line 39 of file iparamb2.h.

#define P_AUTO_UI   0x0004

this block support automatic UI rollout managements, requires rollout template res ID, etc.

Definition at line 40 of file iparamb2.h.

#define P_USE_PARAMS   0x0008

this block shares (exactly) the paramdefs from another descriptor, requires address of source descriptor

Definition at line 41 of file iparamb2.h.

#define P_INCLUDE_PARAMS   0x0010

this block loads in a copy the paramdefs from another descriptor, requires address of source descriptor

Definition at line 42 of file iparamb2.h.

#define P_MULTIMAP   0x0020

indicates this block as mulitple parameter maps ### move me

Definition at line 43 of file iparamb2.h.

#define P_CALLSETS_ON_LOAD   0x0040

causes CallSets() to be called during load PLCB for this block

Definition at line 44 of file iparamb2.h.

#define P_HASCATEGORY   0x0080

indicates, that category field is defined for rollup (after rollupproc)

Definition at line 45 of file iparamb2.h.

#define P_TEMPLATE_UI   0x0100

indicates that dialog templates will be provided or constructed

Definition at line 46 of file iparamb2.h.

#define P_VERSION   0x0200

Indicates a parameter block version number is specified.

When used as a ParamBlockDesc2 flag, a version number is expected immediately after the flags field, before the reference number field. This version number will be stored as ParamBlockDesc2::version and returned as IParamBlock2::GetVersion() indicates a version number is specified (integer value, before pblock refno)

Definition at line 50 of file iparamb2.h.

#define P_SCRIPTED_CLASS   0x1000

belongs to a scripted plug-in class

Definition at line 53 of file iparamb2.h.

#define P_TEMPORARY   0x2000

temporary descriptor built during scene load to support schema migration

Definition at line 54 of file iparamb2.h.

#define P_ANIMATABLE   0x00000001

animatable param

Definition at line 57 of file iparamb2.h.

#define P_TRANSIENT   0x00000002

do not store actual value, PBAccessor-derived

Definition at line 58 of file iparamb2.h.

#define P_NO_INIT   0x00000004

do not initialize

Definition at line 59 of file iparamb2.h.

#define P_COMPUTED_NAME   0x00000008

call compute name fn to get name

Definition at line 60 of file iparamb2.h.

#define P_INVISIBLE   0x00000010

not visible in track view (if an animatable)

Definition at line 61 of file iparamb2.h.

#define P_RESET_DEFAULT   0x00000020

do not make create params sticky, reset to defaults always

Definition at line 62 of file iparamb2.h.

#define P_SUBANIM   0x00000040

non-animatable reference param is still a subanim (makes it visible in TV)

Definition at line 63 of file iparamb2.h.

#define P_TV_SHOW_ALL   0x00000080

for Tab<> animatables, show all entries even if no controller assigned

Definition at line 64 of file iparamb2.h.

#define P_NO_REF   0x00000100

for reftarg params do not maintain Reference automatically

Definition at line 65 of file iparamb2.h.

#define P_OWNERS_REF   0x00000200

reference param maintained by owner, specify owner's reference number via the p_refno tag

Definition at line 66 of file iparamb2.h.

#define P_CAN_CONVERT   0x00000400

indicates the p_classid validator is is in a CanConvertoTo() call, rather than as exact class

Definition at line 67 of file iparamb2.h.

#define P_SUBTEX   0x00000800

indicates texmap param is kept by owner using MtlBase::xSubTexmap protocol, give subtex # in p_subtexno

Definition at line 68 of file iparamb2.h.

#define P_VARIABLE_SIZE   0x00001000

Tab<> param is variable size allowing scripted changes.

Definition at line 69 of file iparamb2.h.

#define P_NO_AUTO_LABELS   0x00002000

don't auto-set map & mtl names for associated button UI controls

Definition at line 70 of file iparamb2.h.

#define P_SHORT_LABELS   0x00004000

use short auto names for associated button UI controls

Definition at line 71 of file iparamb2.h.

#define P_READ_ONLY   0x00008000

this parameter is not assignable through MAXScript (allows try-and-buy 3rd-party plugins)

Definition at line 72 of file iparamb2.h.

#define P_OBSOLETE   0x40000000

Indicates parameter is obsolete.

Definition at line 77 of file iparamb2.h.

#define P_READ_SECOND_FLAG_VALUE   0x80000000

Indicates that a second per param constructor-specifiable flag value follows the first in the ParamBlockDesc2.

Definition at line 83 of file iparamb2.h.

#define P_USE_ACCESSOR_ONLY   0x00000001

Indicates whether or not when doing a get or set on a param2 value that we only go through the accessor if one is available.

Definition at line 90 of file iparamb2.h.

#define P_IS_REF   0x0000000000010000

is a reftarget param

Definition at line 94 of file iparamb2.h.

#define P_HAS_DEFAULT   0x0000000000020000

has accessor function => a virtual param

Definition at line 95 of file iparamb2.h.

#define P_HAS_CUR_DEFAULT   0x0000000000040000

has a snapshotted current default value

Definition at line 96 of file iparamb2.h.

#define P_HAS_MS_DEFAULT   0x0000000000080000

has a MAXScript default

Definition at line 97 of file iparamb2.h.

#define P_HAS_RANGE   0x0000000000100000

has a range specified

Definition at line 98 of file iparamb2.h.

#define P_HAS_CLASS_ID   0x0000000000200000

a classID validator was given

Definition at line 99 of file iparamb2.h.

#define P_HAS_SCLASS_ID   0x0000000000400000

an SClassID validator was given

Definition at line 100 of file iparamb2.h.

#define P_UI_ENABLED   0x0000000000800000

indicates whether UI controls are initially enabled or diabled

Definition at line 101 of file iparamb2.h.

#define P_HAS_PROMPT   0x0000000001000000

has status line prompt string res ID for various picker buttons

Definition at line 102 of file iparamb2.h.

#define P_HAS_CAPTION   0x0000000002000000

has caption string res ID for open/save file dlgs

Definition at line 103 of file iparamb2.h.

#define P_HAS_FILETYPES   0x0000000004000000

has file types string res ID for open/save file dlgs (in MAXScript type: form)

Definition at line 104 of file iparamb2.h.

#define P_HAS_REFNO   0x0000000008000000

has refno supplied

Definition at line 105 of file iparamb2.h.

#define P_HAS_SUBTEXNO   0x0000000010000000

has subtexno supplied

Definition at line 106 of file iparamb2.h.

#define P_INCLUDED   0x0000000020000000

[INTERNAL ONLY] Sets a ParamDef as included from another descriptor.

If this is set on a ParamDef, its member ptrs have been copied from another descriptor, and will not be released

Definition at line 110 of file iparamb2.h.

#define P_HAS_TOOLTIP   0x0001000000000000

has ToolTip string

Definition at line 111 of file iparamb2.h.

#define P_HAS_ASSETTYPE   0x0002000000000000

has asset type

Definition at line 112 of file iparamb2.h.

#define P_HAS_ASSETTYPENAME   0x0004000000000000

has asset type name

Definition at line 113 of file iparamb2.h.

#define base_type (   t )    ((ParamType2)((t) & ~(TYPE_TAB)))

get base type ignoring Tab flag

Definition at line 118 of file iparamb2.h.

#define root_type (   t )    ((ParamType2)((t) & ~(TYPE_TAB | TYPE_BY_VAL | TYPE_BY_REF | TYPE_BY_PTR)))

get base type ignoring all flags

Definition at line 119 of file iparamb2.h.

#define is_tab (   t )    ((t) & TYPE_TAB)

is this param a table?

Definition at line 120 of file iparamb2.h.

#define is_by_val (   t )    ((t) & TYPE_BY_VAL)

is this param passed by value? (only for FnPub)

Definition at line 121 of file iparamb2.h.

#define is_by_ref (   t )    ((t) & TYPE_BY_REF)

is this param passed by reference? (only for FnPub)

Definition at line 122 of file iparamb2.h.

#define is_by_ptr (   t )    ((t) & TYPE_BY_PTR)

is this param passed by pointer? (only for FnPub)

Definition at line 123 of file iparamb2.h.

#define is_ref (   d )    (((d).flags & (P_IS_REF | P_NO_REF | P_OWNERS_REF)) == P_IS_REF)

is this param a true local refmaker?

Definition at line 124 of file iparamb2.h.

#define has_ui (   d )    ((d).ctrl_count > 0)

this param has UI info defined

Definition at line 125 of file iparamb2.h.

#define reftarg_type (   t )
#define IPARAMBLOCK2POSTLOADINFO_ID   Interface_ID(0x6c7b290a, 0x7c56423c)

Definition at line 3435 of file iparamb2.h.


Function Documentation

PB2Export IParamBlock2* CreateParameterBlock2 ( ParamBlockDesc2 pdesc,
ReferenceMaker iowner 
)
Remarks:
This method is used to create a parameter block2.
Parameters:
ParamBlockDesc2 *pdesc

This is an array of parameter block descriptors.

ReferenceMaker* iowner

Points to the owner of the parameter block.
Returns:
A pointer to the created parameter block. On error NULL is returned.
PB2Export void SetPB2MacroRecorderInterface ( MacroRecorder mri )
Remarks:
This function for internal use only.
PB2Export IParamBlock2* UpdateParameterBlock2 ( ParamBlockDescID pdescOld,
int  oldCount,
IParamBlock oldPB,
ParamBlockDesc2 pdescNew,
IParamBlock2 newPB = NULL 
)
Remarks:
This function updates or creates a new ParamBlock2, based on an existing ParamBlock of an earlier version. The new parameter block inherits any parameters from the old parameter block whose parameter IDs match. This may also be used to partially update an existing ParamBlock2. The parameter type of the ParamBlock and ParamBlock2 entries must match, with a special case that if the ParamBlock parameter type is TYPE_RGBA, the ParamBlock2 parameter type can be either TYPE_RGBA or TYPE_FRGBA
Parameters:
ParamBlockDescID *pdescOld

The array of parameter block descriptors which describes each parameter in the old parameter block.

int oldCount

The number of elements in the array above.

IParamBlock *oldPB

The old parameter block.

ParamBlockDesc2* pdescNew

Points to the new parameter block 2 descriptor.

IParamBlock2* newPB=NULL

Points to an existing IParamBlock2 indicating that this paramblock should be filled in from the old ParamBlock, rather than creating a new one.
Returns:
The new parameter block2.
PB2Export int CopyParamBlock2ToParamBlock ( IParamBlock2 pb2,
IParamBlock pb1,
ParamBlockDescID pdescPB1,
int  pb1Count 
)
Remarks:
This function updates a ParamBlock based on an existing ParamBlock2. The ParamBlock inherits any parameters from the ParamBlock2 whose parameter IDs match. The parameter type of the ParamBlock and ParamBlock2 entries must match, with a special case that if the ParamBlock parameter type is TYPE_RGBA, the ParamBlock2 parameter type can be either TYPE_RGBA or TYPE_FRGBA This is mainly intended for use in Save To Previous, where the current version is ParamBlock2 based, and the old version is ParamBlock based. Note that if a ParamBlock2 parameter is animated, the ParamBlock2 will hold a reference to a controller for that parameter. This function does not clone the controller and have the ParamBlock hold a reference to that clone, rather the ParamBlock will hold a reference to the original controller. This is normally ok, since the ParamBlock will be deleted at the end of the save process. If the ParamBlock is being created other than for Save To Previous, you should consider replacing any references held by the ParamBlock with a clone of that reference.
Parameters:
IParamBlock2* pb2

Points to source IParamBlock2. IParamBlock* pb1

Points to destination IParamBlock. ParamBlockDescID *pdescPB1

The array of parameter block descriptors which describes each parameter in the ParamBlock.

int pb1Count

The number of elements in the array of parameter block descriptors.

Returns:
The number of parameters copied from the IParamBlock2 to the IParamBlock.
    bool Swirl::SpecifySaveReferences(ReferenceSaveManager& referenceSaveManager)
    {
        // if saving to previous version that used pb1 instead of pb2...
        DWORD saveVersion = GetSavingVersion();
        if (saveVersion != 0 && saveVersion <= MAX_RELEASE_R13)
        {
            // create the pb1 instance
            IParamBlock* paramBlock1 = CreateParameterBlock( pbdesc,swirl_num_params_ver1,1);
            DbgAssert(paramBlock1 != NULL);
            if (paramBlock1)
            {
                // copy data from the pb2 to the pb1
                int numParamsCopied = CopyParamBlock2ToParamBlock(pblock,paramBlock1,pbdesc,swirl_num_params_ver1);
                DbgAssert(numParamsCopied == swirl_num_params_ver1);
                // register the reference slot replacement
                referenceSaveManager.ReplaceReferenceSlot(PBLOCK_REF,paramBlock1);
            }
        }
        return Texmap::SpecifySaveReferences(referenceSaveManager);
    }
PB2Export bool IsParamTypeAnimatable ( const ParamType2  t )
Remarks:
This function determines whether a param type is animatable.