00001 #ifndef __FBDATA_H__
00002 #define __FBDATA_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00045 #include <kaydaradef.h>
00046 #ifndef FBSDK_DLL
00047
00050 #define FBSDK_DLL K_DLLIMPORT
00051 #endif
00052
00053 #include <fbsdk/fbcomponent.h>
00054
00056
00057
00058 #define ANIMATIONNODE_TYPE_NUMBER "Number"
00059 #define ANIMATIONNODE_TYPE_TIME "Time"
00060 #define ANIMATIONNODE_TYPE_VECTOR "Vector"
00061 #define ANIMATIONNODE_TYPE_VECTOR_4 "Vector4"
00062 #define ANIMATIONNODE_TYPE_OBJECT "Object"
00063 #define ANIMATIONNODE_TYPE_REFERENCE "Reference"
00064 #define ANIMATIONNODE_TYPE_EVENT "Event"
00065 #define ANIMATIONNODE_TYPE_STRING "String"
00066
00067
00068 #define ANIMATIONNODE_TYPE_ACTION "Action"
00069 #define ANIMATIONNODE_TYPE_BOOL "Bool"
00070 #define ANIMATIONNODE_TYPE_ENUM "Enum"
00071 #define ANIMATIONNODE_TYPE_INTEGER "Integer"
00072 #define ANIMATIONNODE_TYPE_OCCLUSION "Occlusion"
00073 #define ANIMATIONNODE_TYPE_FIELDOFVIEWX "FieldOfViewX"
00074 #define ANIMATIONNODE_TYPE_FIELDOFVIEWY "FieldOfViewY"
00075 #define ANIMATIONNODE_TYPE_OPTICALCENTERX "OpticalCenterX"
00076 #define ANIMATIONNODE_TYPE_OPTICALCENTERY "OpticalCenterY"
00077 #define ANIMATIONNODE_TYPE_IKREACHTRANSLATION "IK Reach Translation"
00078 #define ANIMATIONNODE_TYPE_IKREACHROTATION "IK Reach Rotation"
00079
00080
00081 #define ANIMATIONNODE_TYPE_COLOR "Color"
00082 #define ANIMATIONNODE_TYPE_LOCAL_TRANSLATION "Lcl Translation"
00083 #define ANIMATIONNODE_TYPE_LOCAL_ROTATION "Lcl Rotation"
00084 #define ANIMATIONNODE_TYPE_LOCAL_SCALING "Lcl Scaling"
00085 #define ANIMATIONNODE_TYPE_TRANSLATION "Translation"
00086 #define ANIMATIONNODE_TYPE_ROTATION "Rotation"
00087 #define ANIMATIONNODE_TYPE_SCALING "Scaling"
00088
00089
00090 #define ANIMATIONNODE_TYPE_COLOR_RGBA "ColorAndAlpha"
00091
00093
00094 K_FORWARD( IConnector );
00095 K_FORWARD( KFCurve );
00096
00097 #ifdef FBSDKUseNamespace
00098 namespace FBSDKNamespace {
00099 #endif
00100
00101 FB_FORWARD( FBEvaluateInfo );
00102
00104 enum FBInterpolation {
00105 kFBInterpolationInvalid = -1,
00106 kFBInterpolationConstant = 0,
00107 kFBInterpolationLinear,
00108 kFBInterpolationCubic,
00109 kFBInterpolationCount
00110 };
00111 FB_DEFINE_ENUM( FBSDK_DLL, Interpolation );
00112
00114 enum FBInterpolatorCurveType {
00115 kFBInterpolatorCurveLinearIn,
00116 kFBInterpolatorCurveLinearOut,
00117 kFBInterpolatorCurveSmoothIn,
00118 kFBInterpolatorCurveSmoothOut,
00119 kFBInterpolatorCurveSlowIn,
00120 kFBInterpolatorCurveSlowOut,
00121 kFBInterpolatorCurveFastIn,
00122 kFBInterpolatorCurveFastOut,
00123 kFBInterpolatorCurveLast
00124 };
00125
00129 enum FBTangentMode {
00130 kFBTangentModeAuto,
00131 kFBTangentModeTCB,
00132 kFBTangentModeUser,
00133 kFBTangentModeBreak
00134 };
00135 FB_DEFINE_ENUM( FBSDK_DLL, TangentMode );
00136
00140 enum FBTangentClampMode {
00141 kFBTangentClampModeNone,
00142 kFBTangentClampModeClamped
00143
00144 };
00145 FB_DEFINE_ENUM( FBSDK_DLL, TangentClampMode );
00146
00150 enum FBTangentConstantMode {
00151 kFBTangentConstantModeNormal,
00152 kFBTangentConstantModeNext
00153 };
00154 FB_DEFINE_ENUM( FBSDK_DLL, TangentConstantMode );
00155
00157
00159 FB_FORWARD( FBFCurve );
00160 __FB_FORWARD( FBFCurveKey );
00161 FB_FORWARD( FBPropertyListFCurveKey );
00162
00164 class FBSDK_DLL FBFCurveKey
00165 {
00166 private:
00167 HDataFBFCurveKey mLocalPtr;
00168 void FBFCurveKeyInitProperties();
00170 void PropertyAdd( FBProperty* ) {};
00171 public:
00176 FBFCurveKey( HKFCurve pFCurve=NULL, int pKeyIndex=1 );
00177
00181 FBFCurveKey( const FBFCurveKey &pFCurveKey );
00182
00185 ~FBFCurveKey();
00186
00192 bool operator==(const FBFCurveKey &pValue) const;
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 FBPropertyFloat Value;
00203 FBPropertyFloat LeftDerivative;
00204 FBPropertyFloat RightDerivative;
00205 FBPropertyFloat LeftTangentWeight;
00206 FBPropertyFloat RightTangentWeight;
00207 FBPropertyFloat LeftBezierTangent;
00208 FBPropertyFloat RightBezierTangent;
00209
00210
00211 FBPropertyFloat Tension;
00212 FBPropertyFloat Continuity;
00213 FBPropertyFloat Bias;
00214
00215 FBPropertyTime Time;
00216 FBPropertyInterpolation Interpolation;
00217 FBPropertyTangentMode TangentMode;
00218 FBPropertyTangentClampMode TangentClampMode;
00219 FBPropertyBool TangentBreak;
00220 FBPropertyTangentConstantMode TangentConstantMode;
00221
00222 friend class FBFCurve;
00223 friend class FBPropertyListFCurveKey;
00224 };
00225
00227
00229 FB_FORWARD( FBFCurveKey );
00230
00232 class FBSDK_DLL FBPropertyListFCurveKey : public FBPropertyBaseList< FBFCurveKey >
00233 {
00234 private:
00240 virtual int Add ( FBFCurveKey pItem );
00241
00247 virtual int Remove ( FBFCurveKey pItem );
00248
00249 public:
00250
00254 virtual void RemoveAt( int pIndex );
00255
00260 virtual FBFCurveKey operator[](int pIndex);
00261
00265 virtual int GetCount();
00266 };
00267
00269
00271 __FB_FORWARD( FBFCurve);
00272
00274 class FBSDK_DLL FBFCurve : public FBComponent {
00275 __FBClassDeclare( FBFCurve,FBComponent );
00276 public:
00280 FBFCurve(HIObject pObject=NULL);
00281
00284 virtual void FBDelete() override;
00285
00290 float Evaluate(FBTime &pTime);
00291
00295 void EditBegin(int pKeyCount=-1);
00296
00300 void EditEnd(int pKeyCount=-1);
00301
00303 void EditClear();
00304
00312 int KeyAdd( FBTime &pTime, double pValue );
00313
00318 bool KeyRemove( int pIndex );
00319
00329 bool KeyDelete(int pStartIndex , int pStopIndex);
00330
00338 bool KeyDelete(FBTime pStart = FBTime::MinusInfinity, FBTime pStop = FBTime::Infinity, bool pInclusive = false);
00339
00345 void KeyInsert( FBTime &pTime, FBInterpolation pInterpolation = kFBInterpolationCubic, FBTangentMode pTangentMode = kFBTangentModeAuto );
00346
00354 void Replace( FBFCurve& pSource, FBTime pStart = FBTime::MinusInfinity, FBTime pStop = FBTime::Infinity, bool pUseExactGivenSpan = false, bool pKeyStartEndOnNoKey = true );
00355
00359 static FBFCurve* CreateInterpolatorCurve( FBInterpolatorCurveType pCurveType );
00360
00361 FBPropertyListFCurveKey Keys;
00362 };
00363
00364 FB_DEFINE_COMPONENT( FBSDK_DLL, FCurve );
00365
00367
00369 __FB_FORWARD( FBAnimationNode);
00370 __FB_FORWARD( FBPropertyListAnimationNode);
00371 FB_DEFINE_LIST( FBSDK_DLL, AnimationNode );
00372
00374 class FBSDK_DLL FBPropertyListAnimationNode : public FBPropertyBaseList< HFBAnimationNode >
00375 {
00376 public:
00381 virtual int Add ( HFBAnimationNode pItem );
00386 virtual int Remove ( HFBAnimationNode pItem );
00390 virtual void RemoveAt( int pIndex );
00395 virtual HFBAnimationNode operator[](int pIndex);
00399 virtual int GetCount();
00405 HFBAnimationNode Find( FBBox *pOriginalOwner, char* pDataType );
00410 HFBAnimationNode Find( char *pNodeName );
00415 HFBAnimationNode FindByLabel( char *pNodeLabel );
00416 };
00417
00418 FB_DEFINE_COMPONENT( FBSDK_DLL, AnimationNode );
00420
00423
00425 enum FBEventAnimationNodeType {
00426 kFBEventAnimationNodeDataChange,
00427 kFBEventAnimationNodeConstraintChange,
00428 kFBEventAnimationNodeNone
00429 };
00430
00431 FB_DEFINE_ENUM( FBSDK_DLL, EventAnimationNodeType );
00432
00433 __FB_FORWARD( FBEventAnimationNode );
00434
00441 class FBSDK_DLL FBEventAnimationNode: public FBEvent
00442 {
00443 public:
00447 FBEventAnimationNode( HKEventBase pEvent );
00448
00449 FBPropertyEventAnimationNodeType Type;
00450 };
00451
00453
00456 class FBSDK_DLL FBPropertyEventAnimationNode : public FBPropertyEvent
00457 {
00458 public:
00463 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00464 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00465 };
00473 typedef bool (* kFBDataHandler )(void* pBuffer,HFBEvaluateInfo pEvaluateInfo,HFBAnimationNode pAnimationNode,void* p1,void* p2);
00474
00476
00479 FB_DEFINE_COMPONENT( FBSDK_DLL, AnimationNode );
00480
00481 class FBSDK_DLL FBAnimationNode : public FBComponent
00482 {
00483 __FBClassDeclare( FBAnimationNode,FBComponent );
00484 public:
00489 FBAnimationNode(char *pName = NULL, HIObject pObject=NULL);
00490
00495 void KeyAdd( FBTime &pTime, double *pData );
00496
00500 void KeyAdd( double *pData );
00501
00505 bool SetCandidate( double* Data );
00506
00510 void SetBufferType( bool pGlobal );
00511
00514 void KeyCandidate();
00515
00518 int GetSizeOfData();
00519
00523 int GetDataDoubleArrayCount();
00524
00530 bool WriteData( double* Data,HFBEvaluateInfo pEvaluateInfo );
00531
00537 bool WriteGlobalData( double* Data,HFBEvaluateInfo pEvaluateInfo );
00538
00544 bool ReadData( double* Data,HFBEvaluateInfo pEvaluateInfo );
00545
00556 bool ReadData( double *Data, FBTime pTime );
00557
00565 bool ReadData( double* Data );
00566
00573 bool Evaluate( double* Data, FBTime pTime, bool pEvaluateCandidate = true );
00574
00578 bool IsKey();
00579
00582 void KeyRemove();
00583
00587 HFBAnimationNode GetAnimationToRecord();
00588
00592 HFBAnimationNode GetAnimationToPlay();
00593
00597 FBTime ConvertGlobalToNodeTime(FBTime& pKeyTime);
00598
00602 FBTime ConvertNodeToGlobalTime(FBTime& pKeyTime);
00603
00604 FBPropertyString Label;
00605 FBPropertyString UserName;
00606 FBPropertykReference Reference;
00607 FBPropertyInt KeyCount;
00608 FBPropertyFCurve FCurve;
00609 FBPropertyBool Live;
00610 FBPropertyBool RecordMode;
00611 FBPropertyAnimationNode Parent;
00612 FBPropertyInterpolation DefaultInterpolation;
00613
00614 FBPropertyListAnimationNode Nodes;
00615
00616 FBPropertyEventAnimationNode OnChange;
00617
00618 friend class FBBox;
00619 };
00620
00622
00624
00628 enum FBLayerMode {
00629 kFBLayerModeInvalidIndex = -1,
00630 kFBLayerModeAdditive = 0,
00631 kFBLayerModeOverride,
00632 kFBLayerModeOverridePassthrough
00633 };
00634 FB_DEFINE_ENUM( FBSDK_DLL, LayerMode );
00635
00639 enum FBLayerRotationMode {
00640 kFBLayerRotationModeInvalidIndex = -1,
00641 kFBLayerRotationModeEulerRotation = 0,
00642 kFBLayerRotationModeQuaternionRotation
00643 };
00644 FB_DEFINE_ENUM( FBSDK_DLL, LayerRotationMode );
00645
00646
00647 __FB_FORWARD( FBAnimationLayer );
00648
00656 class FBSDK_DLL FBAnimationLayer : public FBComponent
00657 {
00658
00659 __FBClassDeclare(FBAnimationLayer, FBComponent);
00660 public:
00661
00667 FBAnimationLayer(char *pName, int pLayerID, HIObject pObject=NULL);
00668
00671 virtual void FBDelete();
00672
00673 FBPropertyBool Solo;
00674 FBPropertyBool Mute;
00675 FBPropertyBool Lock;
00676 FBPropertyAnimatableDouble Weight;
00677 FBPropertyLayerMode LayerMode;
00678 FBPropertyLayerRotationMode LayerRotationMode;
00679
00683 void AddChildLayer( HFBAnimationLayer pAnimationLayer );
00684
00689 FBAnimationLayer* GetChildLayer( int pIndex );
00690
00694 int GetChildCount();
00695
00702 void GetCompleteChildHierarchy(FBArrayTemplate<FBAnimationLayer*>* pChildArray);
00703
00707 void SetParentLayer(FBAnimationLayer* pParentLayer);
00708
00712 FBAnimationLayer* GetParentLayer();
00713
00717 int GetLayerIndex();
00718
00723 void SelectLayer(bool pValue, bool pExclusiveSelect);
00724
00728 bool IsSelected();
00729
00730 private:
00731 void FBAnimationLayerInitProperties();
00732 };
00733
00734
00735 __FB_FORWARD( FBTake);
00737
00739
00742 class FBSDK_DLL FBPropertyListTake : public FBPropertyListComponent
00743 {
00744 public:
00745 FBPropertyListTake();
00750 FBTake* operator[](int pIndex);
00751 };
00752
00754 enum FBAnimationLayerMergeOptions {
00755 kFBAnimLayerMerge_SelectedLayers_SelectedProperties,
00756 kFBAnimLayerMerge_AllLayers_SelectedProperties,
00757 kFBAnimLayerMerge_SelectedLayers_AllProperties,
00758 kFBAnimLayerMerge_AllLayers_AllProperties,
00759 kFBAnimLayerMerge_SelectedLayer_CompleteScene,
00760 kFBAnimLayerMerge_AllLayers_CompleteScene,
00761 };
00762
00764 enum FBMergeLayerMode {
00765 kFBMergeLayerModeAutomatic,
00766 kFBMergeLayerModeAdditive,
00767 kFBMergeLayerModeOverride,
00768 };
00769
00771
00773
00801 class FBSDK_DLL FBTake : public FBComponent {
00802 __FBClassDeclare( FBTake,FBComponent );
00803 public:
00811 FBTake(char *pName, HIObject pObject=NULL);
00812
00817 virtual void FBDelete();
00818
00827 HFBTake CopyTake( char *pNewTakeName );
00828
00833 void PlotAllTakesOnSelected(FBTime pPlotPeriod);
00836 void CreateNewLayer();
00837
00841 void RemoveLayer(int pLayerIndex);
00842
00847 FBAnimationLayer* GetLayer(int pLayerIndex);
00848
00853 FBAnimationLayer* GetLayerByName(char* pName);
00854
00858 void SetCurrentLayer(int pLayerIndex);
00859
00863 int GetCurrentLayer();
00864
00868 int GetLayerCount();
00869
00873 bool MoveCurrentLayerUp();
00874
00878 bool MoveCurrentLayerDown();
00879
00882 void DuplicateSelectedLayers();
00883
00889 void MergeLayers(FBAnimationLayerMergeOptions pMergeOptions, bool pDeleteMergedLayers, FBMergeLayerMode pMergeMode);
00890
00895 void PlotTakeOnSelected(FBTime pPlotPeriod);
00896
00901 void PlotAllTakesOnSelectedProperties(FBTime pPlotPeriod);
00902
00907 void PlotTakeOnSelectedProperties(FBTime pPlotPeriod);
00908
00912 void ClearAllProperties(bool pOnSelectedObjectsOnly);
00913
00914 FBPropertyTimeSpan ReferenceTimeSpan;
00915 FBPropertyTimeSpan LocalTimeSpan;
00916 FBPropertyString Comments;
00917 };
00918
00919 FB_DEFINE_COMPONENT( FBSDK_DLL, Take );
00920
00922
00924 __FB_FORWARD( FBTimeWarpManager );
00925
00929 class FBSDK_DLL FBTimeWarpManager : public FBComponent
00930 {
00931 __FBClassDeclare(FBTimeWarpManager, FBComponent);
00932
00933 public:
00934 typedef void (*TimeWarpChangeCallback)(void* pObject);
00935
00939 FBTimeWarpManager();
00940
00941
00944 void TimeWarpTakeChange();
00945
00949 void TimeWarpClearTake(HFBTake pTake);
00950
00954 void TimeWarpInitTake(HFBTake pTake);
00955
00960 void TimeWarpCopyTake(HFBTake pDstTake, HFBTake pSrcTake );
00961
00962
00968 void TimeWarpAddToTake(HFBTake pTake, HFBAnimationNode pTimeWarp, int pNickNumber=0);
00969
00974 void DestroyTimeWarpFromTake(HFBTake pTake, HFBAnimationNode pTimeWarp);
00975
00979 void RemoveTimeWarpFromScene(HFBAnimationNode pTimeWarp);
00980
00981
00986 kLong GetTimeWarpCount(HFBTake pTake);
00987
00993 HFBAnimationNode GetTimeWarpAtIndex(HFBTake pTake, kLong pIndex);
00994
00995
01001 int GetTimeWarpNickNumber(HFBTake pTake, HFBAnimationNode pTimeWarp);
01002
01009 bool SetTimeWarpNickNumber(HFBTake pTake, HFBAnimationNode pTimeWarp, int pNumber);
01010
01016 int GetTimeWarpNickNumberAtIndex(HFBTake pTake, kLong pIndex);
01017
01023 HFBAnimationNode GetTimeWarpFromNickNumber(HFBTake pTake, int pNumber);
01024
01029 int FindTimeWarpNickNumberGlobal(HFBAnimationNode pTimeWarp);
01030
01031
01038 bool ApplyTimeWarp(HFBTake pTake, FBProperty* pEvalProp, HFBAnimationNode pTimeWarp);
01039
01044 void RemoveTimeWarp(HFBTake pTake, FBProperty* pEvalProp );
01045
01046
01051 void TimeWarpRegisterChangeEvent(TimeWarpChangeCallback pCallback, void* pObject);
01052
01057 void TimeWarpUnregisterChangeEvent(TimeWarpChangeCallback pCallback, void* pObject);
01058
01059
01064 HFBAnimationNode TimeWarpCreateNew( char* pName );
01065
01066
01072 void TimeWarpRename( HFBTake pTake, HFBAnimationNode pTimeWarp, char* pNewName );
01073
01080 void TimeWarpMergeCurveNode( HFBTake pTake,FBProperty* pEvalProp, HFBAnimationNode pNode, HFBAnimationNode pTimeWarpNode );
01081
01085 static FBTimeWarpManager& TheOne();
01086 };
01087
01088 #ifdef FBSDKUseNamespace
01089 }
01090 #endif
01091
01092 #endif
01093