source: golgotha/src/maxtool/sdk_inc/animtbl.h

Last change on this file was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
  • Property svn:keywords set to Id
File size: 30.4 KB
Line 
1/**********************************************************************
2 *<
3        FILE:  animtbl.h
4
5        DESCRIPTION:  Defines Animatable Classes
6
7        CREATED BY: Rolf Berteig & Dan Silva
8
9        HISTORY: created 9 September 1994
10
11 *>     Copyright (c) 1994, All Rights Reserved.
12 **********************************************************************/
13
14#ifndef _ANIMTBL_H_
15#define _ANIMTBL_H_
16
17
18#define ANIMTYPE_NODE           1
19#define ANIMTYPE_ROOTNODE       3
20#define ANIMTYPE_CONTROL        2
21
22/*---------------------------------------------------*/
23
24class TreeListExp;
25class AnimEnum;
26class ReferenceTarget;
27class DWORDTab;
28class IObjParam;
29class INodeTab;
30class AppDataChunk;
31
32// Values for flags in aflag
33#define A_EVALUATING            1
34#define A_NOTIFYDEP             (1<<1)
35#define A_CHILD_TREE_OPEN       (1<<2)
36#define A_SUBANIM_TREE_OPEN     (1<<3)
37#define A_OBJECT_REDUCED        (1<<4)
38
39// BITS 5-11 are reserved for specific sub-class use.
40
41// Atmospheric flags
42#define A_ATMOS_DISABLED        (1<<5)
43
44// OBJECT flags
45#define A_OBJ_CREATING          (1<<5)          // The object is being created. It doesn't want to snap to itself.
46
47// MODIFIER flags .
48#define A_MOD_DISABLED          (1<<5)     // Modifier flag
49#define A_MOD_BEING_EDITED      (1<<6)
50#define A_MOD_USE_SEL           (1<<7)     // Modifier flag (use sub-ob selection)
51
52// MODAPP flags.
53#define A_MODAPP_DISABLED               (1<<5)  // ModApp flag
54#define A_MODAPP_SELECTED               (1<<6)  // ModApp flag (parent node is selected)
55#define A_MODAPP_DISPLAY_ACTIVE (1<<7)  // ModApp flag
56#define A_MODAPP_DYNAMIC_BOX    (1<<8)  // ModApp flag
57
58// Derived Object Flags
59#define A_DERIVEDOBJ_DONTDELETE (1<<9)  // When the last modifier is deleted form this derived object, don't delete the derived object
60
61// CONTROL flags
62#define A_ORT_MASK                              7
63#define A_ORT_BEFORESHIFT               5       // Uses bit 5,6,7,8,9 and 10 to store ORT
64#define A_ORT_AFTERSHIFT                8
65#define A_CTRL_DISABLED                 (1<<11)
66#define A_ORT_DISABLED                  A_SUPERCLASS1  // indicates that the ORT is disabled
67
68// INODE flags
69#define A_INODE_IK_TERMINATOR   (1<<5)  // Terminates the top of an IK chain
70#define A_INODE_IK_POS_PINNED   (1<<6)
71#define A_INODE_IK_ROT_PINNED   (1<<7)
72
73
74// Flags for Hold and Restore logic, for "lazy holding",
75// to avoid multiple holding.
76#define A_HELD                          (1<<12)
77#define A_SET                           (1<<13)
78
79// Deleted but kept around for UNDO
80#define A_IS_DELETED            (1<<14)
81
82// To prevent AutoDelete from being re-entered.
83#define A_BEING_AUTO_DELETED  (1<<15)
84
85// Reserved for superclass use
86#define A_SUPERCLASS1           (1<<20)
87#define A_SUPERCLASS2           (1<<21)
88
89// These are reserved for use by the plug-in. No should will set these flags (except the plug-in class itself)
90#define A_PLUGIN1                       (1<<22)
91#define A_PLUGIN2                       (1<<23)
92#define A_PLUGIN3                       (1<<24)
93#define A_PLUGIN4                       (1<<25)
94
95// Used to test for a dependency
96#define A_DEPENDENCY_TEST       (1<<26)
97
98// Ref target isn't deleted when dependents goes to 0 if this flag is set.
99#define A_LOCK_TARGET           (1<<27)
100
101#define A_WORK1                         (1<<28)
102#define A_WORK2                         (1<<29)
103#define A_WORK3                         (1<<30)
104#define A_WORK4                         (1<<31)
105
106#define A_OPENFLAG(t) ((t==0)?A_CHILD_TREE_OPEN:A_SUBANIM_TREE_OPEN)
107
108
109class TimeMap {
110        public:
111                virtual TimeValue map(TimeValue t)=0;
112                virtual TimeValue prevmap(TimeValue t)=0;
113        };
114
115class TrackHitRecord  {
116        public:
117                DWORD   hit;
118                DWORD   flags;
119                TrackHitRecord(DWORD h=0,DWORD f=0) {hit=h;flags=f;}
120        };
121typedef Tab<TrackHitRecord> TrackHitTab;
122
123
124// Flags passed to MapKeys and DeleteKeys
125#define TRACK_DOSEL                     (1<<0)
126#define TRACK_DOALL                     (1<<1)  // ignore selection
127#define TRACK_SLIDEUNSEL        (1<<2)  // Slide unselected keys to the right
128#define TRACK_RIGHTTOLEFT       (1<<3)  // Enumerate right to left. If TRACK_SLIDEUNSEL is set, keys will slide to the left.
129#define TRACK_DOSUBANIMS        (1<<4)  // This flag is only passed to MapKeys
130#define TRACK_DOCHILDNODES      (1<<5)  // This flag is only passed to MapKeys
131#define TRACK_MAPRANGE          (1<<6)  // The range, if not locked to first and last key, should be mapped as well.
132
133// Flags passed to EditTimeRange
134#define EDITRANGE_LINKTOKEYS    (1<<0)  // This means if one of the ends of the interval is at a key, link it to the key so that if the key moves, the interval moves.
135
136// Flags passed to hit test tracks and fcurves.
137#define HITTRACK_SELONLY                (1<<0)
138#define HITTRACK_UNSELONLY              (1<<1)
139#define HITTRACK_ABORTONHIT             (1<<2)
140#define HITCURVE_TESTTANGENTS   (1<<3)
141
142
143// Flags passed to SelectKeys
144// Either SELECT, DESELECT, or a combination of CLEARKEYS and CLEARCURVE
145// will be specified.
146#define SELKEYS_SELECT                  (1<<0) 
147#define SELKEYS_DESELECT                (1<<1)
148#define SELKEYS_CLEARKEYS               (1<<2)           
149#define SELKEYS_CLEARCURVE              (1<<3)
150#define SELKEYS_FCURVE                  (1<<4)  // indicates that were operating on keys of a function curve, not a track 
151
152
153// Flags passed to GetTimeRange
154#define TIMERANGE_SELONLY               (1<<0)  // The bounding interval of selected keys
155#define TIMERANGE_ALL                   (1<<1)  // Whatever the channel's time range is - usually the bunding interval of all keys.
156#define TIMERANGE_CHILDNODES    (1<<2)  // A node's time range should include child nodes.
157#define TIMERANGE_CHILDANIMS    (1<<3)  // A animatable's child anim ranges should be included
158
159// Passed to the functions that modify a time range such as copy,paste,delete,reverse
160#define TIME_INCLEFT            (1<<10)  // Include left endpoint
161#define TIME_INCRIGHT           (1<<11)  // Include right endpoint
162#define TIME_NOSLIDE            (1<<12)  // Delete any keys in the interval but don't actually remove the block of time.
163
164// In addition to the TIME_ flags above, the following flag may be passed to PasteTrck()
165#define PASTE_RELATIVE          (1<<20) // Add the keys relative to existing keys
166
167// Flags passed to AddKey
168#define ADDKEY_SELECT           (1<<0)  // Select the new key and deselect any other selected keys
169#define ADDKEY_INTERP           (1<<1)  // Init the new key to the interpolated value at that time. Otherwise, init the key to the value of the previous key.
170#define ADDKEY_FLAGGED          (1<<2)  // Flag the newly created key as if FlagKey() was called for it
171
172// Flags passed to CopyKeysFromTime()
173#define COPYKEY_POS                     (1<<0)  // These filter flags are passed to a tm controller. The tm
174#define COPYKEY_ROT                     (1<<1)  // can decide what to do with them... they have obvious meaning
175#define COPYKEY_SCALE           (1<<2)  // For the PRS controller.
176
177// Flags passed to GetNextKeyTime()
178#define NEXTKEY_LEFT            (1<<0)  // Search to the left.
179#define NEXTKEY_RIGHT           (1<<1)  // Search to the right.
180#define NEXTKEY_POS                     (1<<2)
181#define NEXTKEY_ROT                     (1<<3)
182#define NEXTKEY_SCALE           (1<<4)
183
184// Flags passed to IsKeyAtTime
185#define KEYAT_POSITION          (1<<0)
186#define KEYAT_ROTATION          (1<<1)
187#define KEYAT_SCALE                     (1<<2)
188
189// Flags passed to PaintTrack and PaintFCurves
190#define PAINTTRACK_SHOWSEL                      (1<<0)
191#define PAINTTRACK_SHOWSTATS            (1<<1)  // Show for selected keys
192#define PAINTCURVE_SHOWTANGENTS         (1<<2)  // Show for selected keys
193#define PAINTCURVE_FROZEN                       (1<<3)  // Curve is in a frozen state
194
195// Flags passed to GetFCurveExtents
196#define EXTENTS_SHOWTANGENTS            (1<<0) // Tangents are visible for selected keys
197
198
199// Values returned from PaintTrack and HitTestTrack
200#define TRACK_DONE                      1               // Track was successfully painted/hittested
201#define TRACK_DORANGE           2               // This anim has no track. Draw/hittest the bounding range of it's subanims
202
203// Values returned from HitTestFCurve
204#define HITCURVE_KEY            1       // Hit one or more keys
205#define HITCURVE_WHOLE          2   // Hit the curve (anywhere)
206#define HITCURVE_TANGENT        3       // Hit a tangent handle
207#define HITCURVE_NONE           4       // Didn't hit squat
208
209// These flags are passed into PaintFCurves, HitTestFCurves, and GetFCurveExtnents
210// They are filters for controllers with more than one curve
211// NOTE: RGB controllers interpret X as red, Y as green and Z as blue.
212#define DISPLAY_XCURVE          (1<<29)
213#define DISPLAY_YCURVE          (1<<30)
214#define DISPLAY_ZCURVE          (1<<31)
215
216// Values returned from GetSelKeyCoords()
217#define KEYS_NONESELECTED       (1<<0)
218#define KEYS_MULTISELECTED      (1<<1)
219#define KEYS_COMMONTIME         (1<<2)  // Both of these last two bits
220#define KEYS_COMMONVALUE        (1<<3)  // could be set.
221
222// Flags passed to GetSelKeyCoords()
223#define KEYCOORDS_TIMEONLY              (1<<0)
224#define KEYCOORDS_VALUEONLY             (1<<1)
225
226// Returned from NumKeys() if the animatable is not keyframeable
227#define NOT_KEYFRAMEABLE        -1
228
229// Flags passed to AdjustTangents
230#define ADJTAN_LOCK             (1<<0)
231#define ADJTAN_BREAK    (1<<1)
232
233// Flags passed to EditTrackParams
234#define EDITTRACK_FCURVE        (1<<0)  // The user is in the function curve editor.
235#define EDITTRACK_TRACK         (1<<1)  // The user is in one of the track views.
236#define EDITTRACK_SCENE         (1<<2)  // The user is editing a path in the scene.
237#define EDITTRACK_BUTTON        (1<<3)  // The user invoked by choosing the properties button. In this case the time parameter is NOT valid.
238#define EDITTRACK_MOUSE         (1<<4)  // The user invoked by right clicking with the mouse. In this case the time parameter is valid.
239
240
241// These are returned from TrackParamsType(). They define how the track parameters are invoked.
242#define TRACKPARAMS_NONE        0       // Has no track parameters
243#define TRACKPARAMS_KEY         1       // Entered by right clicking on a selected key
244#define TRACKPARAMS_WHOLE       2       // Entered by right clicking anywhere in the track.
245
246
247// Macros for converting track screen coords to time and back.
248#define TimeToScreen(t,scale,scroll) (int(floor((t)*(scale)+0.5)) - (scroll))
249#define ScreenToTime(s,scale,scroll) ((int)floor((s)/(scale) + (scroll)/(scale)+0.5))
250#define ValueToScreen(v,h,scale,scroll) (h-int(floor((v)*(scale)+0.5)) - (scroll))
251#define ScreenToValue(s,h,scale,scroll) ((float(h)-(float(s)+float(scroll)))/(scale))
252
253// Scales a value about an origin
254#define ScaleAboutOrigin(val,origin,scale) ((((val)-(origin))*(scale))+(origin))
255
256
257class TrackClipObject {
258        public:
259                // Specifies the interval of time clipped.
260                Interval clip;         
261
262                // Identifies the creator of the clip object
263                virtual SClass_ID       SuperClassID()=0;
264                virtual Class_ID        ClassID()=0;
265
266                TrackClipObject(Interval iv) {clip = iv;}
267                virtual void DeleteThis()=0;
268        };
269
270
271// This must be updated if a new entry is added to DimType!
272#define NUM_BUILTIN_DIMS        10
273
274enum DimType {
275        DIM_WORLD,
276        DIM_ANGLE,
277        DIM_COLOR,              //0-1
278        DIM_COLOR255,   //0-255
279        DIM_PERCENT,    //0-100
280        DIM_NORMALIZED, //0-1
281        DIM_SEGMENTS,
282        DIM_TIME,
283        DIM_CUSTOM,
284        DIM_NONE
285        };
286
287// These two classes describes the dimension of a parameter (sub-anim).
288// The dimension type and possibly the dimension scale (if the type is
289// custom) are used to determine a scale factor for the parameter.
290// When a controller is drawing a function curve, it only needs to
291// use the Convert() function - the scale factor is rolled into the single
292// 'vzoom' parameter passed to PaintFCurves.
293// So, for a controller to plot a value 'val' at time t it would do the
294// following:
295// int x = TimeToScreen(t,tzoom,tscroll);
296// int y = ValueToScreen(dim->Convert(val),rect.h()-1,vzoom,vscroll);
297//
298class ParamDimensionBase {
299        public:
300                virtual DimType DimensionType()=0;
301                virtual float Convert(float value)=0;
302                virtual float UnConvert(float value)=0;
303        };
304class ParamDimension : public ParamDimensionBase {
305        public:
306                // If the DimType is custom than these must be implemented.
307                virtual float GetDimScale() {return 1.0f;}
308                virtual void SetDimScale() {}
309                virtual TCHAR *DimensionName() {return _T("");}         
310        };
311
312// These point to default implementations for the standard DIM types.
313CoreExport extern ParamDimension *defaultDim;
314CoreExport extern ParamDimension *stdWorldDim;
315CoreExport extern ParamDimension *stdAngleDim;
316CoreExport extern ParamDimension *stdColorDim;
317CoreExport extern ParamDimension *stdColor255Dim;
318CoreExport extern ParamDimension *stdPercentDim;
319CoreExport extern ParamDimension *stdNormalizedDim;
320CoreExport extern ParamDimension *stdSegmentsDim;
321CoreExport extern ParamDimension *stdTimeDim;
322
323// Interface IDs for GetInterface() - NOTE: doesn't need to be released.
324#define I_CONTROL                       0x00001001             
325#define I_MASTER                        0x00001010
326#define I_EASELIST                      0x00001020
327#define I_MULTLIST                      0x00001030
328#define I_BASEOBJECT            0x00001040
329#define I_PARTICLEOBJ           0x00001050
330#define I_KEYCONTROL            0x00001060
331#define I_TEXTOBJECT            0x00001070
332#define I_WAVESOUND                     0x00001080
333
334// Plug-in defined interfaces should be > this id
335#define I_USERINTERFACE         0x0000ffff
336
337       
338#define GetControlInterface(anim)       ((Control*)anim->GetInterface(I_CONTROL))
339#define GetObjectInterface(anim)        ((BaseObject*)anim->GetInterface(I_BASEOBJECT))
340#define GetParticleInterface(anim)      ((ParticleObject*)anim->GetInterface(I_PARTICLEOBJ))
341#define GetKeyControlInterface(anim) ((IKeyControl*)anim->GetInterface(I_KEYCONTROL))
342#define GetMasterController(anim) ((ReferenceTarget*)anim->GetInterface(I_MASTER))
343#define GetTextObjectInterface(anim) ((ITextObject*)anim->GetInterface(I_TEXTOBJECT))
344#define GetWaveSoundInterface(anim) ((IWaveSound*)anim->GetInterface(I_WAVESOUND))
345
346
347// This is the base class for classes that can be hung off an animatable's
348// property list. When an animatable is deleted, it's properties will be
349// deleted and their virtual destructor will be called.
350class AnimProperty {
351        public:
352                virtual BOOL DontDelete() {return FALSE;}
353                virtual ~AnimProperty() {}
354                virtual DWORD ID()=0;
355        };
356
357class AnimPropertyList : public Tab<AnimProperty*> {
358        public:
359                CoreExport int FindProperty(DWORD id,int start=0);
360        };
361
362
363// Property IDs
364#define PROPID_APPDATA          0x00000010
365#define PROPID_EASELIST         0x00000020
366#define PROPID_MULTLIST         0x00000030
367#define PROPID_NOTETRACK        0x00000040
368#define PROPID_USER                     0x0000FFFF     
369// Values above PROPID_USER can be used by plug-ins.
370// Note: that a plug-in should only put user defined properties on it's
371// own list. So IDs only have to be unique within a plug-in. If a plug-in
372// needs to attach data to another object, it can do so via APP_DATA.
373
374// BeginEditParams flags values
375#define BEGIN_EDIT_CREATE               (1<<0)
376#define BEGIN_EDIT_MOTION               (1<<1)  // Controller is being edited in the motion branch
377#define BEGIN_EDIT_HIERARCHY    (1<<2)  // Same as BEGIN_EDIT_IK
378#define BEGIN_EDIT_IK                   (1<<2)  // Controller is being edited in the IK subtask of the hierarchy branch
379#define BEGIN_EDIT_LINKINFO             (1<<3)  // Controller is being edited in the Link Info  subtask of the hierarchy branch
380
381// EndEditParams flags values
382#define END_EDIT_REMOVEUI  (1<<0)
383
384// Flags passed to EnumAuxFiles
385#define FILE_ENUM_INACTIVE              (1<<0)                  // enumerate inactive files
386#define FILE_ENUM_VP                    (1<<1)                  // enumerate video post files
387#define FILE_ENUM_RENDER                (1<<2)                  // enumerate render files
388#define FILE_ENUM_ALL  (FILE_ENUM_INACTIVE|FILE_ENUM_VP|FILE_ENUM_RENDER)       // enumerate ALL files
389#define FILE_ENUM_MISSING_ONLY  (1<<8)                  // enumerate missing files only
390#define FILE_ENUM_1STSUB_MISSING (1<<9)             // just enumerate 1st file named by ifl if missing
391
392// To enumerate all active but missing files
393#define FILE_ENUM_MISSING_ACTIVE (FILE_ENUM_VP|FILE_ENUM_RENDER|FILE_ENUM_MISSING_ONLY)
394
395// To enumerate all active but missing files, but only enumerate first subfile pointed
396// to by an ifl (enumerating all of them can be very slow).
397#define FILE_ENUM_MISSING_ACTIVE1 (FILE_ENUM_MISSING_ACTIVE|FILE_ENUM_1STSUB_MISSING )
398
399// A callback object passed to EnumAuxFiles().
400class NameEnumCallback {
401        public:
402                virtual void RecordName(TCHAR *name)=0;
403        };
404
405class NoteTrack;
406
407class Animatable {
408                friend class ISaveImp;
409                friend class ILoadImp;
410
411        protected:
412                unsigned long aflag;
413                AnimPropertyList aprops;
414
415        public:
416                void SetAFlag(int mask) { aflag|=mask; }
417                void ClearAFlag(int mask) { aflag &= ~mask; }
418                int TestAFlag(int mask) { return(aflag&mask?1:0); }
419                Animatable() { aflag = 0; }             
420                Animatable& operator=(const Animatable& an)  { aflag = an.aflag; return *this; }               
421                virtual void GetClassName(TSTR& s) { s= TSTR(_T("Animatable")); } 
422                CoreExport virtual Class_ID ClassID();
423                CoreExport virtual SClass_ID SuperClassID();           
424                CoreExport virtual ~Animatable();
425
426                // This is how things are actually deleted.
427                // Since they are created with the ClassDesc::Create()  function, and
428                // deleted via this function, they can use a different memory allocator
429                // than the core code. (theoretically)
430                CoreExport virtual void DeleteThis();
431               
432                // Get rid of anything that can be rebuilt
433                // Objects have a default implementation.
434                virtual void FreeCaches() {}
435
436                // 'create' is TRUE if parameters are being edited in the create branch.
437                // 'removeUI' is TRUE if the object's UI should be removed.
438                virtual void BeginEditParams(IObjParam *ip,ULONG flags,Animatable *prev=NULL) {}
439                virtual void EndEditParams(IObjParam *ip,ULONG flags,Animatable *next=NULL) {}
440
441                // OLE-like method for adding new interfaces
442                virtual void* GetInterface(ULONG id) { return NULL; }
443                virtual void ReleaseInterface(ULONG id,void *i) {}
444
445                // General method for adding properties, when
446                // defining a new Interface would be too cumbersome
447                virtual int SetProperty(ULONG id, void *data) { return 0; }
448                virtual void *GetProperty(ULONG id) { return NULL; }
449
450                virtual int NumSubs()  { return 0; }     // How many sub-animatables are there?
451                virtual Animatable* SubAnim(int i) { return NULL; }  // access the ith sub-animatable
452                CoreExport virtual TSTR SubAnimName(int i);  // get name of ith subanim
453                virtual BOOL BypassTreeView() { return FALSE; } // return TRUE and you won't appear in the TreeView however your children will.
454                virtual BOOL AssignController(Animatable *control,int subAnim) {return FALSE;}
455               
456                // Converts an anim index to a ref index or returns -1 if there is no
457                // corrispondance. This is used for copying and pasting in the track
458                // view. If a client does not wish an anim to be copy/pastable then
459                // it can return -1 even if there is a corrisponding ref num.
460                virtual int SubNumToRefNum(int subNum) {return -1;}
461
462                // In addition to SubNumToRefNum(), if an anim doesn't want to be coppied it can return FALSE from this function
463                virtual BOOL CanCopyAnim() {return TRUE;}
464
465                // An anim can implement this to reutrn FALSE to prohibit make unique
466                virtual BOOL CanMakeUnique() {return TRUE;}
467
468                virtual int NumChildren() {return 0; }   // Non-zero only for nodes.
469                virtual Animatable* ChildAnim(int i) { return NULL; } // access the ith child
470                CoreExport virtual TSTR NodeName();        // For nodes only
471
472                CoreExport int EnumAnimTree(AnimEnum *animEnum, Animatable *client, int subNum);
473                CoreExport int HasSubElements(int type=0);             
474
475                // called once at the beginning of each render
476                virtual int RenderBegin(TimeValue t, ULONG flags=0) { return 0; }
477                // called once at the end of each render
478                virtual int RenderEnd(TimeValue t) { return 0; }
479
480                // edit the track or parameters
481                virtual void EditTrack() { assert(0); }
482               
483                // Get the number of keys and the time of the ith key.
484                virtual int NumKeys() {return NOT_KEYFRAMEABLE;}
485                virtual TimeValue GetKeyTime(int index) {return 0;}
486                virtual int GetKeyIndex(TimeValue t) {return -1;}
487                virtual BOOL GetNextKeyTime(TimeValue t,DWORD flags,TimeValue &nt) {return FALSE;}
488                virtual void CopyKeysFromTime(TimeValue src,TimeValue dst,DWORD flags) {}
489                virtual void DeleteKeyAtTime(TimeValue t) {}
490                virtual BOOL IsKeyAtTime(TimeValue t,DWORD flags) {return FALSE;}
491               
492                // The value returned from these two methods should be the number of keys skipped because their times were before
493                // range.Start(). So sel[i] is the selection state for the offset+ith key.
494                virtual int GetKeyTimes(Tab<TimeValue> &times,Interval range,DWORD flags) {return 0;}           
495                virtual int GetKeySelState(BitArray &sel,Interval range,DWORD flags) {return 0;}
496
497                // TreeView Methods
498                /////////////////////////////////////////////////////////////
499                void OpenTreeEntry(int type) {SetAFlag(A_OPENFLAG(type));}
500                void CloseTreeEntry(int type) {ClearAFlag(A_OPENFLAG(type));}
501                CoreExport int IsTreeEntryOpen(int type);
502               
503                // The tracks time range:
504                CoreExport virtual Interval GetTimeRange(DWORD flags);
505                virtual void EditTimeRange(Interval range,DWORD flags) {};
506               
507                // Operations to a selected block of time               
508                virtual void DeleteTime(Interval iv, DWORD flags) {}
509                virtual void ReverseTime(Interval iv, DWORD flags) {}
510                virtual void ScaleTime(Interval iv, float s) {}
511                virtual void InsertTime(TimeValue ins, TimeValue amount) {}
512               
513                // If an anim supports the above time operations it should return TRUE from this method.
514                // Returning TRUE enables time selection on the track view for the track.
515                virtual BOOL SupportTimeOperations() {return FALSE;}
516
517                // Operations to keys
518                CoreExport virtual void MapKeys(TimeMap *map, DWORD flags);
519                virtual void DeleteKeys(DWORD flags) {}
520                virtual void DeleteKeyByIndex(int index) {}
521                virtual void SelectKeys(TrackHitTab& sel, DWORD flags) {}
522                virtual void FlagKey(TrackHitRecord hit) {}
523                virtual int GetFlagKeyIndex() {return -1;}
524                virtual int NumSelKeys() {return 0;}
525                virtual void CloneSelectedKeys(BOOL offset=FALSE) {}   // When offset is TRUE, set the new key time to be centered between the original key and the next key
526                virtual void AddNewKey(TimeValue t,DWORD flags) {}
527                virtual void MoveKeys(ParamDimensionBase *dim,float delta,DWORD flags) {}  // move selected keys vertically in the function curve editor
528                virtual void ScaleKeyValues(ParamDimensionBase *dim,float origin,float scale,DWORD flags) {}
529                virtual void SelectCurve(BOOL sel) {}
530                virtual BOOL IsCurveSelected() {return FALSE;}
531                virtual BOOL IsKeySelected(int index) {return FALSE;}
532                virtual int GetSelKeyCoords(TimeValue &t, float &val,DWORD flags) {return KEYS_NONESELECTED;}
533                virtual void SetSelKeyCoords(TimeValue t, float val,DWORD flags) {}
534                virtual void AdjustTangents(
535                        TrackHitRecord hit,
536                        ParamDimensionBase *dim,
537                        Rect& rcGraph,
538                        float tzoom,
539                        int tscroll,
540                        float vzoom,
541                        int vscroll,
542                        int dx,int dy,
543                        DWORD flags) {};
544
545                // Does this animatable actually have animation?
546                // Default implementation returns TRUE if a child anim has animation.
547                CoreExport virtual BOOL IsAnimated();
548
549                // Clipboard methods:
550                virtual BOOL CanCopyTrack(Interval iv, DWORD flags) {return FALSE;}
551                virtual BOOL CanPasteTrack(TrackClipObject *cobj,Interval iv, DWORD flags) {return FALSE;}
552                virtual TrackClipObject *CopyTrack(Interval iv, DWORD flags) {return NULL;}
553                virtual void PasteTrack(TrackClipObject *cobj,Interval iv, DWORD flags) {}
554
555                // Drawing and hit testing tracks
556                virtual int GetTrackVSpace( int lineHeight ) { return 1; }
557                virtual int HitTestTrack(                       
558                        TrackHitTab& hits,
559                        Rect& rcHit,
560                        Rect& rcTrack,                 
561                        float zoom,
562                        int scroll,
563                        DWORD flags ) { return TRACK_DORANGE; }
564                virtual int PaintTrack(                 
565                        HDC hdc,
566                        Rect& rcTrack,
567                        Rect& rcPaint,
568                        float zoom,
569                        int scroll,
570                        DWORD flags ) { return TRACK_DORANGE; }
571               
572                // Drawing and hit testing function curves
573                virtual int PaintFCurves(                       
574                        ParamDimensionBase *dim,
575                        HDC hdc,
576                        Rect& rcGraph,
577                        Rect& rcPaint,
578                        float tzoom,
579                        int tscroll,
580                        float vzoom,
581                        int vscroll,
582                        DWORD flags ) { return 0; }
583                virtual int HitTestFCurves(                     
584                        ParamDimensionBase *dim,
585                        TrackHitTab& hits,
586                        Rect& rcHit,
587                        Rect& rcGraph,                 
588                        float tzoom,
589                        int tscroll,
590                        float vzoom,
591                        int vscroll,
592                        DWORD flags ) { return HITCURVE_NONE; }
593               
594                // Edit key info (or whatever) for selected keys.
595                // hParent is the parent window that should be used to create any dialogs.
596                // This function should not return until the user has completed editng at which
597                // time any windows that were created should be destroyed. Unlike
598                // BeginEditParams/EndEditParams this interface is modal.               
599                virtual void EditTrackParams(
600                        TimeValue t,    // The horizontal position of where the user right clicked.
601                        ParamDimensionBase *dim,
602                        TCHAR *pname, // The name of the parameter as given by the client
603                        HWND hParent,
604                        IObjParam *ip,
605                        DWORD flags) {}
606
607                // Returns a value indicating how track parameters are
608                // are invoked. See description above by
609                // TRACKPARAMS_NONE, TRACKPARAMS_KEY, TRACKPARAMS_WHOLE
610                virtual int TrackParamsType() {return TRACKPARAMS_NONE;}
611
612                // Calculate the largest and smallest values.
613                // If this is processed, return non-zero.
614                virtual int GetFCurveExtents(
615                        ParamDimensionBase *dim,
616                        float &min, float &max, DWORD flags) {return 0;}
617               
618                // Describes the type of dimension of the ith sub-anim
619                virtual ParamDimension* GetParamDimension(int i) {return defaultDim;}
620
621                // This is not used anymore.
622                virtual LRESULT CALLBACK TrackViewWinProc( HWND hwnd,  UINT message,
623                                                           WPARAM wParam, LPARAM lParam ) { return 0;}
624
625
626                // Add/delete note tracks
627                CoreExport void AddNoteTrack(NoteTrack *note);
628                CoreExport void DeleteNoteTrack(NoteTrack *note,BOOL delNote=TRUE); // If delNote is FALSE the note track will be removed from the anim but not deleted.
629                CoreExport BOOL HasNoteTracks();
630                CoreExport int NumNoteTracks();
631                CoreExport NoteTrack *GetNoteTrack(int i);
632
633                // Enumerate auxiliary files -- see ref.h for default implementation
634                virtual void EnumAuxFiles(NameEnumCallback& nameEnum, DWORD flags = FILE_ENUM_ALL) {}
635
636                // A master controller should implement this method to give the
637                // MAX a list of nodes that are part of the system.
638                virtual void GetSystemNodes(INodeTab &nodes) {}
639
640                // If an object is a sub-class of a particular class, it will have a
641                // different ClassID() because it is a different class. This method
642                // allows an object to indicate that it is a sub-class of a particluar
643                // class and therefore can be treated as one.
644                // For example, a class could be derived from TriObject. This derived
645                // class would have a different ClassID() then TriObject's class ID
646                // however it still can be treated (cast) as a TriObject because it
647                // is derived from TriObject.
648                // Note the default implelementation: a class is considered to also
649                // be a subclass of itself.
650                virtual BOOL IsSubClassOf(Class_ID classID) {return classID==ClassID();}
651
652                // Access app data chunks
653                CoreExport void AddAppDataChunk(Class_ID cid, SClass_ID sid, DWORD sbid, DWORD len, void *d);
654                CoreExport AppDataChunk *GetAppDataChunk(Class_ID cid, SClass_ID sid, DWORD sbid);
655                CoreExport BOOL RemoveAppDataChunk(Class_ID cid, SClass_ID sid, DWORD sbid);           
656        };
657
658
659
660
661
662//
663// Callback for EnumAnimTree:
664//
665// Scope values:
666
667#define SCOPE_DOCLOSED 1                // do "closed" animatables.
668#define SCOPE_SUBANIM  2                // do the sub anims
669#define SCOPE_CHILDREN 4                // do the node children
670#define SCOPE_OPEN      (SCOPE_SUBANIM|SCOPE_CHILDREN) // do all open animatables
671#define SCOPE_ALL       (SCOPE_OPEN|SCOPE_DOCLOSED)     // do all animatables
672
673// Return values for AnimEnum procs
674#define ANIM_ENUM_PROCEED 1
675#define ANIM_ENUM_STOP 2
676#define ANIM_ENUM_ABORT 3
677
678class AnimEnum {
679        protected:
680                int depth;
681                int scope; 
682        public:
683                AnimEnum(int s = SCOPE_OPEN, int deep = 0) { scope = s; depth = deep; }
684                void SetScope(int s) { scope = s; }
685                int Scope() { return scope; }
686                void IncDepth() { depth++; }
687                void DecDepth() { depth--; }
688                int Depth() { return depth; }
689                virtual int proc(Animatable *anim, Animatable *client, int subNum)=0;
690        };
691
692// A usefule enumeration
693class ClearAnimFlagEnumProc : public AnimEnum {
694                DWORD flag;
695        public:
696                ClearAnimFlagEnumProc(DWORD f) {flag=f;}
697                int proc(Animatable *anim, Animatable *client, int subNum) {
698                        anim->ClearAFlag(flag);
699                        return ANIM_ENUM_PROCEED;
700                        }
701        };
702
703
704//
705// The is used by the two functions GetSubObjectCenters() and
706// GetSubObjectTMs() found in the classes BaseObject and Control.
707//
708class SubObjAxisCallback {
709        public:
710                virtual void Center(Point3 c,int id)=0;
711                virtual void TM(Matrix3 tm,int id)=0;
712                virtual int Type()=0;
713        };
714
715// Values returned by Type();
716#define SO_CENTER_SELECTION     1
717#define SO_CENTER_PIVOT         2
718
719
720// --- AppData ---------------------------------------------
721
722// An individual app data chunk
723class AppDataChunk {
724        public:
725                // Note that data pointer should be allocated with standard malloc
726                // since it will be freed in the destructor.
727                AppDataChunk(Class_ID cid, SClass_ID sid, DWORD sbid, DWORD len, void *d)
728                        {classID=cid; superClassID=sid; subID=sbid; length=len; data=d;}
729                AppDataChunk() {length=0;data=NULL;}
730
731                ~AppDataChunk() {
732                        if (data) free(data);
733                        }               
734
735                // The super class and class IDs of the object that
736                // is the owner of this chunk.
737                Class_ID  classID;
738                SClass_ID superClassID;
739
740                // An extra ID that lets the owner identify its sub chunks.
741                DWORD subID;
742               
743                // The chunk data itself
744                DWORD length;
745                void *data;
746
747                // IO
748                CoreExport IOResult Load(ILoad *iload);
749                CoreExport IOResult Save(ISave *isave);
750        };
751
752
753// This list is maintained by the systems. Plug-ins need not concern themselves with it.
754class AnimAppData : public AnimProperty {
755        public:                         
756                Tab<AppDataChunk*> chunks;
757                CRITICAL_SECTION csect;
758                AppDataChunk *lastSearch;
759
760                DWORD ID() {return PROPID_APPDATA;}             
761                CoreExport ~AnimAppData();
762                CoreExport AnimAppData();
763
764                CoreExport AppDataChunk *FindChunk(Class_ID cid, SClass_ID sid, DWORD sbid);
765                void AddChunk(AppDataChunk *newChunk) {chunks.Append(1,&newChunk);}
766                CoreExport BOOL RemoveChunk(Class_ID cid, SClass_ID sid, DWORD sbid);
767
768                CoreExport IOResult Load(ILoad *iload);
769                CoreExport IOResult Save(ISave *isave);
770        };
771
772 
773CoreExport void SetLockFailureLevel(int level);
774CoreExport int GetLockFailureLevel();
775
776class Interface;
777CoreExport Interface *GetCOREInterface();
778
779
780// This API allows plug-in to query various system settings.
781// At the moment the only setting available is the enabled state
782// fo reditable meshes.
783#define SYSSET_ENABLE_EDITABLEMESH              1
784
785CoreExport int GetSystemSetting(int id);
786
787// Returns the state of the VERSION_3DSMAX #define from PLUGAPI.H
788// when the running version of MAX was compiled.
789CoreExport DWORD Get3DSMAXVersion();
790
791
792#endif // _ANIMTBL_H_
793
Note: See TracBrowser for help on using the repository browser.