kfbxscene.h

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 - 2009 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 
00120     void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray,
00121                        kFbxClassId classId,
00122                        bool pDepthFirst = false);
00123 
00125 
00130 
00134     void FillTextureArray(KArrayTemplate<KFbxTexture*>& pTextureArray);
00135 
00139     void FillMaterialArray(KArrayTemplate<KFbxSurfaceMaterial*>& pMaterialArray);
00140 
00142 
00147 
00151     int             GetGenericNodeCount();
00152 
00157     KFbxGenericNode* GetGenericNode(int pIndex);
00158 
00163     KFbxGenericNode* GetGenericNode(char* pName);
00164 
00169     bool             AddGenericNode(KFbxGenericNode* pGenericNode);
00170 
00176     bool             RemoveGenericNode(KFbxGenericNode* pGenericNode);
00177 
00179 
00180 
00185 
00189     int GetCharacterCount();
00190 
00195     KFbxCharacter* GetCharacter(int pIndex);
00196 
00201     int CreateCharacter(char* pName);
00202 
00207     void DestroyCharacter(int pIndex);
00208 
00210 
00215 
00219     int GetControlSetPlugCount();
00220 
00225     KFbxControlSetPlug* GetControlSetPlug(int pIndex);
00226 
00231     int CreateControlSetPlug(char* pName);
00232 
00237     void DestroyControlSetPlug(int pIndex);
00238 
00240 
00245 
00250     int GetCharacterPoseCount();
00251 
00256     KFbxCharacterPose* GetCharacterPose(int pIndex);
00257 
00262     int CreateCharacterPose(char* pName);
00263 
00268     void DestroyCharacterPose(int pIndex);
00269 
00271 
00276 
00281     int GetPoseCount();
00282 
00287     KFbxPose* GetPose(int pIndex);
00288 
00294     bool AddPose(KFbxPose* pPose);
00295 
00301     bool RemovePose(KFbxPose* pPose);
00302 
00308     bool RemovePose(int pIndex);
00309 
00310 
00312 
00316 
00320     inline KFbxDocumentInfo* GetSceneInfo() { return GetDocumentInfo(); }
00321 
00325     inline void SetSceneInfo(KFbxDocumentInfo* pSceneInfo) { SetDocumentInfo(pSceneInfo); }
00326 
00328 
00333 
00337     KFbxGlobalLightSettings& GetGlobalLightSettings();
00338 
00342     KFbxGlobalCameraSettings& GetGlobalCameraSettings();
00343 
00347     KFbxGlobalTimeSettings& GetGlobalTimeSettings();
00348 
00352     KFbxGlobalSettings& GetGlobalSettings();
00353 
00357     const KFbxGlobalSettings& GetGlobalSettings() const;
00358 
00360 
00362 //
00363 //  WARNING!
00364 //
00365 //  Anything beyond these lines may not be documented accurately and is
00366 //  subject to change without notice.
00367 //
00369 
00370 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00371 
00372     void ConnectMaterials();
00373 
00374     void BuildMaterialLayersDirectArray();
00375     void ReindexMaterialConnections(); // called to make sure that eINDEX is remapped to eINDEX_TO_DIRECT
00376 
00380     void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray);
00381 
00385     void FillPoseArray(KArrayTemplate<KFbxPose*>& pPoseArray);
00386 
00387     // Clone
00388     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00389 
00390 
00395 
00399     int                     GetMaterialCount            ();
00400 
00406     KFbxSurfaceMaterial*            GetMaterial                 (int pIndex);
00407 
00412     KFbxSurfaceMaterial*            GetMaterial                 (char* pName);
00413 
00418     bool                    AddMaterial                 (KFbxSurfaceMaterial* pMaterial);
00419 
00424     bool                    RemoveMaterial              (KFbxSurfaceMaterial* pMaterial);
00425 
00427 
00432 
00436     int                     GetTextureCount             ();
00437 
00443     KFbxTexture*            GetTexture                  (int pIndex);
00444 
00449     KFbxTexture*            GetTexture                  (char* pName);
00450 
00455     bool                    AddTexture                  (KFbxTexture* pTexture);
00456 
00461     bool                    RemoveTexture               (KFbxTexture* pTexture);
00462 
00464 
00469 
00473     int                     GetNodeCount                ();
00474 
00480     KFbxNode*               GetNode                     (int pIndex);
00481 
00486     bool                    AddNode                     (KFbxNode* pNode);
00487 
00492     bool                    RemoveNode                  (KFbxNode* pNode);
00493 
00500     int                     GetCurveOnSurfaceCount      ();
00501 
00502     KFbxNode*               FindNodeByName              ( const KString& pName );
00503 
00505 
00510 
00514     int                     GetGeometryCount            ();
00515 
00521     KFbxGeometry*           GetGeometry                 (int pIndex);
00522 
00527     bool                    AddGeometry                 (KFbxGeometry* pGeometry);
00528 
00533     bool                    RemoveGeometry              (KFbxGeometry* pGeometry);
00534 
00536 
00541 
00545     int                     GetVideoCount               ();
00546 
00552     KFbxVideo*              GetVideo                    (int pIndex);
00553 
00558     bool                    AddVideo                    (KFbxVideo* pVideo);
00559 
00564     bool                    RemoveVideo                 (KFbxVideo* pVideo);
00565 
00567 
00568     int                     GetTakeNodeContainerCount   ();
00569     KFbxTakeNodeContainer*  GetTakeNodeContainer        (int pIndex);
00570     bool                    AddTakeNodeContainer        (KFbxTakeNodeContainer* pTakeNodeContainer);
00571     bool                    RemoveTakeNodeContainer     (KFbxTakeNodeContainer* pTakeNodeContainer);
00572 
00573     KSet* AddTakeTimeWarpSet(char *pTakeName);
00574     KSet* GetTakeTimeWarpSet(char *pTakeName);
00575 
00576 private:
00577     KFbxScene(KFbxSdkManager& pManager, char const* pName);
00578 
00579     virtual void Construct(const KFbxScene* pFrom);
00580     virtual void Destruct(bool pRecursive, bool pDependents);
00581 
00582     KFbxScene& operator=(KFbxScene const& pScene);
00583 
00584     void FillNodeArrayRecursive(KArrayTemplate<KFbxNode*>& pNodeArray,
00585                                 kFbxClassId classId,
00586                                 KFbxNode* pNode);
00587 
00588     void ConnectTextureLayerElement(KFbxLayerContainer* pLayerContainer,
00589                                     KFbxLayerElement::ELayerElementType pLayerType,
00590                                     KFbxNode* pParentNode);
00591 
00592     void BuildTextureLayersDirectArrayForLayerType(KFbxLayerContainer* pLayerContainer,
00593                                                    KFbxLayerElement::ELayerElementType pLayerType);
00594 
00595 public:
00596     void ConvertNurbsSurfaceToNurb();
00597     void ConvertMeshNormals();
00598     void ConvertNurbCurvesToNulls();
00599     void ConnectTextures();
00600     void BuildTextureLayersDirectArray();
00601     void FixInheritType(KFbxNode *pNode);
00602     kFbxClassId ConvertAttributeTypeToClassID(KFbxNodeAttribute::EAttributeType pAttributeType);
00603 
00604 private:
00605     KFbxNode*                           mRootNode;
00606 
00607     KFbxGlobalLightSettings*            mGlobalLightSettings;
00608     KFbxGlobalCameraSettings*           mGlobalCameraSettings;
00609     KFbxGlobalTimeSettings*             mGlobalTimeSettings;
00610 
00611     KCharPtrSet                         mTakeTimeWarpSet;
00612 
00613     friend class KFbxLayerContainer;
00614     friend class KFbxNodeFinderDuplicateName;
00615 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00616 };
00617 
00618 typedef  class KFBX_DLL KArrayTemplate<KFbxTakeInfo *>          KArrayKFbxTakeInfo;
00619 typedef KFbxScene* HKFbxScene;
00620 
00621 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00622 
00623 #endif // FBXFILESDK_KFBXPLUGINS_KFBXSCENE_H
00624