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 - 2010 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 #include <fbxfilesdk/fbxfilesdk_def.h>
00041 
00042 #include <fbxfilesdk/fbxcore/fbxcollection/kfbxdocument.h>
00043 
00044 #include <fbxfilesdk/kfbxplugins/kfbxdeformer.h>
00045 #include <fbxfilesdk/kfbxplugins/kfbxsubdeformer.h>
00046 #include <fbxfilesdk/kfbxplugins/kfbxlayer.h>
00047 #include <fbxfilesdk/kfbxplugins/kfbxnodeattribute.h>
00048 #include <fbxfilesdk/kfbxplugins/kfbxglobalsettings.h>
00049 #include <fbxfilesdk/kfbxplugins/kfbxanimevaluator.h>
00050 
00051 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00052 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00053 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00054 #include <fbxfilesdk/components/kbaselib/klib/kcharptrset.h>
00055 
00056 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00057 
00058 class KFbxSdkManager;
00059 class KFbxObject;
00060 class KFbxNode;
00061 class KFbxVideo;
00062 class KFbxTexture;
00063 class KFbxSurfaceMaterial;
00064 class KFbxMarkerSet;
00065 class KFbxActor;
00066 class KFbxCharacter;
00067 class KFbxControlSetPlug;
00068 class KFbxCharacterPose;
00069 class KFbxPose;
00070 class KFbxDocumentInfo;
00071 class KFbxTakeInfo;
00072 class KFbxGlobalSettings;
00073 class KFbxGenericNode;
00074 class KFbxConstraint;
00075 class KFbxGeometry;
00076 class KFbxLayerContainer;
00077 class KSet;
00078 
00079 class KFbxGlobalLightSettings;
00080 class KFbxGlobalCameraSettings;
00081 class KFbxGlobalTimeSettings;
00082 
00083 
00093 class KFBX_DLL KFbxScene : public KFbxDocument
00094 {
00095     KFBXOBJECT_DECLARE(KFbxScene, KFbxDocument);
00096 
00097 public:
00099     void Clear();
00100 
00105 
00112     KFbxNode* GetRootNode() const;
00113 
00121     K_DEPRECATED void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray, kFbxClassId classId, bool pDepthFirst=false);
00122 
00124 
00129 
00133     void FillTextureArray(KArrayTemplate<KFbxTexture*>& pTextureArray);
00134 
00138     void FillMaterialArray(KArrayTemplate<KFbxSurfaceMaterial*>& pMaterialArray);
00139 
00141 
00146 
00150     int             GetGenericNodeCount() const;
00151 
00156     KFbxGenericNode* GetGenericNode(int pIndex);
00157 
00162     KFbxGenericNode* GetGenericNode(char* pName);
00163 
00168     bool             AddGenericNode(KFbxGenericNode* pGenericNode);
00169 
00175     bool             RemoveGenericNode(KFbxGenericNode* pGenericNode);
00176 
00178 
00179 
00184 
00188     int GetCharacterCount() const;
00189 
00194     KFbxCharacter* GetCharacter(int pIndex);
00195 
00200     int CreateCharacter(char* pName);
00201 
00206     void DestroyCharacter(int pIndex);
00207 
00209 
00214 
00218     int GetControlSetPlugCount() const;
00219 
00224     KFbxControlSetPlug* GetControlSetPlug(int pIndex);
00225 
00230     int CreateControlSetPlug(char* pName);
00231 
00236     void DestroyControlSetPlug(int pIndex);
00237 
00239 
00244 
00249     int GetCharacterPoseCount() const;
00250 
00255     KFbxCharacterPose* GetCharacterPose(int pIndex);
00256 
00261     int CreateCharacterPose(char* pName);
00262 
00267     void DestroyCharacterPose(int pIndex);
00268 
00270 
00275 
00280     int GetPoseCount() const;
00281 
00286     KFbxPose* GetPose(int pIndex);
00287 
00293     bool AddPose(KFbxPose* pPose);
00294 
00300     bool RemovePose(KFbxPose* pPose);
00301 
00307     bool RemovePose(int pIndex);
00308 
00309 
00311 
00315 
00319     inline KFbxDocumentInfo* GetSceneInfo() { return GetDocumentInfo(); }
00320 
00324     inline void SetSceneInfo(KFbxDocumentInfo* pSceneInfo) { SetDocumentInfo(pSceneInfo); }
00325 
00327 
00332 
00336     KFbxGlobalSettings& GetGlobalSettings();
00337 
00341     const KFbxGlobalSettings& GetGlobalSettings() const;
00342 
00343 
00373         K_DEPRECATED KFbxGlobalLightSettings& GetGlobalLightSettings();
00374 
00378         K_DEPRECATED KFbxGlobalCameraSettings& GetGlobalCameraSettings();
00379 
00383         K_DEPRECATED KFbxGlobalTimeSettings& GetGlobalTimeSettings();
00385 
00387 
00392 
00396         void SetEvaluator(KFbxAnimEvaluator* pEvaluator);
00397 
00403         KFbxAnimEvaluator* GetEvaluator();
00404 
00406 
00408 //
00409 //  WARNING!
00410 //
00411 //  Anything beyond these lines may not be documented accurately and is
00412 //  subject to change without notice.
00413 //
00415 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00416 
00417     virtual KFbxObject& Copy(const KFbxObject& pObject);
00418 
00419     void ConnectMaterials();
00420 
00421     void BuildMaterialLayersDirectArray();
00422     void ReindexMaterialConnections(); // called to make sure that eINDEX is remapped to eINDEX_TO_DIRECT
00423 
00427     K_DEPRECATED void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray);
00428 
00432     void FillPoseArray(KArrayTemplate<KFbxPose*>& pPoseArray);
00433 
00434     // Clone
00435     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00436 
00437 
00442 
00446     int                     GetMaterialCount            () const;
00447 
00453     KFbxSurfaceMaterial*            GetMaterial                 (int pIndex);
00454 
00459     KFbxSurfaceMaterial*            GetMaterial                 (char* pName);
00460 
00465     bool                    AddMaterial                 (KFbxSurfaceMaterial* pMaterial);
00466 
00471     bool                    RemoveMaterial              (KFbxSurfaceMaterial* pMaterial);
00472 
00474 
00479 
00483     int                     GetTextureCount             () const;
00484 
00490     KFbxTexture*            GetTexture                  (int pIndex);
00491 
00496     KFbxTexture*            GetTexture                  (char* pName);
00497 
00502     bool                    AddTexture                  (KFbxTexture* pTexture);
00503 
00508     bool                    RemoveTexture               (KFbxTexture* pTexture);
00509 
00511 
00516 
00520     int                     GetNodeCount                () const;
00521 
00527     KFbxNode*               GetNode                     (int pIndex);
00528 
00533     bool                    AddNode                     (KFbxNode* pNode);
00534 
00539     bool                    RemoveNode                  (KFbxNode* pNode);
00540 
00547     int                     GetCurveOnSurfaceCount      ();
00548 
00549     KFbxNode*               FindNodeByName              ( const KString& pName );
00550 
00552 
00557 
00561     int                     GetGeometryCount            () const;
00562 
00568     KFbxGeometry*           GetGeometry                 (int pIndex);
00569 
00574     bool                    AddGeometry                 (KFbxGeometry* pGeometry);
00575 
00580     bool                    RemoveGeometry              (KFbxGeometry* pGeometry);
00581 
00583 
00588 
00592     int                     GetVideoCount               () const;
00593 
00599     KFbxVideo*              GetVideo                    (int pIndex);
00600 
00605     bool                    AddVideo                    (KFbxVideo* pVideo);
00606 
00611     bool                    RemoveVideo                 (KFbxVideo* pVideo);
00612 
00614 
00615     KSet* AddTakeTimeWarpSet(char *pTakeName);
00616     KSet* GetTakeTimeWarpSet(char *pTakeName);
00617 
00618 private:
00619     KFbxScene(KFbxSdkManager& pManager, char const* pName);
00620 
00621     virtual void Construct(const KFbxScene* pFrom);
00622     virtual void Destruct(bool pRecursive, bool pDependents);
00623 
00624     // Don't mark it as DEPRECATED to avoid useless warning. This method is only called by
00625     // FillNodeArray() and the method is already makred as deprecated. When FillNodeArray is going to 
00626     // be removed, FillNodeArrayRecursive will be too.
00627     void FillNodeArrayRecursive(KArrayTemplate<KFbxNode*>& pNodeArray, kFbxClassId classId, KFbxNode* pNode);
00628 
00629     void ConnectTextureLayerElement(KFbxLayerContainer* pLayerContainer,
00630                                     KFbxLayerElement::ELayerElementType pLayerType,
00631                                     KFbxNode* pParentNode);
00632 
00633     void BuildTextureLayersDirectArrayForLayerType(KFbxLayerContainer* pLayerContainer,
00634                                                    KFbxLayerElement::ELayerElementType pLayerType);
00635 
00636 public:
00637     void ConvertNurbsSurfaceToNurb();
00638     void ConvertMeshNormals();
00639     void ConvertNurbCurvesToNulls();
00640     void ConnectTextures();
00641     void BuildTextureLayersDirectArray();
00642     void FixInheritType(KFbxNode *pNode);
00643     kFbxClassId ConvertAttributeTypeToClassID(KFbxNodeAttribute::EAttributeType pAttributeType);
00644 
00645     KFbxGlobalLightSettings&  GlobalLightSettings()  { return *mGlobalLightSettings; }
00646     KFbxGlobalCameraSettings& GlobalCameraSettings() { return *mGlobalCameraSettings; }
00647     KFbxGlobalTimeSettings&   GlobalTimeSettings()   { return *mGlobalTimeSettings; }
00648 
00649 private:
00650     KFbxNode*                           mRootNode;
00651 
00652     KFbxGlobalLightSettings*            mGlobalLightSettings;
00653     KFbxGlobalCameraSettings*           mGlobalCameraSettings;
00654     KFbxGlobalTimeSettings*             mGlobalTimeSettings;
00655 
00656     KFbxAnimEvaluator*                  mEvaluator;
00657 
00658     KCharPtrSet                         mTakeTimeWarpSet;
00659 
00660     friend class KFbxLayerContainer;
00661     friend class KFbxNodeFinderDuplicateName;
00662 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00663 };
00664 
00665 typedef  class KFBX_DLL KArrayTemplate<KFbxTakeInfo *>          KArrayKFbxTakeInfo;
00666 typedef KFbxScene* HKFbxScene;
00667 
00668 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00669 
00670 #endif // FBXFILESDK_KFBXPLUGINS_KFBXSCENE_H
00671