FBX SDK Reference Guide: kfcurvenode.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_COMPONENTS_KFCURVE_KFCURVENODE_H
00005 #define FBXFILESDK_COMPONENTS_KFCURVE_KFCURVENODE_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 2001 - 2008 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 
00042 #include <fbxfilesdk/components/kfcurve/kfcurve_h.h>
00043 
00044 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00045 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00046 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00047 
00048 #include <fbxfilesdk/components/kfcurve/kfcurve.h>
00049 
00050 #ifndef KFBX_PLUGIN
00051     #include <fbxfilesdk/components/kfcurve/i/ifcurveeti.h>
00052     #include <fbxfilesdk/components/kbaselib/object/i/iobject.h>
00053     #include <fbxfilesdk/components/kbaselib/object/i/ifbobjectholder.h>
00054 #endif
00055 
00056 KFBX_FORWARD (IConnector) 
00057 KFBX_FORWARD (IData) 
00058 
00059 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00060 
00061 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00062 
00063     enum 
00064     {   
00065         KFCN_IN = 0, 
00066         KFCN_OUT = 1, 
00067         KFCN_INOUT_MASK = 1, 
00068 
00069         KFCN_HIDDEN = 0, 
00070         KFCN_SHOWN = 2, 
00071 
00072         KFCN_CONTAINER_NODE = 0, 
00073         KFCN_REFERENCER_NODE = 8, 
00074         KFCN_REFERENCER_MASK = 8, 
00075 
00076         KFCN_TAKE_NODE = 16, 
00077         KFCN_FIXED_NODE = 0, 
00078         KFCN_TAKE_MASK = 16,
00079 
00080         KFCN_EXPENDED_NODE = 32, 
00081         KFCN_NOTEXPENDED_NODE = 0, 
00082         KFCN_EXPENDED_MASK = 32,
00083 
00084         KFCN_MULTILAYER = 64,
00085         KFCN_MONOLAYER  = 0,
00086         KFCN_MULTILAYER_MASK = 64,
00087 
00088         KFCN_ALWAYS_CANDIDATE = 128,
00089         KFCN_ALWAYS_CANDIDATE_TESTED = 256
00090     };
00091 
00092     //
00093     // Picking Types define
00094     //
00095     enum 
00096     {
00097         KCP_KEY = 1, 
00098         KCP_LTANGENT, 
00099         KCP_RTANGENT
00100     };
00101 
00102     //
00103     //  Node/Layer info
00104     //
00105     enum
00106     {
00107         KFCL_NOLAYER,
00108         KFCL_ADD,       // For translation and standard others
00109         KFCL_EULER_XYZ, // For rotation
00110         KFCL_MULT,      // For scaling, mainly
00111         KFCL_QUAT       // For quaternion rotation
00112     };
00113 
00114     #define KFCURVENODE_TRANSFORM               "Transform"
00115         #define KFCURVENODE_T                       "T"
00116             #define KFCURVENODE_T_X                     "X"
00117             #define KFCURVENODE_T_Y                     "Y"
00118             #define KFCURVENODE_T_Z                     "Z"
00119         #define KFCURVENODE_R                       "R"
00120             #define KFCURVENODE_R_X                     "X"
00121             #define KFCURVENODE_R_Y                     "Y"
00122             #define KFCURVENODE_R_Z                     "Z"
00123             #define KFCURVENODE_R_W                     "W"
00124         #define KFCURVENODE_S                       "S"
00125             #define KFCURVENODE_S_X                     "X"
00126             #define KFCURVENODE_S_Y                     "Y"
00127             #define KFCURVENODE_S_Z                     "Z"
00128     #define KFCURVENODE_LCL_T                   "Lcl Translation"
00129     #define KFCURVENODE_LCL_R                   "Lcl Rotation"
00130     #define KFCURVENODE_LCL_S                   "Lcl Scaling"
00131     #define KFCURVENODE_VISIBILITY              "Visibility"
00132 
00133     // Addition for the optical marker node attribute.
00134     #define KFCURVENODE_OCCLUSION               "Occlusion"
00135 
00136     // Addition for the IK effector marker node attribute.
00137     #define KFCURVENODE_IK_REACH_TRANSLATION    "IK Reach Translation"
00138     #define KFCURVENODE_IK_REACH_ROTATION       "IK Reach Rotation"
00139 
00140     // Addition for the light node attribute.
00141     #define KFCURVENODE_LIGHT_CONEANGLE         "Cone angle"
00142     #define KFCURVENODE_LIGHT_FOG               "Fog"
00143     #define KFCURVENODE_LIGHT_INTENSITY         "Intensity"
00144     #define KFCURVENODE_COLOR                   "Color"
00145     #define KFCURVENODE_COLOR_RED                   "X"
00146     #define KFCURVENODE_COLOR_GREEN                 "Y"
00147     #define KFCURVENODE_COLOR_BLUE                  "Z"
00148 
00149     // Addition for the camera node attribute.
00150     #define KFCURVENODE_CAMERA_FIELDOFVIEW      "FieldOfView"
00151     #define KFCURVENODE_CAMERA_FIELDOFVIEWX     "FieldOfViewX"
00152     #define KFCURVENODE_CAMERA_FIELDOFVIEWY     "FieldOfViewY"
00153     #define KFCURVENODE_CAMERA_FOCALLENGTH      "FocalLength"
00154     #define KFCURVENODE_CAMERA_OPTICALCENTERX   "OpticalCenterX"
00155     #define KFCURVENODE_CAMERA_OPTICALCENTERY   "OpticalCenterY"
00156     #define KFCURVENODE_CAMERA_ROLL             "Roll"
00157     #define KFCURVENODE_CAMERA_TURNTABLE        "TurnTable"
00158     #define KFCURVENODE_BACKGROUND_COLOR        "BackgroundColor"
00159     #define KFCURVENODE_BACKGROUND_COLOR_RED        "X"
00160     #define KFCURVENODE_BACKGROUND_COLOR_GREEN      "Y"
00161     #define KFCURVENODE_BACKGROUND_COLOR_BLUE       "Z"
00162 
00163     // Addition for the camera switcher node attribute.
00164     #define KFCURVENODE_CAMERA_INDEX            "Camera Index"
00165 
00166     // Addition for the texture.
00167     #define KFCURVENODE_TEXTURE_TRANSLATION     "Translation"
00168     #define KFCURVENODE_TEXTURE_TRANSLATION_X   "X"
00169     #define KFCURVENODE_TEXTURE_TRANSLATION_Y   "Y"
00170     #define KFCURVENODE_TEXTURE_TRANSLATION_Z   "Z"
00171     #define KFCURVENODE_TEXTURE_ROTATION        "Rotation"
00172     #define KFCURVENODE_TEXTURE_ROTATION_X      "X"
00173     #define KFCURVENODE_TEXTURE_ROTATION_Y      "Y"
00174     #define KFCURVENODE_TEXTURE_ROTATION_Z      "Z"
00175     #define KFCURVENODE_TEXTURE_SCALING         "Scaling"
00176     #define KFCURVENODE_TEXTURE_SCALING_X       "X"
00177     #define KFCURVENODE_TEXTURE_SCALING_Y       "Y"
00178     #define KFCURVENODE_TEXTURE_SCALING_Z       "Z"
00179     #define KFCURVENODE_TEXTURE_ALPHA           "Alpha"
00180 
00181     // Addition for the material.
00182     #define KFCURVENODE_MATERIAL_EMISSIVE       "Emissive"
00183     #define KFCURVENODE_MATERIAL_EMISSIVE_R     "X"
00184     #define KFCURVENODE_MATERIAL_EMISSIVE_G     "Y"
00185     #define KFCURVENODE_MATERIAL_EMISSIVE_B     "Z"
00186     #define KFCURVENODE_MATERIAL_AMBIENT        "Ambient"
00187     #define KFCURVENODE_MATERIAL_AMBIENT_R      "X"
00188     #define KFCURVENODE_MATERIAL_AMBIENT_G      "Y"
00189     #define KFCURVENODE_MATERIAL_AMBIENT_B      "Z"
00190     #define KFCURVENODE_MATERIAL_DIFFUSE        "Diffuse"
00191     #define KFCURVENODE_MATERIAL_DIFFUSE_R      "X"
00192     #define KFCURVENODE_MATERIAL_DIFFUSE_G      "Y"
00193     #define KFCURVENODE_MATERIAL_DIFFUSE_B      "Z"
00194     #define KFCURVENODE_MATERIAL_SPECULAR       "Specular"
00195     #define KFCURVENODE_MATERIAL_SPECULAR_R     "X"
00196     #define KFCURVENODE_MATERIAL_SPECULAR_G     "Y"
00197     #define KFCURVENODE_MATERIAL_SPECULAR_B     "Z"
00198     #define KFCURVENODE_MATERIAL_OPACITY        "Opacity"
00199     #define KFCURVENODE_MATERIAL_REFLECTIVITY   "Reflectivity"
00200     #define KFCURVENODE_MATERIAL_SHININESS      "Shininess"
00201 
00202     // Addition for the generic vector property.
00203     #define KFCURVENODE_USER_PROPERTY_VECTOR_X  "X"
00204     #define KFCURVENODE_USER_PROPERTY_VECTOR_Y  "Y"
00205     #define KFCURVENODE_USER_PROPERTY_VECTOR_Z  "Z"
00206 
00207     // Addition for the generic color property.
00208     #define KFCURVENODE_USER_PROPERTY_COLOR_R  "X"
00209     #define KFCURVENODE_USER_PROPERTY_COLOR_G  "Y"
00210     #define KFCURVENODE_USER_PROPERTY_COLOR_B  "Z"
00211 
00212 
00213     // Addition of generic matrix
00214     #define KFCURVENODE_USER_PROPERTY_MATRIX "Matrix"
00215     #define KFCURVENODE_USER_PROPERTY_MATRIX_0 "0"
00216     #define KFCURVENODE_USER_PROPERTY_MATRIX_1 "1"
00217     #define KFCURVENODE_USER_PROPERTY_MATRIX_2 "2"
00218     #define KFCURVENODE_USER_PROPERTY_MATRIX_3 "3"
00219     #define KFCURVENODE_USER_PROPERTY_MATRIX_4 "4"
00220     #define KFCURVENODE_USER_PROPERTY_MATRIX_5 "5"
00221     #define KFCURVENODE_USER_PROPERTY_MATRIX_6 "6"
00222     #define KFCURVENODE_USER_PROPERTY_MATRIX_7 "7" 
00223     #define KFCURVENODE_USER_PROPERTY_MATRIX_8 "8"
00224     #define KFCURVENODE_USER_PROPERTY_MATRIX_9 "9"
00225     #define KFCURVENODE_USER_PROPERTY_MATRIX_A "A"
00226     #define KFCURVENODE_USER_PROPERTY_MATRIX_B "B"
00227     #define KFCURVENODE_USER_PROPERTY_MATRIX_C "C"
00228     #define KFCURVENODE_USER_PROPERTY_MATRIX_D "D"
00229     #define KFCURVENODE_USER_PROPERTY_MATRIX_E "E"
00230     #define KFCURVENODE_USER_PROPERTY_MATRIX_F "F"
00231 
00232     // Default array size for 1 minute of animation (30fps) 
00233     #define SELECTION_ARRAY_SIZE    30*60+1
00234     //#define SELECTION_ARRAY_SIZE 1024*1024
00235 
00236     #define KFCURVENODE_CANDIDATE_MAX_COUNT 4
00237 
00238 
00239     typedef int  kFCurveNodeType;
00240 
00241     KFBX_FORWARD (KFCurveNode);
00242     typedef HKFCurveNode HIKFCurveNode;
00243     typedef KFCurveNode IKFCurveNode;
00244 
00245     #define IKFCurveNodeID 43763634
00246 
00247     enum EKFCurveNodeEventType
00248     {
00249         KFCURVENODEEVENT_NONE = 0, 
00250         KFCURVENODEEVENT_SELECTION = 1, 
00251         KFCURVENODEEVENT_DESTROY = 2, 
00252         KFCURVENODEEVENT_FCURVE = 4, 
00253         KFCURVENODEEVENT_TIMEWARP = 8, 
00254         KFCURVENODEEVENT_CTRLCURVE = 16, 
00255         KFCURVENODEEVENT_DATAUPDATED = 32
00256     };
00257 
00258     struct KExternalTimingInformation
00259     {
00260         KTime mLclOffset;
00261         KTime mDuration;
00262     };
00263 
00264 
00265     // Curve node event class.
00266     class KFBX_DLL KFCurveNodeEvent : public KEventBase
00267     {
00268     public:
00269         /* Nature (s) of this node event.
00270         *   It is a bit field.  Value defined in the enum stated before 
00271         *   the class can composited. 
00272         * stored in mType
00273         */
00274         // Event count.
00275         int mEventCount;
00276 
00277         // Data.
00278         void* mData;
00279 
00280         // Clear the curve node event object.
00281         inline void Clear () 
00282         {
00283             mType=KFCURVENODEEVENT_NONE; 
00284             mEventCount = 0; 
00285             mData = NULL; 
00286         }
00287 
00288         /* Add an event of type pWhat.
00289         *   \param pWhat    Use EKFCurveNodeEventType to identify what pWhat means.
00290         */
00291         inline void Add (int pWhat) 
00292         {
00293             mType |= pWhat;
00294             mEventCount++;
00295         }
00296 
00297         // Set the data contained by the node event.
00298         inline void SetData (void* pData) {mData = pData;}
00299     };
00300 
00301 
00302     struct KFCurveNodeCallback 
00303     {
00304         KFCurveNodeEvent mEvent;
00305         KArrayUL mCallbackFunctions;   // no delete on object must use array ul
00306         KArrayUL mCallbackObjects;     // no delete on object must use array ul
00307         bool mCallbackEnable;
00308     };
00309 
00310     typedef void (*kFCurveNodeCallback) (KFCurveNode* pFCurve, KFCurveNodeEvent* FCurveNodeEvent, void* pObject) ;
00311 
00312     typedef class KArrayTemplate< HKFCurveNode > KArrayTemplateFCurveNode;  
00313 
00314     // Return codes for function KFCurveNode::IsKey().
00315     enum 
00316     { 
00317         ISKEY_NONE,
00318         ISKEY_SOME, 
00319         ISKEY_ALL 
00320     };
00321 
00322 
00323     class KFBX_DLL KFCurveNodeCandidateState
00324     {
00325     public:
00326         KFCurveNodeCandidateState();
00327         ~KFCurveNodeCandidateState();
00328 
00329         void Dump(int pLevel = 0);
00330 
00331         void SetCandidateTotalTime      ( KTime &pCandidateTime ) { mCandidateTotalTime = pCandidateTime; };
00332         void SetCandidateSpecificTime   ( KTime &pCandidateTime ) { mCandidateSpecificTime = pCandidateTime; };
00333 
00334     protected:
00335         friend class KFCurveNode;
00336         
00337         int mSpecificCandidateMethod;
00338         int mTotalCandidateMethod;
00339 
00340         double mCandidateTotalValue[KFCURVENODE_CANDIDATE_MAX_COUNT];
00341         KTime   mCandidateTotalTime;
00342 
00343         double mCandidateSpecificValue;
00344         double mFCurveValue;
00345         KTime mCandidateSpecificTime;
00346 
00347         KFCurveNodeCandidateState *mSubStates[KFCURVENODE_CANDIDATE_MAX_COUNT];
00348         KFCurveNodeCandidateState *mLayerState;
00349         int                        mLayerID;
00350 
00351     };
00352 
00353 
00366     #ifdef KFBX_PLUGIN
00367         class KFBX_DLL KFCurveNode
00368     #else 
00369         class KFBX_DLL KFCurveNode : public IFBObjectHolder
00370     #endif
00371     {
00372 
00373     public:
00374 
00379 
00388         KFCurveNode 
00389         (
00390             char* pNodeName, 
00391             char* pTimeWarpName, 
00392             HKDataType pDataType, 
00393             int  pLayerType = KFCL_NOLAYER,
00394             int  pLayerID = 0
00395         ) ;
00396 
00404         KFCurveNode(HKFCurveNode pTemplateCurveNode);
00405 
00407         virtual ~KFCurveNode () ;
00408 
00409         #ifndef DOXYGEN_SHOULD_SKIP_THIS
00410         #ifdef KFBX_PLUGIN
00411             void Destroy (int Local=0) ;
00412         #else
00413             KFBX_IObject_Declare (KFBX_Implementation) 
00414         #endif
00415         #endif
00416 
00418 
00423 
00427         void CreateFCurve( );
00428 
00433         bool FCurveCreated( );
00434 
00436 
00441 
00452         HKFCurveNode Clone(bool pKeepAttached);
00453 
00467         HKFCurveNode CloneTemplate(bool pKeepAttached=false, bool pCloneFCurves=false, bool pCreateCurves=false, int pLayerID = -1);
00468 
00476         void CopyFrom(HKFCurveNode pSource, bool pTransferCurve = false);
00477 
00486         HKFCurveNode Copy(KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE);
00487 
00489 
00494 
00496         char* GetName () ;
00497 
00499         char* GetTimeWarpName() ;
00500 
00502         char* GetTypeName() ;
00503 
00505 
00510 
00514         HKFCurve FCurveGet();
00515 
00524         KFCurve* FCurveSet (KFCurve* pCurve, bool pDestroyOldCurve = false) ;
00525 
00532         void FCurveReplace (KFCurve* pCurve) ;
00533 
00542         bool GetTransformCurves (KFCurve* pT[3], KFCurve* pR[3], KFCurve* pS[3]) ;
00543 
00545 
00550 
00554         virtual void Clear () ;
00555 
00560         virtual int Add(HKFCurveNode pCurveNode);
00561         
00565         virtual void Remove (int pIndex) ;
00566         
00570         virtual void Delete (int pIndex) ;
00571         
00573         virtual int GetCount () ;
00574         
00579         virtual HKFCurveNode Get(int pIndex) ;
00580         
00587         virtual bool IsChild(KFCurveNode* pCurveNode, bool pRecursive = false) ;
00588 
00594         virtual int Find (char* pName) ;
00595 
00601         virtual int Find(HKFCurveNode pNode);
00602 
00607         HKFCurveNode FindRecursive(char* pName);
00608 
00615         HKFCurveNode FindOrCreate(char* pName, bool pFindOrCreateCurve = true) ;
00616         
00620         virtual void SetParent(HKFCurveNode pParent) {mParent = pParent;}
00621         
00625         virtual HKFCurveNode GetParent() {return mParent;}
00626 
00628 
00633 
00639         int KeyGetCount(bool pRecursiveInLayers = false);
00640 
00647         void KeyGetCount(int& pCurveCount, int& pTotalCount, int& pMinCount, int& pMaxCount);
00648 
00656         void GetCurveWithFirstKey(KFCurve*& lCurveWithFirstKey, bool *pCurveMask /* = NULL */, bool pRecursiveInLayers);
00657 
00664         void GetCurveWithLastKey(KFCurve*& lCurveWithLastKey, bool *pCurveMask /* = NULL */, bool pRecursiveInLayers);
00665 
00672         KTime GetFirstKeyTime(bool *pCurveMask = NULL, bool pRecursiveInLayers = false);
00673 
00680         KTime GetLastKeyTime(bool *pCurveMask = NULL, bool pRecursiveInLayers = false);
00681 
00692         double* KeyAdd (KTime pTime, double* pValue) ;
00693 
00707         double* KeyAppend (KTime pTime, double* pValue, bool pCheckForContinuousRotation = false) ;
00708 
00719         bool GetAnimationInterval (KTime& pStart, KTime& pStop) ;
00720 
00725         void GetTimeSpan          (KTime& pStart, KTime& pStop) ;   
00726 
00742         int IsKey (KTime& pTime, int *pLast, bool* pCurveMask = NULL, double pKeyIndexTolerance = 0.0, double pMin = -K_DOUBLE_MAX,  double pMax = K_DOUBLE_MAX );
00743 
00753         bool DeleteKey (KTime& pTime, bool* pCurveMask = NULL, double pKeyIndexTolerance = 0.0 );
00754 
00765         KTime GetNextKeyTime (KTime pTime, bool* pCurveMask = NULL, bool pRecursiveInLayers = false);
00766 
00776         KTime GetPrevKeyTime (KTime pTime, bool* pCurveMask = NULL );
00777 
00792         double* Evaluate (double* pValue, KTime pTime, kFCurveIndex* pLast=NULL) ;
00793         
00804         double* GetValue (double* pValue) ;
00805         
00815         double* SetValue (double* pValue) ;
00816 
00823         void Delete(KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE);
00824 
00837     void Replace(HKFCurveNode pSource, KTime pStart = KTIME_MINUS_INFINITE, KTime pStop = KTIME_INFINITE, bool pUseGivenSpan = false, bool pKeyStartEndOnNoKey = true, KTime pTimeSpanOffset = KTIME_ZERO );
00838 
00840 
00842     //
00843     //  WARNING!
00844     //
00845     //  Anything beyond these lines may not be documented accurately and is 
00846     //  subject to change without notice.
00847     //
00849 
00850     #ifndef DOXYGEN_SHOULD_SKIP_THIS
00851 
00856 
00858         float* GetColor();
00859 
00861         void SetColor (float pColor[3]) ;
00862 
00864 
00869 
00871         inline int IncReferenceCount () {return ++mReferenceCount;}
00872 
00874         inline int DecReferenceCount () {mReferenceCount--; return mReferenceCount;}
00875 
00877         inline int GetReferenceCount () {return mReferenceCount;}
00878 
00880 
00885 
00887         int GetTakeType () ;
00888 
00890         void SetTakeType (int pType) ;
00891 
00893 
00898 
00900         bool GetVisibility () ;
00901 
00903         void SetVisibility (bool pVisible, bool pRecursive=false, bool pRecurseLayer = false, int lChildIndex = -1) ;
00904 
00906 
00911 
00916         void DataNodeSet (HKFCurveNode pDataNode, bool pRecursive=true) ;
00917 
00921         HKFCurveNode DataNodeGet () ;
00922 
00926         bool SetPreExtrapolation(kUInt pNewPreExtrapolation, bool pRespectUserLock=true );
00927         bool SetPreExtrapolationCount(kUInt pNewPreExtrapolationCount, bool pRespectUserLock=true);
00928         bool SetPostExtrapolation(kUInt pNewPreExtrapolation, bool pRespectUserLock=true);
00929         bool SetPostExtrapolationCount(kUInt pNewPreExtrapolationCount, bool pRespectUserLock=true);
00930 
00932 
00937 
00939         int GetContainerType () ;
00940 
00942         void SetContainerType (int pInOutType) ;
00943 
00945 
00950 
00952         int GetIOType () ;
00953 
00955         void SetIOType (int pInOutType) ;
00956 
00958 
00963 
00965         int IsExpended () ;
00966 
00968         void SetExpended (bool pExpended) ;
00969 
00971 
00976 
00978         int IsMultiLayer() ;
00979 
00981         void SetMultiLayer (bool pMultiLayer) ;
00982 
00984         HKFCurveNode GetLayerNode(int pLayerID);
00985 
00987     #ifndef KFBX_PLUGIN
00988         void ExtractKeysIndex( KArraykInt &pArray, KTimeSpan pTimeSpan, double pMinValue =  -K_DOUBLE_MAX, double pMaxValue =  K_DOUBLE_MAX);
00989     #endif
00990 
00992 
00997 
01001         bool LookLikeSampledData(KTime pThresholdPeriod);
01002 
01004 
01009 
01011         int GetUpdateId () ;
01012 
01014         int GetValuesUpdateId ();
01015 
01017         int GetNodeUpdateId () ;
01018 
01019 
01021 
01026         
01028         bool CallbackEnable (bool pEnable) ;
01029         
01031         bool CallbackIsEnable () ;
01032         
01034         void CallbackClear () ;
01035         
01037         void CallbackAddEvent (int pWhat) ;
01038         
01040         void CallbackRegister (kFCurveNodeCallback, void* pObject) ;
01041         
01043         void CallbackUnregister (kFCurveNodeCallback, void* pObject) ;
01044 
01046 
01047     #ifndef KFBX_PLUGIN
01048 
01052 
01054         void SetETI(IKFCurveETI * pFCurveETI);
01055         IKFCurveETI * GetETI() const;
01056 
01058         KTime ETINodeTime2GlobalTime(KTime const & pTime);
01059         KTime ETIGlobalTime2NodeTime(KTime const & pTime);
01060         KTime ETIGetDuration();
01061         KTime ETIGetTrimOffset();
01062         KTime ETIGetGlobalOffset();
01063         double ETIGetScaleFactor();
01064         bool ETIGetColor(KgeRGBVector & pColor);
01065         bool ETIIsGlobalTimeInSpan(KTime const & pTime, bool pIncludeStop = true);
01066         typedef KTime (IKFCurveETI::*TETITimeFetcher)();
01067         KTime ETIGetSpecifiedTime(TETITimeFetcher pFunc);
01068         bool ETIIsSelectedDuration();
01069     #endif
01070 
01072 
01073         bool    FbxStore (KFbx* pFbx, bool pOnlyDefaults = false, bool pReplaceLclTRSName = false, bool pSkipTimeWarpName = false, char* pFieldName = "Channel", bool pColor = true, bool pIsVersion5 = false ) ;
01074         bool    FbxRetrieve (KFbx* pFbx, bool pOnlyDefaults = false, bool pCreateIfNotFound = true,bool pColor = false);
01075         bool    FbxInternalRetrieve (KFbx* pFbx, bool pOnlyDefaults = false, bool pCreateIfNotFound = true,bool pColor = false) ;
01076         bool    FbxTimeWarpNameRetrieve(KFbx* pFbx);
01077         bool    FbxLayerAndTimeWarpRetrieve(KFbx* pFbx, bool pOnlyDefaults = false, bool pCreateIfNotFound = true,bool pColor = false) ;
01078 
01080 
01084         bool mUseQuaternion;
01085         inline bool GetUseQuaternion(){return mUseQuaternion;}; 
01086         void SetUseQuaternion(bool pVal); 
01087         private:
01088             void RotationNodeEvaluate(double* pValue, KTime pTime, kFCurveIndex* pLast,bool pEvaluateCandidate  );
01089 
01091 
01092     public:
01094 
01098         void GetCandidateState(KFCurveNodeCandidateState& pState);
01099         void SetCandidateState(const KFCurveNodeCandidateState& pState, bool pDestroyMissingLayers = false );
01100 
01101         int     GetCandidateSpecificMethod();
01102         int     GetCandidateTotalMethod();
01103         KTime   GetCandidateTotalTime();
01104         double* GetCandidateTotalValue();
01105         int     GetCandidateTotalValueSize();
01106 
01107         void    SetCandidateSpecificMethod(int pMethod);
01108         void    SetCandidateTotalMethod(int pMethod);
01109         void    SetCandidateTotalTime(KTime pTime);
01110         void    SetCandidateTotalValue(double* pValue);
01111 
01113 
01114     void GetQuaternionInterpolationBezierPoints(KTime pCurrentTime, KgeQuaternion &pQ0, KgeQuaternion &lQ1, KgeQuaternion &lQ2, KgeQuaternion &lQ3);
01115 
01116     protected:
01117         struct NameInfo 
01118         {
01119             KString     mName;
01120             KString     mTimeWarpName;
01121             HKDataType  mDataType;
01122             int     mRefCount;
01123         }*mNameInfo;
01124 
01125         void    SetNameInfo( NameInfo* pNameInfo );
01126 
01127         int mType;
01128 
01129         int mReferenceCount;
01130         KArrayTemplate<HKFCurveNode> mNodes;
01131 
01132         HIKFCurve    mFCurve;
01133         HKFCurveNode mTimeWarp;
01134         HKFCurveNode mLayer;        // Ctrl Curve (Animation layering) 
01135         HKFCurveNode mObjectLayer;  // Pointer to Layer 0
01136         HKFCurveNode mTemplate;
01137         HKFCurveNode mDataNode;
01138         HKFCurveNode mParent;
01139 
01140         int mLayerType;
01141         int mLayerID;
01142 
01143         int mUpdateId;
01144 
01145         public:
01146         int mMBRotationOrder;
01147         inline int GetRotationOrder(){return mMBRotationOrder;}; 
01148         void SetRotationOrder(int pRotationOrder);
01149 
01151         int GetLayerType() { return mLayerType; }
01152 
01153         protected:
01154         //
01155         //  Candidates in nodes (Max is KFCURVENODE_CANDIDATE_MAX_COUNT)
01156         //
01157         
01158         void FromTotalCandidateToSpecificCandidate(int pLayerID);
01159 
01160         enum {eUseFCurve = 1, eUseTotal = 2};
01161         int mSpecificCandidateMethod;  // Used as a bit field
01162         int mTotalCandidateMethod;     // Used as an enum
01163                                         // To my knowledge the possible state are       
01164                                         // No validcandidate                            mCandidateTotalTime == INFINITE and no FCurve candidate for the current time
01165                                         // Total candidate is valid and fcuve invalid   mTotalCandidateMethod ==  eUseTotal and mSpecificCandidateMethod == eUseTotal
01166                                         // FCurve is valid and Total invalid            mTotalCandidateMethod ==  eUseFCurve and mSpecificCandidateMethod == eUseFCurve
01167                                         // Total valid and FCurve computed              mTotalCandidateMethod ==  eUseTotal and mSpecificCandidateMethod == eUseTotal | eUseFCurve
01168 
01169                                         // FCurve valid and total computed              mTotalCandidateMethod ==  eUseTotal and mSpecificCandidateMethod == eUseFCurve
01170                                         // FCurve valid (and computed from total) and total computed    mTotalCandidateMethod ==  eUseTotal and mSpecificCandidateMethod == eUseTotal | eUseFCurve
01171                         
01172                     
01173                                         
01174 
01175         double mCandidateTotalValue[KFCURVENODE_CANDIDATE_MAX_COUNT];   // For all layers at once (only meaningful on ObjectLayer )
01176         KTime   mCandidateTotalTime;
01177 
01178         //
01179         //  Callbacks
01180         //
01181         
01182         KFCurveNodeCallback* mCallback;
01183         int mUserLock;
01184 
01185 
01186     #ifndef KFBX_PLUGIN
01187         //
01188         //  External Timing Information (for transportation only: optional, not used internally, and not persisted).
01189         //
01190         IKFCurveETI * mETI;
01191     #endif
01192 
01193     private:
01194         void KeyGetCountRecursive(int& pCurveCount, int& pTotalCount, int& pMinCount, int& pMaxCount);
01195         bool GetAnimationIntervalRecursive (KTime& pStart, KTime& pStop) ;
01196         void IsKeyRecursive( KTime& pTime, int &pKeyCount, int &pKeyFound, int *pLast, bool *pCurveMask, double pKeyIndexTolerance = 0.0, double pMin = -K_DOUBLE_MAX,  double pMax = K_DOUBLE_MAX );
01197 
01198         friend KFBX_DLL HKFCurveNode KFCurveNodeCreate (KFbx* pFbx, HKFCurveNode pParent, bool pOnlyDefaults, bool pCreateIfNotFound, bool pColor );
01199 
01200     public:
01201         //
01202         // TimeWarp
01203         //
01204 
01206         void TimeWarpSet (HKFCurveNode pLayer);
01207 
01211         HKFCurveNode TimeWarpGet ();
01212 
01213         //
01214         // Layers
01215         //
01216 
01218         void LayerSet(HKFCurveNode pLayer, bool pDeleteCurrentAndSubLayers ); // No default value to make sure you know what you are doing
01219 
01223         HKFCurveNode LayerGet ();
01224 
01228         HKFCurveNode LayerGet( int pLayerID );
01229 
01231         void CreateLayerAt( int pLayerID );
01232     private:
01234         HKFCurveNode LayerCreate ( int pLayerID, bool pDeleteCurrentLayer );    // No default value to make sure you know what you are doing
01235     public:
01237         virtual HKFCurveNode Find(HKDataType pDataType);
01238         
01243         HKFCurveNode FindRecursive(HKDataType pDataType);
01244 
01246         HKDataType GetDataType();
01247             
01251         void Delete(HKFCurveNode pNode);
01252 
01254         HKFCurveNode ObjectLayerGet();
01255 
01257         void ObjectLayerSet( HKFCurveNode pNode );
01258 
01260         inline int GetLayerID() { return mLayerID; };
01261 
01263         inline void SetLayerID( int pLayerID ) { mLayerID = pLayerID; };
01264 
01266         void SetLayerType( int pLayerType, HKFCurveNode pObjectLayerNode = NULL );
01267 
01269         HKFCurveNode GetPreviousLayer( int pLayerID );
01270 
01272         HKFCurveNode RemoveLayer( int pLayerID, bool pDestroy = true );
01273 
01274         // Copy a specific anyer or create one if none exist 
01275         HKFCurveNode InsertOrCopyLayer( int pLayerId, HKFCurveNode pLayerNode );
01276 
01277         void SingleLayerCopyFrom(HKFCurveNode pSource, bool pTransferCurve = false );
01278 
01279         HKFCurveNode SingleLayerCopy(KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE ); 
01280 
01281         //
01282         // Templates
01283         //
01284 
01286         void TemplateSet (HKFCurveNode pTemplate);
01287 
01291         HKFCurveNode TemplateGet ();
01292 
01293         //
01294         // Copy/paste
01295         //
01296 
01298         void LayerCopyFromRecursive( HKFCurveNode pSource, bool pTransferCurve = false );
01299 
01300         //
01301         //  Candidates
01302         //
01303 
01305         bool    CandidateClear ( int pLayerID = 0, bool pClearAllSubLayersToo = true );
01306 
01308         void    CandidateClearSubLayers ();
01309         
01311         double* CandidateSet (KTime pTime, double* pValue, int pLayerID = 0, int pChildIndexInParent = -1 );
01312 
01314         double *CandidateSetSpecificLayer (KTime pTime,double *pValue, int pLayerID = 0 );
01315 
01317         double* CandidateGet (double* pValue, int pLayerID = 0 );
01318         
01320         double* CandidateGetSpecificLayer( double* pValue, KTime &pCandidateTime, int pLayerID = 0 );
01321         
01323         void CandidateGetTotalCandidate( double* pValue, KTime &pCandidateTime );
01324         
01326         bool IsCandidate              ();
01327         
01329         bool    CandidateKey 
01330         (
01331             kFCurveIndex*   pLast           = NULL, 
01332             int             pLayerID        = 0, 
01333             bool*           pCurveMask      = NULL, 
01334             bool            pZeroKey        = false , 
01335             int         pInterpolation  = KFCURVE_INTERPOLATION_CUBIC, 
01336             int         pTangeantMode   = KFCURVE_TANGEANT_USER, 
01337             int         pContinuity     = KFCURVE_CONTINUITY,
01338             bool            pTanOverride    = true,
01339             KTime           pCandidateTime  = KTIME_INFINITE,
01340             double          pKeyIndexTolerance = 0.0
01341         );
01342 
01344         bool    CandidateKeySpecificLayer 
01345         (
01346             kFCurveIndex*   pLast           = NULL, 
01347             int             pLayerID        = 0, 
01348             bool*           pCurveMask      = NULL,
01349             int         pInterpolation  = KFCURVE_INTERPOLATION_CUBIC, 
01350             int         pTangeantMode   = KFCURVE_TANGEANT_USER, 
01351             int         pContinuity     = KFCURVE_CONTINUITY,
01352             bool            pTanOverride    = true,
01353             KTime           pCandidateTime  = KTIME_INFINITE,
01354             double          pKeyIndexTolerance = 0.0
01355         );
01356 
01357         // !    If CurveNode is MonoLayer it will return 0
01358         int         GetCorrectLayerID( int pLayerID );
01359         HKFCurveNode    GetCorrectLayer  ( int pLayerID, bool pCreateLayerIfNesseary = false );
01360 
01362         void    ComputeCandidateForLayer( double *pDestLayerValue, double *pCandidateValue, KTime pTime, int pLayerID, kFCurveIndex *pLast );
01363 
01365         void    EvaluateCurvesExceptLayerRecursiveAdd ( double *pValue, KTime pTime, int pExceptLayerID, kFCurveIndex* pLast=NULL);
01366         
01368         void    EvaluateCurvesExceptLayerRecursiveMult ( double *pValue, KTime pTime, int pExceptLayerID, kFCurveIndex* pLast=NULL);
01369 
01371         void    EvaluateCurvesBeforeLayerRecursiveEulerXYZ ( KgeRMatrix &pBefore, KTime lCandidateTime, int pLayerID, kFCurveIndex* pLast );
01372 
01374         void    EvaluateCurvesAfterLayerRecursiveEulerXYZ  ( KgeRMatrix &pAfter, KTime lCandidateTime, int pAfterLayerID, kFCurveIndex* pLast );
01375 
01377         void    EvaluateCurvesBeforeLayerRecursiveQuat( KgeQuaternion &pBefore, KTime pTime, int pBeforeLayerID, kFCurveIndex* pLast );
01378 
01380         void    EvaluateCurvesAfterLayerRecursiveQuat ( KgeQuaternion &pAfter , KTime pTime, int pBeforeLayerID, kFCurveIndex* pLast );
01381 
01383         double* CandidateGetWithTime ( double *pValue, KTime &pCandidateTime );
01384 
01385 
01386         //
01387         // Helpers
01388         //
01389 
01391         double* EvaluateSpecificLayer( double *pValue, KTime pTime, int pLayerID, kFCurveIndex* pLast=NULL);
01392 
01394         double *CandidateEvaluateSpecificLayer( double *pValue, KTime pTime, int pLayerID, kFCurveIndex *pLast=NULL);
01395 
01397         double* GeneralEvaluate (double* pValue, KTime pTime, kFCurveIndex* pLast=NULL,bool pEvaluateCandidate=true);
01398 
01400         double* CandidateEvaluate (double* pValue, KTime pTime, kFCurveIndex* pLast=NULL);
01401 
01403         bool IsEditable ();
01404 
01406         void GetZeroValues( double *pValues );
01407 
01408         // ! Content replacement for quaternions ( = with scaling of the quaternion )
01409         void ReplaceForQuaternion( HKFCurveNode pSource, KTime pStart, KTime pStop, double pScaleStart, double pScaleStop, bool pUseExactGivenSpan /*= false*/, bool pKeyStartEndOnNoKey /*= true*/, KTime pTimeSpanOffset /*= KTIME_ZERO*/ );
01410 
01411         // ! Calculates the offset between to euler rotations
01412         bool GetContinuousOffset( double pOffset[3], double pNew[3], double pOld[3] );
01413 
01414         // ! Unrolls a rotation at a given time, using the previous key.
01415         void GetContinuousRotation( double pResultKeyValue[3], double pCurrentKeyValue[3], KTime pCurrentKeyTime );
01416 
01417         // ! Sets the user name
01418         void SetTimeWarpName( char* pName );
01419 
01420         // ! Returns the total key count for all child (pChildIndex) in every layer.
01421         int KeyGetCountOnChild( int pChildIndex );
01422 
01423         //
01424         //  User lock
01425         //
01426 
01428         void    UserLockAdd();
01429 
01431         void    UserLockRemove();
01432 
01434         bool    IsUserLocked();
01435 
01436     #ifndef KFBX_PLUGIN
01437         //
01438         // FBObjectHolder for FBSDK reference
01439         //
01440 
01442         KFBObjectHolder mFBObjectHolder;
01443 
01445         KFBObjectHolder &GetFBHolder () {return mFBObjectHolder;}
01446     #endif
01447 
01448     public:
01453         virtual int SortedAdd (HKFCurveNode pNode) ;
01454 
01456     public:
01457 
01458         // For Backward compatibility reasons must be revisited please ...
01459         HIConnector mConnector; // Do not set this member because if the Connector is set, it means that it is a Connector FCurveNode. So watchout!!!
01460 
01461 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01462 
01463     };
01464 
01465 
01475     KFBX_DLL HKFCurveNode KFCurveNodeCreate(char* pNodeName, char* pTimeWarpName, char* pTypeName, int pLayerType = KFCL_NOLAYER, int pLayerID = 0);
01476     KFBX_DLL HKFCurveNode KFCurveNodeCreate(char* pNodeName, HKDataType pDataType=NULL, int pLayerType = KFCL_NOLAYER, int pLayerID = 0);
01477 
01478 
01486     KFBX_DLL HKFCurveNode KFCurveNodeCreate(HKFCurveNode pTemplateCurveNode);
01487 
01488     // Create a curve node, FBX SDK internal use only.
01489     KFBX_DLL HKFCurveNode KFCurveNodeCreate(KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = false);
01490 
01491     // Create a curve node, FBX SDK internal use only.
01492     KFBX_DLL HKFCurveNode KFCurveNodeCreate(KFbx* pFbx, HKFCurveNode pParent, bool pOnlyDefaults = false, bool pCreateIfNotFound = true, bool pColor = false);
01493 
01494     // Create a layer node, FBX SDK internal use only.
01495     KFBX_DLL HKFCurveNode KFCurveNodeLayerCreate (KFbx* pFbx,HKFCurveNode pParent, bool pOnlyDefaults = false );
01496 
01497     // Create a curve node from a datatype, FBX SDK internal use only.
01498     KFBX_DLL HKFCurveNode FCurveNodeCreateFromDataType( HKDataType pDataType,char* pNodeName);
01499 
01500 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01501 
01502 #endif // FBXFILESDK_COMPONENTS_KFCURVE_KFCURVENODE_H
01503