kfbxscene.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002 
00003    Copyright (C) 2010 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 
00014 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXSCENE_H
00015 #define FBXFILESDK_KFBXPLUGINS_KFBXSCENE_H
00016 
00017 
00018 #include <fbxfilesdk/fbxfilesdk_def.h>
00019 
00020 #include <fbxfilesdk/fbxcore/fbxcollection/kfbxdocument.h>
00021 
00022 #include <fbxfilesdk/kfbxplugins/kfbxdeformer.h>
00023 #include <fbxfilesdk/kfbxplugins/kfbxsubdeformer.h>
00024 #include <fbxfilesdk/kfbxplugins/kfbxlayer.h>
00025 #include <fbxfilesdk/kfbxplugins/kfbxnodeattribute.h>
00026 #include <fbxfilesdk/kfbxplugins/kfbxglobalsettings.h>
00027 #include <fbxfilesdk/kfbxplugins/kfbxanimevaluator.h>
00028 
00029 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00030 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00031 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00032 #include <fbxfilesdk/components/kbaselib/klib/kcharptrset.h>
00033 
00034 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00035 
00036 class KFbxSdkManager;
00037 class KFbxObject;
00038 class KFbxNode;
00039 class KFbxVideo;
00040 class KFbxTexture;
00041 class KFbxSurfaceMaterial;
00042 class KFbxMarkerSet;
00043 class KFbxActor;
00044 class KFbxCharacter;
00045 class KFbxControlSetPlug;
00046 class KFbxCharacterPose;
00047 class KFbxPose;
00048 class KFbxDocumentInfo;
00049 class KFbxTakeInfo;
00050 class KFbxGlobalSettings;
00051 class KFbxGenericNode;
00052 class KFbxConstraint;
00053 class KFbxGeometry;
00054 class KFbxLayerContainer;
00055 class KSet;
00056 
00057 class KFbxGlobalLightSettings;
00058 class KFbxGlobalCameraSettings;
00059 class KFbxGlobalTimeSettings;
00060 
00061 
00082 class KFBX_DLL KFbxScene : public KFbxDocument
00083 {
00084     KFBXOBJECT_DECLARE(KFbxScene, KFbxDocument);
00085 
00086 public:
00091 
00092     void Clear();
00094 
00099 
00106     KFbxNode* GetRootNode() const;
00108 
00113 
00117     void FillTextureArray(KArrayTemplate<KFbxTexture*>& pTextureArray);
00118 
00122     void FillMaterialArray(KArrayTemplate<KFbxSurfaceMaterial*>& pMaterialArray);
00123 
00125 
00130 
00134     int             GetGenericNodeCount() const;
00135 
00140     KFbxGenericNode* GetGenericNode(int pIndex);
00141 
00146     KFbxGenericNode* GetGenericNode(char* pName);
00147 
00152     bool             AddGenericNode(KFbxGenericNode* pGenericNode);
00153 
00159     bool             RemoveGenericNode(KFbxGenericNode* pGenericNode);
00160 
00162 
00163 
00168 
00172     int GetCharacterCount() const;
00173 
00178     KFbxCharacter* GetCharacter(int pIndex);
00179 
00184     int CreateCharacter(char* pName);
00185 
00189     void DestroyCharacter(int pIndex);
00190 
00192 
00197 
00201     int GetControlSetPlugCount() const;
00202 
00207     KFbxControlSetPlug* GetControlSetPlug(int pIndex);
00208 
00213     int CreateControlSetPlug(char* pName);
00214 
00218     void DestroyControlSetPlug(int pIndex);
00219 
00221 
00226 
00231     int GetCharacterPoseCount() const;
00232 
00237     KFbxCharacterPose* GetCharacterPose(int pIndex);
00238 
00243     int CreateCharacterPose(char* pName);
00244 
00248     void DestroyCharacterPose(int pIndex);
00249 
00251 
00256 
00261     int GetPoseCount() const;
00262 
00267     KFbxPose* GetPose(int pIndex);
00268 
00274     bool AddPose(KFbxPose* pPose);
00275 
00281     bool RemovePose(KFbxPose* pPose);
00282 
00288     bool RemovePose(int pIndex);
00289 
00290 
00292 
00296 
00300     inline KFbxDocumentInfo* GetSceneInfo() { return GetDocumentInfo(); }
00301 
00305     inline void SetSceneInfo(KFbxDocumentInfo* pSceneInfo) { SetDocumentInfo(pSceneInfo); }
00306 
00308 
00313 
00317     KFbxGlobalSettings& GetGlobalSettings();
00318 
00322     const KFbxGlobalSettings& GetGlobalSettings() const;
00324 
00345 
00349         void SetEvaluator(KFbxAnimEvaluator* pEvaluator);
00350 
00356         KFbxAnimEvaluator* GetEvaluator();
00357 
00359 
00363     K_DEPRECATED void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray);
00364 
00368     void FillPoseArray(KArrayTemplate<KFbxPose*>& pPoseArray);
00369 
00370 
00375 
00379     int                     GetMaterialCount            () const;
00380 
00386     KFbxSurfaceMaterial*            GetMaterial                 (int pIndex);
00387 
00392     KFbxSurfaceMaterial*            GetMaterial                 (char* pName);
00393 
00398     bool                    AddMaterial                 (KFbxSurfaceMaterial* pMaterial);
00399 
00404     bool                    RemoveMaterial              (KFbxSurfaceMaterial* pMaterial);
00405 
00407 
00412 
00422     int                     GetTextureCount             () const;
00423 
00434     KFbxTexture*            GetTexture                  (int pIndex);
00435 
00440     KFbxTexture*            GetTexture                  (char* pName);
00441 
00446     bool                    AddTexture                  (KFbxTexture* pTexture);
00447 
00452     bool                    RemoveTexture               (KFbxTexture* pTexture);
00453 
00455 
00460 
00464     int                     GetNodeCount                () const;
00465 
00471     KFbxNode*               GetNode                     (int pIndex);
00472 
00477     bool                    AddNode                     (KFbxNode* pNode);
00478 
00483     bool                    RemoveNode                  (KFbxNode* pNode);
00484 
00491     int                     GetCurveOnSurfaceCount      ();
00492 
00497     KFbxNode*               FindNodeByName              ( const KString& pName );
00498 
00500 
00505 
00509     int                     GetGeometryCount            () const;
00510 
00516     KFbxGeometry*           GetGeometry                 (int pIndex);
00517 
00522     bool                    AddGeometry                 (KFbxGeometry* pGeometry);
00523 
00528     bool                    RemoveGeometry              (KFbxGeometry* pGeometry);
00529 
00531 
00536 
00540     int                     GetVideoCount               () const;
00541 
00547     KFbxVideo*              GetVideo                    (int pIndex);
00548 
00553     bool                    AddVideo                    (KFbxVideo* pVideo);
00554 
00559     bool                    RemoveVideo                 (KFbxVideo* pVideo);
00560 
00562 
00579     void SyncShowPropertyForInstance();
00581 
00582 //
00583 //  WARNING!
00584 //
00585 //  Anything beyond these lines may not be documented accurately and is
00586 //  subject to change without notice.
00587 //
00589 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00590     virtual KFbxObject& Copy(const KFbxObject& pObject);
00591 
00592     void ConnectMaterials();
00593 
00594     void BuildMaterialLayersDirectArray();
00595     void ReindexMaterialConnections(); // called to make sure that eINDEX is remapped to eINDEX_TO_DIRECT
00596 
00597     KSet* AddTakeTimeWarpSet(char *pTakeName);
00598     KSet* GetTakeTimeWarpSet(char *pTakeName);
00599 
00600     // This function will destroy the scene (and all the objects directly connected to it) without sending 
00601     // the Connect notifications nor trying to disconnect the objects first. This is a bypass of the intended
00602     // workflow and should be used with care.
00603     void ForceKill();
00604 
00605 private:
00606     KFbxScene(KFbxSdkManager& pManager, char const* pName);
00607 
00608     virtual void Construct(const KFbxScene* pFrom);
00609     virtual void Destruct(bool pRecursive, bool pDependents);
00610 
00611     // Don't mark it as DEPRECATED to avoid useless warning. This method is only called by
00612     // FillNodeArray() and the method is already makred as deprecated. When FillNodeArray is going to 
00613     // be removed, FillNodeArrayRecursive will be too.
00614     void FillNodeArrayRecursive(KArrayTemplate<KFbxNode*>& pNodeArray, kFbxClassId classId, KFbxNode* pNode);
00615 
00616     void ConnectTextureLayerElement(KFbxLayerContainer* pLayerContainer,
00617                                     KFbxLayerElement::ELayerElementType pLayerType,
00618                                     KFbxNode* pParentNode);
00619 
00620     void BuildTextureLayersDirectArrayForLayerType(KFbxLayerContainer* pLayerContainer,
00621                                                    KFbxLayerElement::ELayerElementType pLayerType);
00622 
00623 public:
00624     void ConvertNurbsSurfaceToNurb();
00625     void ConvertMeshNormals();
00626     void ConvertNurbCurvesToNulls();
00627     void ConnectTextures();
00628     void BuildTextureLayersDirectArray();
00629     void FixInheritType(KFbxNode *pNode);
00630 
00636     void UpdateScaleCompensate(KFbxNode *pNode, KFbxIOSettings& pIOS);
00637 
00638     kFbxClassId ConvertAttributeTypeToClassID(KFbxNodeAttribute::EAttributeType pAttributeType);
00639 
00645     KFbxGlobalLightSettings&  GlobalLightSettings()  { return *mGlobalLightSettings; }
00647     KFbxGlobalCameraSettings& GlobalCameraSettings() { return *mGlobalCameraSettings; }
00649     KFbxGlobalTimeSettings&   GlobalTimeSettings()   { return *mGlobalTimeSettings; }
00650 
00651 private:
00652     KFbxNode*                           mRootNode;
00653 
00654     KFbxGlobalLightSettings*            mGlobalLightSettings;
00655     KFbxGlobalCameraSettings*           mGlobalCameraSettings;
00656     KFbxGlobalTimeSettings*             mGlobalTimeSettings;
00657 
00658     KFbxAnimEvaluator*                  mEvaluator;
00659 
00660     KCharPtrSet                         mTakeTimeWarpSet;
00661 
00662     friend class KFbxLayerContainer;
00663     friend class KFbxNodeFinderDuplicateName;
00664 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00665 };
00666 
00667 typedef  class KFBX_DLL KArrayTemplate<KFbxTakeInfo *>          KArrayKFbxTakeInfo;
00668 typedef KFbxScene* HKFbxScene;
00669 
00670 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00671 
00672 #endif // FBXFILESDK_KFBXPLUGINS_KFBXSCENE_H
00673