kfbxscene.h

Go to the documentation of this file.
00001 
00003 #ifndef _FBXSDK_SCENE_H_
00004 #define _FBXSDK_SCENE_H_
00005 
00006 /**************************************************************************************
00007 
00008  Copyright © 2001 - 2007 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 <kfbxplugins/kfbxdeformer.h>
00049 #include <kfbxplugins/kfbxsubdeformer.h>
00050 #include <kfbxplugins/kfbxlayer.h>
00051 #include <kfbxplugins/kfbxnodeattribute.h>
00052 #include <kfbxplugins/kfbxglobalsettings.h>
00053 
00054 #include <klib/karrayul.h>
00055 #include <klib/kerror.h>
00056 #include <klib/kstring.h>
00057 
00058 #include <fbxfilesdk_nsbegin.h>
00059 
00060 class KFbxSdkManager;
00061 class KFbxObject;
00062 class KFbxNode;
00063 class KFbxVideo;
00064 class KFbxTexture;
00065 class KFbxSurfaceMaterial;
00066 class KFbxMarkerSet;
00067 class KFbxActor;
00068 class KFbxCharacter;
00069 class KFbxControlSetPlug;
00070 class KFbxCharacterPose;
00071 class KFbxPose;
00072 class KFbxSceneInfo;
00073 class KFbxTakeInfo;
00074 class KFbxGlobalLightSettings;
00075 class KFbxGlobalCameraSettings;
00076 class KFbxGlobalTimeSettings;
00077 class KFbxGlobalSettings;
00078 class KFbxGenericNode;
00079 class KFbxConstraint;
00080 class KFbxGeometry;
00081 class KFbxTakeNodeContainer;
00082 class KFbxLayerContainer;
00083 
00084 class KFbxScene_internal;
00094 class KFBX_DLL KFbxScene : public KFbxObject
00095 {
00096     KFBXOBJECT_DECLARE(KFbxScene);
00097 
00098 public:
00100     void Clear();
00101 
00106 
00113     KFbxNode* GetRootNode();
00114 
00133     KFbxNode* GetCameraSwitcher();
00134 
00142     void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray, 
00143                        KFbxNodeAttribute::EAttributeType pAttributeType,
00144                        bool pDepthFirst = false);
00145 
00147 
00152 
00156 //  void FillVideoArray(KArrayTemplate<KFbxVideo*>& pVideoArray);
00157 
00161     void FillTextureArray(KArrayTemplate<KFbxTexture*>& pTextureArray);
00162 
00166     void FillMaterialArray(KArrayTemplate<KFbxSurfaceMaterial*>& pMaterialArray);
00167     
00169 
00174 
00178     int             GetGenericNodeCount();
00179 
00184     KFbxGenericNode* GetGenericNode(int pIndex);
00185 
00190     KFbxGenericNode* GetGenericNode(char* pName);
00191 
00196     bool             AddGenericNode(KFbxGenericNode* pGenericNode);
00197 
00203     bool             RemoveGenericNode(KFbxGenericNode* pGenericNode);
00204     
00206 
00207 
00212 
00216     int GetCharacterCount();
00217 
00222     KFbxCharacter* GetCharacter(int pIndex);
00223 
00228     int CreateCharacter(char* pName);
00229 
00234     void DestroyCharacter(int pIndex);
00235 
00237 
00242 
00246     int GetControlSetPlugCount();
00247 
00252     KFbxControlSetPlug* GetControlSetPlug(int pIndex);
00253 
00258     int CreateControlSetPlug(char* pName);
00259 
00264     void DestroyControlSetPlug(int pIndex);
00265 
00267 
00272 
00277     int GetCharacterPoseCount();
00278 
00283     KFbxCharacterPose* GetCharacterPose(int pIndex);
00284 
00289     int CreateCharacterPose(char* pName);
00290 
00295     void DestroyCharacterPose(int pIndex);
00296 
00298 
00303 
00308     int GetPoseCount();
00309 
00314     KFbxPose* GetPose(int pIndex);
00315 
00321     bool AddPose(KFbxPose* pPose);
00322     
00328     bool RemovePose(KFbxPose* pPose);
00329 
00335     bool RemovePose(int pIndex);
00336 
00337 
00339 
00343 
00347     KFbxSceneInfo* GetSceneInfo();
00348 
00352     void SetSceneInfo(KFbxSceneInfo* pSceneInfo);
00353 
00355 
00360 
00364     KFbxGlobalLightSettings& GetGlobalLightSettings();
00365 
00369     KFbxGlobalCameraSettings& GetGlobalCameraSettings();
00370 
00374     KFbxGlobalTimeSettings& GetGlobalTimeSettings();
00375 
00379     KFbxGlobalSettings& GetGlobalSettings();
00380 
00384     const KFbxGlobalSettings& GetGlobalSettings() const;
00385 
00387 
00392 
00406     bool CreateTake(char* pName);
00407 
00419     bool RemoveTake(char* pName);
00420 
00436     bool SetCurrentTake(char* pName);
00437 
00444     char* GetCurrentTakeName();
00445 
00453     void FillTakeNameArray(KArrayTemplate<KString*>& pNameArray);
00454 
00456 
00461 
00467     bool SetTakeInfo(const KFbxTakeInfo& pTakeInfo);
00468 
00474     KFbxTakeInfo* GetTakeInfo(const KString& pTakeName);
00475 
00477 
00483 
00487     KError& GetError();
00488     
00492     typedef enum 
00493     {
00494         eTAKE_ERROR,
00495         eKFBX_OBJECT_IS_NULL,
00496         eKFBX_OBJECT_ALREADY_OWNED,
00497         eKFBX_OBJECT_UNKNOWN,
00498         eERROR_COUNT
00499     } EError;
00500     
00504     EError GetLastErrorID();
00505 
00509     char* GetLastErrorString();
00510 
00512 
00514 //
00515 //  WARNING!
00516 //
00517 //  Anything beyond these lines may not be documented accurately and is 
00518 //  subject to change without notice.
00519 //
00521 
00522 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00523 
00527     void FillNodeArray(KArrayTemplate<KFbxNode*>& pNodeArray);
00528     
00532     void FillPoseArray(KArrayTemplate<KFbxPose*>& pPoseArray);
00533     
00534     void                ReplaceCameraSwitcher(KFbxNode* pNode);
00535 
00539     virtual KFbxObject::ENameSpace GetNameSpace() const;
00540 
00541     virtual KObject* GetFbxObject_internal();
00542     virtual KObject const*  GetFbxObject_internal() const;
00543 
00544     // Clone
00545     virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType) const;
00546 
00547 
00552 
00556     int                     GetMaterialCount            ();
00557 
00563     KFbxSurfaceMaterial*            GetMaterial                 (int pIndex);
00564 
00569     KFbxSurfaceMaterial*            GetMaterial                 (char* pName);
00570 
00575     bool                    AddMaterial                 (KFbxSurfaceMaterial* pMaterial);
00576 
00581     bool                    RemoveMaterial              (KFbxSurfaceMaterial* pMaterial);
00582 
00584 
00589 
00593     int                     GetTextureCount             ();
00594 
00600     KFbxTexture*            GetTexture                  (int pIndex);
00601 
00606     KFbxTexture*            GetTexture                  (char* pName);
00607 
00612     bool                    AddTexture                  (KFbxTexture* pTexture);
00613 
00618     bool                    RemoveTexture               (KFbxTexture* pTexture);
00619 
00621 
00626 
00630     int                     GetNodeCount                ();
00631 
00637     KFbxNode*               GetNode                     (int pIndex);
00638 
00643     bool                    AddNode                     (KFbxNode* pNode);
00644 
00649     bool                    RemoveNode                  (KFbxNode* pNode);
00650 
00657     int                     GetCurveOnSurfaceCount      (); 
00658 
00659     KFbxNode*               FindNodeByName              ( const KString& pName );
00660     
00662 
00667 
00671     int                     GetGeometryCount            ();
00672 
00678     KFbxGeometry*           GetGeometry                 (int pIndex);
00679 
00684     bool                    AddGeometry                 (KFbxGeometry* pGeometry);
00685 
00690     bool                    RemoveGeometry              (KFbxGeometry* pGeometry);
00691 
00693 
00698 
00702     int                     GetVideoCount               ();
00703 
00709     KFbxVideo*              GetVideo                    (int pIndex);
00710 
00715     bool                    AddVideo                    (KFbxVideo* pVideo);
00716 
00721     bool                    RemoveVideo                 (KFbxVideo* pVideo);
00722 
00724 
00725     int                     GetTakeNodeContainerCount   ();
00726     KFbxTakeNodeContainer*  GetTakeNodeContainer        (int pIndex);
00727     bool                    AddTakeNodeContainer        (KFbxTakeNodeContainer* pTakeNodeContainer);
00728     bool                    RemoveTakeNodeContainer     (KFbxTakeNodeContainer* pTakeNodeContainer);
00729 
00730 private:
00731     static char const* GetNamePrefix() { return 0; }
00732 
00733     KFbxScene(KFbxSdkManager& pManager, char const* pName);
00734     ~KFbxScene();
00735 
00736     bool FbxPlugNotify(KFbxPlugEvent const &pEvent);
00737 
00738 
00739     virtual void Destruct(bool pRecursive, bool pDependents);
00740 
00741     KFbxScene& operator=(KFbxScene const& pScene); 
00742 
00743     bool FindTakeName(const KString& pTakeName);
00744 
00745     void FillNodeArrayRecursive(KArrayTemplate<KFbxNode*>& pNodeArray, 
00746                                 KFbxNodeAttribute::EAttributeType pAttributeType,
00747                                 KFbxNode* pNode);
00748 
00749     void ConnectMaterials();
00750     void ConnectTextures();
00751     void ConnectTextureLayerElement(KFbxLayerContainer* pLayerContainer, 
00752                                     KFbxLayerElement::ELayerElementType pLayerType);
00753     void ConnectVideos();
00754 
00755     void BuildMaterialLayersDirectArray();
00756     void BuildTextureLayersDirectArray();
00757     void BuildTextureLayersDirectArrayForLayerType(KFbxLayerContainer* pLayerContainer, 
00758                                                    KFbxLayerElement::ELayerElementType pLayerType);
00759 
00760     void FixInheritType(KFbxNode *pNode);
00761 
00762     void ConvertNurbsSurfaceToNurb();
00763     void ConvertMeshNormals();
00764     void ConvertNurbCurvesToNulls();
00765 
00766     KFbxScene_internal*                 mPH;
00767 
00768     KFbxSdkManager*                     mSdkManager;
00769     KFbxNode*                           mCameraSwitcher;
00770     KFbxNode*                           mRootNode;
00771 
00772     KFbxGlobalLightSettings*            mGlobalLightSettings;
00773     KFbxGlobalCameraSettings*           mGlobalCameraSettings;
00774     KFbxGlobalTimeSettings*             mGlobalTimeSettings;
00775 
00776     KString                             mCurrentTakeName;   
00777     KArrayTemplate<KFbxTakeInfo *>      mTakeInfoArray;
00778     KFbxSceneInfo*                      mSceneInfo;
00779 
00780     KError                              mError;
00781 
00782     friend class KFbxLayerContainer;
00783     friend class KFbxNodeFinderDuplicateName;
00784 
00785     friend class KFbxWriterFbx;
00786     friend class KFbxWriterFbx6;
00787     friend class KFbxReaderFbx;
00788     friend class KFbxReaderFbx6;
00789 
00790 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 
00791 
00792 };
00793 
00794 typedef  class KFBX_DLL KArrayTemplate<KFbxTakeInfo *>          KArrayKFbxTakeInfo;
00795 typedef KFbxScene* HKFbxScene;
00796 
00797 #include <fbxfilesdk_nsend.h>
00798 
00799 #endif // #ifndef _FBXSDK_SCENE_H_
00800 
00801