kfbxgeometry.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXGEOMETRY_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXGEOMETRY_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright (C) 2001 - 2010 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
00043 #include <fbxfilesdk/kfbxplugins/kfbxgeometrybase.h>
00044 #include <fbxfilesdk/kfbxplugins/kfbxdeformer.h>
00045 #include <fbxfilesdk/kfbxplugins/kfbxshape.h>
00046 #include <fbxfilesdk/kfbxplugins/kfbxblendshape.h>
00047 #include <fbxfilesdk/kfbxplugins/kfbxblendshapechannel.h>
00048 
00049 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00050 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00051 
00052 #include <fbxfilesdk/kfbxmath/kfbxxmatrix.h>
00053 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00054 
00055 class KFbxGeometryWeightedMap;
00056 class KFbxNode;
00057 class KFbxShape;
00058 class KFbxTexture;
00059 class KFbxSdkManager;
00060 class KFbxVector4;
00061 class KFbxAnimCurve;
00062 class KFbxAnimLayer;
00063 class KFbxScene;
00064 class KFbxCluster;
00065 typedef class KFbxCluster KFbxLink;
00066 
00083 class KFBX_DLL KFbxGeometry : public KFbxGeometryBase
00084 {
00085     KFBXOBJECT_DECLARE(KFbxGeometry,KFbxGeometryBase);
00086 
00087 public:
00094     virtual EAttributeType GetAttributeType() const;
00095 
00100 
00106     int AddDeformer(KFbxDeformer* pDeformer);
00107 
00113     KFbxDeformer* RemoveDeformer(int pIndex);
00114 
00118     int GetDeformerCount() const;
00119 
00125     KFbxDeformer* GetDeformer(int pIndex) const;
00126 
00131     int GetDeformerCount(KFbxDeformer::EDeformerType pType) const;
00132 
00139     KFbxDeformer* GetDeformer(int pIndex, KFbxDeformer::EDeformerType pType) const;
00140 
00142 
00147 
00151     KFbxGeometryWeightedMap* GetSourceGeometryWeightedMap();
00152 
00156     int GetDestinationGeometryWeightedMapCount() const;
00157 
00162     KFbxGeometryWeightedMap* GetDestinationGeometryWeightedMap(int pIndex);
00163 
00165 
00194     K_DEPRECATED virtual int AddShape(KFbxShape* pShape, char const* pShapeName);
00195 
00252     K_DEPRECATED virtual KFbxShape* GetShape(int pIndex);
00253 
00260     K_DEPRECATED virtual KFbxShape const* GetShape(int pIndex) const;
00261 
00268     K_DEPRECATED virtual char const* GetShapeName(int pIndex) const;
00269 
00283     K_DEPRECATED virtual KFbxAnimCurve* GetShapeChannel(char const* pShapeName, KFbxAnimLayer* pLayer, bool pCreateAsNeeded = false);
00284 
00292     K_DEPRECATED virtual KFCurve* GetShapeChannel(int pIndex, bool pCreateAsNeeded=false, char const* pTakeName = NULL);
00293 
00307     K_DEPRECATED virtual KFbxAnimCurve* GetShapeChannel(int pIndex, KFbxAnimLayer* pLayer, bool pCreateAsNeeded = false);
00308 
00310 
00315 
00323     bool AddShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, KFbxShape* pShape, double pPercent = 100);
00324 
00329     void ClearShape();
00330 
00334     int GetShapeCount() const;
00335 
00341     int GetShapeCount(int pBlendShapeIndex, int pBlendShapeChannelIndex) const;
00342 
00350     KFbxShape* GetShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, int pShapeIndex);
00351 
00359     KFbxShape const* GetShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, int pShapeIndex) const;
00360 
00374     KFbxAnimCurve* GetShapeChannel(int pBlendShapeIndex, int pBlendShapeChannelIndex, KFbxAnimLayer* pLayer, bool pCreateAsNeeded = false);
00376 
00383     typedef enum
00384     {
00385         eRAW,
00386         eLOW_NO_NORMALS,
00387         eLOW,
00388         eHIGH_NO_NORMALS,
00389         eHIGH
00390     } ESurfaceMode;
00391 
00399 
00404     KFbxXMatrix& GetPivot(KFbxXMatrix& pXMatrix) const;
00405 
00409     void SetPivot(KFbxXMatrix& pXMatrix);
00410 
00413     void ApplyPivot();
00414 
00416 
00424 
00432     K_DEPRECATED void SetDefaultShape(int pIndex, double pPercent);
00433 
00441     K_DEPRECATED void SetDefaultShape(char const* pShapeName, double pPercent);
00442 
00449     K_DEPRECATED const double GetDefaultShape(int pIndex) const;
00450 
00457     K_DEPRECATED const double GetDefaultShape(char const* pShapeName) const;
00458 
00460 
00467 
00476     void SetDefaultShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, double pPercent);
00477 
00486     void SetDefaultShape(KFbxBlendShapeChannel* pBlendShapeChannel,  double pPercent);
00487 
00495     double GetDefaultShape(int pBlendShapeIndex, int pBlendShapeChannelIndex) const;
00496 
00504     double GetDefaultShape(KFbxBlendShapeChannel* pBlendShapeChannel) const;
00505 
00507 
00512 
00516     KError& GetError ();
00517 
00520     typedef enum
00521     {
00522         eINDEX_OUT_OF_RANGE,            
00523         eNULL_PARAMETER,                
00524         eSHAPE_ALREADY_ADDED,           
00525         eSHAPE_INVALID_NAME,            
00526         eSHAPE_NAME_CLASH,              
00527         eSHAPE_NO_CURVE_FOUND,          
00528         eUNKNOWN_ERROR,                 
00529         eERROR_COUNT
00530     } EError;
00531 
00535     EError GetLastErrorID() const;
00536 
00540     const char* GetLastErrorString() const;
00541 
00543 
00545 //
00546 //  WARNING!
00547 //
00548 //  Anything beyond these lines may not be documented accurately and is
00549 //  subject to change without notice.
00550 //
00552 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00553 
00554     virtual KFbxObject& Copy(const KFbxObject& pObject);
00555 
00556 protected:
00557     KFbxGeometry(KFbxSdkManager& pManager, char const* pName);
00558     virtual void Destruct(bool pRecursive, bool pDependents);
00559 
00560     virtual void SetDocument(KFbxDocument* pDocument);
00561 
00562 public:
00564     void CleanShapeChannels(KFbxAnimLayer* pAnimLayer);
00566     void CleanShapeChannel(KFbxAnimLayer* pAnimLayer, int pShapeIndex);
00567 
00568     void CreateShapeChannelProperties(KString& pShapeName);
00569 
00570 protected:
00571     // Shape channel name creation for nurb and patch.
00572     KString CreateShapeChannelName(int pShapeIndex);
00573 
00574     // Shape channel name creation for mesh.
00575     KString CreateShapeChannelName(KString pShapeName);
00576 
00577 public:
00578     void ConvertShapeNamesToV5Format(KString pTakeNodeName);
00579     void ConvertShapeNamesToV5Format(KString pTakeNodeName, int pShapeIndex);
00580     void RevertShapeNamesToV6Format(KString pTakeNodeName);
00581     void RevertShapeNamesToV6Format(KString pTakeNodeName, int pShapeIndex);
00582     void ClearTemporaryShapeNames();
00583 
00584 protected:
00585     void CopyDeformers(KFbxGeometry const* pGeometry);
00586     void CopyShapes(KFbxGeometry const* pGeometry);
00587 
00588     void CopyPivot(KFbxGeometry const* pSource);
00589 
00590     // Used during FBX v5 file store
00591     KArrayTemplate<KString*> mShapeNameArrayV6;
00592     KArrayTemplate<KString*> mShapeNameArrayV5;
00593     KArrayTemplate<KString*> mShapeChannelNameArrayV5;
00594 
00595     KFbxXMatrix* mPivot;
00596 
00597 
00598     mutable KError mError;
00599 
00600     friend class KFbxScene;
00601 
00602 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00603 
00604 };
00605 
00606 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00607 
00608 #endif // FBXFILESDK_KFBXPLUGINS_KFBXGEOMETRY_H
00609