📄 animtbl.h
字号:
// Macros for converting track screen coords to time and back.
#define TimeToScreen(t,scale,scroll) (int(floor((t)*(scale)+0.5)) - (scroll))
#define ScreenToTime(s,scale,scroll) ((int)floor((s)/(scale) + (scroll)/(scale)+0.5))
#define ValueToScreen(v,h,scale,scroll) (h-int(floor((v)*(scale)+0.5)) - (scroll))
#define ScreenToValue(s,h,scale,scroll) ((float(h)-(float(s)+float(scroll)))/(scale))
// Scales a value about an origin
#define ScaleAboutOrigin(val,origin,scale) ((((val)-(origin))*(scale))+(origin))
class TrackClipObject {
public:
// Specifies the interval of time clipped.
Interval clip;
// Identifies the creator of the clip object
virtual SClass_ID SuperClassID()=0;
virtual Class_ID ClassID()=0;
TrackClipObject(Interval iv) {clip = iv;}
virtual void DeleteThis()=0;
virtual int NumKeys() {return 0;}
virtual BOOL GetKeyVal(int i, void *val) {return FALSE;}
virtual BOOL SetKeyVal(int i, void *val) {return FALSE;}
};
// This must be updated if a new entry is added to DimType!
#define NUM_BUILTIN_DIMS 10
enum DimType {
DIM_WORLD,
DIM_ANGLE,
DIM_COLOR, //0-1
DIM_COLOR255, //0-255
DIM_PERCENT, //0-100
DIM_NORMALIZED, //0-1
DIM_SEGMENTS,
DIM_TIME,
DIM_CUSTOM,
DIM_NONE
};
// These two classes describes the dimension of a parameter (sub-anim).
// The dimension type and possibly the dimension scale (if the type is
// custom) are used to determine a scale factor for the parameter.
// When a controller is drawing a function curve, it only needs to
// use the Convert() function - the scale factor is rolled into the single
// 'vzoom' parameter passed to PaintFCurves.
// So, for a controller to plot a value 'val' at time t it would do the
// following:
// int x = TimeToScreen(t,tzoom,tscroll);
// int y = ValueToScreen(dim->Convert(val),rect.h()-1,vzoom,vscroll);
//
class ParamDimensionBase {
public:
virtual DimType DimensionType()=0;
virtual float Convert(float value)=0;
virtual float UnConvert(float value)=0;
};
class ParamDimension : public ParamDimensionBase {
public:
// If the DimType is custom than these must be implemented.
virtual float GetDimScale() {return 1.0f;}
virtual void SetDimScale() {}
virtual TCHAR *DimensionName() {return _T("");}
};
// These point to default implementations for the standard DIM types.
CoreExport extern ParamDimension *defaultDim;
CoreExport extern ParamDimension *stdWorldDim;
CoreExport extern ParamDimension *stdAngleDim;
CoreExport extern ParamDimension *stdColorDim;
CoreExport extern ParamDimension *stdColor255Dim;
CoreExport extern ParamDimension *stdPercentDim;
CoreExport extern ParamDimension *stdNormalizedDim;
CoreExport extern ParamDimension *stdSegmentsDim;
CoreExport extern ParamDimension *stdTimeDim;
// Interface IDs for GetInterface() - NOTE: doesn't need to be released.
#define I_CONTROL 0x00001001
#define I_MASTER 0x00001010
#define I_EASELIST 0x00001020
#define I_MULTLIST 0x00001030
#define I_BASEOBJECT 0x00001040
#define I_PARTICLEOBJ 0x00001050
#define I_KEYCONTROL 0x00001060
#define I_TEXTOBJECT 0x00001070
#define I_WAVESOUND 0x00001080
#ifdef _SUBMTLASSIGNMENT
#define I_SUBMTLAPI 0x00001090
#endif
#define I_MESHSELECT 0x000010A0
#define I_MESHSELECTDATA 0x000010B0
#define I_MAXSCRIPTPLUGIN 0x000010C0
#define I_MESHDELTAUSER 0x000010D0
#define I_MESHDELTAUSERDATA 0x000010E0
#define I_SPLINESELECT 0x000010F0 // JBW: add interface to spline selection & ops (for SplineShape & EditSplineMod)
#define I_SPLINESELECTDATA 0x00001100
#define I_SPLINEOPS 0x00001110
#define I_PATCHSELECT 0x00001120
#define I_PATCHSELECTDATA 0x00001130
#define I_PATCHOPS 0x00001140
#define I_COMPONENT 0x0000F010
#define I_REFARRAY 0x0000F030
#ifdef DESIGN_VER
//VIZ specific range begins here 0x0000F000
#define I_LINK_TARGET 0x0000F020
#define I_LAYER 0x0000F040
#define I_LAYER_MANAGER 0x0000F050
#endif
#define I_REAGENT 0x0000F060
#define I_GEOMIMP 0x0000F070 //JH 3/7/99 implementaion neutral interface to geometry caches
#define I_AGGREGATION 0x0000F080
#define I_VALENCE 0x0000F090
#define I_GUEST 0x0000F100
#define I_HOST 0x0000F110
#define I_SCENEOBJECT 0x0000F120
// Plug-in defined interfaces should be > this id
#define I_USERINTERFACE 0x0000ffff
#define GetControlInterface(anim) ((Control*)anim->GetInterface(I_CONTROL))
#define GetObjectInterface(anim) ((BaseObject*)anim->GetInterface(I_BASEOBJECT))
#define GetParticleInterface(anim) ((ParticleObject*)anim->GetInterface(I_PARTICLEOBJ))
#define GetKeyControlInterface(anim) ((IKeyControl*)anim->GetInterface(I_KEYCONTROL))
#define GetMasterController(anim) ((ReferenceTarget*)anim->GetInterface(I_MASTER))
#define GetTextObjectInterface(anim) ((ITextObject*)anim->GetInterface(I_TEXTOBJECT))
#define GetWaveSoundInterface(anim) ((IWaveSound*)anim->GetInterface(I_WAVESOUND))
#define GetMeshSelectInterface(anim) ((IMeshSelect*)anim->GetInterface(I_MESHSELECT))
#define GetMeshSelectDataInterface(anim) ((IMeshSelectData*)anim->GetInterface(I_MESHSELECTDATA))
#define GetMeshDeltaUserInterface(anim) ((MeshDeltaUser*)anim->GetInterface(I_MESHDELTAUSER))
#define GetMeshDeltaUserDataInterface(anim) ((MeshDeltaUserData*)anim->GetInterface(I_MESHDELTAUSERDATA))
// This is the base class for classes that can be hung off an animatable's
// property list. When an animatable is deleted, it's properties will be
// deleted and their virtual destructor will be called.
class AnimProperty {
public:
virtual BOOL DontDelete() {return FALSE;}
virtual ~AnimProperty() {}
virtual DWORD ID()=0;
};
class AnimPropertyList : public Tab<AnimProperty*> {
public:
CoreExport int FindProperty(DWORD id,int start=0);
};
// Property IDs
#define PROPID_APPDATA 0x00000010
#define PROPID_EASELIST 0x00000020
#define PROPID_MULTLIST 0x00000030
#define PROPID_NOTETRACK 0x00000040
#define PROPID_CLEARCACHES 0x00000050
#define PROPID_HAS_WSM 0x00000060
#define PROPID_PSTAMP_SMALL 0x00000070
#define PROPID_PSTAMP_LARGE 0x00000071
#define PROPID_SVDATA 0x00000080
#define PROPID_FORCE_RENDER_MESH_COPY 0x000000100
#define PROPID_EVAL_STEPSIZE_BUG_FIXED 0x1000
#define PROPID_USER 0x0000FFFF
// Values above PROPID_USER can be used by plug-ins.
// Note: that a plug-in should only put user defined properties on it's
// own list. So IDs only have to be unique within a plug-in. If a plug-in
// needs to attach data to another object, it can do so via APP_DATA.
// BeginEditParams flags values
#define BEGIN_EDIT_CREATE (1<<0)
#define BEGIN_EDIT_MOTION (1<<1) // Controller is being edited in the motion branch
#define BEGIN_EDIT_HIERARCHY (1<<2) // Same as BEGIN_EDIT_IK
#define BEGIN_EDIT_IK (1<<2) // Controller is being edited in the IK subtask of the hierarchy branch
#define BEGIN_EDIT_LINKINFO (1<<3) // Controller is being edited in the Link Info subtask of the hierarchy branch
// EndEditParams flags values
#define END_EDIT_REMOVEUI (1<<0)
// Flags passed to EnumAuxFiles
#define FILE_ENUM_INACTIVE (1<<0) // enumerate inactive files
#define FILE_ENUM_VP (1<<1) // enumerate video post files
#define FILE_ENUM_RENDER (1<<2) // enumerate render files
#define FILE_ENUM_ALL (FILE_ENUM_INACTIVE|FILE_ENUM_VP|FILE_ENUM_RENDER) // enumerate ALL files
#define FILE_ENUM_MISSING_ONLY (1<<8) // enumerate missing files only
#define FILE_ENUM_1STSUB_MISSING (1<<9) // just enumerate 1st file named by ifl if missing
#define FILE_ENUM_DONT_RECURSE (1<<10) // don't enumerate references
#define FILE_ENUM_CHECK_AWORK1 (1<<11) // don't enumerate things with flag A_WORK1 set
// To enumerate all active but missing files
#define FILE_ENUM_MISSING_ACTIVE (FILE_ENUM_VP|FILE_ENUM_RENDER|FILE_ENUM_MISSING_ONLY)
// To enumerate all active but missing files, but only enumerate first subfile pointed
// to by an ifl (enumerating all of them can be very slow).
#define FILE_ENUM_MISSING_ACTIVE1 (FILE_ENUM_MISSING_ACTIVE|FILE_ENUM_1STSUB_MISSING )
// A callback object passed to EnumAuxFiles().
class NameEnumCallback {
public:
virtual void RecordName(TCHAR *name)=0;
};
class NoteTrack;
class Animatable {
friend class ISaveImp;
friend class ILoadImp;
protected:
unsigned long aflag;
AnimPropertyList aprops;
DWORD tvflags1, tvflags2;
public:
void SetAFlag(int mask) { aflag|=mask; }
void ClearAFlag(int mask) { aflag &= ~mask; }
int TestAFlag(int mask) { return(aflag&mask?1:0); }
CoreExport Animatable();
Animatable& operator=(const Animatable& an) { aflag = an.aflag; return *this; }
virtual void GetClassName(TSTR& s) { s= TSTR(_T("Animatable")); }
CoreExport virtual Class_ID ClassID();
CoreExport virtual SClass_ID SuperClassID();
CoreExport virtual ~Animatable();
// This is how things are actually deleted.
// Since they are created with the ClassDesc::Create() function, and
// deleted via this function, they can use a different memory allocator
// than the core code. (theoretically)
CoreExport virtual void DeleteThis();
// Get rid of anything that can be rebuilt
// Objects have a default implementation.
virtual void FreeCaches() {}
// 'create' is TRUE if parameters are being edited in the create branch.
// 'removeUI' is TRUE if the object's UI should be removed.
virtual void BeginEditParams(IObjParam *ip,ULONG flags,Animatable *prev=NULL) {}
virtual void EndEditParams(IObjParam *ip,ULONG flags,Animatable *next=NULL) {}
// OLE-like method for adding new interfaces
virtual void* GetInterface(ULONG id){ return NULL;}
virtual void ReleaseInterface(ULONG id,void *i) {}
// General method for adding properties, when
// defining a new Interface would be too cumbersome
virtual int SetProperty(ULONG id, void *data) { return 0; }
virtual void *GetProperty(ULONG id) { return NULL; }
virtual int NumSubs() { return 0; } // How many sub-animatables are there?
virtual Animatable* SubAnim(int i) { return NULL; } // access the ith sub-animatable
CoreExport virtual TSTR SubAnimName(int i); // get name of ith subanim
virtual BOOL BypassTreeView() { return FALSE; } // return TRUE and you won't appear in the TreeView however your children will.
virtual BOOL BypassTrackBar() { return BypassTreeView(); } // return TRUE and you won't appear in the TrackBar however your children will.
virtual BOOL BypassPropertyLevel() { return FALSE; } // return TRUE and you won't appear as a property in the scripter however your children will.
virtual BOOL InvisibleProperty() { return FALSE; } // return TRUE and you won't appear as a property in the scripter.
virtual BOOL AssignController(Animatable *control,int subAnim) {return FALSE;}
// Used to allow deletion of controllers from the track view
virtual BOOL CanDeleteSubAnim(int i) {return FALSE;}
virtual void DeleteSubAnim(int i) {}
// Return the suggested color to draw a sub-anim's function curve
// can be one of PAINTCURVE_GENCOLOR, PAINTCURVE_XCOLOR, PAINTCURVE_YCOLOR, PAINTCURVE_ZCOLOR
virtual DWORD GetSubAnimCurveColor(int subNum) {return PAINTCURVE_GENCOLOR;}
// Converts an anim index to a ref index or returns -1 if there is no
// corrispondance. This is used for copying and pasting in the track
// view. If a client does not wish an anim to be copy/pastable then
// it can return -1 even if there is a corrisponding ref num.
virtual int SubNumToRefNum(int subNum) {return -1;}
// In addition to SubNumToRefNum(), if an anim doesn't want to be coppied it can return FALSE from this function
virtual BOOL CanCopyAnim() {return TRUE;}
// An anim can implement this to reutrn FALSE to prohibit make unique
virtual BOOL CanMakeUnique() {return TRUE;}
virtual int NumChildren() {return 0; } // Non-zero only for nodes.
virtual Animatable* ChildAnim(int i) { return NULL; } // access the ith child
CoreExport virtual TSTR NodeName(); // For nodes only
CoreExport int EnumAnimTree(AnimEnum *animEnum, Animatable *client, int subNum);
CoreExport int HasSubElements(int type=0);
// called once at the beginning of each render
virtual int RenderBegin(TimeValue t, ULONG flags=0) { return 0; }
// called once at the end of each render
virtual int RenderEnd(TimeValue t) { return 0; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -