fbxnode.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_SCENE_GEOMETRY_NODE_H_
00014 #define _FBXSDK_SCENE_GEOMETRY_NODE_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/fbxobject.h>
00019 #include <fbxsdk/core/base/fbxarray.h>
00020 #include <fbxsdk/core/base/fbxerror.h>
00021 #include <fbxsdk/core/base/fbxstring.h>
00022 #include <fbxsdk/core/base/fbxtime.h>
00023 #include <fbxsdk/core/math/fbxvector4.h>
00024 #include <fbxsdk/core/math/fbxmatrix.h>
00025 #include <fbxsdk/core/math/fbxaffinematrix.h>
00026 #include <fbxsdk/core/math/fbxtransforms.h>
00027 #include <fbxsdk/scene/fbxgroupname.h>
00028 
00029 #include <fbxsdk/fbxsdk_nsbegin.h>
00030 
00031 class FbxNodeAttribute;
00032 class FbxScene;
00033 class FbxAnimStack;
00034 class FbxAnimLayer;
00035 class FbxManager;
00036 class FbxCachedEffect;
00037 class FbxLODGroup;
00038 class FbxNull;
00039 class FbxMarker;
00040 class FbxSkeleton;
00041 class FbxGeometry;
00042 class FbxMesh;
00043 class FbxNurbs;
00044 class FbxNurbsCurve;
00045 class FbxLine;
00046 class FbxNurbsSurface;
00047 class FbxTrimNurbsSurface;
00048 class FbxPatch;
00049 class FbxCamera;
00050 class FbxCameraStereo;
00051 class FbxCameraSwitcher;
00052 class FbxLight;
00053 class FbxOpticalReference;
00054 class FbxCharacter;
00055 class FbxNode_internal;
00056 class FbxSurfaceMaterial;
00057 class FbxSubDiv;
00058 class FbxNodeEvalState;
00059 
00083 class FBXSDK_DLL FbxNode : public FbxObject
00084 {
00085     FBXSDK_OBJECT_DECLARE(FbxNode, FbxObject);
00086 
00087 public:
00095         FbxNode* GetParent();
00096         FbxNode const* GetParent() const;
00097 
00105         bool AddChild(FbxNode* pNode);
00106 
00111         FbxNode* RemoveChild(FbxNode* pNode);
00112 
00117         int GetChildCount(bool pRecursive = false) const;
00118 
00123         FbxNode* GetChild(int pIndex);
00124 
00129         FbxNode const* GetChild(int pIndex) const;
00130 
00138         FbxNode* FindChild(char const* pName, bool pRecursive = true, bool pInitial = false);
00139 
00141 
00169         void SetTarget(FbxNode* pNode);
00170 
00174         FbxNode* GetTarget() const;
00175 
00179         void SetPostTargetRotation(FbxVector4 pVector);
00180 
00184         FbxVector4 GetPostTargetRotation() const;
00185 
00189         void SetTargetUp(FbxNode* pNode);
00190 
00194         FbxNode* GetTargetUp() const;
00195 
00199         void SetTargetUpVector(FbxVector4 pVector);
00200 
00204         FbxVector4 GetTargetUpVector() const;
00206 
00225         void SetVisibility(bool pIsVisible);
00226 
00232         bool GetVisibility() const;
00233 
00240         enum EShadingMode
00241         {
00242             eHardShading,               
00243             eWireFrame,             
00244             eFlatShading,               
00245             eLightShading,              
00246             eTextureShading,            
00247             eFullShading        
00248         };
00249 
00253         void SetShadingMode(EShadingMode pShadingMode);
00254 
00258         EShadingMode GetShadingMode() const;
00260 
00274         FbxNodeAttribute* SetNodeAttribute(FbxNodeAttribute* pNodeAttribute);
00275 
00281         FbxNodeAttribute* GetNodeAttribute();
00282 
00288         FbxNodeAttribute const* GetNodeAttribute() const;
00289 
00291         int GetNodeAttributeCount() const;
00292 
00297         int GetDefaultNodeAttributeIndex() const;
00298 
00305         bool SetDefaultNodeAttributeIndex(int pIndex);
00306 
00312         FbxNodeAttribute* GetNodeAttributeByIndex(int pIndex);
00313 
00319         FbxNodeAttribute const* GetNodeAttributeByIndex(int pIndex) const;
00320 
00329         int GetNodeAttributeIndex(FbxNodeAttribute* pNodeAttribute) const;
00330 
00341         bool AddNodeAttribute(FbxNodeAttribute* pNodeAttribute);
00342 
00348         FbxNodeAttribute* RemoveNodeAttribute(FbxNodeAttribute* pNodeAttribute);
00349 
00358         FbxNodeAttribute* RemoveNodeAttributeByIndex(int pIndex);
00359 
00365         FbxCachedEffect* GetCachedEffect();
00366 
00372         FbxLODGroup* GetLodGroup();
00373 
00379         FbxNull* GetNull();
00380 
00386         FbxMarker* GetMarker();
00387 
00393         FbxSkeleton* GetSkeleton();
00394 
00411         FbxGeometry* GetGeometry();
00412 
00421         FbxMesh* GetMesh();
00422 
00431         FbxNurbs* GetNurbs();
00432 
00441         FbxNurbsSurface* GetNurbsSurface();
00442 
00451         FbxNurbsCurve* GetNurbsCurve();
00452 
00461         FbxLine* GetLine();
00462 
00471         FbxTrimNurbsSurface* GetTrimNurbsSurface();
00472 
00481         FbxSubDiv* GetSubdiv();
00482 
00491         FbxPatch* GetPatch();
00492 
00498         FbxCamera* GetCamera();
00499         const FbxCamera* GetCamera() const;
00500 
00506         FbxCameraStereo* GetCameraStereo();
00507 
00513         FbxCameraSwitcher* GetCameraSwitcher();
00514 
00520         FbxLight* GetLight();
00521         const FbxLight * GetLight() const;
00522 
00528         FbxOpticalReference* GetOpticalReference();
00530 
00544         void SetTransformationInheritType(FbxTransform::EInheritType pInheritType);
00545 
00547         void GetTransformationInheritType(FbxTransform::EInheritType& pInheritType) const;
00549 
00667         enum EPivotSet
00668         {
00669             eSourcePivot,       
00670             eDestinationPivot   
00671         };
00672 
00675         enum EPivotState
00676         {
00677             ePivotActive,   
00678             ePivotReference 
00679         };
00680 
00685         void SetPivotState(EPivotSet pPivotSet, EPivotState pPivotState);
00686 
00693         void GetPivotState(EPivotSet pPivotSet, EPivotState& pPivotState) const;
00694 
00700         void SetRotationOrder(EPivotSet pPivotSet, EFbxRotationOrder pRotationOrder);
00701 
00706         void GetRotationOrder(EPivotSet pPivotSet, EFbxRotationOrder& pRotationOrder) const;
00707 
00717         void SetUseRotationSpaceForLimitOnly(EPivotSet pPivotSet, bool pUseForLimitOnly);
00718 
00723         bool GetUseRotationSpaceForLimitOnly(EPivotSet pPivotSet) const;
00724 
00730         void SetRotationActive(bool pVal);
00731 
00735         bool GetRotationActive() const;
00736 
00743         void SetQuaternionInterpolation(EPivotSet pPivotSet, EFbxQuatInterpMode pQuatIterp);
00744 
00749         EFbxQuatInterpMode GetQuaternionInterpolation(EPivotSet pPivotSet) const;
00750 
00759         void SetRotationStiffness(FbxVector4 pRotationStiffness);
00760 
00764         FbxVector4 GetRotationStiffness() const;
00765 
00774         void SetMinDampRange(FbxVector4 pMinDampRange);
00775 
00779         FbxVector4 GetMinDampRange() const;
00780 
00781 
00790         void SetMaxDampRange(FbxVector4 pMaxDampRange);
00791 
00795         FbxVector4 GetMaxDampRange() const;
00796 
00797 
00806         void SetMinDampStrength(FbxVector4 pMinDampStrength);
00807 
00811         FbxVector4 GetMinDampStrength() const;
00812 
00813 
00822         void SetMaxDampStrength(FbxVector4 pMaxDampStrength);
00823 
00827         FbxVector4 GetMaxDampStrength() const;
00828 
00834         void SetPreferedAngle(FbxVector4 pPreferedAngle);
00835 
00839         FbxVector4 GetPreferedAngle() const;
00840 
00846         void SetRotationOffset(EPivotSet pPivotSet, FbxVector4 pVector);
00847 
00853         const FbxVector4& GetRotationOffset(EPivotSet pPivotSet) const;
00854 
00861         void SetRotationPivot(EPivotSet pPivotSet, FbxVector4 pVector);
00862 
00869         const FbxVector4& GetRotationPivot(EPivotSet pPivotSet) const;
00870 
00877         void SetPreRotation(EPivotSet pPivotSet, FbxVector4 pVector);
00878 
00885         const FbxVector4& GetPreRotation(EPivotSet pPivotSet) const;
00886 
00893         void SetPostRotation(EPivotSet pPivotSet, FbxVector4 pVector);
00894 
00901         const FbxVector4& GetPostRotation(EPivotSet pPivotSet) const;
00902 
00908         void SetScalingOffset(EPivotSet pPivotSet, FbxVector4 pVector);
00909 
00915         const FbxVector4& GetScalingOffset(EPivotSet pPivotSet) const;
00916 
00923         void SetScalingPivot(EPivotSet pPivotSet, FbxVector4 pVector);
00924 
00931         const FbxVector4& GetScalingPivot(EPivotSet pPivotSet) const;
00932 
00941         void SetGeometricTranslation(EPivotSet pPivotSet, FbxVector4 pVector);
00942 
00947         FbxVector4 GetGeometricTranslation(EPivotSet pPivotSet) const;
00948 
00957         void SetGeometricRotation(EPivotSet pPivotSet, FbxVector4 pVector);
00958 
00963         FbxVector4 GetGeometricRotation(EPivotSet pPivotSet) const;
00964 
00973         void SetGeometricScaling(EPivotSet pPivotSet, FbxVector4 pVector);
00974 
00979         FbxVector4 GetGeometricScaling(EPivotSet pPivotSet) const;
00980 
00987         void ResetPivotSet( FbxNode::EPivotSet pPivotSet );
00988 
01011         void ConvertPivotAnimation(EPivotSet pConversionTarget, double pFrameRate, bool pKeyReduce=true);
01012         
01043         void ConvertPivotAnimationRecursive(const char * pAnimStackName,
01044             EPivotSet pConversionTarget, double pFrameRate, bool pKeyReduce=true);
01045 
01059         void ResetPivotSetAndConvertAnimation( double pFrameRate=30., bool pKeyReduce=false, bool pToNodeCenter=true, bool pForceResetLimits = false );
01060 
01064         void SetRotationPivotAsCenterRecursive(FbxVector4 pParentGeometricOffset = FbxVector4());
01066 
01078         FbxAMatrix& EvaluateGlobalTransform(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false);
01079 
01091         FbxAMatrix& EvaluateLocalTransform(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false);
01092 
01102         FbxVector4& EvaluateLocalTranslation(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false);
01103 
01114         FbxVector4& EvaluateLocalRotation(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false);
01115 
01125         FbxVector4& EvaluateLocalScaling(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false);
01127 
01128 
01136         int GetCharacterLinkCount() const;
01137 
01150         bool GetCharacterLink(int pIndex, FbxCharacter** pCharacter, int* pCharacterLinkType, int* pNodeId, int *pNodeSubId);
01151 
01163         int FindCharacterLink(FbxCharacter* pCharacter, int pCharacterLinkType, int pNodeId, int pNodeSubId) const;
01165 
01184     virtual bool GetAnimationInterval(FbxTimeSpan& pSpan, FbxAnimStack* pAnimStack = NULL, int pAnimLayerId = 0);
01185 
01186 
01191 
01196         int AddMaterial( FbxSurfaceMaterial* pMaterial );
01197 
01202         bool RemoveMaterial( FbxSurfaceMaterial* pMaterial );
01203 
01210         int GetMaterialCount() const;
01211 
01216         FbxSurfaceMaterial* GetMaterial( int pIndex ) const;
01217 
01220         void RemoveAllMaterials();
01221 
01227         int GetMaterialIndex( char const* pName ) const;
01229 
01238         FbxError& GetError();
01239 
01242         enum EErrorCode
01243         {
01244             eIndexOutOfRange,       
01245             eAttributeNotConnected, 
01246             eErrorCount
01247         };
01248 
01252         EErrorCode GetLastErrorID() const;
01253 
01257         const char* GetLastErrorString() const;
01259 
01260 
01272         FbxPropertyT<FbxDouble3>               LclTranslation;
01273 
01281         FbxPropertyT<FbxDouble3>               LclRotation;
01282 
01290         FbxPropertyT<FbxDouble3>               LclScaling;
01291 
01310         FbxPropertyT<FbxDouble>               Visibility;
01311 
01329         FbxPropertyT<FbxBool>                   VisibilityInheritance;
01330 
01331 
01339         FbxPropertyT<EFbxQuatInterpMode>  QuaternionInterpolate;
01340 
01348         FbxPropertyT<FbxDouble3>               RotationOffset;
01349 
01357         FbxPropertyT<FbxDouble3>               RotationPivot;
01358 
01366         FbxPropertyT<FbxDouble3>               ScalingOffset;
01367 
01375         FbxPropertyT<FbxDouble3>               ScalingPivot;
01376 
01384         FbxPropertyT<FbxBool>                 TranslationActive;
01385 
01392         FbxPropertyT<FbxDouble3>               Translation;
01393 
01401         FbxPropertyT<FbxDouble3>               TranslationMin;
01402 
01410         FbxPropertyT<FbxDouble3>               TranslationMax;
01411 
01419         FbxPropertyT<FbxBool>                 TranslationMinX;
01420 
01428         FbxPropertyT<FbxBool>                 TranslationMinY;
01429 
01437         FbxPropertyT<FbxBool>                 TranslationMinZ;
01438 
01446         FbxPropertyT<FbxBool>                 TranslationMaxX;
01447 
01455         FbxPropertyT<FbxBool>                 TranslationMaxY;
01456 
01464         FbxPropertyT<FbxBool>                 TranslationMaxZ;
01465 
01473         FbxPropertyT<EFbxRotationOrder>           RotationOrder;
01474 
01482         FbxPropertyT<FbxBool>                 RotationSpaceForLimitOnly;
01483 
01491         FbxPropertyT<FbxDouble>               RotationStiffnessX;
01492 
01500         FbxPropertyT<FbxDouble>               RotationStiffnessY;
01501 
01509         FbxPropertyT<FbxDouble>               RotationStiffnessZ;
01510 
01518         FbxPropertyT<FbxDouble>               AxisLen;
01519      
01527         FbxPropertyT<FbxDouble3>               PreRotation;
01528 
01536         FbxPropertyT<FbxDouble3>               PostRotation;
01537 
01545         FbxPropertyT<FbxBool>                 RotationActive;
01546 
01554         FbxPropertyT<FbxDouble3>               RotationMin;
01555 
01563         FbxPropertyT<FbxDouble3>               RotationMax;
01564 
01572         FbxPropertyT<FbxBool>                 RotationMinX;
01573 
01581         FbxPropertyT<FbxBool>                 RotationMinY;
01582 
01590         FbxPropertyT<FbxBool>                 RotationMinZ;
01591 
01599         FbxPropertyT<FbxBool>                 RotationMaxX;
01600 
01608         FbxPropertyT<FbxBool>                 RotationMaxY;
01609 
01617         FbxPropertyT<FbxBool>                 RotationMaxZ;
01618 
01626         FbxPropertyT<FbxTransform::EInheritType>    InheritType;
01627 
01635         FbxPropertyT<FbxBool>                 ScalingActive;
01636 
01643         FbxPropertyT<FbxDouble3>               Scaling;
01644 
01652         FbxPropertyT<FbxDouble3>               ScalingMin;
01653 
01661         FbxPropertyT<FbxDouble3>               ScalingMax;
01662 
01670         FbxPropertyT<FbxBool>                 ScalingMinX;
01671 
01679         FbxPropertyT<FbxBool>                 ScalingMinY;
01680 
01688         FbxPropertyT<FbxBool>                 ScalingMinZ;
01689 
01697         FbxPropertyT<FbxBool>                 ScalingMaxX;
01698 
01706         FbxPropertyT<FbxBool>                 ScalingMaxY;
01707 
01715         FbxPropertyT<FbxBool>                 ScalingMaxZ;
01716 
01724         FbxPropertyT<FbxDouble3>               GeometricTranslation;
01725 
01733         FbxPropertyT<FbxDouble3>               GeometricRotation;
01734      
01742         FbxPropertyT<FbxDouble3>               GeometricScaling;
01743 
01744         // IK Settings
01746 
01754         FbxPropertyT<FbxDouble>               MinDampRangeX;
01755 
01763         FbxPropertyT<FbxDouble>               MinDampRangeY;
01764 
01772         FbxPropertyT<FbxDouble>               MinDampRangeZ;
01773 
01781         FbxPropertyT<FbxDouble>               MaxDampRangeX;
01782 
01790         FbxPropertyT<FbxDouble>               MaxDampRangeY;
01791 
01799         FbxPropertyT<FbxDouble>               MaxDampRangeZ;
01800 
01808         FbxPropertyT<FbxDouble>               MinDampStrengthX;
01809 
01817         FbxPropertyT<FbxDouble>               MinDampStrengthY;
01818 
01826         FbxPropertyT<FbxDouble>               MinDampStrengthZ;
01827 
01835         FbxPropertyT<FbxDouble>               MaxDampStrengthX;
01836 
01844         FbxPropertyT<FbxDouble>               MaxDampStrengthY;
01845 
01853         FbxPropertyT<FbxDouble>               MaxDampStrengthZ;
01854 
01862         FbxPropertyT<FbxDouble>               PreferedAngleX;
01863 
01871         FbxPropertyT<FbxDouble>               PreferedAngleY;
01872 
01880         FbxPropertyT<FbxDouble>               PreferedAngleZ;
01882 
01889         FbxPropertyT<FbxReference>            LookAtProperty;
01890 
01897         FbxPropertyT<FbxReference>            UpVectorProperty;
01898 
01921         FbxPropertyT<FbxBool>                 Show;
01922 
01930         FbxPropertyT<FbxBool>                 NegativePercentShapeSupport;
01931 
01939         FbxPropertyT<FbxInt>              DefaultAttributeIndex;
01940 
01948         FbxPropertyT<FbxBool>              Freeze;
01949 
01959         FbxPropertyT<FbxBool>              LODBox;
01961 
01963 //
01964 //  WARNING!
01965 //
01966 //  Anything beyond these lines may not be documented accurately and is 
01967 //  subject to change without notice.
01968 //
01970 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01971     void                    AddChildName(char* pChildName);
01972     char*                   GetChildName(FbxUInt pIndex) const;
01973     FbxUInt                 GetChildNameCount() const;
01974 
01975     FbxTransform&           GetTransform();
01976     FbxLimits&              GetTranslationLimits();
01977     FbxLimits&              GetRotationLimits();
01978     FbxLimits&              GetScalingLimits();
01979 
01980     void                    UpdatePivotsAndLimitsFromProperties();
01981     void                    UpdatePropertiesFromPivotsAndLimits();
01982 
01983     void                    SetRotationActiveProperty(bool pVal);
01984     void                    PivotSetToMBTransform(EPivotSet pPivotSet);
01985 
01986     int                     AddCharacterLink(FbxCharacter* pCharacter, int pCharacterLinkType, int pNodeId, int pNodeSubId);
01987     int                     RemoveCharacterLink(FbxCharacter* pCharacter, int pCharacterLinkType, int pNodeId, int pNodeSubId);
01988 
01989     virtual FbxObject&      Copy(const FbxObject& pObject);
01990     virtual const char*     GetTypeName() const;
01991     virtual FbxStringList   GetTypeFlags() const;
01992     virtual bool            PropertyNotify(EPropertyNotifyType pType, FbxProperty* pProperty);
01993 
01994     enum ECullingType
01995     {
01996         eCullingOff,
01997         eCullingOnCCW,
01998         eCullingOnCW
01999     };
02000 
02001     ECullingType            mCullingType;
02002     bool                    mCorrectInheritType;
02003 
02004 protected:
02005     FbxNode(FbxManager& pManager, char const* pName);
02006 
02007     virtual void        Construct(const FbxNode* pFrom);
02008     virtual bool        ConstructProperties(bool pForceSet);
02009     virtual void        Destruct(bool pRecursive, bool pDependents);
02010     void                Reset();
02011     bool                GetAnimationIntervalRecursive(FbxTimeSpan& pTimeInterval, FbxAnimLayer* pAnimLayer);
02012 
02013 private:
02014     void                ResetLimitsRecursive(FbxNode* pNode);
02015     void                ConvertPivotAnimationRecursiveWrapper(const char * pAnimStackName, EPivotSet pConversionTarget, double pFrameRate, bool pKeyReduce);
02016     FbxNode&            DeepCopy(const FbxNode& pNode, bool pCopyNodeAttribute);
02017 
02018     FbxTransform        mTransform;
02019     FbxNode_internal*   mPH;
02020     mutable FbxError    mError;
02021 
02022     friend class FbxScene;
02023     friend class FbxGeometry;
02024     friend class FbxLight;
02025     friend class FbxNodeFinderDuplicateName;
02026     friend class FbxCharacter;
02027     friend class FbxControlSet;
02028     friend class FbxNode_internal;
02029     friend class FbxNodeEvalState;
02030 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
02031 };
02032 
02033 inline EFbxType FbxTypeOf(const EFbxRotationOrder&){ return eFbxEnum; }
02034 inline EFbxType FbxTypeOf(const FbxTransform::EInheritType&){ return eFbxEnum; }
02035 inline EFbxType FbxTypeOf(const EFbxQuatInterpMode&){ return eFbxEnum; }
02036 
02037 #include <fbxsdk/fbxsdk_nsend.h>
02038 
02039 #endif /* _FBXSDK_SCENE_GEOMETRY_NODE_H_ */