FBX SDK Reference Guide: kfbxscene.h Source File
Go to the documentation of this file.
00001 
00003 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXSCENE_H
00004 #define FBXFILESDK_KFBXPLUGINS_KFBXSCENE_H
00005 
00006 /**************************************************************************************
00007 
00008  Copyright (C)2001 - 2008 Autodesk, Inc. and/or its licensors.
00009  All Rights Reserved.
00010 
00011  The coded instructions, statements, computer programs, and/or related material 
00012  (collectively the "Data") in these files contain unpublished information 
00013  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00014  Canada and United States of America federal copyright law and by international 
00015  treaties. 
00016  
00017  The Data may not be disclosed or distributed to third parties, in whole or in
00018  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00019 
00020  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00021  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00022  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00023  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00024  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00025  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00026  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00027  
00028  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00029  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00030  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00031  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00032  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00033  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00034  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00035  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00036  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00037  OR DAMAGE. 
00038 
00039 **************************************************************************************/
00040 
00041 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00042 #include <fbxfilesdk/components/kbaselib/kaydara.h>
00043 
00044 #include <fbxfilesdk/fbxcore/fbxcollection/kfbxdocument.h>
00045 
00046 #include <fbxfilesdk/kfbxplugins/kfbxdeformer.h>
00047 #include <fbxfilesdk/kfbxplugins/kfbxsubdeformer.h>
00048 #include <fbxfilesdk/kfbxplugins/kfbxlayer.h>
00049 #include <fbxfilesdk/kfbxplugins/kfbxnodeattribute.h>
00050 #include <fbxfilesdk/kfbxplugins/kfbxglobalsettings.h>
00051 
00052 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00053 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00054 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00055 #include <fbxfilesdk/components/kbaselib/klib/kcharptrset.h>
00056 
00057 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00058 
00059 class KFbxSdkManager;
00060 class KFbxObject;
00061 class KFbxNode;
00062 class KFbxVideo;
00063 class KFbxTexture;
00064 class KFbxSurfaceMaterial;
00065 class KFbxMarkerSet;
00066 class KFbxActor;
00067 class KFbxCharacter;
00068 class KFbxControlSetPlug;
00069 class KFbxCharacterPose;
00070 class KFbxPose;
00071 class KFbxDocumentInfo;
00072 class KFbxTakeInfo;
00073 class KFbxGlobalLightSettings;
00074 class KFbxGlobalCameraSettings;
00075 class KFbxGlobalTimeSettings;
00076 class KFbxGlobalSettings;
00077 class KFbxGenericNode;
00078 class KFbxConstraint;
00079 class KFbxGeometry;
00080 class KFbxTakeNodeContainer;
00081 class KFbxLayerContainer;
00082 
00092 class KFBX_DLL KFbxScene : public KFbxDocument
00093 {
00094     KFBXOBJECT_DECLARE(KFbxScene,KFbxDocument);
00095 
00096 public:
00098     void Clear();
00099 
00104 
00111     KFbxNode* GetRootNode() const;
00112 
00113 
00121     K_DEPRECATED void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray,
00122         KFbxNodeAttribute::EAttributeType pAttributeType,
00123         bool pDepthFirst = false);
00124 
00132     void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray,
00133                        kFbxClassId classId,
00134                        bool pDepthFirst = false);
00135 
00137 
00142 
00146     void FillTextureArray(KArrayTemplate<KFbxTexture*>& pTextureArray);
00147 
00151     void FillMaterialArray(KArrayTemplate<KFbxSurfaceMaterial*>& pMaterialArray);
00152 
00154 
00159 
00163     int             GetGenericNodeCount();
00164 
00169     KFbxGenericNode* GetGenericNode(int pIndex);
00170 
00175     KFbxGenericNode* GetGenericNode(char* pName);
00176 
00181     bool             AddGenericNode(KFbxGenericNode* pGenericNode);
00182 
00188     bool             RemoveGenericNode(KFbxGenericNode* pGenericNode);
00189 
00191 
00192 
00197 
00201     int GetCharacterCount();
00202 
00207     KFbxCharacter* GetCharacter(int pIndex);
00208 
00213     int CreateCharacter(char* pName);
00214 
00219     void DestroyCharacter(int pIndex);
00220 
00222 
00227 
00231     int GetControlSetPlugCount();
00232 
00237     KFbxControlSetPlug* GetControlSetPlug(int pIndex);
00238 
00243     int CreateControlSetPlug(char* pName);
00244 
00249     void DestroyControlSetPlug(int pIndex);
00250 
00252 
00257 
00262     int GetCharacterPoseCount();
00263 
00268     KFbxCharacterPose* GetCharacterPose(int pIndex);
00269 
00274     int CreateCharacterPose(char* pName);
00275 
00280     void DestroyCharacterPose(int pIndex);
00281 
00283 
00288 
00293     int GetPoseCount();
00294 
00299     KFbxPose* GetPose(int pIndex);
00300 
00306     bool AddPose(KFbxPose* pPose);
00307 
00313     bool RemovePose(KFbxPose* pPose);
00314 
00320     bool RemovePose(int pIndex);
00321 
00322 
00324 
00328 
00332     inline KFbxDocumentInfo* GetSceneInfo() { return GetDocumentInfo(); }
00333 
00337     inline void SetSceneInfo(KFbxDocumentInfo* pSceneInfo) { SetDocumentInfo(pSceneInfo); }
00338 
00340 
00345 
00349     KFbxGlobalLightSettings& GetGlobalLightSettings();
00350 
00354     KFbxGlobalCameraSettings& GetGlobalCameraSettings();
00355 
00359     KFbxGlobalTimeSettings& GetGlobalTimeSettings();
00360 
00364     KFbxGlobalSettings& GetGlobalSettings();
00365 
00369     const KFbxGlobalSettings& GetGlobalSettings() const;
00370 
00372 
00374 //
00375 //  WARNING!
00376 //
00377 //  Anything beyond these lines may not be documented accurately and is
00378 //  subject to change without notice.
00379 //
00381 
00382 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00383 
00384     void ConnectMaterials();
00385 
00386     void BuildMaterialLayersDirectArray();
00387     void ReindexMaterialConnections(); // called to make sure that eINDEX is remapped to eINDEX_TO_DIRECT
00388 
00392     void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray);
00393 
00397     void FillPoseArray(KArrayTemplate<KFbxPose*>& pPoseArray);
00398 
00399     // Clone
00400     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00401 
00402 
00407 
00411     int                     GetMaterialCount            ();
00412 
00418     KFbxSurfaceMaterial*            GetMaterial                 (int pIndex);
00419 
00424     KFbxSurfaceMaterial*            GetMaterial                 (char* pName);
00425 
00430     bool                    AddMaterial                 (KFbxSurfaceMaterial* pMaterial);
00431 
00436     bool                    RemoveMaterial              (KFbxSurfaceMaterial* pMaterial);
00437 
00439 
00444 
00448     int                     GetTextureCount             ();
00449 
00455     KFbxTexture*            GetTexture                  (int pIndex);
00456 
00461     KFbxTexture*            GetTexture                  (char* pName);
00462 
00467     bool                    AddTexture                  (KFbxTexture* pTexture);
00468 
00473     bool                    RemoveTexture               (KFbxTexture* pTexture);
00474 
00476 
00481 
00485     int                     GetNodeCount                ();
00486 
00492     KFbxNode*               GetNode                     (int pIndex);
00493 
00498     bool                    AddNode                     (KFbxNode* pNode);
00499 
00504     bool                    RemoveNode                  (KFbxNode* pNode);
00505 
00512     int                     GetCurveOnSurfaceCount      ();
00513 
00514     KFbxNode*               FindNodeByName              ( const KString& pName );
00515 
00517 
00522 
00526     int                     GetGeometryCount            ();
00527 
00533     KFbxGeometry*           GetGeometry                 (int pIndex);
00534 
00539     bool                    AddGeometry                 (KFbxGeometry* pGeometry);
00540 
00545     bool                    RemoveGeometry              (KFbxGeometry* pGeometry);
00546 
00548 
00553 
00557     int                     GetVideoCount               ();
00558 
00564     KFbxVideo*              GetVideo                    (int pIndex);
00565 
00570     bool                    AddVideo                    (KFbxVideo* pVideo);
00571 
00576     bool                    RemoveVideo                 (KFbxVideo* pVideo);
00577 
00579 
00580     int                     GetTakeNodeContainerCount   ();
00581     KFbxTakeNodeContainer*  GetTakeNodeContainer        (int pIndex);
00582     bool                    AddTakeNodeContainer        (KFbxTakeNodeContainer* pTakeNodeContainer);
00583     bool                    RemoveTakeNodeContainer     (KFbxTakeNodeContainer* pTakeNodeContainer);
00584 
00585     KSet* AddTakeTimeWarpSet(char *pTakeName);
00586     KSet* GetTakeTimeWarpSet(char *pTakeName);
00587 
00588 private:
00589     KFbxScene(KFbxSdkManager& pManager, char const* pName);
00590     ~KFbxScene();
00591 
00592     virtual void Construct(const KFbxScene* pFrom);
00593     virtual void Destruct(bool pRecursive, bool pDependents);
00594 
00595     KFbxScene& operator=(KFbxScene const& pScene);
00596 
00597     K_DEPRECATED void FillNodeArrayRecursive(KArrayTemplate<KFbxNode*>& pNodeArray,
00598 
00599         KFbxNodeAttribute::EAttributeType pAttributeType,
00600 
00601         KFbxNode* pNode);
00602 
00603     void FillNodeArrayRecursive(KArrayTemplate<KFbxNode*>& pNodeArray,
00604                                 kFbxClassId classId,
00605                                 KFbxNode* pNode);
00606 
00607     void ConnectTextureLayerElement(KFbxLayerContainer* pLayerContainer,
00608                                     KFbxLayerElement::ELayerElementType pLayerType,
00609                                     KFbxNode* pParentNode);
00610 
00611     void BuildTextureLayersDirectArrayForLayerType(KFbxLayerContainer* pLayerContainer,
00612                                                    KFbxLayerElement::ELayerElementType pLayerType);
00613 
00614 public:
00615     void ConvertNurbsSurfaceToNurb();
00616     void ConvertMeshNormals();
00617     void ConvertNurbCurvesToNulls();
00618     void ConnectTextures();
00619     void BuildTextureLayersDirectArray();
00620     void FixInheritType(KFbxNode *pNode);
00621     kFbxClassId ConvertAttributeTypeToClassID(KFbxNodeAttribute::EAttributeType pAttributeType);
00622 
00623 private:
00624     KFbxNode*                           mRootNode;
00625 
00626     KFbxGlobalLightSettings*            mGlobalLightSettings;
00627     KFbxGlobalCameraSettings*           mGlobalCameraSettings;
00628     KFbxGlobalTimeSettings*             mGlobalTimeSettings;
00629 
00630     KCharPtrSet                         mTakeTimeWarpSet;
00631 
00632     friend class KFbxLayerContainer;
00633     friend class KFbxNodeFinderDuplicateName;
00634 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00635 };
00636 
00637 typedef  class KFBX_DLL KArrayTemplate<KFbxTakeInfo *>          KArrayKFbxTakeInfo;
00638 typedef KFbxScene* HKFbxScene;
00639 
00640 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00641 
00642 #endif // FBXFILESDK_KFBXPLUGINS_KFBXSCENE_H
00643