FBX SDK Reference Guide: kfbxscene.h Source File
Go to the documentation of this file.
00001 
00003 #ifndef _FBXSDK_SCENE_H_
00004 #define _FBXSDK_SCENE_H_
00005 
00006 /**************************************************************************************
00007 
00008  Copyright © 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 <kaydaradef.h>
00042 #ifndef KFBX_DLL
00043     #define KFBX_DLL K_DLLIMPORT
00044 #endif
00045 
00046 #include <kaydara.h>
00047 
00048 #include <fbxcore/fbxcollection/kfbxdocument.h>
00049 
00050 #include <kfbxplugins/kfbxdeformer.h>
00051 #include <kfbxplugins/kfbxsubdeformer.h>
00052 #include <kfbxplugins/kfbxlayer.h>
00053 #include <kfbxplugins/kfbxnodeattribute.h>
00054 #include <kfbxplugins/kfbxglobalsettings.h>
00055 
00056 #include <klib/karrayul.h>
00057 #include <klib/kerror.h>
00058 #include <klib/kstring.h>
00059 #include <klib/kcharptrset.h>
00060 
00061 #include <fbxfilesdk_nsbegin.h>
00062 
00063 class KFbxSdkManager;
00064 class KFbxObject;
00065 class KFbxNode;
00066 class KFbxVideo;
00067 class KFbxTexture;
00068 class KFbxSurfaceMaterial;
00069 class KFbxMarkerSet;
00070 class KFbxActor;
00071 class KFbxCharacter;
00072 class KFbxControlSetPlug;
00073 class KFbxCharacterPose;
00074 class KFbxPose;
00075 class KFbxDocumentInfo;
00076 class KFbxTakeInfo;
00077 class KFbxGlobalLightSettings;
00078 class KFbxGlobalCameraSettings;
00079 class KFbxGlobalTimeSettings;
00080 class KFbxGlobalSettings;
00081 class KFbxGenericNode;
00082 class KFbxConstraint;
00083 class KFbxGeometry;
00084 class KFbxTakeNodeContainer;
00085 class KFbxLayerContainer;
00086 
00096 class KFBX_DLL KFbxScene : public KFbxDocument
00097 {
00098     KFBXOBJECT_DECLARE(KFbxScene,KFbxDocument);
00099 
00100 public:
00102     void Clear();
00103 
00108 
00115     KFbxNode* GetRootNode() const;
00116 
00117 
00125     void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray,
00126                        KFbxNodeAttribute::EAttributeType pAttributeType,
00127                        bool pDepthFirst = false);
00128 
00130 
00135 
00139     void FillTextureArray(KArrayTemplate<KFbxTexture*>& pTextureArray);
00140 
00144     void FillMaterialArray(KArrayTemplate<KFbxSurfaceMaterial*>& pMaterialArray);
00145 
00147 
00152 
00156     int             GetGenericNodeCount();
00157 
00162     KFbxGenericNode* GetGenericNode(int pIndex);
00163 
00168     KFbxGenericNode* GetGenericNode(char* pName);
00169 
00174     bool             AddGenericNode(KFbxGenericNode* pGenericNode);
00175 
00181     bool             RemoveGenericNode(KFbxGenericNode* pGenericNode);
00182 
00184 
00185 
00190 
00194     int GetCharacterCount();
00195 
00200     KFbxCharacter* GetCharacter(int pIndex);
00201 
00206     int CreateCharacter(char* pName);
00207 
00212     void DestroyCharacter(int pIndex);
00213 
00215 
00220 
00224     int GetControlSetPlugCount();
00225 
00230     KFbxControlSetPlug* GetControlSetPlug(int pIndex);
00231 
00236     int CreateControlSetPlug(char* pName);
00237 
00242     void DestroyControlSetPlug(int pIndex);
00243 
00245 
00250 
00255     int GetCharacterPoseCount();
00256 
00261     KFbxCharacterPose* GetCharacterPose(int pIndex);
00262 
00267     int CreateCharacterPose(char* pName);
00268 
00273     void DestroyCharacterPose(int pIndex);
00274 
00276 
00281 
00286     int GetPoseCount();
00287 
00292     KFbxPose* GetPose(int pIndex);
00293 
00299     bool AddPose(KFbxPose* pPose);
00300 
00306     bool RemovePose(KFbxPose* pPose);
00307 
00313     bool RemovePose(int pIndex);
00314 
00315 
00317 
00321 
00325     inline KFbxDocumentInfo* GetSceneInfo() { return GetDocumentInfo(); }
00326 
00330     inline void SetSceneInfo(KFbxDocumentInfo* pSceneInfo) { SetDocumentInfo(pSceneInfo); }
00331 
00333 
00338 
00342     KFbxGlobalLightSettings& GetGlobalLightSettings();
00343 
00347     KFbxGlobalCameraSettings& GetGlobalCameraSettings();
00348 
00352     KFbxGlobalTimeSettings& GetGlobalTimeSettings();
00353 
00357     KFbxGlobalSettings& GetGlobalSettings();
00358 
00362     const KFbxGlobalSettings& GetGlobalSettings() const;
00363 
00365 
00367 //
00368 //  WARNING!
00369 //
00370 //  Anything beyond these lines may not be documented accurately and is
00371 //  subject to change without notice.
00372 //
00374 
00375 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00376 
00377     void ConnectMaterials();
00378 
00379     void BuildMaterialLayersDirectArray();
00380     void ReindexMaterialConnections(); // called to make sure that eINDEX is remapped to eINDEX_TO_DIRECT
00381 
00385     void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray);
00386 
00390     void FillPoseArray(KArrayTemplate<KFbxPose*>& pPoseArray);
00391 
00392     // Clone
00393     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00394 
00395 
00400 
00404     int                     GetMaterialCount            ();
00405 
00411     KFbxSurfaceMaterial*            GetMaterial                 (int pIndex);
00412 
00417     KFbxSurfaceMaterial*            GetMaterial                 (char* pName);
00418 
00423     bool                    AddMaterial                 (KFbxSurfaceMaterial* pMaterial);
00424 
00429     bool                    RemoveMaterial              (KFbxSurfaceMaterial* pMaterial);
00430 
00432 
00437 
00441     int                     GetTextureCount             ();
00442 
00448     KFbxTexture*            GetTexture                  (int pIndex);
00449 
00454     KFbxTexture*            GetTexture                  (char* pName);
00455 
00460     bool                    AddTexture                  (KFbxTexture* pTexture);
00461 
00466     bool                    RemoveTexture               (KFbxTexture* pTexture);
00467 
00469 
00474 
00478     int                     GetNodeCount                ();
00479 
00485     KFbxNode*               GetNode                     (int pIndex);
00486 
00491     bool                    AddNode                     (KFbxNode* pNode);
00492 
00497     bool                    RemoveNode                  (KFbxNode* pNode);
00498 
00505     int                     GetCurveOnSurfaceCount      ();
00506 
00507     KFbxNode*               FindNodeByName              ( const KString& pName );
00508 
00510 
00515 
00519     int                     GetGeometryCount            ();
00520 
00526     KFbxGeometry*           GetGeometry                 (int pIndex);
00527 
00532     bool                    AddGeometry                 (KFbxGeometry* pGeometry);
00533 
00538     bool                    RemoveGeometry              (KFbxGeometry* pGeometry);
00539 
00541 
00546 
00550     int                     GetVideoCount               ();
00551 
00557     KFbxVideo*              GetVideo                    (int pIndex);
00558 
00563     bool                    AddVideo                    (KFbxVideo* pVideo);
00564 
00569     bool                    RemoveVideo                 (KFbxVideo* pVideo);
00570 
00572 
00573     int                     GetTakeNodeContainerCount   ();
00574     KFbxTakeNodeContainer*  GetTakeNodeContainer        (int pIndex);
00575     bool                    AddTakeNodeContainer        (KFbxTakeNodeContainer* pTakeNodeContainer);
00576     bool                    RemoveTakeNodeContainer     (KFbxTakeNodeContainer* pTakeNodeContainer);
00577 
00578     KSet* AddTakeTimeWarpSet(char *pTakeName);
00579     KSet* GetTakeTimeWarpSet(char *pTakeName);
00580 
00581 private:
00582     KFbxScene(KFbxSdkManager& pManager, char const* pName);
00583     ~KFbxScene();
00584 
00585     virtual void Construct(const KFbxScene* pFrom);
00586     virtual void Destruct(bool pRecursive, bool pDependents);
00587 
00588     KFbxScene& operator=(KFbxScene const& pScene);
00589 
00590     void FillNodeArrayRecursive(KArrayTemplate<KFbxNode*>& pNodeArray,
00591                                 KFbxNodeAttribute::EAttributeType pAttributeType,
00592                                 KFbxNode* pNode);
00593 
00594     void ConnectTextures();
00595     void ConnectTextureLayerElement(KFbxLayerContainer* pLayerContainer,
00596                                     KFbxLayerElement::ELayerElementType pLayerType,
00597                                     KFbxNode* pParentNode);
00598 
00599     void BuildTextureLayersDirectArray();
00600     void BuildTextureLayersDirectArrayForLayerType(KFbxLayerContainer* pLayerContainer,
00601                                                    KFbxLayerElement::ELayerElementType pLayerType);
00602 
00603     void FixInheritType(KFbxNode *pNode);
00604 
00605 public:
00606     void ConvertNurbsSurfaceToNurb();
00607     void ConvertMeshNormals();
00608     void ConvertNurbCurvesToNulls();
00609 
00610 private:
00611     KFbxNode*                           mRootNode;
00612 
00613     KFbxGlobalLightSettings*            mGlobalLightSettings;
00614     KFbxGlobalCameraSettings*           mGlobalCameraSettings;
00615     KFbxGlobalTimeSettings*             mGlobalTimeSettings;
00616 
00617     KCharPtrSet                         mTakeTimeWarpSet;
00618 
00619     friend class KFbxLayerContainer;
00620     friend class KFbxNodeFinderDuplicateName;
00621 
00622     friend class KFbxWriterFbx;
00623     friend class KFbxWriterFbx6;
00624     friend class KFbxWriterFbx7;
00625     friend class KFbxReaderFbx;
00626     friend class KFbxReaderFbx6;
00627     friend class KFbxReaderFbx7;
00628 
00629 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00630 
00631 };
00632 
00633 typedef  class KFBX_DLL KArrayTemplate<KFbxTakeInfo *>          KArrayKFbxTakeInfo;
00634 typedef KFbxScene* HKFbxScene;
00635 
00636 #include <fbxfilesdk_nsend.h>
00637 
00638 #endif // #ifndef _FBXSDK_SCENE_H_
00639 
00640