kfcurvenode.h

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 (C) 2001 - 2009 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 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
00043 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00044 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00045 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00046 
00047 #include <fbxfilesdk/components/kfcurve/kfcurve.h>
00048 
00049 KFBX_FORWARD (IConnector) 
00050 KFBX_FORWARD (IData) 
00051 
00052 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00053 
00054     enum 
00055     {   
00056         KFCN_IN = 0, 
00057         KFCN_OUT = 1, 
00058         KFCN_INOUT_MASK = 1, 
00059 
00060         KFCN_HIDDEN = 0, 
00061         KFCN_SHOWN = 2, 
00062 
00063         KFCN_CONTAINER_NODE = 0, 
00064         KFCN_REFERENCER_NODE = 8, 
00065         KFCN_REFERENCER_MASK = 8, 
00066 
00067         KFCN_TAKE_NODE = 16, 
00068         KFCN_FIXED_NODE = 0, 
00069         KFCN_TAKE_MASK = 16,
00070 
00071         KFCN_EXPENDED_NODE = 32, 
00072         KFCN_NOTEXPENDED_NODE = 0, 
00073         KFCN_EXPENDED_MASK = 32,
00074 
00075         KFCN_MULTILAYER = 64,
00076         KFCN_MONOLAYER  = 0,
00077         KFCN_MULTILAYER_MASK = 64,
00078 
00079         KFCN_ALWAYS_CANDIDATE = 128,
00080         KFCN_ALWAYS_CANDIDATE_TESTED = 256
00081     };
00082 
00083     //
00084     // Picking Types define
00085     //
00086     enum 
00087     {
00088         KCP_KEY = 1, 
00089         KCP_LTANGENT, 
00090         KCP_RTANGENT
00091     };
00092 
00093     //
00094     //  Node/Layer info
00095     //
00096     enum
00097     {
00098         KFCL_NOLAYER,
00099         KFCL_ADD,       // For translation and standard others
00100         KFCL_EULER_XYZ, // For rotation
00101         KFCL_MULT,      // For scaling, mainly
00102         KFCL_QUAT       // For quaternion rotation
00103     };
00104 
00105     #define KFCURVENODE_TRANSFORM               "Transform"
00106         #define KFCURVENODE_T                       "T"
00107             #define KFCURVENODE_T_X                     "X"
00108             #define KFCURVENODE_T_Y                     "Y"
00109             #define KFCURVENODE_T_Z                     "Z"
00110         #define KFCURVENODE_R                       "R"
00111             #define KFCURVENODE_R_X                     "X"
00112             #define KFCURVENODE_R_Y                     "Y"
00113             #define KFCURVENODE_R_Z                     "Z"
00114             #define KFCURVENODE_R_W                     "W"
00115         #define KFCURVENODE_S                       "S"
00116             #define KFCURVENODE_S_X                     "X"
00117             #define KFCURVENODE_S_Y                     "Y"
00118             #define KFCURVENODE_S_Z                     "Z"
00119     #define KFCURVENODE_LCL_T                   "Lcl Translation"
00120     #define KFCURVENODE_LCL_R                   "Lcl Rotation"
00121     #define KFCURVENODE_LCL_S                   "Lcl Scaling"
00122     #define KFCURVENODE_VISIBILITY              "Visibility"
00123 
00124     // Addition for the optical marker node attribute.
00125     #define KFCURVENODE_OCCLUSION               "Occlusion"
00126 
00127     // Addition for the IK effector marker node attribute.
00128     #define KFCURVENODE_IK_REACH_TRANSLATION    "IK Reach Translation"
00129     #define KFCURVENODE_IK_REACH_ROTATION       "IK Reach Rotation"
00130 
00131     // Addition for the light node attribute.
00132     #define KFCURVENODE_LIGHT_CONEANGLE         "Cone angle"
00133     #define KFCURVENODE_LIGHT_FOG               "Fog"
00134     #define KFCURVENODE_LIGHT_INTENSITY         "Intensity"
00135     #define KFCURVENODE_COLOR                   "Color"
00136     #define KFCURVENODE_COLOR_RED                   "X"
00137     #define KFCURVENODE_COLOR_GREEN                 "Y"
00138     #define KFCURVENODE_COLOR_BLUE                  "Z"
00139 
00140     // Addition for the camera node attribute.
00141     #define KFCURVENODE_CAMERA_FIELDOFVIEW      "FieldOfView"
00142     #define KFCURVENODE_CAMERA_FIELDOFVIEWX     "FieldOfViewX"
00143     #define KFCURVENODE_CAMERA_FIELDOFVIEWY     "FieldOfViewY"
00144     #define KFCURVENODE_CAMERA_FOCALLENGTH      "FocalLength"
00145     #define KFCURVENODE_CAMERA_OPTICALCENTERX   "OpticalCenterX"
00146     #define KFCURVENODE_CAMERA_OPTICALCENTERY   "OpticalCenterY"
00147     #define KFCURVENODE_CAMERA_ROLL             "Roll"
00148     #define KFCURVENODE_CAMERA_TURNTABLE        "TurnTable"
00149     #define KFCURVENODE_BACKGROUND_COLOR        "BackgroundColor"
00150     #define KFCURVENODE_BACKGROUND_COLOR_RED        "X"
00151     #define KFCURVENODE_BACKGROUND_COLOR_GREEN      "Y"
00152     #define KFCURVENODE_BACKGROUND_COLOR_BLUE       "Z"
00153 
00154     // Addition for the camera switcher node attribute.
00155     #define KFCURVENODE_CAMERA_INDEX            "Camera Index"
00156 
00157     // Addition for the texture.
00158     #define KFCURVENODE_TEXTURE_TRANSLATION     "Translation"
00159     #define KFCURVENODE_TEXTURE_TRANSLATION_X   "X"
00160     #define KFCURVENODE_TEXTURE_TRANSLATION_Y   "Y"
00161     #define KFCURVENODE_TEXTURE_TRANSLATION_Z   "Z"
00162     #define KFCURVENODE_TEXTURE_ROTATION        "Rotation"
00163     #define KFCURVENODE_TEXTURE_ROTATION_X      "X"
00164     #define KFCURVENODE_TEXTURE_ROTATION_Y      "Y"
00165     #define KFCURVENODE_TEXTURE_ROTATION_Z      "Z"
00166     #define KFCURVENODE_TEXTURE_SCALING         "Scaling"
00167     #define KFCURVENODE_TEXTURE_SCALING_X       "X"
00168     #define KFCURVENODE_TEXTURE_SCALING_Y       "Y"
00169     #define KFCURVENODE_TEXTURE_SCALING_Z       "Z"
00170     #define KFCURVENODE_TEXTURE_ALPHA           "Alpha"
00171 
00172     // Addition for the material.
00173     #define KFCURVENODE_MATERIAL_EMISSIVE       "Emissive"
00174     #define KFCURVENODE_MATERIAL_EMISSIVE_R     "X"
00175     #define KFCURVENODE_MATERIAL_EMISSIVE_G     "Y"
00176     #define KFCURVENODE_MATERIAL_EMISSIVE_B     "Z"
00177     #define KFCURVENODE_MATERIAL_AMBIENT        "Ambient"
00178     #define KFCURVENODE_MATERIAL_AMBIENT_R      "X"
00179     #define KFCURVENODE_MATERIAL_AMBIENT_G      "Y"
00180     #define KFCURVENODE_MATERIAL_AMBIENT_B      "Z"
00181     #define KFCURVENODE_MATERIAL_DIFFUSE        "Diffuse"
00182     #define KFCURVENODE_MATERIAL_DIFFUSE_R      "X"
00183     #define KFCURVENODE_MATERIAL_DIFFUSE_G      "Y"
00184     #define KFCURVENODE_MATERIAL_DIFFUSE_B      "Z"
00185     #define KFCURVENODE_MATERIAL_SPECULAR       "Specular"
00186     #define KFCURVENODE_MATERIAL_SPECULAR_R     "X"
00187     #define KFCURVENODE_MATERIAL_SPECULAR_G     "Y"
00188     #define KFCURVENODE_MATERIAL_SPECULAR_B     "Z"
00189     #define KFCURVENODE_MATERIAL_OPACITY        "Opacity"
00190     #define KFCURVENODE_MATERIAL_REFLECTIVITY   "Reflectivity"
00191     #define KFCURVENODE_MATERIAL_SHININESS      "Shininess"
00192 
00193     // Addition for the generic vector property.
00194     #define KFCURVENODE_USER_PROPERTY_VECTOR_X  "X"
00195     #define KFCURVENODE_USER_PROPERTY_VECTOR_Y  "Y"
00196     #define KFCURVENODE_USER_PROPERTY_VECTOR_Z  "Z"
00197     #define KFCURVENODE_USER_PROPERTY_VECTOR_W  "W"
00198 
00199     // Addition for the generic color property.
00200     #define KFCURVENODE_USER_PROPERTY_COLOR_R  "X"
00201     #define KFCURVENODE_USER_PROPERTY_COLOR_G  "Y"
00202     #define KFCURVENODE_USER_PROPERTY_COLOR_B  "Z"
00203     #define KFCURVENODE_USER_PROPERTY_COLOR_A  "W"
00204 
00205     // Addition of generic matrix
00206     #define KFCURVENODE_USER_PROPERTY_MATRIX "Matrix"
00207     #define KFCURVENODE_USER_PROPERTY_MATRIX_0 "0"
00208     #define KFCURVENODE_USER_PROPERTY_MATRIX_1 "1"
00209     #define KFCURVENODE_USER_PROPERTY_MATRIX_2 "2"
00210     #define KFCURVENODE_USER_PROPERTY_MATRIX_3 "3"
00211     #define KFCURVENODE_USER_PROPERTY_MATRIX_4 "4"
00212     #define KFCURVENODE_USER_PROPERTY_MATRIX_5 "5"
00213     #define KFCURVENODE_USER_PROPERTY_MATRIX_6 "6"
00214     #define KFCURVENODE_USER_PROPERTY_MATRIX_7 "7" 
00215     #define KFCURVENODE_USER_PROPERTY_MATRIX_8 "8"
00216     #define KFCURVENODE_USER_PROPERTY_MATRIX_9 "9"
00217     #define KFCURVENODE_USER_PROPERTY_MATRIX_A "A"
00218     #define KFCURVENODE_USER_PROPERTY_MATRIX_B "B"
00219     #define KFCURVENODE_USER_PROPERTY_MATRIX_C "C"
00220     #define KFCURVENODE_USER_PROPERTY_MATRIX_D "D"
00221     #define KFCURVENODE_USER_PROPERTY_MATRIX_E "E"
00222     #define KFCURVENODE_USER_PROPERTY_MATRIX_F "F"
00223 
00224     // Default array size for 1 minute of animation (30fps) 
00225     #define SELECTION_ARRAY_SIZE    30*60+1
00226     //#define SELECTION_ARRAY_SIZE 1024*1024
00227 
00228     #define KFCURVENODE_CANDIDATE_MAX_COUNT 4
00229 
00230 
00231     typedef int  kFCurveNodeType;
00232 
00233     KFBX_FORWARD (KFCurveNode);
00234     typedef HKFCurveNode HIKFCurveNode;
00235     typedef KFCurveNode IKFCurveNode;
00236 
00237     #define IKFCurveNodeID 43763634
00238 
00239     enum EKFCurveNodeEventType
00240     {
00241         KFCURVENODEEVENT_NONE = 0, 
00242         KFCURVENODEEVENT_SELECTION = 1, 
00243         KFCURVENODEEVENT_DESTROY = 2, 
00244         KFCURVENODEEVENT_FCURVE = 4, 
00245         KFCURVENODEEVENT_TIMEWARP = 8, 
00246         KFCURVENODEEVENT_CTRLCURVE = 16, 
00247         KFCURVENODEEVENT_DATAUPDATED = 32
00248     };
00249 
00250     struct KExternalTimingInformation
00251     {
00252         KTime mLclOffset;
00253         KTime mDuration;
00254     };
00255 
00256 
00259     class KFBX_DLL KFCurveNodeEvent : public KEventBase
00260     {
00261     public:
00267 
00268         int mEventCount;
00269 
00271         void* mData;
00272 
00274         inline void Clear () 
00275         {
00276             mType=KFCURVENODEEVENT_NONE; 
00277             mEventCount = 0; 
00278             mData = NULL; 
00279         }
00280 
00284         inline void Add (int pWhat) 
00285         {
00286             mType |= pWhat;
00287             mEventCount++;
00288         }
00289 
00290         // Set the data contained by the node event.
00291         inline void SetData (void* pData) {mData = pData;}
00292     };
00293 
00294 
00295     struct KFCurveNodeCallback 
00296     {
00297         KFCurveNodeEvent mEvent;
00298         KArrayUL mCallbackFunctions;   // no delete on object must use array ul
00299         KArrayUL mCallbackObjects;     // no delete on object must use array ul
00300         bool mCallbackEnable;
00301     };
00302 
00303     typedef void (*kFCurveNodeCallback) (KFCurveNode* pFCurve, KFCurveNodeEvent* FCurveNodeEvent, void* pObject) ;
00304 
00305     typedef class KArrayTemplate< HKFCurveNode > KArrayTemplateFCurveNode;  
00306 
00307     // Return codes for function KFCurveNode::IsKey().
00308     enum 
00309     { 
00310         ISKEY_NONE,
00311         ISKEY_SOME, 
00312         ISKEY_ALL 
00313     };
00314 
00315 
00316     class KFBX_DLL KFCurveNodeCandidateState
00317     {
00318     public:
00319         KFCurveNodeCandidateState();
00320         ~KFCurveNodeCandidateState();
00321 
00322         void Dump(int pLevel = 0);
00323 
00324         void SetCandidateTotalTime      ( KTime &pCandidateTime ) { mCandidateTotalTime = pCandidateTime; };
00325         void SetCandidateSpecificTime   ( KTime &pCandidateTime ) { mCandidateSpecificTime = pCandidateTime; };
00326 
00327     protected:
00328         friend class KFCurveNode;
00329         
00330         int mSpecificCandidateMethod;
00331         int mTotalCandidateMethod;
00332 
00333         double mCandidateTotalValue[KFCURVENODE_CANDIDATE_MAX_COUNT];
00334         KTime   mCandidateTotalTime;
00335 
00336         double mCandidateSpecificValue;
00337         double mFCurveValue;
00338         KTime mCandidateSpecificTime;
00339 
00340         KFCurveNodeCandidateState *mSubStates[KFCURVENODE_CANDIDATE_MAX_COUNT];
00341         KFCurveNodeCandidateState *mLayerState;
00342         int                        mLayerID;
00343 
00344     };
00345 
00346 
00359     class KFBX_DLL KFCurveNode
00360     {
00361 
00362     public:
00363 
00368 
00377         KFCurveNode 
00378         (
00379             char* pNodeName, 
00380             char* pTimeWarpName, 
00381             HKDataType pDataType, 
00382             int  pLayerType = KFCL_NOLAYER,
00383             int  pLayerID = 0
00384         ) ;
00385 
00393         KFCurveNode(HKFCurveNode pTemplateCurveNode);
00394 
00396         virtual ~KFCurveNode () ;
00397 
00398     private:
00399         // Disabling copy constructor, since this class maintains pointers with ref counts on them
00400         KFCurveNode& operator = (const KFCurveNode&);
00401         KFCurveNode(const KFCurveNode& );
00402          
00403     public:
00404 
00405 
00406 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00407         void Destroy (int Local=0) ;
00408 #endif
00409 
00411 
00416 
00420         void CreateFCurve( );
00421 
00426         bool FCurveCreated( );
00427 
00429 
00434 
00445         HKFCurveNode Clone(bool pKeepAttached);
00446 
00460         HKFCurveNode CloneTemplate(bool pKeepAttached=false, bool pCloneFCurves=false, bool pCreateCurves=false, int pLayerID = -1);
00461 
00469         void CopyFrom(HKFCurveNode pSource, bool pTransferCurve = false);
00470 
00479         HKFCurveNode Copy(KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE);
00480 
00482 
00487 
00489         char* GetName () const;
00490 
00492         char* GetTimeWarpName() const;
00493 
00495         char* GetTypeName() const;
00496 
00498 
00503 
00507         HKFCurve FCurveGet() const;
00508 
00517         KFCurve* FCurveSet (KFCurve* pCurve, bool pDestroyOldCurve = false) ;
00518 
00525         void FCurveReplace (KFCurve* pCurve) ;
00526 
00535         bool GetTransformCurves (KFCurve* pT[3], KFCurve* pR[3], KFCurve* pS[3]) ;
00536 
00538 
00543 
00547         virtual void Clear () ;
00548 
00553         virtual int Add(HKFCurveNode pCurveNode);
00554         
00558         virtual void Remove (int pIndex) ;
00559         
00563         virtual void Delete (int pIndex) ;
00564         
00566         virtual int GetCount () const;
00567         
00572         virtual HKFCurveNode Get(int pIndex) const;
00573         
00580         virtual bool IsChild(KFCurveNode* pCurveNode, bool pRecursive = false) const;
00581 
00587         virtual int Find (char* pName) const;
00588 
00594         virtual int Find(HKFCurveNode pNode) const;
00595 
00600         HKFCurveNode FindRecursive(char* pName) const;
00601 
00608         HKFCurveNode FindOrCreate(char* pName, bool pFindOrCreateCurve = true) ;
00609         
00613         virtual void SetParent(HKFCurveNode pParent) {mParent = pParent;}
00614         
00618         virtual HKFCurveNode GetParent() const {return mParent;}
00619 
00621 
00626 
00632         int KeyGetCount(bool pRecursiveInLayers = false) const;
00633 
00640         void KeyGetCount(int& pCurveCount, int& pTotalCount, int& pMinCount, int& pMaxCount) const;
00641 
00649         void GetCurveWithFirstKey(KFCurve*& lCurveWithFirstKey, bool *pCurveMask /* = NULL */, bool pRecursiveInLayers) const;
00650 
00657         void GetCurveWithLastKey(KFCurve*& lCurveWithLastKey, bool *pCurveMask /* = NULL */, bool pRecursiveInLayers) const;
00658 
00665         KTime GetFirstKeyTime(bool *pCurveMask = NULL, bool pRecursiveInLayers = false) const;
00666 
00673         KTime GetLastKeyTime(bool *pCurveMask = NULL, bool pRecursiveInLayers = false) const;
00674 
00685         double* KeyAdd (KTime pTime, double* pValue) ;
00686 
00700         double* KeyAppend (KTime pTime, double* pValue, bool pCheckForContinuousRotation = false) ;
00701 
00712         bool GetAnimationInterval (KTime& pStart, KTime& pStop) const;
00713 
00718         void GetTimeSpan          (KTime& pStart, KTime& pStop) const;  
00719 
00735         int IsKey (KTime& pTime, int *pLast, bool* pCurveMask = NULL, double pKeyIndexTolerance = 0.0, double pMin = -K_DOUBLE_MAX,  double pMax = K_DOUBLE_MAX ) const;
00736 
00746         bool DeleteKey (KTime& pTime, bool* pCurveMask = NULL, double pKeyIndexTolerance = 0.0 );
00747 
00758         KTime GetNextKeyTime (KTime pTime, bool* pCurveMask = NULL, bool pRecursiveInLayers = false) const;
00759 
00769         KTime GetPrevKeyTime (KTime pTime, bool* pCurveMask = NULL ) const;
00770 
00785         double* Evaluate (double* pValue, KTime pTime, kFCurveIndex* pLast=NULL) ;
00786         
00797         double* GetValue (double* pValue) const;
00798         
00808         double* SetValue (double* pValue) ;
00809 
00816         void Delete(KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE);
00817 
00830     void Replace(HKFCurveNode pSource, KTime pStart = KTIME_MINUS_INFINITE, KTime pStop = KTIME_INFINITE, bool pUseGivenSpan = false, bool pKeyStartEndOnNoKey = true, KTime pTimeSpanOffset = KTIME_ZERO );
00831 
00833 
00835     //
00836     //  WARNING!
00837     //
00838     //  Anything beyond these lines may not be documented accurately and is 
00839     //  subject to change without notice.
00840     //
00842 
00843     #ifndef DOXYGEN_SHOULD_SKIP_THIS
00844 
00849 
00851         float* GetColor();
00852 
00854         void SetColor (float pColor[3]) ;
00855 
00857 
00862 
00864         inline int IncReferenceCount () {return ++mReferenceCount;}
00865 
00867         inline int DecReferenceCount () {mReferenceCount--; return mReferenceCount;}
00868 
00870         inline int GetReferenceCount () const {return mReferenceCount;}
00871 
00873 
00878 
00880         int GetTakeType () const;
00881 
00883         void SetTakeType (int pType) ;
00884 
00886 
00891 
00893         bool GetVisibility () const;
00894 
00896         void SetVisibility (bool pVisible, bool pRecursive=false, bool pRecurseLayer = false, int lChildIndex = -1) ;
00897 
00899 
00904 
00909         void DataNodeSet (HKFCurveNode pDataNode, bool pRecursive=true) ;
00910 
00914         HKFCurveNode DataNodeGet ();
00915 
00919         bool SetPreExtrapolation(kUInt pNewPreExtrapolation, bool pRespectUserLock=true );
00920         bool SetPreExtrapolationCount(kUInt pNewPreExtrapolationCount, bool pRespectUserLock=true);
00921         bool SetPostExtrapolation(kUInt pNewPreExtrapolation, bool pRespectUserLock=true);
00922         bool SetPostExtrapolationCount(kUInt pNewPreExtrapolationCount, bool pRespectUserLock=true);
00923 
00925 
00930 
00932         int GetContainerType () const;
00933 
00935         void SetContainerType (int pInOutType) ;
00936 
00938 
00943 
00945         int GetIOType () const;
00946 
00948         void SetIOType (int pInOutType) ;
00949 
00951 
00956 
00958         int IsExpended () const;
00959 
00961         void SetExpended (bool pExpended) ;
00962 
00964 
00969 
00971         int IsMultiLayer() const;
00972 
00974         void SetMultiLayer (bool pMultiLayer) ;
00975 
00977         HKFCurveNode GetLayerNode(int pLayerID);
00978 
00980 
00985 
00989         bool LookLikeSampledData(KTime pThresholdPeriod) const;
00990 
00992 
00997 
00999         int GetUpdateId () const;
01000 
01002         int GetValuesUpdateId () const;
01003 
01005         int GetNodeUpdateId () const;
01006 
01007 
01009 
01014         
01016         bool CallbackEnable (bool pEnable) ;
01017         
01019         bool CallbackIsEnable () const;
01020         
01022         void CallbackClear () ;
01023         
01025         void CallbackAddEvent (int pWhat) ;
01026         
01028         void CallbackRegister (kFCurveNodeCallback, void* pObject) ;
01029         
01031         void CallbackUnregister (kFCurveNodeCallback, void* pObject) ;
01032 
01034 
01035         bool    FbxStore (KFbx* pFbx, bool pOnlyDefaults = false, bool pReplaceLclTRSName = false, bool pSkipTimeWarpName = false, char* pFieldName = "Channel", bool pColor = true, KFCurve::FbxStoreVersionID pIsVersionID = KFCurve::V7 ) ;
01036         bool    FbxRetrieve (KFbx* pFbx, bool pOnlyDefaults = false, bool pCreateIfNotFound = true,bool pColor = false);
01037         bool    FbxInternalRetrieve (KFbx* pFbx, bool pOnlyDefaults = false, bool pCreateIfNotFound = true,bool pColor = false) ;
01038         bool    FbxTimeWarpNameRetrieve(KFbx* pFbx);
01039         bool    FbxLayerAndTimeWarpRetrieve(KFbx* pFbx, bool pOnlyDefaults = false, bool pCreateIfNotFound = true,bool pColor = false) ;
01040 
01042 
01046         bool mUseQuaternion;
01047         inline bool GetUseQuaternion()const {return mUseQuaternion;}; 
01048         void SetUseQuaternion(bool pVal); 
01049         private:
01050             void RotationNodeEvaluate(double* pValue, KTime pTime, kFCurveIndex* pLast,bool pEvaluateCandidate  );
01051 
01053 
01054     public:
01056 
01060         void GetCandidateState(KFCurveNodeCandidateState& pState) const;
01061         void SetCandidateState(const KFCurveNodeCandidateState& pState, bool pDestroyMissingLayers = false );
01062 
01063         int     GetCandidateSpecificMethod() const;
01064         int     GetCandidateTotalMethod() const;
01065         KTime   GetCandidateTotalTime() const;
01066         double* GetCandidateTotalValue();
01067         int     GetCandidateTotalValueSize() const;
01068 
01069         void    SetCandidateSpecificMethod(int pMethod);
01070         void    SetCandidateTotalMethod(int pMethod);
01071         void    SetCandidateTotalTime(KTime pTime);
01072         void    SetCandidateTotalValue(double* pValue);
01073 
01075 
01076     void GetQuaternionInterpolationBezierPoints(KTime pCurrentTime, KgeQuaternion &pQ0, KgeQuaternion &lQ1, KgeQuaternion &lQ2, KgeQuaternion &lQ3);
01077 
01078     private:
01079         struct NameInfo 
01080         {
01081             KString     mName;
01082             KString     mTimeWarpName;
01083             HKDataType  mDataType;
01084             int     mRefCount;
01085         }*mNameInfo;
01086 
01087         void    SetNameInfo( NameInfo* pNameInfo );
01088 
01089     protected:
01090 
01091         int mType;
01092 
01093         int mReferenceCount;
01094         KArrayTemplate<HKFCurveNode> mNodes;
01095 
01096         HIKFCurve    mFCurve;
01097         HKFCurveNode mTimeWarp;
01098         HKFCurveNode mLayer;        // Ctrl Curve (Animation layering) 
01099         HKFCurveNode mObjectLayer;  // Pointer to Layer 0
01100         HKFCurveNode mTemplate;
01101         HKFCurveNode mDataNode;
01102         HKFCurveNode mParent;
01103 
01104         int mLayerType;
01105         int mLayerID;
01106 
01107         int mUpdateId;
01108 
01109         public:
01110         int mMBRotationOrder;
01111         inline int GetRotationOrder() const {return mMBRotationOrder;}; 
01112         void SetRotationOrder(int pRotationOrder);
01113 
01115         int GetLayerType() const { return mLayerType; }
01116 
01117         protected:
01118         //
01119         //  Candidates in nodes (Max is KFCURVENODE_CANDIDATE_MAX_COUNT)
01120         //
01121         
01122         void FromTotalCandidateToSpecificCandidate(int pLayerID);
01123 
01124         enum {eUseFCurve = 1, eUseTotal = 2};
01125         int mSpecificCandidateMethod;  // Used as a bit field
01126         int mTotalCandidateMethod;     // Used as an enum
01127                                         // To my knowledge the possible state are       
01128                                         // No validcandidate                            mCandidateTotalTime == INFINITE and no FCurve candidate for the current time
01129                                         // Total candidate is valid and fcuve invalid   mTotalCandidateMethod ==  eUseTotal and mSpecificCandidateMethod == eUseTotal
01130                                         // FCurve is valid and Total invalid            mTotalCandidateMethod ==  eUseFCurve and mSpecificCandidateMethod == eUseFCurve
01131                                         // Total valid and FCurve computed              mTotalCandidateMethod ==  eUseTotal and mSpecificCandidateMethod == eUseTotal | eUseFCurve
01132 
01133                                         // FCurve valid and total computed              mTotalCandidateMethod ==  eUseTotal and mSpecificCandidateMethod == eUseFCurve
01134                                         // FCurve valid (and computed from total) and total computed    mTotalCandidateMethod ==  eUseTotal and mSpecificCandidateMethod == eUseTotal | eUseFCurve
01135                         
01136                     
01137                                         
01138 
01139         double mCandidateTotalValue[KFCURVENODE_CANDIDATE_MAX_COUNT];   // For all layers at once (only meaningful on ObjectLayer )
01140         KTime   mCandidateTotalTime;
01141 
01142         //
01143         //  Callbacks
01144         //
01145         
01146         KFCurveNodeCallback* mCallback;
01147         int mUserLock;
01148 
01149     private:
01150         void KeyGetCountRecursive(int& pCurveCount, int& pTotalCount, int& pMinCount, int& pMaxCount) const;
01151         bool GetAnimationIntervalRecursive (KTime& pStart, KTime& pStop) const;
01152         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 ) const;
01153 
01154         friend KFBX_DLL HKFCurveNode KFCurveNodeCreate (KFbx* pFbx, HKFCurveNode pParent, bool pOnlyDefaults, bool pCreateIfNotFound, bool pColor );
01155 
01156     public:
01157         //
01158         // TimeWarp
01159         //
01160 
01162         void TimeWarpSet (HKFCurveNode pLayer);
01163 
01167         HKFCurveNode TimeWarpGet () const;
01168 
01169         //
01170         // Layers
01171         //
01172 
01174         void LayerSet(HKFCurveNode pLayer, bool pDeleteCurrentAndSubLayers ); // No default value to make sure you know what you are doing
01175 
01179         HKFCurveNode LayerGet () const;
01180 
01184         HKFCurveNode LayerGet( int pLayerID );
01185 
01187         void CreateLayerAt( int pLayerID );
01188     private:
01190         HKFCurveNode LayerCreate ( int pLayerID, bool pDeleteCurrentLayer );    // No default value to make sure you know what you are doing
01191     public:
01193         virtual HKFCurveNode Find(HKDataType pDataType) const;
01194         
01199         HKFCurveNode FindRecursive(HKDataType pDataType) const;
01200 
01202         HKDataType GetDataType() const;
01203             
01207         void Delete(HKFCurveNode pNode);
01208 
01210         HKFCurveNode ObjectLayerGet() const;
01211 
01213         void ObjectLayerSet( HKFCurveNode pNode );
01214 
01216         inline int GetLayerID() const { return mLayerID; };
01217 
01219         inline void SetLayerID( int pLayerID ) { mLayerID = pLayerID; };
01220 
01222         void SetLayerType( int pLayerType, HKFCurveNode pObjectLayerNode = NULL );
01223 
01225         HKFCurveNode GetPreviousLayer( int pLayerID );
01226 
01228         HKFCurveNode RemoveLayer( int pLayerID, bool pDestroy = true );
01229 
01230         // Copy a specific anyer or create one if none exist 
01231         HKFCurveNode InsertOrCopyLayer( int pLayerId, HKFCurveNode pLayerNode );
01232 
01233         void SingleLayerCopyFrom(HKFCurveNode pSource, bool pTransferCurve = false );
01234 
01235         HKFCurveNode SingleLayerCopy(KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE ); 
01236 
01237         //
01238         // Templates
01239         //
01240 
01242         void TemplateSet (HKFCurveNode pTemplate);
01243 
01247         HKFCurveNode TemplateGet () const;
01248 
01249         //
01250         // Copy/paste
01251         //
01252 
01254         void LayerCopyFromRecursive( HKFCurveNode pSource, bool pTransferCurve = false );
01255 
01256         //
01257         //  Candidates
01258         //
01259 
01261         bool    CandidateClear ( int pLayerID = 0, bool pClearAllSubLayersToo = true );
01262 
01264         void    CandidateClearSubLayers ();
01265         
01267         double* CandidateSet (KTime pTime, double* pValue, int pLayerID = 0, int pChildIndexInParent = -1 );
01268 
01270         double *CandidateSetSpecificLayer (KTime pTime,double *pValue, int pLayerID = 0 );
01271 
01273         double* CandidateGet (double* pValue, int pLayerID = 0 ) const;
01274         
01276         double* CandidateGetSpecificLayer( double* pValue, KTime &pCandidateTime, int pLayerID = 0 );
01277         
01279         void CandidateGetTotalCandidate( double* pValue, KTime &pCandidateTime ) const;
01280         
01282         bool IsCandidate              () const;
01283         
01285         bool    CandidateKey 
01286         (
01287             kFCurveIndex*   pLast           = NULL, 
01288             int             pLayerID        = 0, 
01289             bool*           pCurveMask      = NULL, 
01290             bool            pZeroKey        = false , 
01291             int         pInterpolation  = KFCURVE_INTERPOLATION_CUBIC, 
01292             int         pTangeantMode   = KFCURVE_TANGEANT_USER, 
01293             int         pContinuity     = KFCURVE_CONTINUITY,
01294             bool            pTanOverride    = true,
01295             KTime           pCandidateTime  = KTIME_INFINITE,
01296             double          pKeyIndexTolerance = 0.0
01297         );
01298 
01300         bool    CandidateKeySpecificLayer 
01301         (
01302             kFCurveIndex*   pLast           = NULL, 
01303             int             pLayerID        = 0, 
01304             bool*           pCurveMask      = NULL,
01305             int         pInterpolation  = KFCURVE_INTERPOLATION_CUBIC, 
01306             int         pTangeantMode   = KFCURVE_TANGEANT_USER, 
01307             int         pContinuity     = KFCURVE_CONTINUITY,
01308             bool            pTanOverride    = true,
01309             KTime           pCandidateTime  = KTIME_INFINITE,
01310             double          pKeyIndexTolerance = 0.0
01311         );
01312 
01313         // !    If CurveNode is MonoLayer it will return 0
01314         int         GetCorrectLayerID( int pLayerID ) const;
01315         HKFCurveNode    GetCorrectLayer  ( int pLayerID, bool pCreateLayerIfNesseary = false );
01316 
01318         void    ComputeCandidateForLayer( double *pDestLayerValue, double *pCandidateValue, KTime pTime, int pLayerID, kFCurveIndex *pLast );
01319 
01321         void    EvaluateCurvesExceptLayerRecursiveAdd ( double *pValue, KTime pTime, int pExceptLayerID, kFCurveIndex* pLast=NULL);
01322         
01324         void    EvaluateCurvesExceptLayerRecursiveMult ( double *pValue, KTime pTime, int pExceptLayerID, kFCurveIndex* pLast=NULL);
01325 
01327         void    EvaluateCurvesBeforeLayerRecursiveEulerXYZ ( KgeRMatrix &pBefore, KTime lCandidateTime, int pLayerID, kFCurveIndex* pLast );
01328 
01330         void    EvaluateCurvesAfterLayerRecursiveEulerXYZ  ( KgeRMatrix &pAfter, KTime lCandidateTime, int pAfterLayerID, kFCurveIndex* pLast );
01331 
01333         void    EvaluateCurvesBeforeLayerRecursiveQuat( KgeQuaternion &pBefore, KTime pTime, int pBeforeLayerID, kFCurveIndex* pLast );
01334 
01336         void    EvaluateCurvesAfterLayerRecursiveQuat ( KgeQuaternion &pAfter , KTime pTime, int pBeforeLayerID, kFCurveIndex* pLast );
01337 
01339         double* CandidateGetWithTime ( double *pValue, KTime &pCandidateTime );
01340 
01341 
01342         //
01343         // Helpers
01344         //
01345 
01347         double* EvaluateSpecificLayer( double *pValue, KTime pTime, int pLayerID, kFCurveIndex* pLast=NULL);
01348 
01350         double *CandidateEvaluateSpecificLayer( double *pValue, KTime pTime, int pLayerID, kFCurveIndex *pLast=NULL);
01351 
01353         double* GeneralEvaluate (double* pValue, KTime pTime, kFCurveIndex* pLast=NULL,bool pEvaluateCandidate=true);
01354 
01356         double* CandidateEvaluate (double* pValue, KTime pTime, kFCurveIndex* pLast=NULL);
01357 
01359         bool IsEditable ();
01360 
01362         void GetZeroValues( double *pValues ) const;
01363 
01364         // ! Content replacement for quaternions ( = with scaling of the quaternion )
01365         void ReplaceForQuaternion( HKFCurveNode pSource, KTime pStart, KTime pStop, double pScaleStart, double pScaleStop, bool pUseExactGivenSpan /*= false*/, bool pKeyStartEndOnNoKey /*= true*/, KTime pTimeSpanOffset /*= KTIME_ZERO*/ );
01366 
01367         // ! Calculates the offset between to euler rotations
01368         bool GetContinuousOffset( double pOffset[3], double pNew[3], double pOld[3] ) const;
01369 
01370         // ! Unrolls a rotation at a given time, using the previous key.
01371         void GetContinuousRotation( double pResultKeyValue[3], double pCurrentKeyValue[3], KTime pCurrentKeyTime );
01372 
01373         // ! Sets the user name
01374         void SetTimeWarpName( char* pName );
01375 
01376         // ! Returns the total key count for all child (pChildIndex) in every layer.
01377         int KeyGetCountOnChild( int pChildIndex ) const;
01378 
01379         //
01380         //  User lock
01381         //
01382 
01384         void    UserLockAdd();
01385 
01387         void    UserLockRemove();
01388 
01390         bool    IsUserLocked() const;
01391 
01392     public:
01397         virtual int SortedAdd (HKFCurveNode pNode) ;
01398 
01400     public:
01401 
01402         // For Backward compatibility reasons must be revisited please ...
01403         HIConnector mConnector; // Do not set this member because if the Connector is set, it means that it is a Connector FCurveNode. So watchout!!!
01404 
01405 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01406 
01407     };
01408 
01409 
01419     KFBX_DLL HKFCurveNode KFCurveNodeCreate(char* pNodeName, char* pTimeWarpName, char* pTypeName, int pLayerType = KFCL_NOLAYER, int pLayerID = 0);
01420     KFBX_DLL HKFCurveNode KFCurveNodeCreate(char* pNodeName, HKDataType pDataType=NULL, int pLayerType = KFCL_NOLAYER, int pLayerID = 0);
01421 
01422 
01430     KFBX_DLL HKFCurveNode KFCurveNodeCreate(HKFCurveNode pTemplateCurveNode);
01431 
01432     // Create a curve node, FBX SDK internal use only.
01433     KFBX_DLL HKFCurveNode KFCurveNodeCreate(KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = false);
01434 
01435     // Create a curve node, FBX SDK internal use only.
01436     KFBX_DLL HKFCurveNode KFCurveNodeCreate(KFbx* pFbx, HKFCurveNode pParent, bool pOnlyDefaults = false, bool pCreateIfNotFound = true, bool pColor = false);
01437 
01438     // Create a layer node, FBX SDK internal use only.
01439     KFBX_DLL HKFCurveNode KFCurveNodeLayerCreate (KFbx* pFbx,HKFCurveNode pParent, bool pOnlyDefaults = false );
01440 
01441     // Create a curve node from a datatype, FBX SDK internal use only.
01442     KFBX_DLL HKFCurveNode FCurveNodeCreateFromDataType( HKDataType pDataType,char* pNodeName);
01443 
01444 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01445 
01446 #endif // FBXFILESDK_COMPONENTS_KFCURVE_KFCURVENODE_H
01447