iparamb2.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *<
00003     FILE: iparamb2.h
00004 
00005     DESCRIPTION: Interface to Parameter blocks, 2nd edition
00006 
00007     CREATED BY: Rolf Berteig,
00008                 John Wainwright, 2nd Ed.
00009 
00010     HISTORY: created 1/25/95
00011              2nd Ed. 9/2/98
00012 
00013  *> Copyright (c) 1994, All Rights Reserved.
00014  **********************************************************************/
00015 
00016 #pragma once
00017 #include "PB2Export.h"
00018 #include "maxheap.h"
00019 #include "iparamb.h"
00020 #include "iparamm.h"
00021 #include "assetmanagement\AssetType.h"
00022 #include "assetmanagement\AssetId.h"
00023 #include "strbasic.h"         // MCHAR
00024 #include "iparamb2Typedefs.h"
00025 #include "TabTypes.h"
00026 // forward declarations
00027 class Matrix3;
00028 namespace MaxSDK
00029 {
00030     namespace AssetManagement
00031     {
00032         class AssetUser;
00033     }
00034 }
00035 
00036 
00037 // per descriptor flags
00038 #define P_CLASS_PARAMS      0x0001      //!< this block holds class-level parameters, attached to ClassDesc
00039 #define P_AUTO_CONSTRUCT    0x0002      //!< instructs ClassDesc2 to autoconstuct this block & wire it in, requires pblock refno
00040 #define P_AUTO_UI           0x0004      //!< this block support automatic UI rollout managements, requires rollout template res ID, etc.
00041 #define P_USE_PARAMS        0x0008      //!< this block shares (exactly) the paramdefs from another descriptor, requires address of source descriptor
00042 #define P_INCLUDE_PARAMS    0x0010      //!< this block loads in a copy the paramdefs from another descriptor, requires address of source descriptor
00043 #define P_MULTIMAP          0x0020      //!< indicates this block as mulitple parameter maps   ### move me
00044 #define P_CALLSETS_ON_LOAD  0x0040      //!< causes CallSets() to be called during load PLCB for this block
00045 #define P_HASCATEGORY       0x0080      //!< indicates, that category field is defined for rollup (after rollupproc)
00046 #define P_TEMPLATE_UI       0x0100      //!< indicates that dialog templates will be provided or constructed
00047 
00048 
00050 #define P_VERSION           0x0200      //!< indicates a version number is specified (integer value, before pblock refno)
00051 
00052 // per descriptor internal flags
00053 #define P_SCRIPTED_CLASS    0x1000      //!< belongs to a scripted plug-in class
00054 #define P_TEMPORARY         0x2000      //!< temporary descriptor built during scene load to support schema migration
00055 
00056 // per param constructor-specifiable flags (flag value 1)
00057 #define P_ANIMATABLE        0x00000001  //!< animatable param
00058 #define P_TRANSIENT         0x00000002  //!< do not store actual value, PBAccessor-derived
00059 #define P_NO_INIT           0x00000004  //!< do not initialize
00060 #define P_COMPUTED_NAME     0x00000008  //!< call compute name fn to get name
00061 #define P_INVISIBLE         0x00000010  //!< not visible in track view (if an animatable)
00062 #define P_RESET_DEFAULT     0x00000020  //!< do not make create params sticky, reset to defaults always
00063 #define P_SUBANIM           0x00000040  //!< non-animatable reference param is still a subanim (makes it visible in TV)
00064 #define P_TV_SHOW_ALL       0x00000080  //!< for Tab<> animatables, show all entries even if no controller assigned
00065 #define P_NO_REF            0x00000100  //!< for reftarg params do not maintain Reference automatically
00066 #define P_OWNERS_REF        0x00000200  //!< reference param maintained by owner, specify owner's reference number via the p_refno tag
00067 #define P_CAN_CONVERT       0x00000400  //!< indicates the p_classid validator is is in a CanConvertoTo() call, rather than as exact class
00068 #define P_SUBTEX            0x00000800  //!< indicates texmap param is kept by owner using MtlBase::xSubTexmap protocol, give subtex # in p_subtexno
00069 #define P_VARIABLE_SIZE     0x00001000  //!< Tab<> param is variable size allowing scripted changes
00070 #define P_NO_AUTO_LABELS    0x00002000  //!< don't auto-set map & mtl names for associated button UI controls
00071 #define P_SHORT_LABELS      0x00004000  //!< use short auto names for associated button UI controls
00072 #define P_READ_ONLY         0x00008000  //!< this parameter is not assignable through MAXScript (allows try-and-buy 3rd-party plugins)
00073 
00075 /* When used as a ParamBlockDesc2 param flag, the param will not be saved to disk or maintain references or animation keys.
00076 When loading older files, the parameter will be reset after the load is completed, but will be valid during a post-load callback */
00077 #define P_OBSOLETE          0x40000000  // obsolete param, don't maintain refs, a controller or a tab, and don't save to file
00078 
00080 /* If this flag is set on the first per param constructor-specifiable flag value, a second DWORD size per param constructor-specifiable 
00081    flag value follows the first. The value will be read in, shifted left DWORD places and combined with the first flag value to form the 
00082    ParamDef flag value.*/
00083 #define P_READ_SECOND_FLAG_VALUE 0x80000000  
00084 
00086 /* If this flag is set the paramblock2 will only go through the accessor when getting or setting a value, or when determining if a key 
00087 exists at a certain time. If this flag isn't set, the normal operation on a SetValue is to send the value through the accessor first, 
00088 and then set the controller's value; on a GetValue to get the value from the controller and then send it through the accessor.
00089 This flag is specified in the second per param constructor-specifiable flag value*/
00090 #define P_USE_ACCESSOR_ONLY 0x00000001
00091 
00092 
00093 // per param internal flags
00094 #define P_IS_REF            0x0000000000010000 //!< is a reftarget param
00095 #define P_HAS_DEFAULT       0x0000000000020000 //!< has accessor function => a virtual param
00096 #define P_HAS_CUR_DEFAULT   0x0000000000040000 //!< has a snapshotted current default value
00097 #define P_HAS_MS_DEFAULT    0x0000000000080000 //!< has a MAXScript default
00098 #define P_HAS_RANGE         0x0000000000100000 //!< has a range specified
00099 #define P_HAS_CLASS_ID      0x0000000000200000 //!< a classID validator was given
00100 #define P_HAS_SCLASS_ID     0x0000000000400000 //!< an SClassID validator was given
00101 #define P_UI_ENABLED        0x0000000000800000 //!< indicates whether UI controls are initially enabled or diabled
00102 #define P_HAS_PROMPT        0x0000000001000000 //!< has status line prompt string res ID for various picker buttons
00103 #define P_HAS_CAPTION       0x0000000002000000 //!< has caption string res ID for open/save file dlgs
00104 #define P_HAS_FILETYPES     0x0000000004000000 //!< has file types string res ID for open/save file dlgs (in MAXScript type: form)
00105 #define P_HAS_REFNO         0x0000000008000000 //!< has refno supplied
00106 #define P_HAS_SUBTEXNO      0x0000000010000000 //!< has subtexno supplied
00107 
00108 
00110 #define P_INCLUDED          0x0000000020000000
00111 #define P_HAS_TOOLTIP       0x0001000000000000 //!< has ToolTip string
00112 #define P_HAS_ASSETTYPE     0x0002000000000000 //!< has asset type
00113 #define P_HAS_ASSETTYPENAME 0x0004000000000000 //!< has asset type name
00114 
00115 // Parameter types
00116 #include "paramtype.h"  // parameter type codes
00117 
00118 #define base_type(t)    ((ParamType2)((t) & ~(TYPE_TAB)))   //!< get base type ignoring Tab flag
00119 #define root_type(t)    ((ParamType2)((t) & ~(TYPE_TAB | TYPE_BY_VAL | TYPE_BY_REF | TYPE_BY_PTR))) //!< get base type ignoring all flags
00120 #define is_tab(t)       ((t) & TYPE_TAB)                    //!< is this param a table?
00121 #define is_by_val(t)    ((t) & TYPE_BY_VAL)                 //!< is this param passed by value?  (only for FnPub)
00122 #define is_by_ref(t)    ((t) & TYPE_BY_REF)                 //!< is this param passed by reference?  (only for FnPub)
00123 #define is_by_ptr(t)    ((t) & TYPE_BY_PTR)                 //!< is this param passed by pointer?  (only for FnPub)
00124 #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?
00125 #define has_ui(d)       ((d).ctrl_count > 0)                //!< this param has UI info defined
00126 #define reftarg_type(t) (base_type(t) == TYPE_MTL || base_type(t) == TYPE_TEXMAP || base_type(t) == TYPE_INODE || \
00127                          base_type(t) == TYPE_REFTARG || base_type(t) == TYPE_PBLOCK2 || base_type(t) == TYPE_OBJECT || base_type(t) == TYPE_CONTROL)
00128 
00129 class ParamBlockDesc2;
00130 class ClassDesc;
00131 class PBBitmap;
00132 class ParamMap2UserDlgProc;
00133 class MSPluginClass;
00134 class Value;
00135 class Rollout;
00136 class FPInterface;
00137 
00138 // parameter value
00139 #pragma pack(push,parameter_entry)
00140 //#pragma pack(1)   // this messes up Win64 builds & the GreatCircle memory debugger
00141 
00142 class Texmap;
00143 class Mtl;
00144 class INode;
00145 class IAutoMParamDlg;
00146 class IAutoSParamDlg;
00147 class IAutoEParamDlg;
00148 struct ParamDef;
00149 
00153 struct PB2Value: public MaxHeapOperators {
00154     union
00155     {
00157         int                 i;
00159         float               f;
00161         Point3*             p;
00163         Point4*             p4;
00165         TimeValue           t;
00167         MCHAR*              s;
00169         PBBitmap*           bm;
00171         ReferenceTarget*    r;
00172         // new for R4
00174         Matrix3*            m;
00176         Control*            control;  // replaces i,f,p or t values if animated
00178         Point2*             p2;
00179     };
00181     BYTE flags;
00182 
00183     PB2Export BOOL is_constant();
00184     PB2Export void Free(ParamType2 type);
00185 };
00186 
00187 #pragma pack(pop,parameter_entry)
00188 
00189 // defines a parameter alias
00195 struct ParamAlias: public MaxHeapOperators {
00197     MCHAR*  alias;
00199     ParamID ID;
00202     int     tabIndex;
00203 };
00204 
00205 // the interface to a ParamBlock2
00215 #pragma warning(push)
00216 #pragma warning(disable:4100)
00217 class IParamBlock2 : public ReferenceTarget 
00218 {
00219     public:
00221         virtual DWORD       GetVersion()=0;
00224         virtual int         NumParams()=0;
00226         virtual MCHAR*      GetLocalName()=0;
00227         // acquire & release the descriptor for this paramblock, get individual paramdefs
00230         virtual ParamBlockDesc2* GetDesc()=0;
00233         virtual void        ReleaseDesc()=0;
00236         virtual void        SetDesc(ParamBlockDesc2* desc)=0;
00240         virtual ParamDef&   GetParamDef(ParamID id)=0;
00241         // access block ID
00244         virtual BlockID     ID()=0;
00245         // index-to/from-ID conversion
00250         virtual int         IDtoIndex(ParamID id)=0;
00254         virtual ParamID     IndextoID(int i)=0;
00255         // get object that owns this block
00258         virtual ReferenceMaker* GetOwner()=0;
00259 
00260         // Get's the super class of a parameters controller
00264         virtual SClass_ID GetAnimParamControlType(int anim)=0;
00268         virtual SClass_ID GetParamControlType(ParamID id)=0;
00269         // Get the param type & name
00272         virtual ParamType2 GetParameterType(ParamID id)=0;
00278         virtual MSTR GetLocalName(ParamID id, int tabIndex = -1)=0; 
00279 
00280         // parameter accessors, one for each known type
00292         virtual BOOL SetValue(ParamID id, TimeValue t, float v, int tabIndex=0)=0;
00304         virtual BOOL SetValue(ParamID id, TimeValue t, int v, int tabIndex=0)=0;        
00316         virtual BOOL SetValue(ParamID id, TimeValue t, Point3& v, int tabIndex=0)=0;        
00328         virtual BOOL SetValue(ParamID id, TimeValue t, Point4& v, int tabIndex=0)=0;        
00340         virtual BOOL SetValue(ParamID id, TimeValue t, Color& v, int tabIndex=0)=0;  // uses Point3 controller
00352         virtual BOOL SetValue(ParamID id, TimeValue t, AColor& v, int tabIndex=0)=0;  // uses Point4 controller
00364         virtual BOOL SetValue(ParamID id, TimeValue t, const MCHAR* v, int tabIndex=0)=0;
00376         virtual BOOL SetValue(ParamID id, TimeValue t, Mtl* v, int tabIndex=0)=0;
00388         virtual BOOL SetValue(ParamID id, TimeValue t, Texmap* v, int tabIndex=0)=0;
00400         virtual BOOL SetValue(ParamID id, TimeValue t, PBBitmap* v, int tabIndex=0)=0;
00412         virtual BOOL SetValue(ParamID id, TimeValue t, INode* v, int tabIndex=0)=0;
00424         virtual BOOL SetValue(ParamID id, TimeValue t, ReferenceTarget* v, int tabIndex=0)=0;
00436         virtual BOOL SetValue(ParamID id, TimeValue t, IParamBlock2* v, int tabIndex=0)=0;
00448         virtual BOOL SetValue(ParamID id, TimeValue t, Matrix3& v, int tabIndex=0)=0;       
00449 
00460         virtual BOOL SetValue(ParamID id, TimeValue t, const MaxSDK::AssetManagement::AssetUser& v, int tabIndex=0)=0;      
00461 
00462 
00476         virtual BOOL GetValue(ParamID id, TimeValue t, float& v, Interval &ivalid, int tabIndex=0)=0;
00490         virtual BOOL GetValue(ParamID id, TimeValue t, int& v, Interval &ivalid, int tabIndex=0)=0;
00504         virtual BOOL GetValue(ParamID id, TimeValue t, Point3& v, Interval &ivalid, int tabIndex=0)=0;
00518         virtual BOOL GetValue(ParamID id, TimeValue t, Point4& v, Interval &ivalid, int tabIndex=0)=0;
00532         virtual BOOL GetValue(ParamID id, TimeValue t, Color& v, Interval &ivalid, int tabIndex=0)=0; // uses Point3 controller
00546         virtual BOOL GetValue(ParamID id, TimeValue t, AColor& v, Interval &ivalid, int tabIndex=0)=0; // uses Point4 controller
00560         virtual BOOL GetValue(ParamID id, TimeValue t, const MCHAR*& v, Interval &ivalid, int tabIndex=0)=0;
00574         virtual BOOL GetValue(ParamID id, TimeValue t, Mtl*& v, Interval &ivalid, int tabIndex=0)=0;
00587         virtual BOOL GetValue(ParamID id, TimeValue t, Texmap*& v, Interval &ivalid, int tabIndex=0)=0;
00600         virtual BOOL GetValue(ParamID id, TimeValue t, PBBitmap*& v, Interval &ivalid, int tabIndex=0)=0;
00613         virtual BOOL GetValue(ParamID id, TimeValue t, INode*& v, Interval &ivalid, int tabIndex=0)=0;
00626         virtual BOOL GetValue(ParamID id, TimeValue t, ReferenceTarget*& v, Interval &ivalid, int tabIndex=0)=0;
00639         virtual BOOL GetValue(ParamID id, TimeValue t, IParamBlock2*& v, Interval &ivalid, int tabIndex=0)=0;
00652         virtual BOOL GetValue(ParamID id, TimeValue t, Matrix3& v, Interval &ivalid, int tabIndex=0)=0;
00653 
00665         virtual BOOL GetValue(ParamID id, TimeValue t, MaxSDK::AssetManagement::AssetUser& v, Interval &ivalid, int tabIndex=0)=0;
00666 
00667         // short cut getters for each type
00678         virtual Color       GetColor(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00689         virtual AColor      GetAColor(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00700         virtual Point3      GetPoint3(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00711         virtual Point4      GetPoint4(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00722         virtual int         GetInt(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00733         virtual float       GetFloat(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00744         virtual TimeValue   GetTimeValue(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00755         virtual const MCHAR*        GetStr(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00766         virtual Mtl*        GetMtl(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00777         virtual Texmap*     GetTexmap(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00788         virtual PBBitmap*   GetBitmap(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00799         virtual INode*      GetINode(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00810         virtual ReferenceTarget* GetReferenceTarget(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00821         virtual IParamBlock2* GetParamBlock2(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00832         virtual Matrix3     GetMatrix3(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00833 
00844         virtual MaxSDK::AssetManagement::AssetUser  GetAssetUser(ParamID id, TimeValue t=0, int tabIndex=0)=0;
00845 
00846         // and one to get the value in a PB2Value 
00854         virtual PB2Value& GetPB2Value(ParamID id, int tabIndex=0)=0;
00855 
00856 
00857         // parameter Tab management
00860         virtual int     Count(ParamID id)=0;
00864         virtual void    ZeroCount(ParamID id)=0;
00869         virtual void    SetCount(ParamID id, int n)=0;
00876         virtual int     Delete(ParamID id, int start,int num)=0; 
00881         virtual int     Resize(ParamID id, int num)=0;
00884         virtual void    Shrink(ParamID id)=0;
00909         virtual void    Sort(ParamID id, CompareFnc cmp)=0;
00910         // Tab Insert for each type
00917         virtual int     Insert(ParamID id, int at, int num, float* el)=0;
00924         virtual int     Insert(ParamID id, int at, int num, Point3** el)=0;
00925         virtual int     Insert(ParamID id, int at, int num, Point4** el)=0;
00932         virtual int     Insert(ParamID id, int at, int num, Color** el)=0;
00933         virtual int     Insert(ParamID id, int at, int num, AColor** el)=0;
00941         virtual int     Insert(ParamID id, int at, int num, TimeValue* el)=0;
00949         virtual int     Insert(ParamID id, int at, int num, MCHAR** vel)=0;
00957         virtual int     Insert(ParamID id, int at, int num, const MCHAR** vel)=0;
00964         virtual int     Insert(ParamID id, int at, int num, Mtl** el)=0;
00971         virtual int     Insert(ParamID id, int at, int num, Texmap** el)=0;
00979         virtual int     Insert(ParamID id, int at, int num, PBBitmap** el)=0;
00986         virtual int     Insert(ParamID id, int at, int num, INode** v)=0;
00994         virtual int     Insert(ParamID id, int at, int num, ReferenceTarget** el)=0;
00995         virtual int     Insert(ParamID id, int at, int num, IParamBlock2** el)=0;
01002         virtual int     Insert(ParamID id, int at, int num, Matrix3** el)=0;
01003         // Tab Insert for each type
01011         virtual int     Append(ParamID id, int num, float* el, int allocExtra=0)=0;
01020         virtual int     Append(ParamID id, int num, Point3** el, int allocExtra=0)=0;
01021         virtual int     Append(ParamID id, int num, Point4** el, int allocExtra=0)=0;
01030         virtual int     Append(ParamID id, int num, Color** el, int allocExtra=0)=0;
01031         virtual int     Append(ParamID id, int num, AColor** el, int allocExtra=0)=0;
01040         virtual int     Append(ParamID id, int num, TimeValue* el, int allocExtra=0)=0;
01049         virtual int     Append(ParamID id, int num, MCHAR** el, int allocExtra=0)=0;
01058         virtual int     Append(ParamID id, int num, const MCHAR** el, int allocExtra=0)=0;
01066         virtual int     Append(ParamID id, int num, Mtl** el, int allocExtra=0)=0;
01075         virtual int     Append(ParamID id, int num, Texmap** el, int allocExtra=0)=0;
01084         virtual int     Append(ParamID id, int num, PBBitmap** el, int allocExtra=0)=0;
01093         virtual int     Append(ParamID id, int num, INode** el, int allocExtra=0)=0;
01102         virtual int     Append(ParamID id, int num, ReferenceTarget** el, int allocExtra=0)=0;
01103         virtual int     Append(ParamID id, int num, IParamBlock2** el, int allocExtra=0)=0;
01111         virtual int     Append(ParamID id, int num, Matrix3** el, int allocExtra=0)=0;
01112 
01120         virtual BOOL KeyFrameAtTimeByIndex(int i,      TimeValue t, int tabIndex=0) { return FALSE; }
01122         MAX_DEPRECATED BOOL KeyFrameAtTime(int i,      TimeValue t, int tabIndex=0);
01131         virtual BOOL KeyFrameAtTimeByID(ParamID id, TimeValue t, int tabIndex=0) { return KeyFrameAtTimeByIndex(IDtoIndex(id), t, tabIndex); }
01133         MAX_DEPRECATED BOOL KeyFrameAtTime(ParamID id, TimeValue t, int tabIndex=0);
01139         virtual void RemoveControllerByIndex(int i, int tabIndex)=0;
01141         MAX_DEPRECATED void RemoveController(int i, int tabIndex);
01147         virtual Control*    GetControllerByID(ParamID id, int tabIndex=0)=0;
01149         MAX_DEPRECATED Control* GetController(ParamID id, int tabIndex=0);
01155         virtual Control*    GetControllerByIndex(int i, int tabIndex=0)=0;
01157         MAX_DEPRECATED Control* GetController(int i, int tabIndex=0);
01165         virtual void        SetControllerByIndex(int i, int tabIndex, Control* c, BOOL preserveFrame0Value=TRUE)=0;
01173         virtual void        SetControllerByID(ParamID id, int tabIndex, Control* c, BOOL preserveFrame0Value=TRUE) { SetControllerByIndex(IDtoIndex(id), tabIndex, c, preserveFrame0Value); }
01175         MAX_DEPRECATED void SetController(int i, int tabIndex, Control *c, BOOL preserveFrame0Value=TRUE);
01177         MAX_DEPRECATED void SetController(ParamID id, int tabIndex, Control *c, BOOL preserveFrame0Value=TRUE);
01183         virtual void        SwapControllers(int i1, int tabIndex1, int i2, int tabIndex2)=0;
01184 
01185         // Given the param num & optional Tab<> index, what is the refNum?
01190         virtual int GetRefNum(int i, int tabIndex=0)=0;
01191         // Given the param num & optional Tab<> index, what is the animated param controller refnum?
01196         virtual int GetControllerRefNum(int i, int tabIndex=0)=0;
01197 
01198         // Given the parameter ID what is the animNum?
01203         virtual int GetAnimNum(ParamID id, int tabIndex=0)=0;
01204 
01205         // Given the animNum what is the parameter index?
01210         virtual int AnimNumToParamNum(int animNum, int& tabIndex)=0;
01211 
01215         virtual ParamDimension* GetParamDimension(int subAnim)=0;
01216 
01217         // This is only for use in a RescaleWorldUnits() implementation:
01218         // The param block implementation of RescaleWorldUnits scales only tracks
01219         // that have dimension type = stdWorldDim. If letting the param block handle 
01220         // the rescaling is not sufficient, call this on just the parameters you need to rescale.
01230         virtual void RescaleParam(int paramNum, int tabIndex, float f)=0;
01231 
01232         // When a NotifyRefChanged is received from a param block, you 
01233         // can call this method to find out which parameter generated the notify.
01234         virtual ParamID LastNotifyParamID()=0;
01246         virtual ParamID LastNotifyParamID(int& tabIndex)=0;  // variant also returns changing element index
01247         
01248         // control notifications, enable/disable send NotifyRefChanged messages when parameters change (via SetValue(), eg)
01261         virtual void EnableNotifications(BOOL onOff)=0;
01262 
01266         virtual BOOL IsNotificationEnabled() = 0;
01267 
01268         // allows owner to signal pblock when P_OWNER_REF params are deleted
01276         virtual void RefDeleted(ParamID id, int tabIndex=0)=0;
01277 
01278         // ParamMap2 access, 
01283         virtual void SetMap(IParamMap2* m, MapID map_id = 0)=0;
01287         virtual IParamMap2* GetMap(MapID map_id = 0)=0;
01288         // rollout state, normally used by ParamMap2 to automatically save & restore state 
01298         virtual void SetRolloutOpen(BOOL open, MapID map_id = 0)=0;
01303         virtual BOOL GetRolloutOpen(MapID map_id = 0)=0;
01308         virtual void SetRolloutScrollPos(int pos, MapID map_id = 0)=0;
01312         virtual int GetRolloutScrollPos(MapID map_id = 0)=0;
01313 
01314         // ParamDlg access, 
01318         virtual IAutoMParamDlg* GetMParamDlg()=0;
01322         virtual IAutoEParamDlg* GetEParamDlg()=0;
01323 
01324         // init parameters with MAXScript defaults
01340         virtual void InitMSParameters()=0;
01341 
01342         // alias maintenance
01351         virtual void DefineParamAlias(MCHAR* alias_name, ParamID id, int tabIndex=-1)=0;
01357         virtual ParamAlias* FindParamAlias(MCHAR* alias_name)=0;
01364         virtual MCHAR* FindParamAlias(ParamID id, int tabIndex=-1)=0;
01368         virtual void ClearParamAliases()=0;
01370         virtual int ParamAliasCount()=0;
01374         virtual ParamAlias* GetParamAlias(int i)=0;
01375 
01376         // set subanim number for given param
01391         virtual void SetSubAnimNum(ParamID id, int subAnimNum, int tabIndex=0)=0;
01394         virtual void ClearSubAnimMap()=0;
01395 
01396         // parameter value copying, copy src_id param from src block to id param in this block
01405         virtual void Assign(ParamID id, IParamBlock2* src, ParamID src_id)=0;
01406 
01407         // find the param ID & tabIndex for given ReferenceTarget(either as a subanim or reftarg parameter)
01414         virtual ParamID FindRefParam(ReferenceTarget* ref, int& tabIndex)=0;
01415 
01416         // reset params to default values
01424         virtual void ResetAll(BOOL updateUI = TRUE, BOOL callSetHandlers = TRUE)=0;
01435         virtual void Reset(ParamID id, int tabIndex=-1, BOOL updateUI = TRUE, BOOL callSetHandlers = TRUE)=0;
01436         // force a call to the PBAccessor Get()/Set() functions for a param or all params
01445         virtual void CallSet(ParamID id, int tabIndex=-1)=0;
01454         virtual void CallGet(ParamID id, int tabIndex=-1)=0;
01459         virtual void CallSets()=0;
01464         virtual void CallGets()=0;
01465         // get validity of all params in all paramblock
01470         virtual void GetValidity(TimeValue t, Interval &valid)=0;
01471 };
01472 
01473 // specialize this class to provide a custom SetValue() validator
01474 // the Validate() function should return falsi if the given PB2Value is
01475 // not valid
01485 class PBValidator : public InterfaceServer
01486 {
01487 public:
01492     virtual BOOL Validate(PB2Value& v) = 0;
01507     virtual BOOL Validate(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex) { return this->Validate(v); }
01512     virtual void DeleteThis() { };
01513 };
01514 
01515 // specialize this class to provide 'virtual' parameter value accessor functions
01534 class PBAccessor : public InterfaceServer
01535 {
01536 public:
01537     // get into v
01560     virtual void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid) { }    
01561     // set from v
01579     virtual void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) { }                      
01580     // computed keyframe presence
01599     virtual BOOL KeyFrameAtTime(ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) { return FALSE; }
01600     // computed parameter localized (subanim) name, only called if P_COMPUTED_NAME is flagged
01616     virtual MSTR GetLocalName(ReferenceMaker* owner, ParamID id, int tabIndex) { return _M(""); }
01617     // called when a Tab<> parameter has a change made to its table structure
01618     enum tab_changes { tab_insert, tab_append, tab_delete, tab_ref_deleted, tab_setcount, tab_sort };
01639     virtual void TabChanged(tab_changes changeCode, Tab<PB2Value>* tab, ReferenceMaker* owner, ParamID id, int tabIndex, int count) { }
01640     // implement this if your PBAccessors are dynamically allocated
01645     virtual void DeleteThis() { };
01646 };
01647 
01648 #pragma warning(pop)
01649 // Parameter Block Descriptors
01650 //    in PB2s, there is one ParamBlockDesc2 per entire PB, containing
01651 //    the metadata for all the parameters in the PB.  All the PBs
01652 //    mapped by this structure contain pointers back to it and the 
01653 //    owning class's ClassDesc contains all the PB2Descs for PBs in
01654 //    its objects
01655 
01656 // HEY!  for the moment, all the possible optional parameters are in extensis.  If
01657 //       this proves a big memory hog, we can institute some kind of streaming
01658 //       scheme that packs used optionals into a single mem buffer.  The GetDesc() 
01659 //       function should be used to access the PBD in all cases to allow this caching.
01660 //       sizeof(ParmDef) ~ 70 bytes, so for 2500 params =~ 175K bytes
01661  
01662 #pragma pack(push, parameter_def)
01663 // #pragma pack(1)   // this messes up Win64 builds & the GreatCircle memory debugger
01664 
01670 struct ParamDef: public MaxHeapOperators
01671 {
01672     DWORD size;
01673     //public:
01675     ParamID     ID;             // pos independent ID
01680     MCHAR*      int_name;       // fixed internal name
01682     ParamType2  type;           // parameter type
01686     ULONGLONG   flags;          // status flags
01687     // optional
01689     StringResID local_name;     // localized (subabim) name (string res id)
01691     ParamDimension* dim;        // parameter dimension
01693     PB2Value    def;            // default value
01695     PB2Value    ms_def;         // default value for MAXScript & MacroRecorder
01697     PB2Value    cur_def;        // current 'sticky' default value, used to maintain creation defaults within a session
01699     int         description;    // one sentence description (string res id)
01701     PB2Value    range_low;      // range values
01703     PB2Value    range_high;
01706     PBValidator* validator;     // validator object
01712     PBAccessor* accessor;       // virtual param accessor object
01714     short       tab_size;       // initial table size
01716     short       ref_no;         // block-owner's refno for non-hosted ReferenceTargets
01718     short       subobj_no;      // block-owner's SubTex/SubMtl index for Texmap/Mtl parameters in Mtl owners
01720     Class_ID    class_ID;       // validator for reftargs
01722     SClass_ID   sclass_ID;      //    "       "     "
01723     // UI optional
01725     ControlType2 ctrl_type;     // type of UI control
01745     EditSpinnerType spin_type;  // spinner type if spinner
01747     int*        ctrl_IDs;       // array of control IDs for this control  (or ui element names if for scripted plugin)
01749     short       ctrl_count;     // number of controls
01754     union { // radiobutton vals or bit numbers for int bits controlled by multiple checkboxes
01755         int* val_bits;
01756         float* val_bits_float;
01757         };
01758 
01760     float       scale;          // display scale
01761 // begin - mjm 12.19.98
01763     int     numSegs;        // slider segments
01764 // end - mjm 12.19.98
01766     ParamID*    enable_ctrls;   // array of which other params ahave their UI ctrls automatically enabled by this param
01768     short       enable_count;   // count of enable control params
01770     int     prompt;         // status line prompt string res ID for various picker buttons
01772     int     caption;        // caption string res ID for open/save file dlgs
01774     int toolTip;
01776     MCHAR*      init_file;      // initial filename for open/save file dlgs
01778     int     file_types;     // file types string res ID for open/save file dlgs (in MAXScript type: form)
01779     // new for R4
01781     Tab<MapID>  maps;
01782 
01784     MCHAR *     dyn_file_types; 
01785 
01787     MaxSDK::AssetManagement::AssetType asset_type_id;
01788 
01790     PB2Export void DeleteThis();
01791     ParamDef() { size = sizeof(ParamDef);}
01792 };
01793         
01794 #pragma pack(pop, parameter_def)
01795 
01796 /* ----------------------- ClassDesc2 ------------------------------------*/
01797 
01798 class MtlBase;
01799 class SpecialFX; // mjm - 07.06.00
01800 
01801 // 2nd Edition of ClassDesc with necessary extra stuff for ParamBlock2 support
01810 class ClassDesc2 : public ClassDesc 
01811 {
01812     private:
01813         Tab<ParamBlockDesc2*>   pbDescs;        // parameter block descriptors
01814         Tab<IParamMap2*>        paramMaps;      // any current param maps
01815         IAutoMParamDlg*         masterMDlg;     // master material/mapParamDlg if any
01816         IAutoEParamDlg*         masterEDlg;     // master EffectParamDlg if any
01817 
01818     protected:
01819         
01821 
01825         void SetMParamDlg(IAutoMParamDlg* dlg) { masterMDlg = dlg; }
01826 
01832 
01836 
01841 
01843 
01847 
01857 
01864 
01874 
01878 
01886 
01890 
01905 
01920 
01925 
01934 
01945 
01954 
01962 
01969 
01979 
01986 
02002 
02012 
02023 
02033 
02042 
02053 
02059 
02065 
02070 
02074 
02079 
02087 
02095 
02103 
02112 
02181 
02188 
02536 
02551 
02561 
02566 
02579 
02590 
02604 
02614 
02618 
02620 
02626 
02633 
02639 
02657 
02672 
02687 
02703 
02719 
02734 
02749 
02764 
02779 
02795 
02810 
02830 
02849 
02868 
02887 
02905 
02922 
02939 
02956 
02973 
02991 
03010 
03024 
03038 
03052 
03065 
03078 
03091 
03104 
03117 
03130 
03143 
03156 
03169 
03176 
03180 
03189 
03195 
03208 
03214 
03223 
03229 
03239 
03248 
03253 
03258 
03267 
03273 
03277 
03279 
03282 
03283 
03286 
03290 
03301 
03304 
03327 
03381 
03406 
03417 
03427 
03438 
03447 
03451 
03453 
03456 
03459 
03461 
03463 
03465 
03466 
03468 
03474 
03479