00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #pragma once
00018 #include "BuildWarnings.h"
00019 #include "maxheap.h"
00020 #include "strbasic.h"
00021 #include "noncopyable.h"
00022 #include "autoptr.h"
00023 #include <WTypes.h>
00024 #include "CoreExport.h"
00025 #include "Animatable.h"
00026 #include "AnimatableFlags.h"
00027 #include "hold.h"
00028 #include "channels.h"
00029
00030
00031
00032
00033
00034 typedef void* ReferenceData;
00035 typedef unsigned int TargetParam;
00036
00037
00038
00039
00040
00048
00050 typedef ULONG_PTR PartID;
00051
00056
00057 #define PART_TOPO TOPO_CHANNEL
00058
00059 #define PART_GEOM GEOM_CHANNEL
00060
00061 #define PART_TEXMAP TEXMAP_CHANNEL
00062
00063 #define PART_MTL MTL_CHANNEL
00064
00065 #define PART_SELECT SELECT_CHANNEL
00066
00067 #define PART_SUBSEL_TYPE SUBSEL_TYPE_CHANNEL
00068
00069 #define PART_DISPLAY DISP_ATTRIB_CHANNEL
00070
00071 #define PART_VERTCOLOR VERTCOLOR_CHANNEL
00072
00073 #define PART_GFX_DATA GFX_DATA_CHANNEL
00074
00075 #define PART_DISP_APPROX DISP_APPROX_CHANNEL
00076
00077 #define PART_EXTENSION EXTENSION_CHANNEL
00078
00079 #define PART_TM_CHAN TM_CHANNEL
00080
00081 #define PART_MTL_CHAN GLOBMTL_CHANNEL
00082
00083 #define PART_OBJECT_TYPE (1<<11)
00084
00085 #define PART_TM (1<<12)
00086
00087 #define PART_OBJ (PART_TOPO|PART_GEOM)
00088
00089 #define PART_ALL (ALL_CHANNELS|PART_TM)
00090
00091
00096 #define PART_GI_EXCLUDED (1<<0)
00097 #define PART_GI_OCCLUDER (1<<1)
00098 #define PART_GI_RECEIVER (1<<2)
00099 #define PART_GI_DIFFUSE (1<<3)
00100 #define PART_GI_SPECULAR (1<<4)
00101 #define PART_GI_NBREFINESTEPS (1<<5)
00102 #define PART_GI_MESHSIZE (1<<6)
00103 #define PART_GI_MESHINGENABLED (1<<7)
00104 #define PART_GI_USEGLOBALMESHING (1<<8)
00105 #define PART_GI_EXCLUDEFROMREGATHERING (1<<9)
00106 #define PART_GI_STOREILLUMMESH (1<<10)
00107 #define PART_GI_RAYMULT (1<<11)
00108 #define PART_GI_USE_ADAPTIVE_SUBDIVISION (1<<12)
00109 #define PART_GI_MIN_MESH_SIZE (1<<13)
00110 #define PART_GI_INITIAL_MESH_SIZE (1<<14)
00111 #define PART_GI_CONTRAST_THRESHOLD (1<<15)
00112
00113
00114
00119 #define PART_REND_PROP_RENDERABLE (1<<0)
00120 #define PART_REND_PROP_CAST_SHADOW (1<<1)
00121 #define PART_REND_PROP_RCV_SHADOW (1<<2)
00122 #define PART_REND_PROP_RENDER_OCCLUDED (1<<3)
00123 #define PART_REND_PROP_VISIBILITY (1<<4)
00124 #define PART_REND_PROP_INHERIT_VIS (1<<5)
00125 #define PART_REND_PROP_PRIMARY_INVISIBILITY (1<<6)
00126 #define PART_REND_PROP_SECONDARY_INVISIBILITY (1<<7)
00127
00128
00133 #define PART_DISP_PROP_IS_HIDDEN (1<<0)
00134 #define PART_DISP_PROP_IS_FROZEN (1<<1)
00135 #define PART_DISP_PROP_SHOW_FRZN_WITH_MTL (1<<2)
00136 #define PART_DISP_PROP_BOX_MODE (1<<3)
00137 #define PART_DISP_PROP_BACKCULL (1<<4)
00138 #define PART_DISP_PROP_ALL_EDGES (1<<5)
00139 #define PART_DISP_PROP_BONE_ONLY (1<<6)
00140 #define PART_DISP_PROP_BONE_AS_LINE (1<<7)
00141 #define PART_DISP_PROP_SHOW_PATH (1<<8)
00142 #define PART_DISP_PROP_VERT_TICKS (1<<9)
00143 #define PART_DISP_PROP_XRAY_MTL (1<<10)
00144 #define PART_DISP_PROP_IGNORE_EXTENTS (1<<11)
00145 #define PART_DISP_PROP_COLOR_VERTS (1<<12)
00146
00147
00150
00151 #define PART_EXCLUDE_RADIOSITY (1<<29)
00152
00153
00154 #define PART_HIDESTATE (1<<30)
00155
00156
00157 #define PART_MXS_PROPCHANGE (1<<16)
00158
00162
00163 #define PART_PUT_IN_FG (1<<0)
00164
00165 #define PART_SHOW_DEPENDENCIES (1<<1)
00166
00167 #define PART_SHOWDEP_ON (1<<2)
00168
00169
00171
00173
00200
00202 typedef unsigned int RefMessage;
00203
00205 #define REFMSG_LOOPTEST 0x00000010
00206
00208
00215 #define REFMSG_TARGET_DELETED 0x00000020
00216
00217 #define REFMSG_MODAPP_DELETING 0x00000021
00218
00219 #define REFMSG_EVAL 0x00000030
00220
00221 #define REFMSG_RESET_ORIGIN 0x00000040
00222
00224
00236 #define REFMSG_CHANGE 0x00000050
00237
00239 #define REFMSG_FLAGDEPENDENTS 0x00000070
00240
00241 #define REFMSG_TARGET_SELECTIONCHANGE 0x00000080
00242
00244
00245 #define REFMSG_BEGIN_EDIT 0x00000090
00246
00247
00252 #define REFMSG_END_EDIT 0x000000A0
00253
00255 #define REFMSG_DISABLE 0x000000B0
00256
00257 #define REFMSG_ENABLE 0x000000C0
00258
00259 #define REFMSG_TURNON 0x000000D0
00260
00261 #define REFMSG_TURNOFF 0x000000E0
00262
00263 #define REFMSG_LOOKAT_TARGET_DELETED 0x000000F0
00264
00265 #define REFMSG_INVALIDATE_IF_BG 0x000000F1
00266
00268
00269 #define REFMSG_MOD_DISPLAY_ON 0x000000F2
00270
00271
00272 #define REFMSG_MOD_DISPLAY_OFF 0x000000F3
00273
00275
00281 #define REFMSG_MOD_EVAL 0x000000F4
00282
00284
00289 #define REFMSG_IS_OK_TO_CHANGE_TOPOLOGY 0x000000F5
00290
00291
00292
00293
00294
00296 #define REFMSG_NODE_LINK 0x000000F6
00297
00299
00302 #define REFMSG_NODE_NAMECHANGE 0x000000F7
00303
00305
00307 #define REFMSG_OBREF_CHANGE 0x000000F8
00308
00310 #define REFMSG_MODIFIER_ADDED 0x000000F9
00311
00313 #define REFMSG_CONTROLREF_CHANGE 0x000000FA
00314
00317
00318 #define REFMSG_GET_PARAM_NAME 0x000000FB
00319
00322
00323 #define REFMSG_GET_PARAM_DIM 0x000000FC
00324
00327 #define REFMSG_GET_CONTROL_DIM 0x000000FD
00328
00330
00335 #define REFMSG_TM_CHANGE 0x000000FE
00336
00338 #define REFMSG_RANGE_CHANGE 0x000000FF
00339
00341 #define REFMSG_LINEHEIGHT_CHANGE 0x00000100
00342
00344
00345 #define REFMSG_BECOMING_ANIMATED 0x00000101
00346
00348
00351 #define REFMSG_SUBANIM_STRUCTURE_CHANGED 0x00000102
00352
00354
00355
00356 #define REFMSG_REF_DELETED 0x00000103
00357
00359
00360
00361 #define REFMSG_REF_ADDED 0x00000104
00362
00365 #define REFMSG_BRANCHED_HISTORY_CHANGED 0x00000105
00366
00369
00370 #define REFMSG_NODEINSELSET_CHANGED 0x00000106
00371
00373
00377 #define REFMSG_TEST_DEPENDENCY 0x00000107
00378
00380
00384 #define REFMSG_WANT_SHOWPARAMLEVEL 0x00000108
00385
00387
00390 #define REFMSG_BEFORE_PASTE 0x00000109
00391
00392
00395 #define REFMSG_NOTIFY_PASTE 0x0000010A
00396
00399 #define REFMSG_UV_SYM_CHANGE 0x0000010B
00400
00402
00404 #define REFMSG_GET_NODE_NAME 0x0000010C
00405
00407 #define REFMSG_SEL_NODES_DELETED 0x0000010D
00408
00410 #define REFMSG_PRENOTIFY_PASTE 0x0000010E
00411
00413
00416 #define REFMSG_SHAPE_START_CHANGE 0x0000010F
00417
00419 #define REFMSG_SHAPE_END_CHANGE 0x00000110
00420
00422
00423 #define REFMSG_TEXMAP_REMOVED 0x00000111
00424
00426
00428 #define REFMSG_FLAG_NODES_WITH_SEL_DEPENDENTS 0x00000112
00429
00431 #define REFMSG_CONTAINED_SHAPE_POS_CHANGE 0x00000120
00432
00433 #define REFMSG_CONTAINED_SHAPE_SEL_CHANGE 0x00000121
00434
00435 #define REFMSG_CONTAINED_SHAPE_GENERAL_CHANGE 0x00000122
00436
00438
00443 #define REFMSG_SELECT_BRANCH 0x00000130
00444
00446
00449 #define REFMSG_MOUSE_CYCLE_STARTED 0x00000140
00450
00452 #define REFMSG_MOUSE_CYCLE_COMPLETED 0x00000150
00453
00455
00458 #define REFMSG_CHECK_FOR_INVALID_BIND 0x00000161
00459
00461
00476 #define REFMSG_OBJECT_CACHE_DUMPED 0x00000162
00477
00479
00481 #define REFMSG_SFX_CHANGE 0x00000170
00482
00484
00486 #define REFMSG_OBJXREF_UPDATEMAT 0x00000180
00487
00488
00490 #define REFMSG_OBJXREF_UPDATECTRL 0x00000181
00491
00494
00495
00496 #define REFMSG_OBJXREF_GETNODES 0x00000190
00497
00498
00499 #define REFMSG_CTRLXREF_GETNODES 0x00000191
00500
00501
00502 #define REFMSG_MTLXREF_GETNODES 0x00000192
00503
00504
00506
00509 #define REFMSG_OBJECT_REPLACED 0x00000200
00510
00512 #define REFMSG_NODE_WIRECOLOR_CHANGED 0x00000210
00513
00515 #define REFMSG_NUM_SUBOBJECTTYPES_CHANGED 0x00000211
00516
00518
00521 #define REFMSG_GET_NODE_HANDLE 0x00000220
00522
00524 #define REFMSG_END_MODIFY_PARAMS 0x00000230
00525
00526 #define REFMSG_BEGIN_MODIFY_PARAMS 0x00000231
00527
00529
00532 #define REFMSG_TAB_ELEMENT_NULLED 0x00000232
00533
00535
00546 #define REFMSG_NODE_HANDLE_CHANGED 0x00000233
00547
00549
00551 #define REFMSG_NODE_WSCACHE_UPDATED 0x00000234
00552
00554 #define REFMSG_NODE_MATERIAL_CHANGED 0x00000235
00555
00557
00567 #define REFMSG_SUBANIM_NUMBER_CHANGED 0x00000236
00568
00570
00571 #define REFMSG_NODE_FLAGOMB_RENDER 0x00000237
00572
00573
00576
00577 #define REFMSG_NODE_GI_PROP_CHANGED 0x00000238
00578
00580 #define REFMSG_KEY_SELECTION_CHANGED 0x00000239
00581
00582
00586 #define REFMSG_NODE_RENDERING_PROP_CHANGED 0x00000240
00587
00588
00589 #define REFMSG_NODE_DISPLAY_PROP_CHANGED 0x00000241
00590
00592
00599 #define REFMSG_MXS_CUSTATTRIB_CHANGE 0x00000250
00600
00602
00608 #define REFMSG_NODE_PRE_DELETE 0x00000255
00609
00610
00612 #define REFMSG_LOCKED 0x00000260
00613
00615 #define REFMSG_UNLOCKED 0x00000261
00616
00618
00627 #define REFMSG_OBJECT_DEFINITION_CHANGE_BEGIN 0x00000270
00628
00630
00639 #define REFMSG_OBJECT_DEFINITION_CHANGE_END 0x00000271
00640
00642 #define REFMSG_USER 0x00010000
00643
00644
00645
00647
00654
00655
00656 #define TARGETMSG_USER 0x00010000
00657
00658 #define TARGETMSG_ATTACHING_NODE 0x00000010
00659
00660 #define TARGETMSG_DELETING_NODE 0x00000020
00661
00662
00665 #define TARGETMSG_DETACHING_NODE 0x00000030
00666
00667
00669
00670
00672 enum RefResult {
00674 REF_FAIL = 0,
00678 REF_HALT = 0,
00680 REF_SUCCEED,
00682 REF_DONTCARE,
00686 REF_STOP,
00688 REF_INVALID,
00693 REF_AUTO_DELETE
00694 };
00695
00696 class ReferenceTarget;
00698 typedef ReferenceTarget* RefTargetHandle;
00699
00700 class ReferenceMaker;
00702 typedef ReferenceMaker* RefMakerHandle;
00703
00704
00705 #define VALID(x) (x)
00706
00708 #define NOTIFY_ALL 0xfffffff0
00709
00710 class PostPatchProc;
00711
00713
00718 class RemapDir: public MaxHeapOperators {
00719 public:
00721
00722
00723 virtual RefTargetHandle FindMapping(RefTargetHandle from) = 0;
00724
00726
00760 virtual RefTargetHandle CloneRef(RefTargetHandle oldTarg);
00761
00763
00783 virtual void PatchPointer(RefTargetHandle* patchThis, RefTargetHandle oldTarg) = 0;
00784
00786
00796 virtual void AddPostPatchProc(PostPatchProc* proc, bool toDelete) = 0;
00798
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825 virtual void AddEntry(RefTargetHandle hfrom, RefTargetHandle hto)=0;
00827
00828
00829
00830
00831
00832
00833 virtual void Backpatch()=0;
00835 virtual bool BackpatchPending()=0;
00837 virtual void Clear()=0;
00839 virtual void ClearBackpatch()=0;
00841 virtual void DeleteThis()=0;
00843 virtual ~RemapDir() {}
00845 };
00846
00847 class PostPatchProc: public MaxHeapOperators {
00848 public:
00849 virtual ~PostPatchProc(){}
00850 virtual int Proc(RemapDir& remap) = 0;
00851 };
00852
00853 class DeleteRefRestore;
00854 class MakeRefRestore;
00855 class ParamBlock;
00856 class ISave;
00857 class ILoad;
00858 class ILoadImp;
00859 class DependentIterator;
00860
00863
00864
00865 #define DEP_ENUM_CONTINUE 0
00866
00867 #define DEP_ENUM_HALT 1
00868
00869 #define DEP_ENUM_SKIP 2
00870
00871
00873
00875 class DependentEnumProc: public MaxHeapOperators {
00876
00877 friend class ReferenceTarget;
00878 friend class ReferenceMaker;
00879
00880 class DependentEnumProcImplData;
00881 const MaxSDK::Util::AutoPtr<DependentEnumProcImplData> mDependentEnumProcImplData;
00882
00883 protected:
00884 CoreExport DependentEnumProc();
00885 CoreExport virtual ~DependentEnumProc();
00886
00887
00888 DependentEnumProc(const DependentEnumProc&);
00889 DependentEnumProc& operator=(const DependentEnumProc& rhs);
00890
00891 public:
00893
00907 virtual int proc(ReferenceMaker *rmaker)=0;
00908
00910
00919 CoreExport bool CheckIfAndSetAsVisited(ReferenceMaker *rmaker);
00920
00921 };
00922
00924
00931 class SaveEnumProc: public MaxHeapOperators {
00932 public:
00934
00938 virtual void proc(ReferenceMaker *rmaker)=0;
00940
00948 virtual int terminate(ReferenceMaker *rmaker)=0;
00949 };
00950
00951
00953
00969 class DefaultRemapDir: public RemapDir
00970 {
00971 private:
00972 const MaxSDK::Util::AutoPtr<RemapDir> mRemapDir;
00973
00974 DefaultRemapDir(const DefaultRemapDir& aDefaultRemapDir);
00975 DefaultRemapDir& operator=(const DefaultRemapDir& rhs);
00976 public:
00977 CoreExport DefaultRemapDir(BOOL use_A_WORK2_flag = FALSE);
00978 CoreExport ~DefaultRemapDir();
00979 RefTargetHandle FindMapping(RefTargetHandle from);
00980 void AddEntry(RefTargetHandle hfrom, RefTargetHandle hto);
00981 void PatchPointer(RefTargetHandle* patchThis, RefTargetHandle oldTarg);
00982 void Backpatch();
00983 bool BackpatchPending();
00984 void Clear();
00985 void ClearBackpatch();
00986 void DeleteThis();
00987 void AddPostPatchProc(PostPatchProc* proc, bool toDelete);
00988 };
00989
00991
01006 CoreExport RemapDir* NewRemapDir(BOOL use_A_WORK2_flag=FALSE);
01007
01009 #define REFERENCE_MAKER_INTERFACE 0x2f96f73
01010
01011 #define REFERENCE_TARGET_INTERFACE 0x66b073ea
01012
01013 class RefEnumProc;
01014 class ReferenceSaveManager;
01015
01017
01041 class ReferenceMaker : public Animatable {
01042 friend class DeleteRefRestore;
01043 friend class MakeRefRestore;
01044 friend class ReferenceTarget;
01045 friend class ParamBlock;
01046 friend class RootNode;
01047 friend class BaseNode;
01048 friend class ILoadImp;
01049 friend class RefMakerPLC;
01050 friend class RefList;
01051
01052
01053 friend class LayerManagerRestore;
01054 friend class RepMtlRest;
01055 friend class MAXMaterialLibrary;
01056
01058
01059 protected:
01061
01065 CoreExport virtual ~ReferenceMaker() = 0;
01066
01067 public:
01069 CoreExport ReferenceMaker();
01070
01072
01080 CoreExport void DeleteMe();
01082
01083 virtual void GetClassName(MSTR& s) { s = _M("ReferenceMaker"); }
01084 CoreExport virtual SClass_ID SuperClassID();
01085
01087
01088
01089
01118 CoreExport RefResult ReplaceReference(
01119 int which,
01120 RefTargetHandle newtarg,
01121 BOOL delOld = TRUE);
01122
01124
01127 CoreExport RefResult DeleteAllRefsFromMe();
01128
01130
01136 virtual RefResult DeleteAllRefsToMe() { return REF_SUCCEED; }
01137
01139
01142 CoreExport RefResult DeleteAllRefs();
01143
01145
01154 CoreExport RefResult DeleteReference( int i);
01155
01157
01163 virtual BOOL CanTransferReference(int i) { UNUSED_PARAM(i); return TRUE; }
01165
01170
01171
01172
01180 CoreExport virtual int NumRefs();
01181
01183
01191 CoreExport virtual RefTargetHandle GetReference(int i);
01192 protected:
01194
01206 CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);
01208
01209 public:
01211
01212
01213
01220 CoreExport ReferenceSaveManager& GetReferenceSaveManager();
01221
01223
01232 CoreExport virtual IOResult Save(ISave *isave);
01233
01235
01244 CoreExport virtual IOResult Load(ILoad *iload);
01245
01247
01262 virtual int RemapRefOnLoad(int iref) { return iref; }
01263
01265
01278 CoreExport virtual void RescaleWorldUnits(float f);
01280
01282
01283
01284
01286 CoreExport virtual RefResult NotifyDependents(
01287 Interval changeInt,
01288 PartID partID,
01289 RefMessage message,
01290 SClass_ID sclass = NOTIFY_ALL,
01291 BOOL propagate = TRUE,
01292 RefTargetHandle hTarg = NULL);
01294
01296
01297
01298
01308 CoreExport virtual void EnumAuxFiles(AssetEnumCallback& assetEnum, DWORD flags);
01309
01311
01312 CoreExport virtual void SaveEnum(SaveEnumProc& sep, BOOL isNodeCall = 0);
01313
01315
01421 CoreExport virtual bool SpecifySaveReferences(ReferenceSaveManager& referenceSaveManager);
01422
01424
01430
01431
01432
01433 CoreExport int DoEnumDependents(DependentEnumProc* dep);
01434
01436
01442 CoreExport virtual int DoEnumDependentsImpl(DependentEnumProc* dep);
01443
01445
01482 CoreExport bool EnumRefHierarchy(
01483 RefEnumProc &proc,
01484 bool includeCustAttribs = true,
01485 bool includeIndirectRefs = true,
01486 bool includeNonPersistentRefs = true,
01487 bool preventDuplicatesViaFlag = true);
01489
01491
01492
01494
01500 CoreExport int FindRef(RefTargetHandle rtarg);
01501
01503
01511 virtual BOOL IsRefTarget() { return FALSE; }
01512
01514
01520 virtual BOOL IsRefMaker() { return TRUE; }
01521
01523
01539 virtual BOOL IsRealDependency(ReferenceTarget *rtarg) { UNUSED_PARAM(rtarg); return TRUE;}
01540
01543
01564 virtual BOOL ShouldPersistWeakRef(RefTargetHandle rtarg) { UNUSED_PARAM(rtarg); return FALSE; }
01566
01571
01573
01574
01577 CoreExport virtual void* GetInterface(ULONG id);
01578
01580
01583 CoreExport virtual BaseInterface* GetInterface(Interface_ID id);
01585
01586 protected:
01589
01590 void BlockEval() { SetAFlag(A_EVALUATING); }
01591 void UnblockEval() { ClearAFlag(A_EVALUATING); }
01592 int Evaluating() { return TestAFlag(A_EVALUATING); }
01593
01594 CoreExport RefResult StdNotifyRefChanged(
01595 Interval changeInt,
01596 RefTargetHandle hTarget,
01597 PartID partID,
01598 RefMessage message,
01599 BOOL propagate = TRUE);
01601
01604
01605
01606
01646 virtual RefResult NotifyRefChanged(
01647 Interval changeInt,
01648 RefTargetHandle hTarget,
01649 PartID& partID,
01650 RefMessage message) = 0;
01652
01653 private:
01656
01657 void CheckForNonNullRefsOnInitialization(int ignoreRef = -1);
01658
01660
01661
01662
01663
01664 bool ValidateExistingReference(int which);
01665
01667 bool EnumRefHierarchyImpl(
01668 RefEnumProc &proc,
01669 bool includeCustAttribs,
01670 bool includeIndirectRefs,
01671 bool includeNonPersistentRefs);
01672
01674 void AddReference(AnimHandle hTarget);
01676 void RemoveReference(AnimHandle hTarget);
01677
01679
01680 class ReferenceMakerImplData;
01681 const MaxSDK::Util::AutoPtr<ReferenceMakerImplData> mImplData;
01682 };
01683
01684 #pragma warning(push)
01685 #pragma warning(disable:4239)
01686
01688
01696 class ReferenceTarget : public ReferenceMaker {
01697 friend class DependentIterator;
01698 friend class DeleteRefRestore;
01699 friend class MakeRefRestore;
01700 friend class ReferenceMaker;
01701 class RefList;
01702
01704
01705 protected:
01707
01712 CoreExport virtual ~ReferenceTarget() = 0;
01713
01714 public:
01716 CoreExport ReferenceTarget();
01717
01719
01736 CoreExport virtual RefResult AutoDelete();
01737
01739
01751 CoreExport RefResult MaybeAutoDelete();
01753
01754 CoreExport virtual void GetClassName(MSTR& s);
01755 CoreExport virtual SClass_ID SuperClassID();
01756
01758
01759
01760
01764 virtual BOOL IsRefTarget() { return TRUE; }
01765
01767
01774 CoreExport RefResult TestForLoop( Interval refInterval, RefMakerHandle hmaker);
01775
01777
01781 CoreExport BOOL HasDependents();
01782
01784
01788 CoreExport BOOL HasRealDependents();
01789
01791
01797 void BeginDependencyTest() { ClearAFlag(A_DEPENDENCY_TEST); }
01798
01800
01806 BOOL EndDependencyTest() { return TestAFlag(A_DEPENDENCY_TEST); }
01808
01810
01811
01812
01816 virtual void RefAdded(RefMakerHandle rm) { UNUSED_PARAM(rm); }
01817
01820
01825 virtual void RefAddedUndoRedo(RefMakerHandle rm) { UNUSED_PARAM(rm); }
01826
01827
01828
01829
01831
01836 virtual void RefDeleted() {}
01837
01840
01845 virtual void RefDeletedUndoRedo() {}
01846
01848
01851 CoreExport RefResult DeleteAllRefsToMe();
01852
01854
01860 CoreExport RefResult TransferReferences(
01861 RefTargetHandle oldTarget,
01862 BOOL delOld = FALSE);
01864
01866
01867
01869
01877 CoreExport int DoEnumDependents(DependentEnumProc* dep);
01879
01881
01882
01922 CoreExport virtual RefTargetHandle Clone(RemapDir& remap);
01923
01925
01942 CoreExport virtual void BaseClone(
01943 ReferenceTarget *from,
01944 ReferenceTarget *to,
01945 RemapDir &remap);
01947
01949
01950
01951
01993 CoreExport virtual RefResult NotifyDependents(
01994 Interval changeInt,
01995 PartID partID,
01996 RefMessage message,
01997 SClass_ID sclass = NOTIFY_ALL,
01998 BOOL propagate = TRUE,
01999 RefTargetHandle hTarg = NULL);
02000
02002
02012 void FlagDependents( TimeValue t, PartID which=PART_PUT_IN_FG ) {
02013 NotifyDependents( Interval(t,t), which, REFMSG_FLAGDEPENDENTS );
02014 }
02015
02017
02024 virtual void NotifyForeground(TimeValue t) {
02025 NotifyDependents(Interval(t,t),PART_PUT_IN_FG,REFMSG_FLAGDEPENDENTS);
02026 }
02027
02029
02035 virtual void NotifyTarget(int message, ReferenceMaker* hMaker) { UNUSED_PARAM(message); UNUSED_PARAM(hMaker); }
02037
02039
02040
02041
02045 CoreExport virtual void* GetInterface(ULONG id);
02046
02048
02052 CoreExport virtual BaseInterface* GetInterface(Interface_ID id);
02054
02055 protected:
02056
02058
02089 CoreExport virtual int DoEnumDependentsImpl(DependentEnumProc* dep);
02090
02091 private:
02092
02093 using ReferenceMaker::NotifyRefChanged;
02094
02096
02103 CoreExport RefResult MakeReference(
02104 Interval refInterval,
02105 RefMakerHandle hmaker,
02106 int whichRef = -1);
02107
02108 private:
02110
02113 class RefListItem: public MaxSDK::Util::Noncopyable
02114 {
02115 public:
02116 ReferenceMaker* mMaker;
02117 RefListItem* mNext;
02119 RefListItem( ReferenceMaker* maker, RefListItem *list );
02120 ~RefListItem();
02121 };
02122
02124
02127 class RefList: public MaxSDK::Util::Noncopyable
02128 {
02130 friend class ReferenceTarget;
02131 friend class DependentIterator;
02132 public:
02134 RefList();
02135
02137 ~RefList();
02138
02140 RefListItem* FirstItem() const;
02141
02143
02148 RefResult DeleteItem(ReferenceMaker* maker, int eval);
02149
02151
02154 RefResult AddItem(ReferenceMaker* maker);
02155
02157 bool Empty() const;
02158
02159 private:
02161 void SetOwner(ReferenceTarget& owner);
02162
02164 void RemoveEmptyListItems();
02165
02167
02168 bool CleanupReferences();
02169
02170 private:
02172 RefListItem* mFirst;
02174 AnimHandle mOwnerRefTarget;
02176 bool mHasEmptyListItems;
02177 };
02178
02180 RefList* mRefs;
02181 };
02182
02183 #pragma warning(pop)
02184
02185
02186 namespace MaxSDK
02187 {
02188 class SingleWeakRefMaker;
02189 };
02190
02192
02213 class DependentIterator: public MaxSDK::Util::Noncopyable
02214 {
02215 public:
02217
02218 CoreExport DependentIterator(ReferenceTarget* rtarg);
02220 CoreExport ~DependentIterator();
02222 CoreExport ReferenceMaker* Next();
02225 CoreExport void Reset();
02226
02227 private:
02228
02229 DependentIterator();
02230
02231 private:
02232 ReferenceTarget* mTarget;
02233 ReferenceTarget::RefListItem* mNext;
02234 };
02235
02236 class DeletedRestore : public RestoreObj
02237 {
02238 RefMakerHandle anim, svanim;
02239 public:
02240 CoreExport DeletedRestore();
02241 CoreExport DeletedRestore(RefMakerHandle an);
02242 CoreExport ~DeletedRestore();
02243 CoreExport void Restore(int isUndo);
02244 CoreExport void Redo();
02245 CoreExport MSTR Description();
02246 };
02247
02250
02251
02252 #define REF_ENUM_CONTINUE 0
02253
02254 #define REF_ENUM_HALT 1
02255
02256 #define REF_ENUM_SKIP 2
02257
02258
02260
02292 class RefEnumProc: public MaxHeapOperators
02293 {
02294 friend class ReferenceTarget;
02295 class RefEnumProcImplData;
02296 const MaxSDK::Util::AutoPtr<RefEnumProcImplData> mRefEnumProcImplData;
02297
02298 protected:
02299 CoreExport RefEnumProc();
02300 CoreExport virtual ~RefEnumProc();
02301
02302
02303 RefEnumProc(const RefEnumProc&);
02304 RefEnumProc& operator=(const RefEnumProc& rhs);
02305
02306 public:
02308
02323 virtual int proc(ReferenceMaker *rm)=0;
02324
02326
02333 CoreExport virtual bool CheckIfAndSetAsVisited(ReferenceMaker *rmaker);
02334
02336
02356 CoreExport void BeginEnumeration(bool preventDuplicatesViaFlag = true);
02357
02359
02364 CoreExport void EndEnumeration();
02365 };
02366
02368
02401 CoreExport ReferenceTarget *CloneRefHierarchy(ReferenceTarget *rm);
02402
02403
02406
02413 class GlobalReferenceMaker : public MaxHeapOperators
02414 {
02415 public:
02416 virtual ~GlobalReferenceMaker() {}
02417 class GlobalReferenceDisableGuard;
02418
02420
02437 virtual RefResult NotifyRefChanged(
02438 Interval iv,
02439 RefTargetHandle hTarg,
02440 PartID& partID,
02441 RefMessage msg) = 0;
02442 };
02443
02445
02457 class GlobalReferenceMaker::GlobalReferenceDisableGuard : public MaxHeapOperators
02458 {
02459 public:
02460
02463 CoreExport static bool IsDisabled();
02464
02466
02470 CoreExport GlobalReferenceDisableGuard(bool doDisable = true);
02471
02473
02475 CoreExport ~GlobalReferenceDisableGuard();
02476
02477 private:
02478
02480 static int m_disableCount;
02481
02484 bool m_doDisable;
02485 };
02486
02489
02492 CoreExport void RegisterGlobalReference(GlobalReferenceMaker *maker);
02493
02495
02498 CoreExport void UnRegisterGlobalReference(GlobalReferenceMaker *maker);
02499
02501
02506 CoreExport void ClearAFlagInHierarchy(RefMakerHandle rm, DWORD mask);
02507
02509
02512 CoreExport void ClearAFlagInAllAnimatables(DWORD mask);
02513
02516
02521 CoreExport BOOL DependsOn(RefMakerHandle mkr, RefMakerHandle targ);
02522
02524
02531 CoreExport DWORD GetSavingVersion();
02532
02535 CoreExport DWORD SetSavingVersion(DWORD version);
02536
02538
02543 CoreExport void DisableRefMsgs();
02545
02547 CoreExport void EnableRefMsgs();
02548
02550
02559 class SingleRefMaker: public ReferenceMaker {
02560 protected:
02562 RefTargetHandle rtarget;
02563 public:
02565 CoreExport SingleRefMaker();
02567
02568 CoreExport ~SingleRefMaker();
02569
02571
02572 CoreExport void SetRef(RefTargetHandle rt);
02573
02575 CoreExport RefTargetHandle GetRef() const;
02576
02578
02592 CoreExport RefResult NotifyRefChanged(
02593 Interval changeInt,
02594 RefTargetHandle hTarget,
02595 PartID& partID,
02596 RefMessage message );
02597 CoreExport void DeleteThis();
02598 CoreExport SClass_ID SuperClassID();
02599
02600
02601 CoreExport int NumRefs();
02602 CoreExport RefTargetHandle GetReference(int i);
02603 protected:
02604 CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);
02605 public:
02606 CoreExport BOOL CanTransferReference(int i);
02607 };
02608
02610
02620 class CoreExport AnimateSuspend: public MaxHeapOperators {
02621 private:
02622 BOOL animateSuspended;
02623 BOOL setKeyModeSuspended;
02624 BOOL macroRecSuspended;
02625 BOOL refMsgsSuspended;
02626 public:
02628
02636 AnimateSuspend(
02637 BOOL setKeyModeToo = FALSE,
02638 BOOL macroRecToo = FALSE,
02639 BOOL refMsgsToo = FALSE );
02641 void Resume();
02643 ~AnimateSuspend() {Resume ();}
02644 };
02645
02647
02653 class CoreExport SuspendAll: public MaxHeapOperators {
02654 private:
02655 BOOL holdSuspended;
02656 BOOL macroRecSuspended;
02657 BOOL animateSuspended;
02658 BOOL setKeyModeSuspended;
02659 BOOL autoBackupSuspended;
02660 BOOL saveRequiredState;
02661 BOOL refMsgsSuspended;
02662 BOOL m_previousSaveRequiredState;
02663 BOOL m_previousAutoBackupState;
02664 public:
02666
02682 SuspendAll(
02683 BOOL holdState = FALSE,
02684 BOOL macroRecorder = FALSE,
02685 BOOL animateMode = FALSE,
02686 BOOL setKeyMode = FALSE,
02687 BOOL autoBackup = FALSE,
02688 BOOL saveRequired = FALSE,
02689 BOOL refMsgs = FALSE );
02691 void Resume();
02693 ~SuspendAll() {Resume ();}
02694 };
02695