00001
00004 #ifndef _FBXSDK_NODE_H_
00005 #define _FBXSDK_NODE_H_
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
00039
00040
00041
00042 #include <kaydaradef.h>
00043 #ifndef KFBX_DLL
00044 #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046
00047 #include <kaydara.h>
00048
00049 #include <kfbxplugins/kfbxtakenodecontainer.h>
00050 #include <kfbxplugins/kfbxnodelimits.h>
00051 #include <kfbxplugins/kfbxgroupname.h>
00052
00053 #include <kfbxmath/kfbxtransformation.h>
00054 #include <kfbxmath/kfbxvector4.h>
00055 #include <kfbxmath/kfbxmatrix.h>
00056 #include <kfbxmath/kfbxxmatrix.h>
00057
00058 #include <klib/karrayul.h>
00059 #include <klib/kerror.h>
00060 #include <klib/kstring.h>
00061 #include <klib/ktime.h>
00062
00063 #ifndef MB_FBXSDK
00064 #include <kbaselib_nsuse.h>
00065 #endif
00066 #include <kbaselib_forward.h>
00067
00068 #include <fbxfilesdk_nsbegin.h>
00069
00070 class KFbxNodeAttribute;
00071 class KFbxScene;
00072 class KFbxSdkManager;
00073 class KFbxNull;
00074 class KFbxMarker;
00075 class KFbxSkeleton;
00076 class KFbxGeometry;
00077 class KFbxMesh;
00078 class KFbxNurb;
00079 class KFbxNurbsCurve;
00080 class KFbxNurbsSurface;
00081 class KFbxTrimNurbsSurface;
00082 class KFbxPatch;
00083 class KFbxCamera;
00084 class KFbxCameraSwitcher;
00085 class KFbxLight;
00086 class KFbxOpticalReference;
00087 class KFbxCharacter;
00088 class KFbxNode_internal;
00089 class KFbxSurfaceMaterial_internal;
00090 class KFbxNodeAttribute_internal;
00091
00092
00093
00106 class KFBX_DLL KFbxNode : public KFbxTakeNodeContainer
00107 {
00108 KFBXOBJECT_DECLARE(KFbxNode);
00109 public:
00115
00119 KFbxNode* GetParent();
00120
00134 bool AddChild(KFbxNode* pNode);
00135
00141 KFbxNode* RemoveChild(KFbxNode* pNode);
00142
00147 int GetChildCount(bool pRecursive = false) const;
00148
00153 KFbxNode* GetChild(int pIndex);
00154
00159 KFbxNode const* GetChild(int pIndex) const;
00160
00167 KFbxNode* FindChild(char const* pName, bool pRecursive = true, bool pInitial = false);
00168
00170
00189
00193 void SetTarget(KFbxNode* pNode);
00194
00198 KFbxNode* GetTarget() const;
00199
00203 void SetPostTargetRotation(KFbxVector4 pVector);
00204
00208 KFbxVector4 GetPostTargetRotation() const;
00209
00213 void SetTargetUp(KFbxNode* pNode);
00214
00218 KFbxNode* GetTargetUp() const;
00219
00223 void SetTargetUpVector(KFbxVector4 pVector);
00224
00228 KFbxVector4 GetTargetUpVector() const;
00229
00231
00236
00240 void SetVisibility(bool pIsVisible);
00241
00245 bool GetVisibility() const;
00246
00255 typedef enum
00256 {
00257 eHARD_SHADING,
00258 eWIRE_FRAME,
00259 eFLAT_SHADING,
00260 eLIGHT_SHADING,
00261 eTEXTURE_SHADING,
00262 eLIGHT_TEXTURE_SHADING
00263 } EShadingMode;
00264
00268 void SetShadingMode(EShadingMode pShadingMode);
00269
00273 EShadingMode GetShadingMode() const;
00274
00278 void SetMultiLayer(bool pMultiLayer);
00279
00283 bool GetMultiLayer() const;
00284
00290 typedef enum
00291 {
00292 eOLD_MULTI_TAKE,
00293 eMULTI_TAKE,
00294 eMONO_TAKE
00295 } EMultiTakeMode;
00296
00300 void SetMultiTakeMode(EMultiTakeMode pMultiTakeMode);
00301
00305 EMultiTakeMode GetMultiTakeMode() const;
00306
00308
00313
00325 KFbxNodeAttribute* SetNodeAttribute(KFbxNodeAttribute* pNodeAttribute);
00326
00331 KFbxNodeAttribute* GetNodeAttribute();
00332
00337 KFbxNodeAttribute const* GetNodeAttribute() const;
00338
00342 int GetNodeAttributeCount() const;
00343
00348 int GetDefaultNodeAttributeIndex() const;
00349
00355 bool SetDefaultNodeAttributeIndex(int pIndex);
00356
00362 KFbxNodeAttribute* GetNodeAttributeByIndex(int pIndex);
00363
00369 KFbxNodeAttribute const* GetNodeAttributeByIndex(int pIndex) const;
00370
00377 int GetNodeAttributeIndex(KFbxNodeAttribute* pNodeAttribute) const;
00378
00386 bool AddNodeAttribute(KFbxNodeAttribute* pNodeAttribute);
00387
00394 KFbxNodeAttribute* RemoveNodeAttribute(KFbxNodeAttribute* pNodeAttribute);
00395
00402 KFbxNodeAttribute* RemoveNodeAttributeByIndex(int pIndex);
00403
00408 KFbxNull* GetNull();
00409
00414 KFbxMarker* GetMarker();
00415
00420 KFbxSkeleton* GetSkeleton();
00421
00427 KFbxGeometry* GetGeometry();
00428
00433 KFbxMesh* GetMesh();
00434
00439 KFbxNurb* GetNurb();
00440
00445 KFbxNurbsSurface* GetNurbsSurface();
00446
00451 KFbxNurbsCurve* GetNurbsCurve();
00452
00457 KFbxTrimNurbsSurface* GetTrimNurbsSurface();
00458
00463 KFbxPatch* GetPatch();
00464
00469 KFbxCamera* GetCamera();
00470
00476 KFbxCameraSwitcher* GetCameraSwitcher();
00477
00482 KFbxLight* GetLight();
00483
00489 KFbxOpticalReference* GetOpticalReference();
00490
00492
00499
00503 void SetDefaultT(const KFbxVector4& pT);
00504
00509 KFbxVector4& GetDefaultT(KFbxVector4& pT);
00510
00514 void SetDefaultR(const KFbxVector4& pR);
00515
00520 KFbxVector4& GetDefaultR(KFbxVector4& pR);
00521
00525 void SetDefaultS(const KFbxVector4& pS);
00526
00531 KFbxVector4& GetDefaultS(KFbxVector4& pS);
00532
00540 void SetDefaultVisibility(double pVisibility);
00541
00549 double GetDefaultVisibility();
00550
00552
00561
00567 void SetTransformationInheritType(ETransformInheritType pInheritType);
00568
00572 void GetTransformationInheritType(ETransformInheritType& pInheritType);
00573
00575
00576
00585
00590 typedef enum
00591 {
00592 eSOURCE_SET,
00593 eDESTINATION_SET
00594 } EPivotSet;
00595
00600 typedef enum
00601 {
00602 ePIVOT_STATE_ACTIVE,
00603 ePIVOT_STATE_REFERENCE
00604 } EPivotState;
00605
00612 void SetPivotState(EPivotSet pPivotSet, EPivotState pPivotState);
00613
00620 void GetPivotState(EPivotSet pPivotSet, EPivotState& pPivotState);
00621
00627 void SetRotationOrder(EPivotSet pPivotSet, ERotationOrder pRotationOrder);
00628
00633 void GetRotationOrder(EPivotSet pPivotSet, ERotationOrder& pRotationOrder);
00634
00643 void SetUseRotationSpaceForLimitOnly(EPivotSet pPivotSet, bool pUseForLimitOnly);
00644
00649 bool GetUseRotationSpaceForLimitOnly(EPivotSet pPivotSet);
00650
00656 void SetRotationActive(bool pVal);
00657
00661 bool GetRotationActive();
00662
00667 void SetUseQuaternionForInterpolation(EPivotSet pPivotSet, bool pUseQuaternion);
00668
00673 bool GetUseQuaternionForInterpolation(EPivotSet pPivotSet) const;
00674
00683 void SetRotationStiffness(KFbxVector4 pRotationStiffness);
00684
00688 KFbxVector4 GetRotationStiffness();
00689
00690
00699 void SetMinDampRange(KFbxVector4 pMinDampRange);
00700
00704 KFbxVector4 GetMinDampRange();
00705
00706
00715 void SetMaxDampRange(KFbxVector4 pMaxDampRange);
00716
00720 KFbxVector4 GetMaxDampRange();
00721
00722
00731 void SetMinDampStrength(KFbxVector4 pMinDampStrength);
00732
00736 KFbxVector4 GetMinDampStrength();
00737
00738
00747 void SetMaxDampStrength(KFbxVector4 pMaxDampStrength);
00748
00752 KFbxVector4 GetMaxDampStrength();
00753
00754
00760 void SetPreferedAngle(KFbxVector4 pPreferedAngle);
00761
00765 KFbxVector4 GetPreferedAngle();
00766
00767
00773 void SetRotationOffset(EPivotSet pPivotSet, KFbxVector4 pVector);
00774
00780 KFbxVector4& GetRotationOffset(EPivotSet pPivotSet) const;
00781
00788 void SetRotationPivot(EPivotSet pPivotSet, KFbxVector4 pVector);
00789
00796 KFbxVector4& GetRotationPivot(EPivotSet pPivotSet) const;
00797
00804 void SetPreRotation(EPivotSet pPivotSet, KFbxVector4 pVector);
00805
00812 KFbxVector4& GetPreRotation(EPivotSet pPivotSet) const;
00813
00820 void SetPostRotation(EPivotSet pPivotSet, KFbxVector4 pVector);
00821
00828 KFbxVector4& GetPostRotation(EPivotSet pPivotSet) const;
00829
00835 void SetScalingOffset(EPivotSet pPivotSet, KFbxVector4 pVector);
00836
00842 KFbxVector4& GetScalingOffset(EPivotSet pPivotSet) const;
00843
00850 void SetScalingPivot(EPivotSet pPivotSet, KFbxVector4 pVector);
00851
00858 KFbxVector4& GetScalingPivot(EPivotSet pPivotSet) const;
00859
00868 void SetGeometricTranslation(EPivotSet pPivotSet, KFbxVector4 pVector);
00869
00874 KFbxVector4 GetGeometricTranslation(EPivotSet pPivotSet) const;
00875
00884 void SetGeometricRotation(EPivotSet pPivotSet, KFbxVector4 pVector);
00885
00890 KFbxVector4 GetGeometricRotation(EPivotSet pPivotSet);
00891
00900 void SetGeometricScaling(EPivotSet pPivotSet, KFbxVector4 pVector);
00901
00905 KFbxVector4 GetGeometricScaling(EPivotSet pPivotSet);
00906
00915 void ConvertPivotAnimation(EPivotSet pConversionTarget, double pFrameRate, bool pKeyReduce=true);
00916
00925 void ConvertPivotAnimationRecursive(EPivotSet pConversionTarget, double pFrameRate, bool pKeyReduce=true);
00926
00931 void ResetPivotSet( KFbxNode::EPivotSet pPivotSet );
00932
00939 void ResetPivotSetAndConvertAnimation( double pFrameRate=30., bool pKeyReduce=false );
00940
00942
00947
00952 KFbxVector4& GetLocalTFromDefaultTake(bool pApplyLimits = false);
00953
00958 KFbxVector4& GetLocalRFromDefaultTake(bool pApplyLimits = false);
00959
00964 KFbxVector4& GetLocalSFromDefaultTake(bool pApplyLimits = false);
00965
00970 KFbxXMatrix& GetGlobalFromDefaultTake(EPivotSet pPivotSet = eSOURCE_SET);
00971
00977 KFbxVector4& GetLocalTFromCurrentTake(KTime pTime, bool pApplyLimits = false);
00978
00984 KFbxVector4& GetLocalRFromCurrentTake(KTime pTime, bool pApplyLimits = false);
00985
00991 KFbxVector4& GetLocalSFromCurrentTake(KTime pTime, bool pApplyLimits = false);
00992
00998 KFbxXMatrix& GetGlobalFromCurrentTake(KTime pTime, EPivotSet pPivotSet = eSOURCE_SET);
00999
01001
01002
01007
01011 int GetCharacterLinkCount();
01012
01024 bool GetCharacterLink(int pIndex, KFbxCharacter** pCharacter, int* pCharacterLinkType, int* pNodeId, int *pNodeSubId);
01025
01035 int FindCharacterLink(KFbxCharacter* pCharacter, int pCharacterLinkType, int pNodeId, int pNodeSubId);
01036
01038
01050 virtual bool GetAnimationInterval(KTime& pStart, KTime& pStop);
01051
01057
01061 KError& GetError();
01062
01076 typedef enum
01077 {
01078 eTAKE_NODE_ERROR,
01079 eNODE_NAME_CLASH,
01080 eMATERIAL_NAME_CLASH,
01081 eTEXTURE_NAME_CLASH,
01082 eVIDEO_NAME_CLASH,
01083 eNOT_A_CHILD,
01084 eCYCLIC_GRAPH,
01085 eINDEX_OUT_OF_RANGE,
01086 eATTRIBUTE_NOT_CONNECTED,
01087 eERROR_COUNT
01088 } EError;
01089
01093 EError GetLastErrorID();
01094
01098 char* GetLastErrorString();
01099
01101
01106
01113 virtual bool SetCurrentTakeNode(int pIndex);
01114
01121 virtual bool SetCurrentTakeNode(char* pName);
01122
01124
01126
01127
01128
01129
01130
01131
01133
01134 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01135
01136 public:
01137
01142
01149 void SetLocalStateFromDefaultTake(bool pRecursive, bool pApplyLimits = false);
01150
01155 void SetDefaultTakeFromLocalState(bool pRecursive);
01156
01163 void SetLocalStateFromCurrentTake(KTime pTime, bool pRecursive,bool pApplyLimits = false);
01164
01170 void SetCurrentTakeFromLocalState(KTime pTime, bool pRecursive);
01171
01177 void ComputeGlobalState(kUInt pUpdateId, bool pRecursive, EPivotSet pPivotSet = eSOURCE_SET);
01178
01184 void ComputeLocalState(kUInt pUpdateId, bool pRecursive);
01185
01189 void SetGlobalState(const KFbxXMatrix& pGX);
01190
01192 KFbxXMatrix& GetGlobalState();
01193
01197 void SetLocalState(const KFbxVector4& pLT,const KFbxVector4& pLR, const KFbxVector4& pLS);
01198
01200 void GetLocalState(KFbxVector4& pLT, KFbxVector4& pLR, KFbxVector4& pLS);
01201
01206 void SetGlobalStateId(kUInt pUpdateId, bool pRecursive);
01207
01209 kUInt GetGlobalStateId();
01210
01215 void SetLocalStateId(kUInt pUpdateId, bool pRecursive);
01216
01218 kUInt GetLocalStateId();
01219
01221
01222 KFbxNodeLimits& GetLimits() { return *mLimits; }
01223
01224 bool GetSelected(bool pRecursive = false);
01225 void SetSelected(bool pSelected, bool pRecursive = false);
01226
01227
01228 class KFBX_DLL KFbxLinkToCharacter
01229 {
01230
01231 public:
01232
01233 bool operator==(KFbxLinkToCharacter& pLinkToCharacter);
01234
01235 KFbxCharacter* mCharacter;
01236 int mType;
01237 int mIndex;
01238 int mSubIndex;
01239 };
01240
01241
01242 virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType = eDEEP_CLONE) const;
01243
01244 protected:
01245 static char const* GetNamePrefix() { return MODEL_PREFIX; }
01246
01247 KFbxNode(KFbxSdkManager& pManager, char const* pName);
01248 virtual ~KFbxNode();
01249
01250 virtual void Destruct(bool pRecursive, bool pDependents);
01251
01253 KFbxNode& operator=(KFbxNode const& pNode);
01254
01255 void Reset();
01256 virtual KFbxObject::ENameSpace GetNameSpace() const;
01257 bool GetAnimationIntervalRecursive(KTime& pStart, KTime& pStop);
01258
01259 virtual void AddChannels(KFbxTakeNode *pTakeNode);
01260
01261 void AddChildName(char* pChildName);
01262 char* GetChildName(kUInt pIndex);
01263 kUInt GetChildNameCount();
01264
01265 public:
01266 void UpdatePivotsAndLimitsFromProperties();
01267 void UpdatePropertiesFromPivotsAndLimits();
01268 void SetRotationActiveProperty(bool pVal);
01269
01270 void PivotSetToMBTransform(EPivotSet pPivotSet);
01271
01272 bool mCorrectInheritType;
01273
01274 virtual KObject* GetFbxObject_internal();
01275 virtual KObject const* GetFbxObject_internal() const;
01276 protected:
01277 KFbxNode_internal* mPH;
01278
01279 virtual KString GetTypeName() const;
01280 virtual KStringList GetTypeFlags() const;
01281
01282 KArrayTemplate<KString*> mChildrenNameList;
01283
01284 KFbxNode* mTarget;
01285 KFbxNode* mUp;
01286 KFbxVector4 mPostTargetRotation;
01287 KFbxVector4 mTargetUpVector;
01288
01289 EShadingMode mShadingMode;
01290 bool mMultiLayer;
01291 EMultiTakeMode mMultiTakeMode;
01292
01293 KMBTransform* GetMBTransform();
01294
01295
01296
01297 class KFBX_DLL KFbxTRSCache
01298 {
01299
01300 public:
01301
01302 KFbxTRSCache();
01303 ~KFbxTRSCache();
01304
01305 void Reset();
01306
01307 int mTIndex;
01308 int mRIndex;
01309 int mSIndex;
01310
01311
01312 KTime mLocalTTime;
01313 KTime mLocalRTime;
01314 KTime mLocalSTime;
01315
01316 bool mLocalTValid;
01317 bool mLocalRValid;
01318 bool mLocalSValid;
01319
01320 KFbxVector4 mLocalT;
01321 KFbxVector4 mLocalR;
01322 KFbxVector4 mLocalS;
01323
01324
01325 bool mGlobalValid;
01326
01327 KTime mGlobalTime;
01328 KFbxXMatrix mGlobalMatrix;
01329
01330 KFbxVector4 mGlobalT;
01331 KFbxXMatrix mGlobalR;
01332 KFbxXMatrix mGlobalS;
01333
01334 };
01335
01336 void ComputeTRSLocalFromDefaultTake(bool pApplyLimits = false);
01337 void ComputeTRSLocalFromCurrentTake(KTime pTime, bool pApplyLimits = false);
01338
01339
01340 KFbxTRSCache mTRSCache;
01341 KFbxTRSCache mDefaultTRSCache;
01342
01343
01344
01345
01346
01347 class KFBX_DLL KFbxState
01348 {
01349
01350 public:
01351
01352 KFbxState();
01353 ~KFbxState();
01354
01355 void Reset();
01356
01357 kUInt mId;
01358
01359 KFbxXMatrix mMatrix;
01360
01361 KFbxVector4 mT;
01362 KFbxXMatrix mR;
01363 KFbxXMatrix mS;
01364 };
01365
01366 KFbxState mLocalState;
01367 KFbxState mGlobalState;
01368
01369
01370
01371 KFbxNodeLimits* mLimits;
01372
01373 bool mSelected;
01374
01375
01376
01377 int AddCharacterLink(KFbxCharacter* pCharacter, int pCharacterLinkType, int pNodeId, int pNodeSubId);
01378 int RemoveCharacterLink(KFbxCharacter* pCharacter, int pCharacterLinkType, int pNodeId, int pNodeSubId);
01379
01380 KArrayTemplate<KFbxLinkToCharacter> mLinkToCharacter;
01381
01382
01383
01384 mutable KError mError;
01385
01386 friend class KFbxReaderFbx;
01387 friend class KFbxReaderFbx6;
01388 friend class KFbxWriterFbx;
01389 friend class KFbxWriterFbx6;
01390 friend class KFbxScene;
01391 friend class KFbxGeometry;
01392 friend class KFbxLight;
01393 friend class KFbxNodeFinderDuplicateName;
01394 friend class KFbxCharacter;
01395 friend class KFbxControlSet;
01396 friend class KFbxNode_internal;
01397 friend class KFbxNodeAttribute_internal;
01398 friend class KFbxSurfaceMaterial_internal;
01399 friend class KFbxTexture_internal;
01400 friend class KFbxVideo_internal;
01401
01402 friend class KFbxNodeLimits;
01403 friend class KFbxLimits;
01404
01405
01406
01407
01408
01409 typedef enum { eCULLING_OFF, eCULLING_ON_CCW, eCULLING_ON_CW } ECullingType;
01410
01411 ECullingType mCullingType;
01412
01413 public:
01414 KFbxXMatrix GetLXFromLocalState( bool pT, bool pR, bool pS, bool pSoff );
01415
01416 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01417
01418 };
01419
01420 typedef class KFBX_DLL KArrayTemplate<KFbxNode::KFbxLinkToCharacter> KArrayKFbxNodeKFbxLinkToCharacter;
01421 typedef KFbxNode* HKFbxNode;
01422 typedef class KFBX_DLL KArrayTemplate<KFbxNode*> KArrayKFbxNode;
01423
01424 #include <fbxfilesdk_nsend.h>
01425
01426 #endif
01427
01428