Azure CI build support. (#182)

Azure build support.
This commit is contained in:
Pär Winzell 2019-04-23 12:44:03 -07:00 committed by GitHub
parent 366e904b70
commit 7fc7120487
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1310 changed files with 337544 additions and 0 deletions

9
.gitattributes vendored
View File

@ -1,5 +1,14 @@
# FBX SDK
*.a filter=lfs diff=lfs merge=lfs -text
*.dylib filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.lib filter=lfs diff=lfs merge=lfs -text
# TEST FILES
*.glb filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text

101
azure-pipelines.yml Normal file
View File

@ -0,0 +1,101 @@
# C/C++ with GCC
# Build your C/C++ project with GCC using make.
# Add steps that publish test results, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc
jobs:
- job: Linux
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
architecture: 'x64'
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install Python tools'
- script: |
pip install conan
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
displayName: 'Install & configure Conan'
- script: |
conan install . -i build -s build_type=Release -e FBXSDK_SDKS=sdk
displayName: 'Resolve binary dependencies and build CMake files.'
- script: |
conan build -bf build .
mv build/FBX2glTF build/FBX2glTF-linux-x64
displayName: 'Build FBX2glTF'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'build/FBX2glTF-linux-x64'
artifactName: 'binaries'
- job: Mac
pool:
vmImage: 'macOS-10.14'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
architecture: 'x64'
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install Python tools'
- script: |
pip install conan
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
displayName: 'Install Conan'
- script: |
conan install . -i build -s compiler=apple-clang -s compiler=apple-clang -s compiler.version=10.0 -s compiler.libcxx=libc++ -s build_type=Release -e FBXSDK_SDKS=sdk
displayName: 'Resolve binary dependencies and build CMake files.'
- script: |
conan build -bf build .
mv build/FBX2glTF build/FBX2glTF-darwin-x64
displayName: 'Build FBX2glTF'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'build/FBX2glTF-darwin-x64'
artifactName: 'binaries'
- job: Windows
pool:
vmImage: 'vs2017-win2016'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
architecture: 'x64'
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install Python tools'
- script: |
pip install conan
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
displayName: 'Install Conan'
- script: |
conan install . -i build -s build_type=Release -e FBXSDK_SDKS=sdk
displayName: 'Resolve binary dependencies and build CMake files.'
- script: |
conan build -bf build .
move build\Release\FBX2glTF.exe build\Release\FBX2glTF-windows-x64.exe
displayName: 'Build FBX2glTF'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'build/Release/FBX2glTF-windows-x64.exe'
artifactName: 'binaries'

View File

@ -0,0 +1,3 @@
<html>
<meta http-equiv="refresh" content="0; URL=http://www.autodesk.com/fbx-sdkdoc-2019-enu">
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,277 @@
/****************************************************************************************
Copyright (C) 2016 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxsdk.h
#ifndef _FBXSDK_H_
#define _FBXSDK_H_
/**
* \mainpage FBX SDK Reference
* <p>
* \section welcome Welcome to the FBX SDK Reference
* The FBX SDK Reference contains reference information on every header file,
* namespace, class, method, enum, typedef, variable, and other C++ elements
* that comprise the FBX software development kit (SDK).
* <p>
* The FBX SDK Reference is organized into the following sections:
* <ul><li>Class List: an alphabetical list of FBX SDK classes
* <li>Class Hierarchy: a textual representation of the FBX SDK class structure
* <li>Graphical Class Hierarchy: a graphical representation of the FBX SDK class structure
* <li>File List: an alphabetical list of all documented header files</ul>
* <p>
* \section otherdocumentation Other Documentation
* Apart from this reference guide, an FBX SDK Programming Guide and many FBX
* SDK examples are also provided.
* <p>
* \section aboutFBXSDK About the FBX SDK
* The FBX SDK is a C++ software development kit (SDK) that lets you import
* and export 3D scenes using the Autodesk FBX file format. The FBX SDK
* reads FBX files created with FiLMBOX version 2.5 and later and writes FBX
* files compatible with MotionBuilder version 6.0 and up.
*/
#pragma pack(push, 8) //FBXSDK is compiled with default value (8)
#include <fbxsdk/fbxsdk_def.h>
#ifndef FBXSDK_NAMESPACE_USING
#define FBXSDK_NAMESPACE_USING 1
#endif
//---------------------------------------------------------------------------------------
//Core Base Includes
#include <fbxsdk/core/base/fbxarray.h>
#include <fbxsdk/core/base/fbxbitset.h>
#include <fbxsdk/core/base/fbxcharptrset.h>
#include <fbxsdk/core/base/fbxcontainerallocators.h>
#include <fbxsdk/core/base/fbxdynamicarray.h>
#include <fbxsdk/core/base/fbxstatus.h>
#include <fbxsdk/core/base/fbxfile.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/base/fbxfolder.h>
#endif
#include <fbxsdk/core/base/fbxhashmap.h>
#include <fbxsdk/core/base/fbxintrusivelist.h>
#include <fbxsdk/core/base/fbxmap.h>
#include <fbxsdk/core/base/fbxmemorypool.h>
#include <fbxsdk/core/base/fbxpair.h>
#include <fbxsdk/core/base/fbxset.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/core/base/fbxstringlist.h>
#include <fbxsdk/core/base/fbxtime.h>
#include <fbxsdk/core/base/fbxtimecode.h>
#include <fbxsdk/core/base/fbxutils.h>
//---------------------------------------------------------------------------------------
//Core Math Includes
#include <fbxsdk/core/math/fbxmath.h>
#include <fbxsdk/core/math/fbxdualquaternion.h>
#include <fbxsdk/core/math/fbxmatrix.h>
#include <fbxsdk/core/math/fbxquaternion.h>
#include <fbxsdk/core/math/fbxvector2.h>
#include <fbxsdk/core/math/fbxvector4.h>
//---------------------------------------------------------------------------------------
//Core Sync Includes
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/sync/fbxatomic.h>
#include <fbxsdk/core/sync/fbxclock.h>
#include <fbxsdk/core/sync/fbxsync.h>
#include <fbxsdk/core/sync/fbxthread.h>
#endif /* !FBXSDK_ENV_WINSTORE */
//---------------------------------------------------------------------------------------
//Core Includes
#include <fbxsdk/core/fbxclassid.h>
#include <fbxsdk/core/fbxconnectionpoint.h>
#include <fbxsdk/core/fbxdatatypes.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/fbxmodule.h>
#include <fbxsdk/core/fbxloadingstrategy.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#include <fbxsdk/core/fbxmanager.h>
#include <fbxsdk/core/fbxobject.h>
#include <fbxsdk/core/fbxperipheral.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/fbxplugin.h>
#include <fbxsdk/core/fbxplugincontainer.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#include <fbxsdk/core/fbxproperty.h>
#include <fbxsdk/core/fbxpropertydef.h>
#include <fbxsdk/core/fbxpropertyhandle.h>
#include <fbxsdk/core/fbxpropertypage.h>
#include <fbxsdk/core/fbxpropertytypes.h>
#include <fbxsdk/core/fbxquery.h>
#include <fbxsdk/core/fbxqueryevent.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/fbxscopedloadingdirectory.h>
#include <fbxsdk/core/fbxscopedloadingfilename.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#include <fbxsdk/core/fbxxref.h>
//---------------------------------------------------------------------------------------
//File I/O Includes
#include <fbxsdk/fileio/fbxexporter.h>
#include <fbxsdk/fileio/fbxexternaldocreflistener.h>
#include <fbxsdk/fileio/fbxfiletokens.h>
#include <fbxsdk/fileio/fbxglobalcamerasettings.h>
#include <fbxsdk/fileio/fbxgloballightsettings.h>
#include <fbxsdk/fileio/fbxgobo.h>
#include <fbxsdk/fileio/fbximporter.h>
#include <fbxsdk/fileio/fbxiobase.h>
#include <fbxsdk/fileio/fbxiopluginregistry.h>
#include <fbxsdk/fileio/fbxiosettings.h>
#include <fbxsdk/fileio/fbxstatisticsfbx.h>
#include <fbxsdk/fileio/fbxstatistics.h>
//---------------------------------------------------------------------------------------
//Scene Includes
#include <fbxsdk/scene/fbxaudio.h>
#include <fbxsdk/scene/fbxaudiolayer.h>
#include <fbxsdk/scene/fbxcollection.h>
#include <fbxsdk/scene/fbxcollectionexclusive.h>
#include <fbxsdk/scene/fbxcontainer.h>
#include <fbxsdk/scene/fbxcontainertemplate.h>
#include <fbxsdk/scene/fbxdisplaylayer.h>
#include <fbxsdk/scene/fbxdocument.h>
#include <fbxsdk/scene/fbxdocumentinfo.h>
#include <fbxsdk/scene/fbxenvironment.h>
#include <fbxsdk/scene/fbxgroupname.h>
#include <fbxsdk/scene/fbxlibrary.h>
#include <fbxsdk/scene/fbxmediaclip.h>
#include <fbxsdk/scene/fbxobjectmetadata.h>
#include <fbxsdk/scene/fbxpose.h>
#include <fbxsdk/scene/fbxreference.h>
#include <fbxsdk/scene/fbxscene.h>
#include <fbxsdk/scene/fbxselectionset.h>
#include <fbxsdk/scene/fbxselectionnode.h>
#include <fbxsdk/scene/fbxtakeinfo.h>
#include <fbxsdk/scene/fbxthumbnail.h>
#include <fbxsdk/scene/fbxvideo.h>
//---------------------------------------------------------------------------------------
//Scene Animation Includes
#include <fbxsdk/scene/animation/fbxanimcurve.h>
#include <fbxsdk/scene/animation/fbxanimcurvebase.h>
#include <fbxsdk/scene/animation/fbxanimcurvefilters.h>
#include <fbxsdk/scene/animation/fbxanimcurvenode.h>
#include <fbxsdk/scene/animation/fbxanimevalclassic.h>
#include <fbxsdk/scene/animation/fbxanimevalstate.h>
#include <fbxsdk/scene/animation/fbxanimevaluator.h>
#include <fbxsdk/scene/animation/fbxanimlayer.h>
#include <fbxsdk/scene/animation/fbxanimstack.h>
#include <fbxsdk/scene/animation/fbxanimutilities.h>
//---------------------------------------------------------------------------------------
//Scene Constraint Includes
#include <fbxsdk/scene/constraint/fbxcharacternodename.h>
#include <fbxsdk/scene/constraint/fbxcharacter.h>
#include <fbxsdk/scene/constraint/fbxcharacterpose.h>
#include <fbxsdk/scene/constraint/fbxconstraint.h>
#include <fbxsdk/scene/constraint/fbxconstraintaim.h>
#include <fbxsdk/scene/constraint/fbxconstraintcustom.h>
#include <fbxsdk/scene/constraint/fbxconstraintparent.h>
#include <fbxsdk/scene/constraint/fbxconstraintposition.h>
#include <fbxsdk/scene/constraint/fbxconstraintrotation.h>
#include <fbxsdk/scene/constraint/fbxconstraintscale.h>
#include <fbxsdk/scene/constraint/fbxconstraintsinglechainik.h>
#include <fbxsdk/scene/constraint/fbxconstraintutils.h>
#include <fbxsdk/scene/constraint/fbxcontrolset.h>
#include <fbxsdk/scene/constraint/fbxhik2fbxcharacter.h>
//---------------------------------------------------------------------------------------
//Scene Geometry Includes
#include <fbxsdk/scene/geometry/fbxblendshape.h>
#include <fbxsdk/scene/geometry/fbxblendshapechannel.h>
#include <fbxsdk/scene/geometry/fbxcache.h>
#include <fbxsdk/scene/geometry/fbxcachedeffect.h>
#include <fbxsdk/scene/geometry/fbxcamera.h>
#include <fbxsdk/scene/geometry/fbxcamerastereo.h>
#include <fbxsdk/scene/geometry/fbxcameraswitcher.h>
#include <fbxsdk/scene/geometry/fbxcluster.h>
#include <fbxsdk/scene/geometry/fbxdeformer.h>
#include <fbxsdk/scene/geometry/fbxgenericnode.h>
#include <fbxsdk/scene/geometry/fbxgeometry.h>
#include <fbxsdk/scene/geometry/fbxgeometrybase.h>
#include <fbxsdk/scene/geometry/fbxgeometryweightedmap.h>
#include <fbxsdk/scene/geometry/fbxlight.h>
#include <fbxsdk/scene/geometry/fbxlimitsutilities.h>
#include <fbxsdk/scene/geometry/fbxline.h>
#include <fbxsdk/scene/geometry/fbxlodgroup.h>
#include <fbxsdk/scene/geometry/fbxmarker.h>
#include <fbxsdk/scene/geometry/fbxmesh.h>
#include <fbxsdk/scene/geometry/fbxnode.h>
#include <fbxsdk/scene/geometry/fbxnodeattribute.h>
#include <fbxsdk/scene/geometry/fbxnull.h>
#include <fbxsdk/scene/geometry/fbxnurbs.h>
#include <fbxsdk/scene/geometry/fbxnurbscurve.h>
#include <fbxsdk/scene/geometry/fbxnurbssurface.h>
#include <fbxsdk/scene/geometry/fbxopticalreference.h>
#include <fbxsdk/scene/geometry/fbxpatch.h>
#include <fbxsdk/scene/geometry/fbxproceduralgeometry.h>
#include <fbxsdk/scene/geometry/fbxshape.h>
#include <fbxsdk/scene/geometry/fbxskeleton.h>
#include <fbxsdk/scene/geometry/fbxskin.h>
#include <fbxsdk/scene/geometry/fbxsubdeformer.h>
#include <fbxsdk/scene/geometry/fbxsubdiv.h>
#include <fbxsdk/scene/geometry/fbxtrimnurbssurface.h>
#include <fbxsdk/scene/geometry/fbxvertexcachedeformer.h>
#include <fbxsdk/scene/geometry/fbxweightedmapping.h>
//---------------------------------------------------------------------------------------
//Scene Shading Includes
#include <fbxsdk/scene/shading/fbxshadingconventions.h>
#include <fbxsdk/scene/shading/fbxbindingsentryview.h>
#include <fbxsdk/scene/shading/fbxbindingtable.h>
#include <fbxsdk/scene/shading/fbxbindingtableentry.h>
#include <fbxsdk/scene/shading/fbxbindingoperator.h>
#include <fbxsdk/scene/shading/fbxconstantentryview.h>
#include <fbxsdk/scene/shading/fbxentryview.h>
#include <fbxsdk/scene/shading/fbxfiletexture.h>
#include <fbxsdk/scene/shading/fbximplementation.h>
#include <fbxsdk/scene/shading/fbximplementationfilter.h>
#include <fbxsdk/scene/shading/fbximplementationutils.h>
#include <fbxsdk/scene/shading/fbxlayeredtexture.h>
#include <fbxsdk/scene/shading/fbxoperatorentryview.h>
#include <fbxsdk/scene/shading/fbxproceduraltexture.h>
#include <fbxsdk/scene/shading/fbxpropertyentryview.h>
#include <fbxsdk/scene/shading/fbxsemanticentryview.h>
#include <fbxsdk/scene/shading/fbxsurfacelambert.h>
#include <fbxsdk/scene/shading/fbxsurfacematerial.h>
#include <fbxsdk/scene/shading/fbxsurfacephong.h>
#include <fbxsdk/scene/shading/fbxtexture.h>
//---------------------------------------------------------------------------------------
//Utilities Includes
#include <fbxsdk/utils/fbxdeformationsevaluator.h>
#include <fbxsdk/utils/fbxprocessor.h>
#include <fbxsdk/utils/fbxprocessorxref.h>
#include <fbxsdk/utils/fbxprocessorxrefuserlib.h>
#include <fbxsdk/utils/fbxprocessorshaderdependency.h>
#include <fbxsdk/utils/fbxclonemanager.h>
#include <fbxsdk/utils/fbxgeometryconverter.h>
#include <fbxsdk/utils/fbxmanipulators.h>
#include <fbxsdk/utils/fbxmaterialconverter.h>
#include <fbxsdk/utils/fbxrenamingstrategyfbx5.h>
#include <fbxsdk/utils/fbxrenamingstrategyfbx6.h>
#include <fbxsdk/utils/fbxrenamingstrategyutilities.h>
#include <fbxsdk/utils/fbxrootnodeutility.h>
#include <fbxsdk/utils/fbxusernotification.h>
#include <fbxsdk/utils/fbxscenecheckutility.h>
//---------------------------------------------------------------------------------------
#if defined(FBXSDK_NAMESPACE) && (FBXSDK_NAMESPACE_USING == 1)
using namespace FBXSDK_NAMESPACE;
#endif
#pragma pack(pop)
#endif /* _FBXSDK_H_ */

View File

@ -0,0 +1,420 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
/** \file fbxalloc.h
* Allocation functions definition.
*
* It is possible to override memory allocation functions throughout the FBX SDK by
* providing system memory allocation functions using the handler set functions below.
* The Microsoft Windows implementation in debug mode allows to specify where the
* allocations happen by providing the standard block type, file name and line number.
*/
#ifndef _FBXSDK_CORE_ARCH_ALLOC_H_
#define _FBXSDK_CORE_ARCH_ALLOC_H_
#include <fbxsdk/fbxsdk_def.h>
#if defined(_DEBUG) && defined(FBXSDK_ENV_WIN)
#include <crtdbg.h>
#endif
#if defined(FBXSDK_ENV_MAC)
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <fbxsdk/fbxsdk_nsbegin.h>
#if defined(FBXSDK_CPU_32) && !defined(FBXSDK_ENV_IOS)
#define FBXSDK_MEMORY_ALIGNMENT ((size_t)8U)
#else
#define FBXSDK_MEMORY_ALIGNMENT ((size_t)16U)
#endif
#define FBXSDK_MEMORY_COPY(dst, src, size) {memcpy(dst,src,size);}
typedef void* (*FbxMallocProc)(size_t); //! Function pointer signature used to replace "malloc"
typedef void* (*FbxCallocProc)(size_t, size_t); //! Function pointer signature used to replace "calloc"
typedef void* (*FbxReallocProc)(void*, size_t); //! Function pointer signature used to replace "realloc"
typedef void (*FbxFreeProc)(void*); //! Function pointer signature used to replace "free"
/** Set the global memory allocation function used internally by the FBX SDK.
* \param pHandler Function pointer that implements the necessary procedure to allocate memory in the system. */
FBXSDK_DLL void FbxSetMallocHandler(FbxMallocProc pHandler);
/** Set the global zero'd memory allocation function used internally by the FBX SDK.
* \param pHandler Function pointer that implements the necessary procedure to allocate zero'd memory in the system. */
FBXSDK_DLL void FbxSetCallocHandler(FbxCallocProc pHandler);
/** Set the global memory re-allocation function used internally by the FBX SDK.
* \param pHandler Function pointer that implements the necessary procedure to re-allocate memory in the system. */
FBXSDK_DLL void FbxSetReallocHandler(FbxReallocProc pHandler);
/** Set the global memory freeing function used internally by the FBX SDK.
* \param pHandler Function pointer that implements the necessary procedure to free memory in the system. */
FBXSDK_DLL void FbxSetFreeHandler(FbxFreeProc pHandler);
/** Get the global memory allocation function used internally by the FBX SDK.
* \return pHandler Function pointer on FBX's internal malloc */
FBXSDK_DLL FbxMallocProc FbxGetMallocHandler();
/** Get the global zero'd memory allocation function used internally by the FBX SDK.
* \return pHandler Function pointer on FBX's internal calloc */
FBXSDK_DLL FbxCallocProc FbxGetCallocHandler();
/** Get the global memory re-allocation function used internally by the FBX SDK.
* \return pHandler Function pointer on FBX's internal realloc */
FBXSDK_DLL FbxReallocProc FbxGetReallocHandler();
/** Get the global memory freeing function used internally by the FBX SDK.
* \return pHandler Function pointer on FBX's internal free */
FBXSDK_DLL FbxFreeProc FbxGetFreeHandler();
/** Get the default global memory allocation function used internally by the FBX SDK.
* \return pHandler Function pointer on FBX's internal malloc */
FBXSDK_DLL FbxMallocProc FbxGetDefaultMallocHandler();
/** Get the default global zero'd memory allocation function used internally by the FBX SDK.
* \return pHandler Function pointer on FBX's internal calloc */
FBXSDK_DLL FbxCallocProc FbxGetDefaultCallocHandler();
/** Get the default global memory re-allocation function used internally by the FBX SDK.
* \return pHandler Function pointer on FBX's internal realloc */
FBXSDK_DLL FbxReallocProc FbxGetDefaultReallocHandler();
/** Get the default global memory freeing function used internally by the FBX SDK.
* \return pHandler Function pointer on FBX's internal free */
FBXSDK_DLL FbxFreeProc FbxGetDefaultFreeHandler();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FBXSDK_DLL size_t FbxAllocSize(size_t pNbItems, size_t pItemSize);
FBXSDK_DLL void* FbxMalloc(size_t pSize);
FBXSDK_DLL void* FbxCalloc(size_t pCount, size_t pSize);
FBXSDK_DLL void* FbxRealloc(void* pData, size_t pSize);
FBXSDK_DLL void FbxFree(void* pData);
FBXSDK_DLL char* FbxStrDup(const char* pString);
FBXSDK_DLL wchar_t* FbxStrDupWC(const wchar_t* pString);
//These versions of allocators use the default system mallocs, and on Windows we also pass the debugging parameters.
//If you define FBXSDK_ALLOC_DEBUG in your project, the FBX SDK will use these debug versions everywhere.
FBXSDK_DLL void* FbxMallocDebug(size_t pSize, int pBlock, const char* pFile, int pLine);
FBXSDK_DLL void* FbxCallocDebug(size_t pCount, size_t pSize, int pBlock, const char* pFile, int pLine);
FBXSDK_DLL void* FbxReallocDebug(void* pData, size_t pSize, int pBlock, const char* pFile, int pLine);
FBXSDK_DLL void FbxFreeDebug(void* pData, int pBlock);
//When FBXSDK_ALLOC_DEBUG is defined, redirect allocation calls to the debug version.
#if defined(FBXSDK_ALLOC_DEBUG)
#define FbxMalloc(s) FbxMallocDebug(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define FbxCalloc(c, s) FbxCallocDebug(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define FbxRealloc(p, s) FbxReallocDebug(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define FbxFree(p) FbxFreeDebug(p, _NORMAL_BLOCK)
#endif
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
//! Deletion policy for pointer template classes that uses the delete operator.
template <class Type> class FbxDeletionPolicyDefault
{
public:
//! Destruction policy implementation.
static inline void DeleteIt(Type** pPtr)
{
if( *pPtr )
{
delete *pPtr;
*pPtr = NULL;
}
}
};
//! Deletion policy for pointer template classes that uses the FbxDelete() function.
template<typename T> void FbxDelete(T* p);
template<typename T> void FbxDelete(const T* p);
template <class Type> class FbxDeletionPolicyDelete
{
public:
//! Destruction policy implementation.
static inline void DeleteIt(Type** mPtr)
{
if( *mPtr )
{
FbxDelete(*mPtr);
*mPtr = NULL;
}
}
};
//! Deletion policy for pointer template classes that uses the FbxFree() function.
template <class Type> class FbxDeletionPolicyFree
{
public:
//! Destruction policy implementation.
static inline void DeleteIt(Type** pPtr)
{
if( *pPtr )
{
FbxFree(*pPtr);
*pPtr = NULL;
}
}
};
//! Deletion policy for pointer template classes that uses the Destroy() function.
template <class Type> class FbxDeletionPolicyObject
{
public:
//! Destruction policy implementation.
static inline void DeleteIt(Type** pPtr)
{
if( *pPtr )
{
(*pPtr)->Destroy();
*pPtr = NULL;
}
}
};
/** FbxAutoPtr mimics the \c auto_ptr class template implementation available in the C++ Standard Library. The \c auto_ptr template
* class describes an object that stores a pointer to a single allocated object of type Type* that ensures that the object to which
* it points gets destroyed automatically when control leaves a scope. */
template<class Type, class Policy=FbxDeletionPolicyDefault<Type> > class FbxAutoPtr
{
public:
//! Construct from a pointer.
explicit FbxAutoPtr(Type* pPtr=0) : mPtr(pPtr){}
//! Destructor.
~FbxAutoPtr() { Policy::DeleteIt(&mPtr); }
//! Retrieve the pointer it holds.
inline Type* Get() const { return mPtr; }
//! Member access operator.
inline Type* operator->() const { return mPtr; }
//! Convert to a Type pointer.
inline operator Type* () const { return mPtr; }
//! Dereference operator.
inline Type& operator*() const { return *mPtr; }
//! Logical not operator.
inline bool operator!() const { return mPtr == 0; }
//! Convert to boolean value.
inline operator bool () const { return mPtr != 0; }
//! Reset the scoped pointer by swapping with another pointer.
inline void Reset(Type* pPtr=0)
{
FBX_ASSERT(pPtr == 0 || pPtr != mPtr); //Catch self-reset errors
FbxAutoPtr<Type, Policy>(pPtr).Swap(*this);
}
//! Swap with another pointer.
inline void Swap(FbxAutoPtr& pOther)
{
Type* TmpPtr = pOther.mPtr;
pOther.mPtr = mPtr;
mPtr = TmpPtr;
}
//! Release the pointer, so that it won't perform deletion in its destruction.
inline Type* Release()
{
Type* TmpPtr = mPtr;
mPtr = NULL;
return TmpPtr;
}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
FbxAutoPtr(const FbxAutoPtr&);
FbxAutoPtr& operator=(const FbxAutoPtr&);
Type* mPtr;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
//! Scoped pointer for FbxMalloc allocations, which call FbxFree() to deallocate.
template <class Type> class FbxAutoFreePtr : public FbxAutoPtr<Type, FbxDeletionPolicyFree<Type> >
{
public:
//! Construct from a pointer.
explicit FbxAutoFreePtr(Type* pPtr=0) : FbxAutoPtr<Type, FbxDeletionPolicyFree<Type> >(pPtr){}
};
//! Scoped pointer for FbxNew allocations, which call FbxDelete() to deallocate.
template <class Type> class FbxAutoDeletePtr : public FbxAutoPtr<Type, FbxDeletionPolicyDelete<Type> >
{
public:
//! Construct from a pointer.
explicit FbxAutoDeletePtr(Type* pPtr=0) : FbxAutoPtr<Type, FbxDeletionPolicyDelete<Type> >(pPtr){}
};
//! Scoped pointer for FbxObject derived classes, which call Destroy() to deallocate.
template <class Type> class FbxAutoDestroyPtr : public FbxAutoPtr<Type, FbxDeletionPolicyObject<Type> >
{
public:
//! Construct from a pointer.
explicit FbxAutoDestroyPtr(Type* pPtr=0) : FbxAutoPtr<Type, FbxDeletionPolicyObject<Type> >(pPtr){}
};
/** FbxSharedPtr class describes an object that stores a pointer to a single allocated object of type
* Type* that ensures that the object to which it points gets destroyed automatically when the control
* leaves a scope and the reference count is 0. */
class RefCount
{
public:
RefCount() { Init(); };
~RefCount() { Init(); };
void Init() { count = 0; }
void IncRef() { count++; }
int DecRef() { count--; if (count < 0) count = 0; return count; }
private:
int count;
};
template<class Type, class Policy=FbxDeletionPolicyDefault<Type> > class FbxSharedPtr
{
public:
// Default constructor.
FbxSharedPtr() :
mPtr(0),
mRef(0)
{}
//! Construct from a pointer.
explicit FbxSharedPtr(Type* pPtr) :
mPtr(pPtr),
mRef(0)
{
if (pPtr != 0)
{
mRef = (RefCount*)FbxMalloc(sizeof(RefCount));
mRef->Init();
mRef->IncRef();
}
}
//! Copy constructor
FbxSharedPtr(const FbxSharedPtr& pSPtr) :
mPtr(pSPtr.mPtr),
mRef(pSPtr.mRef)
{
if (pSPtr.mPtr != 0 && mRef != 0)
mRef->IncRef();
}
// Assignment operator
FbxSharedPtr& operator=(const FbxSharedPtr& pSPtr)
{
if (this != &pSPtr) // avoid self assignment
{
Reset();
if (pSPtr.mPtr)
{
mPtr = pSPtr.mPtr;
mRef = pSPtr.mRef;
FBX_ASSERT(mRef != NULL);
mRef->IncRef();
}
}
return *this;
}
//! Destructor.
~FbxSharedPtr() { Destroy(); }
void Destroy() { Reset(); }
//! Retrieve the pointer it holds.
inline Type* Get() const { return mPtr; }
//! Member access operator.
inline Type* operator->() const { return mPtr; }
//! Convert to a Type pointer.
inline operator Type* () const { return mPtr; }
//! Dereference operator.
inline Type& operator*() const { return *mPtr; }
//! Logical not operator.
inline bool operator!() const { return mPtr == 0; }
//! Convert to boolean value.
inline operator bool () const { return mPtr != 0; }
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
void Reset()
{
if (mRef)
{
FBX_ASSERT(mPtr != 0);
if (mRef->DecRef() == 0)
{
Policy::DeleteIt(&mPtr);
FbxFree(mRef);
mRef = NULL;
}
}
}
Type* mPtr;
RefCount* mRef;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
//! Scoped pointer for FbxMalloc allocations, which call FbxFree() to deallocate.
template <class Type> class FbxSharedFreePtr : public FbxSharedPtr<Type, FbxDeletionPolicyFree<Type> >
{
public:
//! Construct from a pointer.
explicit FbxSharedFreePtr(Type* pPtr=0) : FbxSharedPtr<Type, FbxDeletionPolicyFree<Type> >(pPtr){}
};
//! Scoped pointer for FbxNew allocations, which call FbxDelete() to deallocate.
template <class Type> class FbxSharedDeletePtr : public FbxSharedPtr<Type, FbxDeletionPolicyDelete<Type> >
{
public:
//! Construct from a pointer.
explicit FbxSharedDeletePtr(Type* pPtr=0) : FbxSharedPtr<Type, FbxDeletionPolicyDelete<Type> >(pPtr){}
};
//! Scoped pointer for FbxObject derived classes, which call Destroy() to deallocate.
template <class Type> class FbxSharedDestroyPtr : public FbxSharedPtr<Type, FbxDeletionPolicyObject<Type> >
{
public:
//! Construct from a pointer.
explicit FbxSharedDestroyPtr(Type* pPtr=0) : FbxSharedPtr<Type, FbxDeletionPolicyObject<Type> >(pPtr){}
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_ARCH_ALLOC_H_ */

View File

@ -0,0 +1,238 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
/** \file fbxarch.h
* Architecture definition.
*
* List of available preprocessor defines that can appear on various systems:
*
* Operating System Environment:
* FBXSDK_ENV_WIN (Windows)
* FBXSDK_ENV_WINSTORE (Windows Store App)
* FBXSDK_ENV_MAC (MacOSX)
* FBXSDK_ENV_IOS (iOS)
* FBXSDK_ENV_LINUX (Linux)
*
* Architecture:
* FBXSDK_ARCH_IX86 (Intel x86)
* FBXSDK_ARCH_AMD64 (AMD64)
* FBXSDK_ARCH_ARM (Advanced RISC Machine)
*
* Processor:
* FBXSDK_CPU_32 (32bit processor)
* FBXSDK_CPU_64 (64bit processor)
*
* Compiler:
* FBXSDK_COMPILER_MSC (Microsoft Compiler)
* FBXSDK_COMPILER_GNU (GNU Compiler)
* FBXSDK_COMPILER_INTEL (Intel Compiler)
* FBXSDK_COMPILER_CLANG (Clang Compiler)
*
* These definitions are based on the information found here:
* http://predef.sourceforge.net/index.php
*
*/
#ifndef _FBXSDK_CORE_ARCH_ARCH_H_
#define _FBXSDK_CORE_ARCH_ARCH_H_
#if defined(_WIN32) || defined(_WIN64) //Microsoft Windows ------------------------------
#define FBXSDK_ENV_WIN 1
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
#define FBXSDK_ENV_WINSTORE 1
#endif
#if defined(_M_X64)
#define FBXSDK_ARCH_AMD64 1
#define FBXSDK_CPU_64 1
#elif defined(_M_IX86)
#define FBXSDK_ARCH_IX86 1
#define FBXSDK_CPU_32 1
#elif defined(_M_ARM)
#define FBXSDK_ARCH_ARM 1
#define FBXSDK_CPU_32 1
#else
#error Unsupported architecture!
#endif
#if defined(_MSC_VER)
#define FBXSDK_COMPILER_MSC 1
#elif defined(__GNUC__)
#define FBXSDK_COMPILER_GNU 1
#elif defined(__ICL)
#define FBXSDK_COMPILER_INTEL 1
#else
#error Unsupported compiler!
#endif
#elif defined(__APPLE__) || defined(__MACH__) //Apple MacOS/X ---------------------------
#include "TargetConditionals.h"
#define FBXSDK_ENV_MAC 1
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#define FBXSDK_ENV_IOS 1
#endif
#if defined(__i386__)
#define FBXSDK_ARCH_IX86 1
#define FBXSDK_CPU_32 1
#elif defined(__x86_64__) || defined(__x86_64)
#define FBXSDK_ARCH_AMD64 1
#define FBXSDK_CPU_64 1
#elif defined(__arm__)
#define FBXSDK_ARCH_ARM 1
#define FBXSDK_CPU_32 1
#elif defined(__arm64__)
#define FBXSDK_ARCH_ARM 1
#define FBXSDK_CPU_64 1
#else
#error Unsupported architecture!
#endif
#if defined(__GNUC__)
#define FBXSDK_COMPILER_GNU 1
#endif
#if defined(__clang__)
#define FBXSDK_COMPILER_CLANG 1
#endif
#if !defined(FBXSDK_COMPILER_GNU) && !defined(FBXSDK_COMPILER_CLANG)
#error Unsupported compiler!
#endif
#elif defined(__linux__) || defined(__CYGWIN__) || defined(EMSCRIPTEN) || defined(ANDROID) //Linux ---------------------------------
#define FBXSDK_ENV_LINUX 1
#if defined(EMSCRIPTEN)
#define FBXSDK_ENV_EMSCRIPTEN 1
#endif
#if defined(ANDROID)
#define FBXSDK_ENV_ANDROID 1
#endif
#if defined(__i386__)
#define FBXSDK_ARCH_IX86 1
#define FBXSDK_CPU_32 1
#elif defined(__x86_64__) || defined(__x86_64)
#define FBXSDK_ARCH_AMD64 1
#define FBXSDK_CPU_64 1
#elif defined(__arm__)
#define FBXSDK_ARCH_ARM 1
#define FBXSDK_CPU_32 1
#elif defined(EMSCRIPTEN)
#define FBXSDK_ARCH_AMD64 1
#define FBXSDK_CPU_64 1
#else
#error Unsupported architecture!
#endif
#if defined(__GNUC__)
#define FBXSDK_COMPILER_GNU 1
#elif defined(EMSCRIPTEN)
#define FBXSDK_COMPILER_EMSCRIPTEN 1
#else
#error Unsupported compiler!
#endif
#else
#error Unsupported platform!
#endif
//---------------------------------------------------------------------------------------
//Compiler Specifics
#if defined(FBXSDK_SHARED)
#if defined(FBXSDK_COMPILER_MSC) || defined(FBXSDK_COMPILER_INTEL)
#define FBXSDK_DLLIMPORT __declspec(dllimport)
#define FBXSDK_DLLEXPORT __declspec(dllexport)
#elif defined(FBXSDK_COMPILER_GNU) && (__GNUC__ >= 4)
#define FBXSDK_DLLIMPORT __attribute__((visibility("default")))
#define FBXSDK_DLLEXPORT __attribute__((visibility("default")))
#else
#define FBXSDK_DLLIMPORT
#define FBXSDK_DLLEXPORT
#endif
#else
#define FBXSDK_DLLIMPORT
#define FBXSDK_DLLEXPORT
#endif
#ifndef FBXSDK_DLL
#define FBXSDK_DLL FBXSDK_DLLIMPORT
#endif
#if defined(FBXSDK_COMPILER_MSC)
#pragma warning(disable : 4251) //'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
#if _MSC_VER >= 1300 // 7.1
#define FBX_DEPRECATED __declspec(deprecated)
#else
#define FBX_DEPRECATED
#endif
#elif defined(FBXSDK_COMPILER_GNU) || defined(FBXSDK_COMPILER_EMSCRIPTEN)
#define FBX_DEPRECATED __attribute__((deprecated))
#elif defined(FBXSDK_COMPILER_INTEL)
#if __INTEL_COMPILER >= 810
#define FBX_DEPRECATED __declspec(deprecated)
#else
#define FBX_DEPRECATED
#endif
#else
#error Unsupported compiler!
#endif
#ifdef FBXSDK_COMPILER_CLANG
#define FBX_UNUSED(p) _Pragma(FBX_STRINGIFY(unused(p)))
#else
#define FBX_UNUSED(p) (void)(p)
#endif
//---------------------------------------------------------------------------------------
//Platform Standardization
#ifndef NULL
#if defined(__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
#define NULL (__null)
#else
#if defined(__cplusplus)
#define NULL 0
#else
#define NULL ((void*)0)
#endif
#endif
#endif
#if !defined(_MAX_PATH)
#define _MAX_PATH 260
#endif
#if defined(FBXSDK_ENV_WIN)
#define snprintf _snprintf //for stdio.h platform compatibility
#endif
#if !defined(FBXSDK_COMPILER_MSC)
#ifndef strcmpi
#define strcmpi strcasecmp
#endif
#ifndef stricmp
#define stricmp strcasecmp
#endif
#ifndef strncmpi
#define strncmpi strncasecmp
#endif
#ifndef strnicmp
#define strnicmp strncasecmp
#endif
#endif
#endif /* _FBXSDK_CORE_ARCH_ARCH_H_ */

View File

@ -0,0 +1,93 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
/** \file fbxdebug.h
* Debugging macros and functions.
*
* All macros and functions are removed in release builds. To enable asserts, a debug build is required as well
* as the environment variable "FBXSDK_ASSERT" set to 1 is also required. By default, assertions will pop-up
* a window. It is possible to disable the pop-up on the Windows platform by calling the following code:
* \code
* _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
* \endcode
*/
#ifndef _FBXSDK_CORE_ARCH_DEBUG_H_
#define _FBXSDK_CORE_ARCH_DEBUG_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** If this environment variable is set to 1, the FBX SDK will assert in debug builds */
#define FBXSDK_ASSERT_ENVSTR "FBXSDK_ASSERT"
/** The assertion procedure signature. If a different assertion procedure must be provided, it should have this signature.
* \param pFileName The file name where the assertion occurred.
* \param pFunctionName The function name where the assertion occurred.
* \param pLineNumber The line number in the file where the assertion occurred.
* \param pMessage The message to display when the assertion occurs. */
typedef void (*FbxAssertProc)(const char* pFileName, const char* pFunctionName, const unsigned int pLineNumber, const char* pMessage);
/** Change the procedure used when assertion occurs.
* \param pAssertProc The procedure to be called when assertions occurs. */
FBXSDK_DLL void FbxAssertSetProc(FbxAssertProc pAssertProc);
//! Change the procedure back to the default one.
FBXSDK_DLL void FbxAssertSetDefaultProc();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FBXSDK_DLL void _FbxAssert(const char* pFileName, const char* pFunctionName, const unsigned int pLineNumber, bool pFormat, const char* pMessage, ...);
FBXSDK_DLL void _FbxTrace(const char* pMessage, ...);
#ifdef _DEBUG
template <bool x> struct FbxStaticAssertType;
template<> struct FbxStaticAssertType<true> {enum{value=1};};
template<> struct FbxStaticAssertType<false> {enum{value=-1};};
#define FBX_ASSERT(Condition) {if(!(Condition)){_FbxAssert(__FILE__,__FUNCTION__,__LINE__,false,#Condition);}}
#define FBX_ASSERT_MSG(Condition, Message, ...) {if(!(Condition)){_FbxAssert(__FILE__,__FUNCTION__,__LINE__,true,Message,##__VA_ARGS__);}}
#define FBX_ASSERT_NOW(Message, ...) _FbxAssert(__FILE__,__FUNCTION__,__LINE__,true,Message,##__VA_ARGS__);
#define FBX_ASSERT_RETURN(Condition) {if(!(Condition)){FBX_ASSERT_NOW(#Condition); return;}}
#define FBX_ASSERT_RETURN_VALUE(Condition, Value) {if(!(Condition)){FBX_ASSERT_NOW(#Condition); return Value;}}
#define FBX_ASSERT_STATIC(Condition) typedef char FbxBuildBreakIfFalse[FbxStaticAssertType<(bool)(Condition)>::value];
#define FBX_TRACE(Message, ...) {_FbxTrace(Message,##__VA_ARGS__);}
#else
#define FBX_ASSERT(Condition) ((void)0)
#define FBX_ASSERT_MSG(Condition, Message, ...) ((void)0)
#define FBX_ASSERT_NOW(Message, ...) ((void)0)
#define FBX_ASSERT_RETURN(Condition) if(!(Condition)){return;}
#define FBX_ASSERT_RETURN_VALUE(Condition, Value) if(!(Condition)){return Value;}
#define FBX_ASSERT_STATIC(Condition)
#define FBX_TRACE(Message, ...) ((void)0)
#endif
template<typename T> struct FbxIncompatibleWithArray{ enum {value = 0}; };
#define FBXSDK_INCOMPATIBLE_WITH_ARRAY_TEMPLATE(T)\
struct FbxIncompatibleWithArray< T >{\
union {\
T t();\
} catcherr;\
enum {value = 1};}
#define FBXSDK_INCOMPATIBLE_WITH_ARRAY(T)\
template<> FBXSDK_INCOMPATIBLE_WITH_ARRAY_TEMPLATE(T)
#define FBXSDK_IS_INCOMPATIBLE_WITH_ARRAY(T) ((bool) FbxIncompatibleWithArray<T>::value)
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_ARCH_DEBUG_H_ */

View File

@ -0,0 +1,511 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
/** \file fbxnew.h
* New operator override templates.
*
* Instead of overloading the operator new in the FBX SDK, we provide a set of templates
* that are used internally to create objects. This mechanic allows the FBX SDK to call
* a different memory allocator.
* \see FbxSetMallocHandler FbxSetCallocHandler FbxSetReallocHandler FbxSetFreeHandler FbxSetMSizeHandler
*/
#ifndef _FBXSDK_CORE_ARCH_NEW_H_
#define _FBXSDK_CORE_ARCH_NEW_H_
#include <fbxsdk/fbxsdk_def.h>
#include <new>
#if defined(FBXSDK_COMPILER_MSC)
#pragma warning(push)
#pragma warning(disable : 4345) //warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
#endif
#include <fbxsdk/fbxsdk_nsbegin.h>
//Type traits for primitive types
template<typename T> struct FbxSimpleType { enum {value = 0}; };
template<typename T> struct FbxSimpleType<T*> { enum {value = 1}; };
template<typename T> struct FbxSimpleType<const T> { enum {value = FbxSimpleType<T>::value}; };
template<typename T, size_t n> struct FbxSimpleType<T[n]> { enum {value = FbxSimpleType<T>::value}; };
#define FBXSDK_DEFINE_SIMPLE_TYPE(T) template<> struct FbxSimpleType<T>{ union {T t;} catcherr; enum {value = 1};}
FBXSDK_DEFINE_SIMPLE_TYPE(bool);
FBXSDK_DEFINE_SIMPLE_TYPE(char);
FBXSDK_DEFINE_SIMPLE_TYPE(unsigned char);
FBXSDK_DEFINE_SIMPLE_TYPE(short);
FBXSDK_DEFINE_SIMPLE_TYPE(unsigned short);
FBXSDK_DEFINE_SIMPLE_TYPE(int);
FBXSDK_DEFINE_SIMPLE_TYPE(unsigned int);
FBXSDK_DEFINE_SIMPLE_TYPE(long);
FBXSDK_DEFINE_SIMPLE_TYPE(unsigned long);
FBXSDK_DEFINE_SIMPLE_TYPE(float);
FBXSDK_DEFINE_SIMPLE_TYPE(double);
FBXSDK_DEFINE_SIMPLE_TYPE(long double);
FBXSDK_DEFINE_SIMPLE_TYPE(long long);
FBXSDK_DEFINE_SIMPLE_TYPE(unsigned long long);
#define FBXSDK_IS_SIMPLE_TYPE(T) ((bool)FbxSimpleType<T>::value)
template<typename T> T* FbxNew()
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T();
}
template<typename T, typename T1> T* FbxNew(T1& p1)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1);
}
template<typename T, typename T1> T* FbxNew(const T1& p1)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1);
}
template<typename T, typename T1, typename T2> T* FbxNew(T1& p1, T2& p2)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2);
}
template<typename T, typename T1, typename T2> T* FbxNew(T1& p1, const T2& p2)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2);
}
template<typename T, typename T1, typename T2> T* FbxNew(const T1& p1, T2& p2)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2);
}
template<typename T, typename T1, typename T2> T* FbxNew(const T1& p1, const T2& p2)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2);
}
template<typename T, typename T1, typename T2, typename T3> T* FbxNew(T1& p1, T2& p2, T3& p3)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3);
}
template<typename T, typename T1, typename T2, typename T3> T* FbxNew(T1& p1, T2& p2, const T3& p3)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3);
}
template<typename T, typename T1, typename T2, typename T3> T* FbxNew(T1& p1, const T2& p2, T3& p3)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3);
}
template<typename T, typename T1, typename T2, typename T3> T* FbxNew(T1& p1, const T2& p2, const T3& p3)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3);
}
template<typename T, typename T1, typename T2, typename T3> T* FbxNew(const T1& p1, T2& p2, T3& p3)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3);
}
template<typename T, typename T1, typename T2, typename T3> T* FbxNew(const T1& p1, T2& p2, const T3& p3)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3);
}
template<typename T, typename T1, typename T2, typename T3> T* FbxNew(const T1& p1, const T2& p2, T3& p3)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3);
}
template<typename T, typename T1, typename T2, typename T3> T* FbxNew(const T1& p1, const T2& p2, const T3& p3)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(T1& p1, T2& p2, T3& p3, T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(T1& p1, T2& p2, T3& p3, const T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(T1& p1, T2& p2, const T3& p3, T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(T1& p1, T2& p2, const T3& p3, const T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(T1& p1, const T2& p2, T3& p3, T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(T1& p1, const T2& p2, T3& p3, const T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(T1& p1, const T2& p2, const T3& p3, T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(T1& p1, const T2& p2, const T3& p3, const T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(const T1& p1, T2& p2, T3& p3, T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(const T1& p1, T2& p2, T3& p3, const T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(const T1& p1, T2& p2, const T3& p3, T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(const T1& p1, T2& p2, const T3& p3, const T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(const T1& p1, const T2& p2, T3& p3, T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(const T1& p1, const T2& p2, T3& p3, const T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1, p2, p3, p4);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(T1& p1, T2& p2, T3& p3, T4& p4, T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, T2& p2, T3& p3, T4& p4, T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, const T2& p2, T3& p3, T4& p4, T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, T2& p2, const T3& p3, T4& p4, T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, T2& p2, T3& p3, const T4& p4, T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, T2& p2, T3& p3, T4& p4, const T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, T4& p4, T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, const T2& p2, T3& p3, const T4& p4, T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, const T2& p2, T3& p3, T4& p4, const T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, T4& p4, const T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5, const T6& p6)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5,p6);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5, const T6& p6, const T7& p7)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5,p6,p7);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5, const T6& p6, const T7& p7, const T8& p8)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5,p6,p7,p8);
}
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> T* FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5, const T6& p6, const T7& p7, const T8& p8, const T9& p9)
{
T* p = (T*)FbxMalloc(sizeof(T));
return new(p)T(p1,p2,p3,p4,p5,p6,p7,p8,p9);
}
template<typename T> void FbxDelete(T* p)
{
if( p )
{
((T*)p)->~T();
FbxFree(p);
}
}
template<typename T> void FbxDelete(const T* p)
{
if( p )
{
((T*)p)->~T();
FbxFree(const_cast<T*>(p));
}
}
template<typename T> T* FbxNewArray(const int n)
{
size_t lSize = FbxAllocSize((size_t)n, sizeof(T));
if( FBXSDK_IS_SIMPLE_TYPE(T) )
{
return (T*)FbxMalloc(lSize);
}
else
{
void* pTmp = FbxMalloc(lSize + sizeof(int));
T* p = (T*)((int*)pTmp+1);
*((int*)pTmp) = n;
for( int i = 0; i < n; ++i )
{
new((T*)p+i)T; //in-place new, not allocating memory so it is safe.
}
return p;
}
}
template<typename T> void FbxDeleteArray(T* p)
{
if( p )
{
if( !FBXSDK_IS_SIMPLE_TYPE(T) )
{
for( int i = 0; i < ((int*)p)[-1]; ++i )
{
((T*)p)[i].~T();
}
FbxFree((int*)p-1);
}
else
{
FbxFree((void*)p);
}
}
}
#define FBXSDK_FRIEND_NEW()\
template<typename T>\
friend T* FBXSDK_NAMESPACE::FbxNew();\
template<typename T, typename T1>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1);\
template<typename T, typename T1>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1);\
template<typename T, typename T1, typename T2>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2);\
template<typename T, typename T1, typename T2>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2);\
template<typename T, typename T1, typename T2>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2);\
template<typename T, typename T1, typename T2>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2);\
template<typename T, typename T1, typename T2, typename T3>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, T3& p3);\
template<typename T, typename T1, typename T2, typename T3>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, const T3& p3);\
template<typename T, typename T1, typename T2, typename T3>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, T3& p3);\
template<typename T, typename T1, typename T2, typename T3>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, const T3& p3);\
template<typename T, typename T1, typename T2, typename T3>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3);\
template<typename T, typename T1, typename T2, typename T3>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, const T3& p3);\
template<typename T, typename T1, typename T2, typename T3>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3);\
template<typename T, typename T1, typename T2, typename T3>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3);\
\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, T3& p3, T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, T3& p3, const T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, const T3& p3, T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, const T3& p3, const T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, T3& p3, T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, T3& p3, const T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, const T3& p3, T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, const T3& p3, const T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, const T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, const T3& p3, T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, const T3& p3, const T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, const T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, T4& p4);\
template<typename T, typename T1, typename T2, typename T3, typename T4>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4);\
\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, T3& p3, T4& p4, T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, T4& p4, T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, T4& p4, T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, const T3& p3, T4& p4, T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, const T4& p4, T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, T4& p4, const T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, T4& p4, T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, const T4& p4, T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, T4& p4, const T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, T4& p4, const T5& p5);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5);\
\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5, const T6& p6);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5, const T6& p6, const T7& p7);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5, const T6& p6, const T7& p7, const T8& p8);\
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>\
friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5, const T6& p6, const T7& p7, const T8& p8, const T9& p9);\
template<typename T>\
friend void FBXSDK_NAMESPACE::FbxDelete(T* p);\
template<typename T>\
friend void FBXSDK_NAMESPACE::FbxDelete(const T* p);\
template<typename T>\
friend T* FBXSDK_NAMESPACE::FbxNewArray(const int n);\
template<typename T>\
friend void FBXSDK_NAMESPACE::FbxDeleteArray(T* p);
#ifdef FBXSDK_COMPILER_MSC
#pragma warning(pop)
#endif
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_ARCH_NEW_H_ */

View File

@ -0,0 +1,97 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
/** \file fbxstdcompliant.h
* Macros to properly support the CRT secure functions. */
#ifndef _FBXSDK_CORE_ARCH_STDCOMPLIANT_H_
#define _FBXSDK_CORE_ARCH_STDCOMPLIANT_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
#if defined(FBXSDK_ENV_WIN)
#define FBXSDK_printf printf_s
#define FBXSDK_fprintf fprintf_s
inline int FBXSDK_sprintf(char* dst, size_t dstsize, const char* format, ...){ va_list vl; va_start(vl, format); int ret = vsprintf_s(dst, dstsize, format, vl); va_end(vl); return ret; }
inline int FBXSDK_snprintf(char* dst, size_t dstsize, const char* format, ...){ va_list vl; va_start(vl, format); int ret = vsnprintf_s(dst, dstsize, _TRUNCATE, format, vl); va_end(vl); return ret; }
inline int FBXSDK_vsprintf(char* dst, size_t dstsize, const char* format, va_list vl){ return vsprintf_s(dst, dstsize, format, vl); }
inline int FBXSDK_vsnprintf(char* dst, size_t dstsize, const char* format, va_list vl){ return vsnprintf_s(dst, dstsize, _TRUNCATE, format, vl); }
#define FBXSDK_stricmp(dst, src) _stricmp(dst, src)
#define FBXSDK_strnicmp(dst, src, count) _strnicmp(dst, src, count)
#define FBXSDK_strcpy(dst, size, src) strcpy_s(dst, size, src)
#define FBXSDK_strncpy(dst, size, src, count) strncpy_s(dst, size, src, count)
#define FBXSDK_strcat(dst, size, src) strcat_s(dst, size, src)
#define FBXSDK_strtok(str, delim, ctx) strtok_s(str, delim, ctx)
#define FBXSDK_wcscpy(dst, size, src) wcscpy_s(dst, size, src)
#define FBXSDK_wcscat(dst, size, src) wcscat_s(dst, size, src)
#if !defined(FBXSDK_ENV_WINSTORE)
#define FBXSDK_getpid _getpid
#define FBXSDK_getcwd _getcwd
#else
inline int FBXSDK_getpid(){ return 0; }
inline char* FBXSDK_getcwd(char*,int){ return NULL; }
#endif
#define FBXSDK_localtime(ptm, time) { struct tm tms; ptm = &tms; localtime_s(ptm, time); }
#define FBXSDK_gmtime(ptm, time) { struct tm tms; ptm = &tms; gmtime_s(ptm, time); }
#define FBXSDK_fopen(fp, name, mode) fopen_s(&fp, name, mode)
#elif defined(FBXSDK_ENV_MAC) || defined(FBXSDK_ENV_LINUX)
#define FBXSDK_printf printf
#define FBXSDK_fprintf fprintf
inline int FBXSDK_sprintf(char* dst, size_t dstsize, const char* format, ...){ va_list vl; va_start(vl, format); int ret = vsprintf(dst, format, vl); va_end(vl); return ret; }
inline int FBXSDK_snprintf(char* dst, size_t dstsize, const char* format, ...){ va_list vl; va_start(vl, format); int ret = vsnprintf(dst, dstsize, format, vl); va_end(vl); return ret; }
inline int FBXSDK_vsprintf(char* dst, size_t dstsize, const char* format, va_list vl){ return vsprintf(dst, format, vl); }
inline int FBXSDK_vsnprintf(char* dst, size_t dstsize, const char* format, va_list vl){ return vsnprintf(dst, dstsize, format, vl); }
#define FBXSDK_stricmp(dst, src) stricmp(dst, src)
#define FBXSDK_strnicmp(dst, src, count) strnicmp(dst, src, count)
#define FBXSDK_strcpy(dst, size, src) strcpy(dst, src)
#define FBXSDK_strncpy(dst, size, src, count) strncpy(dst, src, count)
#define FBXSDK_strcat(dst, size, src) strcat(dst, src)
#define FBXSDK_strtok(str, delim, ctx) strtok(str, delim)
#define FBXSDK_wcscpy(dst, size, src) wcscpy(dst, src)
#define FBXSDK_wcscat(dst, size, src) wcscat_s(dst, src)
#define FBXSDK_getpid getpid
#define FBXSDK_getcwd getcwd
#define FBXSDK_localtime(tm, time) tm=localtime(time)
#define FBXSDK_gmtime(tm, time) tm=gmtime(time)
#define FBXSDK_fopen(fp, name, mode) fp=fopen(name, mode)
#else
#error Unsupported platform!
#endif
#define FBXSDK_strdup FbxStrDup
//The scanf family functions cannot easily be used in both secure and non-secure versions because
//Microsoft's secure version expects the size of the string/char* arguments following their address.
//On Unix machines the scanf family functions do not have this behavior and trying to use the same
//calls would result in compiler errors because the arguments would not match the format string.
//Using the following macros in the code will simply desable the warning at compile time.
#if defined(FBXSDK_COMPILER_MSC) && (_MSC_VER >= 1300)
#define FBXSDK_CRT_SECURE_NO_WARNING_BEGIN\
{\
__pragma(warning(push))\
__pragma(warning(disable : 4996))\
}
#define FBXSDK_CRT_SECURE_NO_WARNING_END\
{\
__pragma(warning(pop))\
}
#else
#define FBXSDK_CRT_SECURE_NO_WARNING_BEGIN
#define FBXSDK_CRT_SECURE_NO_WARNING_END
#endif
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_ARCH_STDCOMPLIANT_H_ */

View File

@ -0,0 +1,264 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
/** \file fbxtypes.h
* Basic types definition.
*
* Standard basic types used across the FBX SDK. There is also platform independent
* definitions that guarantee size across operating systems. The FBXSDK_SYSTEM_IS_LP64
* define is set to 1 when the operating system defines the "long" C++ type as 64-bit.
*/
#ifndef _FBXSDK_CORE_ARCH_TYPES_H_
#define _FBXSDK_CORE_ARCH_TYPES_H_
#include <fbxsdk/core/arch/fbxarch.h>
//Note: On MacOSX and Linux 64-bit, long is defined as 64-bits while on Windows
//it is still a 32-bits for backward compatibility. We stick with Windows standard.
#if defined(FBXSDK_CPU_64) && !defined(FBXSDK_ENV_WIN)
#define FBXSDK_SYSTEM_IS_LP64 1
#endif
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxObject;
typedef bool FbxBool;
typedef signed char FbxChar;
typedef unsigned char FbxUChar;
typedef signed short FbxShort;
typedef unsigned short FbxUShort;
typedef signed int FbxInt;
typedef unsigned int FbxUInt;
typedef float FbxFloat;
typedef double FbxDouble;
typedef FbxBool* FbxBoolPtr;
typedef FbxChar* FbxCharPtr;
typedef FbxUChar* FbxUCharPtr;
typedef FbxShort* FbxShortPtr;
typedef FbxUShort* FbxUShortPtr;
typedef FbxInt* FbxIntPtr;
typedef FbxUInt* FbxUIntPtr;
typedef FbxFloat* FbxFloatPtr;
typedef FbxDouble* FbxDoublePtr;
typedef FbxInt FbxEnum;
typedef FbxObject* FbxReference;
//-------------------------------------------------------------------------------------
//Architecture independent defines (guarantee size)
#if defined(FBXSDK_COMPILER_MSC)
#define FBXSDK_LONGLONG(x) (x##i64)
#define FBXSDK_ULONGLONG(x) (x##Ui64)
typedef signed __int8 FbxInt8;
typedef unsigned __int8 FbxUInt8;
typedef signed __int16 FbxInt16;
typedef unsigned __int16 FbxUInt16;
typedef signed __int32 FbxInt32;
typedef unsigned __int32 FbxUInt32;
typedef signed __int64 FbxInt64;
typedef unsigned __int64 FbxUInt64;
#else
#define FBXSDK_LONGLONG(x) (x##LL)
#define FBXSDK_ULONGLONG(x) (x##ULL)
typedef signed char FbxInt8;
typedef unsigned char FbxUInt8;
typedef signed short FbxInt16;
typedef unsigned short FbxUInt16;
typedef signed int FbxInt32;
typedef unsigned int FbxUInt32;
typedef signed long long FbxInt64;
typedef unsigned long long FbxUInt64;
#endif
#ifdef FBXSDK_SYSTEM_IS_LP64
typedef signed int FbxLong;
typedef unsigned int FbxULong;
#else
typedef signed long FbxLong;
typedef unsigned long FbxULong;
#endif
typedef FbxInt64 FbxLongLong;
typedef FbxUInt64 FbxULongLong;
typedef FbxLong* FbxLongPtr;
typedef FbxULong* FbxULongPtr;
typedef FbxLongLong* FbxLongLongPtr;
typedef FbxULongLong* FbxULongLongPtr;
#if defined(FBXSDK_ENV_EMSCRIPTEN)
typedef FbxInt32 __int32_t;
typedef FbxUInt32 __uint32_t;
typedef FbxInt64 __int64_t;
typedef FbxUInt64 __uint64_t;
#endif
//-------------------------------------------------------------------------------------
//Minimum and Maximum values for types
#define FBXSDK_CHAR_MIN -128
#define FBXSDK_CHAR_MAX 127
#define FBXSDK_UCHAR_MIN 0
#define FBXSDK_UCHAR_MAX 255
#define FBXSDK_SHORT_MIN -32768
#define FBXSDK_SHORT_MAX 32767
#define FBXSDK_USHORT_MIN 0
#define FBXSDK_USHORT_MAX 65535
#define FBXSDK_INT_MIN 0x80000000
#define FBXSDK_INT_MAX 0x7fffffff
#define FBXSDK_UINT_MIN 0
#define FBXSDK_UINT_MAX 0xffffffff
#define FBXSDK_LONG_MIN FBXSDK_INT_MIN
#define FBXSDK_LONG_MAX FBXSDK_INT_MAX
#define FBXSDK_ULONG_MIN FBXSDK_UINT_MIN
#define FBXSDK_ULONG_MAX FBXSDK_UINT_MAX
#define FBXSDK_LONGLONG_MIN FBXSDK_LONGLONG(0x8000000000000000)
#define FBXSDK_LONGLONG_MAX FBXSDK_LONGLONG(0x7fffffffffffffff)
#define FBXSDK_ULONGLONG_MIN FBXSDK_ULONGLONG(0)
#define FBXSDK_ULONGLONG_MAX FBXSDK_ULONGLONG(0xffffffffffffffff)
#define FBXSDK_FLOAT_MIN FLT_MIN
#define FBXSDK_FLOAT_MAX FLT_MAX
#define FBXSDK_FLOAT_EPSILON FLT_EPSILON
#define FBXSDK_DOUBLE_MIN DBL_MIN
#define FBXSDK_DOUBLE_MAX DBL_MAX
#define FBXSDK_DOUBLE_EPSILON DBL_EPSILON
#define FBXSDK_TOLERANCE (1.0e-6)
//-------------------------------------------------------------------------------------
//Handle and atomic definition (size change depending of architecture)
#if defined(FBXSDK_CPU_32)
typedef FbxUInt32 FbxHandle;
#define FBXSDK_REF_MIN FBXSDK_UINT_MIN
#define FBXSDK_REF_MAX FBXSDK_UINT_MAX
typedef FbxLong FbxAtomic;
#define FBXSDK_ATOMIC_MIN FBXSDK_LONG_MIN
#define FBXSDK_ATOMIC_MAX FBXSDK_LONG_MAX
#elif defined(FBXSDK_CPU_64)
typedef FbxUInt64 FbxHandle;
#define FBXSDK_REF_MIN FBXSDK_ULONGLONG_MIN
#define FBXSDK_REF_MAX FBXSDK_ULONGLONG_MAX
typedef FbxInt64 FbxAtomic;
#define FBXSDK_ATOMIC_MIN FBXSDK_LONGLONG_MIN
#define FBXSDK_ATOMIC_MAX FBXSDK_LONGLONG_MAX
#else
#error Unsupported architecture!
#endif
//-------------------------------------------------------------------------------------
//Various utility functions for fbxsdk basic types
inline FbxChar FbxMin(const FbxChar){ return FBXSDK_CHAR_MIN; }
inline FbxUChar FbxMin(const FbxUChar){ return FBXSDK_UCHAR_MIN; }
inline FbxShort FbxMin(const FbxShort){ return FBXSDK_SHORT_MIN; }
inline FbxUShort FbxMin(const FbxUShort){ return FBXSDK_USHORT_MIN; }
inline FbxInt FbxMin(const FbxInt){ return FBXSDK_INT_MIN; }
inline FbxUInt FbxMin(const FbxUInt){ return FBXSDK_UINT_MIN; }
inline FbxLongLong FbxMin(const FbxLongLong){ return FBXSDK_LONGLONG_MIN; }
inline FbxULongLong FbxMin(const FbxULongLong){ return FBXSDK_ULONGLONG_MIN; }
inline FbxFloat FbxMin(const FbxFloat){ return FBXSDK_FLOAT_MIN; }
inline FbxDouble FbxMin(const FbxDouble){ return FBXSDK_DOUBLE_MIN; }
inline FbxChar FbxMax(const FbxChar){ return FBXSDK_CHAR_MAX; }
inline FbxUChar FbxMax(const FbxUChar){ return FBXSDK_UCHAR_MAX; }
inline FbxShort FbxMax(const FbxShort){ return FBXSDK_SHORT_MAX; }
inline FbxUShort FbxMax(const FbxUShort){ return FBXSDK_USHORT_MAX; }
inline FbxInt FbxMax(const FbxInt){ return FBXSDK_INT_MAX; }
inline FbxUInt FbxMax(const FbxUInt){ return FBXSDK_UINT_MAX; }
inline FbxLongLong FbxMax(const FbxLongLong){ return FBXSDK_LONGLONG_MAX; }
inline FbxULongLong FbxMax(const FbxULongLong){ return FBXSDK_ULONGLONG_MAX; }
inline FbxFloat FbxMax(const FbxFloat){ return FBXSDK_FLOAT_MAX; }
inline FbxDouble FbxMax(const FbxDouble){ return FBXSDK_DOUBLE_MAX; }
#ifndef FBXSDK_SYSTEM_IS_LP64
inline FbxLong FbxMin(const FbxLong){ return FBXSDK_LONG_MIN; }
inline FbxULong FbxMin(const FbxULong){ return FBXSDK_ULONG_MIN; }
inline FbxLong FbxMax(const FbxLong){ return FBXSDK_LONG_MAX; }
inline FbxULong FbxMax(const FbxULong){ return FBXSDK_ULONG_MAX; }
#endif
template<class T> inline T FbxMin(const T){};
template<class T> inline T FbxMax(const T){};
template<class T> inline T FbxMin(const T x, const T y){ return (x < y) ? x : y; }
template<class T> inline T FbxMax(const T x, const T y){ return (x > y) ? x : y; }
//-------------------------------------------------------------------------------------
//Vector Template Types
template<class T> class FBXSDK_DLL FbxVectorTemplate2
{
public:
inline FbxVectorTemplate2(){ *this = T(0); }
inline explicit FbxVectorTemplate2(T pValue){ *this = pValue; }
inline FbxVectorTemplate2(T pData0, T pData1){ mData[0] = pData0; mData[1] = pData1; }
inline ~FbxVectorTemplate2(){}
inline T& operator[](int pIndex){ return mData[pIndex]; }
inline const T& operator[](int pIndex) const { return mData[pIndex]; }
inline FbxVectorTemplate2<T>& operator=(const T& pValue){ mData[0] = pValue; mData[1] = pValue; return *this; }
inline FbxVectorTemplate2<T>& operator=(const FbxVectorTemplate2<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; return *this; }
inline bool operator==(const FbxVectorTemplate2<T>& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1])); }
inline bool operator!=(const FbxVectorTemplate2<T>& pVector) const { return !operator==( pVector ); }
inline T* Buffer(){ return mData; }
inline const T* Buffer() const { return mData; }
T mData[2];
};
template<class T> class FBXSDK_DLL FbxVectorTemplate3
{
public:
inline FbxVectorTemplate3(){ *this = T(0); }
inline explicit FbxVectorTemplate3(T pValue){ *this = pValue; }
inline FbxVectorTemplate3(T pData0, T pData1, T pData2){ mData[0] = pData0; mData[1] = pData1; mData[2] = pData2; }
inline ~FbxVectorTemplate3(){}
inline T& operator[](int pIndex) { return mData[pIndex]; }
inline const T& operator[](int pIndex) const { return mData[pIndex]; }
inline operator FbxVectorTemplate2<T>& () const { return *((FbxVectorTemplate2<T>*)this); }
inline FbxVectorTemplate3<T>& operator=(T const &pValue){ mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; return *this; }
inline FbxVectorTemplate3<T>& operator=(const FbxVectorTemplate2<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; return *this; }
inline FbxVectorTemplate3<T>& operator=(const FbxVectorTemplate3<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; mData[2] = pVector.mData[2]; return *this; }
inline bool operator==(const FbxVectorTemplate3<T>& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1]) && (mData[2] == pVector.mData[2])); }
inline bool operator!=(const FbxVectorTemplate3<T>& pVector) const { return !operator==(pVector); }
inline T* Buffer(){ return mData; }
inline const T* Buffer() const { return mData; }
T mData[3];
};
template<class T> class FBXSDK_DLL FbxVectorTemplate4
{
public:
inline FbxVectorTemplate4(){ *this = T(0); }
inline explicit FbxVectorTemplate4(T pValue){ *this = pValue; }
inline FbxVectorTemplate4(T pData0, T pData1, T pData2, T pData3){ mData[0] = pData0; mData[1] = pData1; mData[2] = pData2; mData[3] = pData3; }
inline ~FbxVectorTemplate4(){}
inline T& operator[](int pIndex){ return mData[pIndex]; }
inline const T& operator[](int pIndex) const { return mData[pIndex]; }
inline operator FbxVectorTemplate3<T>& () const { return *((FbxVectorTemplate3<T>*)this); }
inline FbxVectorTemplate4<T>& operator=(const T& pValue){ mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; mData[3] = pValue; return *this; }
inline FbxVectorTemplate4<T>& operator=(const FbxVectorTemplate3<T>& pValue){ mData[0] = pValue[0]; mData[1] = pValue[1]; mData[2] = pValue[2]; return *this; }
inline FbxVectorTemplate4<T>& operator=(const FbxVectorTemplate4<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; mData[2] = pVector.mData[2]; mData[3] = pVector.mData[3]; return *this; }
inline bool operator==(const FbxVectorTemplate4<T>& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1]) && (mData[2] == pVector.mData[2]) && (mData[3] == pVector.mData[3])); }
inline bool operator!=(const FbxVectorTemplate4<T>& pVector) const { return !operator==( pVector ); }
inline T* Buffer(){ return mData; }
inline const T* Buffer() const { return mData; }
T mData[4];
};
typedef FbxVectorTemplate2<FbxDouble> FbxDouble2;
typedef FbxVectorTemplate3<FbxDouble> FbxDouble3;
typedef FbxVectorTemplate4<FbxDouble> FbxDouble4;
typedef FbxVectorTemplate4<FbxDouble4> FbxDouble4x4;
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_ARCH_TYPES_H_ */

View File

@ -0,0 +1,489 @@
/****************************************************************************************
Copyright (C) 2017 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxarray.h
#ifndef _FBXSDK_CORE_BASE_ARRAY_H_
#define _FBXSDK_CORE_BASE_ARRAY_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Class for array of basic elements such as pointers and basic types. This class will not
* call constructor and destructor for elements, thus it is not suitable for object references.
* Memory allocations are always done in a single contiguous memory region. */
template <class T> class FbxArray
{
public:
//! Element compare function pointer definition
typedef int (*CompareFunc)(const void*, const void*);
//! Constructor.
FbxArray() : mSize(0), mCapacity(0), mArray(NULL){}
//! Reserve constructor.
FbxArray(const int pCapacity) : mSize(0), mCapacity(0), mArray(NULL){ if( pCapacity > 0 ) Reserve(pCapacity); }
//! Copy constructor.
FbxArray(const FbxArray& pArray) : mSize(0), mCapacity(0), mArray(NULL){ *this = pArray; }
/** Destructor.
* \remark The destructor for each element will not be called. */
~FbxArray(){ Clear(); }
/** Insert an element at the given position, growing the array if capacity is not sufficient.
* \param pIndex Position where to insert the element. Must be a positive value.
* \param pElement Element to insert in the array.
* \param pCompact If \c true and capacity is exceeded, grow capacity by one, otherwise double capacity (default).
* \return -1 if insert failed, otherwise the position of the inserted element in the array.
* \remark If the given index is greater than Size(), the element is appended at the end. Use compact mode only if you need to save memory. */
inline int InsertAt(const int pIndex, const T& pElement, bool pCompact=false)
{
FBX_ASSERT_RETURN_VALUE(pIndex >= 0, -1);
int lIndex = FbxMin(pIndex, mSize);
if( mSize >= mCapacity )
{
T lElement = pElement; //Copy element because we might move memory
int lNewCapacity = FbxMax(pCompact ? mCapacity + 1 : mCapacity * 2, 1); //We always double capacity when not compacting
T* lArray = Allocate(lNewCapacity);
FBX_ASSERT_RETURN_VALUE(lArray, -1);
mArray = lArray;
mCapacity = lNewCapacity;
return InsertAt(pIndex, lElement); //Insert copied element because reference might be moved
}
if( lIndex < mSize ) //Move elements to leave a space open to insert the new element
{
//If pElement is inside memmove range, copy element and insert copy instead
if( (&pElement >= &mArray[lIndex]) && (&pElement < &mArray[mSize]) )
{
T lElement = pElement;
return InsertAt(pIndex, lElement);
}
memmove(&mArray[lIndex + 1], &mArray[lIndex], (mSize - lIndex) * sizeof(T));
}
memcpy(&mArray[lIndex], &pElement, sizeof(T));
mSize++;
return lIndex;
}
/** Append an element at the end of the array, doubling the array if capacity is not sufficient.
* \param pElement Element to append to the array.
* \return -1 if add failed, otherwise the position of the added element in the array. */
inline int Add(const T& pElement)
{
return InsertAt(mSize, pElement);
}
/** Append an element at the end of array, if not already present, doubling the array if capacity is not sufficient.
* \param pElement Element to append to the array.
* \return -1 if add failed, otherwise the position of the added element in the array. */
inline int AddUnique(const T& pElement)
{
int lIndex = Find(pElement);
return ( lIndex == -1 ) ? Add(pElement) : lIndex;
}
/** Append an element at the end of the array, growing the array by one element if capacity is not sufficient.
* \param pElement Element to append to the array.
* \return -1 if add failed, otherwise the position of the added element in the array. */
inline int AddCompact(const T& pElement)
{
return InsertAt(mSize, pElement, true);
}
/** Retrieve the number of element contained in the array. To increase the capacity without increasing the size, please use Reserve().
* \return The number of element in the array.
* \remark The size of the array cannot exceed its capacity. */
inline int Size() const { return mSize; }
/** Retrieve the current allocated memory capacity of the array.
* \return The capacity of the array in number of element.
* \remark The capacity will always be greater or equal to its size. */
inline int Capacity() const { return mCapacity; }
/** Retrieve a reference of the element at given index position in the array.
* \param pIndex Position of element in the array.
* \return A reference to the element at the specified position in the array.
* \remark No error will be thrown if the index is out of bounds. */
inline T& operator[](const int pIndex) const
{
#ifdef _DEBUG
FBX_ASSERT_MSG(pIndex >= 0, "Index is out of range!");
if( pIndex >= mSize )
{
if( pIndex < mCapacity )
{
FBX_ASSERT_NOW("Index is out of range, but not outside of capacity! Call SetAt() to use reserved memory.");
}
else FBX_ASSERT_NOW("Index is out of range!");
}
#endif
return (T&)mArray[pIndex];
}
/** Retrieve a copy of the element at given index position in the array.
* \param pIndex Position of element in the array.
* \return The value of the element at the specified position in the array.
* \remark No error will be thrown if the index is out of bounds. */
inline T GetAt(const int pIndex) const
{
return operator[](pIndex);
}
/** Retrieve a copy of the first element.
* \return Copy of the first element.
* \remark The array should have at least one element and no error will be thrown if the array is empty. */
inline T GetFirst() const
{
return GetAt(0);
}
/** Retrieve a copy of the last element.
* \return Copy of the last element.
* \remark The array should have at least one element and no error will be thrown if the array is empty. */
inline T GetLast() const
{
return GetAt(mSize-1);
}
/** Find first matching element, from first to last.
* \param pElement The element to be compared to each of the elements.
* \param pStartIndex The position to start searching from.
* \return Position of first matching element or -1 if there is no matching element. */
inline int Find(const T& pElement, const int pStartIndex=0) const
{
FBX_ASSERT_RETURN_VALUE(pStartIndex >= 0, -1);
for( int i = pStartIndex; i < mSize; ++i )
{
if( operator[](i) == pElement ) return i;
}
return -1;
}
/** Find first matching element, from last to first.
* \param pElement The element to be compared to each of the elements.
* \param pStartIndex The position to start searching from.
* \return Position of first matching element or -1 if there is no matching element. */
inline int FindReverse(const T& pElement, const int pStartIndex=FBXSDK_INT_MAX) const
{
for( int i = FbxMin(pStartIndex, mSize-1); i >= 0; --i )
{
if( operator[](i) == pElement ) return i;
}
return -1;
}
/** Request for allocation of additional memory without inserting new elements. After the memory has been reserved, please use SetAt() to initialize elements.
* \param pCapacity The number of additional element memory allocation requested.
* \return \c true if the memory allocation succeeded or if the capacity is unchanged, \c false otherwise.
* \remark If the requested capacity is less than or equal to the current capacity, this call has no effect. In either case, Size() is unchanged. */
inline bool Reserve(const int pCapacity)
{
FBX_ASSERT_RETURN_VALUE(pCapacity > 0, false);
if( pCapacity > mCapacity )
{
T* lArray = Allocate(pCapacity);
FBX_ASSERT_RETURN_VALUE(lArray, false);
mArray = lArray;
mCapacity = pCapacity;
//Initialize new memory to zero
memset(&mArray[mSize], 0, (mCapacity - mSize) * sizeof(T));
}
return true;
}
/** Set the element at given position in the array.
* \param pIndex Position of element in the array.
* \param pElement The new element.
* \remark If the index is outside range, and outside capacity, this call has no effect. However, if index is
* within capacity range, element count is increased such that Size() will become pIndex + 1. */
inline void SetAt(const int pIndex, const T& pElement)
{
FBX_ASSERT_RETURN(pIndex >= 0 && pIndex < mCapacity);
if( pIndex >= mSize ) mSize = pIndex + 1;
if( mArray ) memcpy(&mArray[pIndex], &pElement, sizeof(T));
}
/** Set the value of the first element.
* \param pElement The new value of the last element.
* \remark The array should have at least one element and no error will be thrown if the array is empty. */
inline void SetFirst(const T& pElement)
{
SetAt(0, pElement);
}
/** Set the value of the last element.
* \param pElement The new value of the last element.
* \remark The array should have at least one element and no error will be thrown if the array is empty. */
inline void SetLast(const T& pElement)
{
SetAt(mSize-1, pElement);
}
/** Remove an element at the given position in the array.
* \param pIndex Position of the element to remove.
* \return Removed element.
* \remark No error will be thrown if the index is out of bounds. */
inline T RemoveAt(const int pIndex)
{
T lElement = GetAt(pIndex);
if( pIndex + 1 < mSize )
{
memmove(&mArray[pIndex], &mArray[pIndex + 1], (mSize - pIndex - 1) * sizeof(T));
}
mSize--;
return lElement;
}
/** Remove the first element in the array.
* \return Removed element.
* \remark The array should have at least one element and no error will be thrown if the array is empty. */
inline T RemoveFirst()
{
return RemoveAt(0);
}
/** Remove the last element in the array.
* \return Removed element.
* \remark The array should have at least one element and no error will be thrown if the array is empty. */
inline T RemoveLast()
{
return RemoveAt(mSize-1);
}
/** Remove first matching element in the array.
* \param pElement Element to be removed.
* \return \c true if a matching element is found and removed, \c false otherwise. */
inline bool RemoveIt(const T& pElement)
{
int Index = Find(pElement);
if( Index >= 0 )
{
RemoveAt(Index);
return true;
}
return false;
}
/** Remove a range of elements at the given position in the array.
* \param pIndex Begin position of the elements to remove.
* \param pCount The count of elements to remove.
* \return \c true if successful, otherwise \c false. */
inline void RemoveRange(const int pIndex, const int pCount)
{
FBX_ASSERT_RETURN(pIndex >= 0);
FBX_ASSERT_RETURN(pCount >= 0);
if( pIndex + pCount < mSize )
{
memmove(&mArray[pIndex], &mArray[pIndex + pCount], (mSize - pIndex - pCount) * sizeof(T));
}
mSize -= pCount;
}
/** Inserts or erases elements at the end such that Size() becomes pSize, increasing capacity if needed. Please use SetAt() to initialize any new elements.
* \param pSize The new count of elements to set the array to. Must be greater or equal to zero.
* \return \c true if the memory (re)allocation succeeded, \c false otherwise.
* \remark If the requested element count is less than or equal to the current count, elements are freed from memory. Otherwise, the array grows and elements are unchanged. */
inline bool Resize(const int pSize)
{
if( pSize == mSize && mSize == mCapacity ) return true;
if( pSize == 0 )
{
Clear();
return true;
}
FBX_ASSERT_RETURN_VALUE(pSize > 0, false);
if( pSize != mCapacity )
{
T* lArray = Allocate(pSize);
FBX_ASSERT_RETURN_VALUE(lArray, false);
mArray = lArray;
}
if( pSize > mCapacity ) //Initialize new memory to zero
{
memset(&mArray[mSize], 0, (pSize - mSize) * sizeof(T));
}
mSize = pSize;
mCapacity = pSize;
return true;
}
/** Increase size of array by the specified size.
* \param pSize The size to add to the array size.
* \return \c true if operation succeeded, \c false otherwise. */
inline bool Grow(const int pSize)
{
return Resize(mSize + pSize);
}
/** Reduce size of array by the specified size.
* \param pSize The size to remove from the array size.
* \return \c true if operation succeeded, \c false otherwise. */
inline bool Shrink(const int pSize)
{
return Resize(mSize - pSize);
}
/** Compact the array so that its capacity is the same as its size.
* \return \c true if operation succeeded, \c false otherwise. */
inline bool Compact()
{
return Resize(mSize);
}
/** Reset the number of element to zero and free the memory allocated.
* \remark This only free the memory allocated by the array, and doesn't call the destructor of each element. */
inline void Clear()
{
if( mArray != NULL )
{
mSize = 0;
mCapacity = 0;
FbxFree(mArray);
mArray = NULL;
}
}
/** Sort the array using the specified compare function pointer
* \param pCompareFunc The compare function to use to sort elements. */
inline void Sort(CompareFunc pCompareFunc)
{
qsort(mArray, mSize, sizeof(T), pCompareFunc);
}
//! Get pointer to internal array of elements.
inline T* GetArray() const { return mArray ? (T*)mArray : NULL; }
//! Cast operator.
inline operator T* (){ return mArray ? (T*)mArray : NULL; }
/** Append another array at the end of this array.
* \param pOther The other array to append to this array. */
inline void AddArray(const FbxArray<T>& pOther)
{
if( Grow(pOther.mSize) )
{
memcpy(&mArray[mSize - pOther.mSize], pOther.mArray, pOther.mSize * sizeof(T));
}
}
/** Append the elements of another array at the end of this array if they are not present.
* \param pOther Another array. */
inline void AddArrayNoDuplicate(const FbxArray<T>& pOther)
{
for( int i = 0, c = pOther.mSize; i < c; ++i )
{
AddUnique(pOther[i]);
}
}
/** Remove the elements of another array from this array is they are present.
* \param pOther Another array. */
inline void RemoveArray(const FbxArray<T>& pOther)
{
for( int i = 0, c = pOther.mSize; i < c; ++i )
{
RemoveIt(pOther[i]);
}
}
/** Operator to copy elements of an array.
* \return this array containing a copy of pOther elements. */
inline FbxArray<T>& operator=(const FbxArray<T>& pOther)
{
if( this != &pOther )
{
if( Resize(pOther.mSize) )
{
memcpy(mArray, pOther.mArray, pOther.mSize * sizeof(T));
}
}
return *this;
}
/** Operator to compare elements of an array.
* \return \c true if the two arrays are equal, otherwise \c false. */
inline bool operator==(const FbxArray<T>& pOther) const
{
if( this == &pOther ) return true;
if( mSize != pOther.mSize ) return false;
return memcmp(mArray, pOther.mArray, sizeof(T) * mSize) == 0;
}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
inline int GetCount() const { return mSize; }
private:
inline T* Allocate(const int pCapacity)
{
return (T*)FbxRealloc(mArray, FbxAllocSize(pCapacity, sizeof(T)));
}
int mSize;
int mCapacity;
T* mArray;
#if defined(FBXSDK_COMPILER_MSC)
//Previously class FbxArray is for pointers. Somehow, it's used to store other types. Here's a compile-time checking for known incompatible classes.
//If it happens you find new incompatible ones, declare them with macro FBXSDK_INCOMPATIBLE_WITH_ARRAY. Also see file fbxstring.h.
FBX_ASSERT_STATIC(FBXSDK_IS_SIMPLE_TYPE(T) || __is_enum(T) || (__has_trivial_constructor(T)&&__has_trivial_destructor(T)) || !FBXSDK_IS_INCOMPATIBLE_WITH_ARRAY(T));
#endif
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
//! Call FbxFree on each element of the array, and then clear it.
template <class T> inline void FbxArrayFree(FbxArray<T>& pArray)
{
for( int i = 0, c = pArray.Size(); i < c; ++i )
{
FbxFree(pArray[i]);
}
pArray.Clear();
}
//! Call FbxDelete on each element of the array, and then clear it.
template <class T> inline void FbxArrayDelete(FbxArray<T>& pArray)
{
for( int i = 0, c = pArray.Size(); i < c; ++i )
{
FbxDelete(pArray[i]);
}
pArray.Clear();
}
//! Call Destroy on each element of the array, and then clear it.
template <class T> inline void FbxArrayDestroy(FbxArray<T>& pArray)
{
for( int i = 0, c = pArray.Size(); i < c; ++i )
{
(pArray[i])->Destroy();
}
pArray.Clear();
}
//! Make sure to break build if someone try to make FbxArray<FbxArray<T>>, which is not supported.
template <class T> FBXSDK_INCOMPATIBLE_WITH_ARRAY_TEMPLATE(FbxArray<T>);
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_ARRAY_H_ */

View File

@ -0,0 +1,90 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxbitset.h
#ifndef _FBXSDK_CORE_BASE_BITSET_H_
#define _FBXSDK_CORE_BASE_BITSET_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** An automatic growing array of bit.
*
* The bit array will automatically grow when specifying bit indexes that are greater
* than the array size when calling SetBit or UnsetBit. Indexes can vary from 0 to
* FBXSDK_UINT_MAX-1. When an invalid index is returned from any functions, FBXSDK_UINT_MAX
* is returned. The bit array is not thread safe.
*/
class FBXSDK_DLL FbxBitSet
{
public:
/** Constructor.
* \param pInitialSize Initial bit array size in bit count (not in byte count!).
*/
FbxBitSet(const FbxUInt pInitialSize=0);
//! Destructor.
virtual ~FbxBitSet();
/** Set the bit at the specified bit index to true regardless of its current value.
* \param pBitIndex The bit index in the array in the range of [0, FBXSDK_UINT_MAX-1].
*/
void SetBit(const FbxUInt pBitIndex);
/** Set all the bits to the specified value regardless of their current value.
* \param pValue The boolean value to set to all bits.
*/
void SetAllBits(const bool pValue);
/** Set the bit at the specified bit index to false regardless of its current value.
* \param pBitIndex The bit index in the array in the range of [0, FBXSDK_UINT_MAX-1].
*/
void UnsetBit(const FbxUInt pBitIndex);
/** Get the bit boolean value at the specified bit index.
* \param pBitIndex The bit index in the array in the range of [0, FBXSDK_UINT_MAX-1].
* \return True if the bit is set, false otherwise.
*/
bool GetBit(const FbxUInt pBitIndex) const;
/** Get the bit index of the first bit that is currently set.
* \return The bit index of the first set bit, FBXSDK_UINT_MAX if none found.
*/
FbxUInt GetFirstSetBitIndex() const;
/** Get the bit index of the last bit that is currently set.
* \return The bit index of the last set bit, FBXSDK_UINT_MAX if none found.
*/
FbxUInt GetLastSetBitIndex() const;
/** Get the bit index of the next set bit after the specified bit index.
* \param pBitIndex The start bit index in the array in the range of [0, FBXSDK_UINT_MAX-1].
* \return The bit index of the next set bit, FBXSDK_UINT_MAX if none found.
*/
FbxUInt GetNextSetBitIndex(const FbxUInt pBitIndex) const;
/** Get the bit index of the previous set bit before the specified bit index.
* \param pBitIndex The start bit index in the array in the range of [0, FBXSDK_UINT_MAX-1].
* \return The bit index of the previous set bit, FBXSDK_UINT_MAX if none found.
*/
FbxUInt GetPreviousSetBitIndex(const FbxUInt pBitIndex) const;
private:
void Grow(const FbxUInt pNewSize);
void* mData;
FbxUInt mSize;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_BITSET_H_ */

View File

@ -0,0 +1,95 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxcharptrset.h
#ifndef _FBXSDK_CORE_BASE_CHARPTRSET_H_
#define _FBXSDK_CORE_BASE_CHARPTRSET_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** This class contains the data structure support for char pointer set.
*/
class FBXSDK_DLL FbxCharPtrSet
{
public:
/** Class constructor
* \param pItemPerBlock Number of item per block. Default is 20. */
FbxCharPtrSet(int pItemPerBlock=20);
//! Class destructor
~FbxCharPtrSet();
/** Add a new item.
* \param pReference char pointer reference to the item.
* \param pItem FbxHandle to the item. */
void Add(const char* pReference, FbxHandle pItem);
/** Removes an item.
* \param pReference char reference to the item.
* \return true if successful. */
bool Remove(const char* pReference);
/** Get an item's reference.
* \param pReference char reference to the item.
* \param PIndex index to the item.
* \return FbxHandle to the item, NULL if fails. */
FbxHandle Get(const char* pReference, int* PIndex=NULL);
/** Get an item's reference from index.
* \param pIndex index to the item.
* \return FbxHandle to the item, NULL if fails. */
FbxHandle& operator[](int pIndex);
/** Get an item's reference from index.
* \param pIndex index to the item.
* \param pReference char reference to the item.
* \return FbxHandle to the item, NULL if fails. */
FbxHandle GetFromIndex(int pIndex, const char** pReference=NULL);
/** Removes an item by index.
* \param pIndex index to the item. */
void RemoveFromIndex(int pIndex);
/** Get the number of item in the array.
* \return the number of element in the set. */
inline int GetCount() const { return mCharPtrSetCount; }
//! Sorts the array.
void Sort();
//! Clears the array.
void Clear();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
struct CharPtrSet;
inline void SetCaseSensitive(bool pIsCaseSensitive){ mIsCaseSensitive = pIsCaseSensitive; }
private:
CharPtrSet* FindEqual(const char* pReference) const;
CharPtrSet* mCharPtrSetArray;
int mCharPtrSetCount;
int mBlockCount;
int mItemPerBlock;
bool mIsChanged;
bool mIsCaseSensitive;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_CHARPTRSET_H_ */

View File

@ -0,0 +1,213 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxcontainerallocators.h
#ifndef _FBXSDK_CORE_BASE_CONTAINER_ALLOCATORS_H_
#define _FBXSDK_CORE_BASE_CONTAINER_ALLOCATORS_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** An allocator class for use as a template parameter to one of the
* container class (FbxMap, FbxSet, FbxDynamicArray...) must implement these.
*/
class FBXSDK_DLL FbxBaseAllocator
{
public:
/** The class constructor.
* \param pRecordSize the size of one record held by the container.
* \remarks The parameter pRecordSize is not necessarily the same
* size as of the value type, since the
* container may wrap the value into a private class.
*/
FbxBaseAllocator(const size_t pRecordSize) :
mRecordSize(pRecordSize)
{
}
/** This tells the allocator that we are about to call AllocateRecords
* one or many times to allocate pRecordCount records.
* \param pRecordCount
* \remarks This gives the allocator a chance to do whatever it deems necessary
* to optimize subsequent allocations, for example, by preallocating a
* sufficiently large pool of memory.
*/
void Reserve(const size_t /*pRecordCount*/)
{
// By default, ignore all preallocating requests.
}
/** Returns a pointer to a uninitialized continuous block of memory
* able to hold pRecordCount * pRecordSize bytes.
* \param pRecordCount
* \remarks pRecordSize was defined in the Constructor description, above.
*/
void* AllocateRecords(const size_t pRecordCount=1)
{
return FbxMalloc(FbxAllocSize(pRecordCount, mRecordSize));
}
/** Frees a block of memory returned by AllocateRecords.
* \param pRecord
*/
void FreeMemory(void* pRecord)
{
FbxFree(pRecord);
}
/** \return the size of each record allocated.
*/
size_t GetRecordSize() const
{
return mRecordSize;
}
private:
size_t mRecordSize;
};
/** This allocator only frees the allocated memory when it is deleted.
* This is a good allocator for building dictionaries, where we only
* add things to a container, but never remove them.
*/
class FbxHungryAllocator
{
public:
FbxHungryAllocator(size_t pRecordSize) :
mRecordSize(pRecordSize),
mRecordPoolSize(0),
mData(NULL)
{
}
FbxHungryAllocator(const FbxHungryAllocator& pOther) :
mRecordSize(pOther.mRecordSize),
mRecordPoolSize(pOther.mRecordPoolSize),
mData(NULL)
{
}
~FbxHungryAllocator()
{
MemoryBlock* lCurrent = mData;
MemoryBlock* lNext = lCurrent ? lCurrent->mNextBlock : 0;
while (lCurrent)
{
FbxDelete(lCurrent);
lCurrent = lNext;
lNext = lCurrent ? lCurrent->mNextBlock : 0;
}
}
void Reserve(const size_t pRecordCount)
{
MemoryBlock* lMem = FbxNew< MemoryBlock >(pRecordCount* mRecordSize);
lMem->mNextBlock = mData;
mData = lMem;
mRecordPoolSize += pRecordCount;
}
void* AllocateRecords(const size_t pRecordCount = 1)
{
MemoryBlock* lBlock = mData;
void* lRecord = NULL;
while( (lBlock != NULL) && ((lRecord = lBlock->GetChunk(pRecordCount * mRecordSize)) == NULL) )
{
lBlock = lBlock->mNextBlock;
}
if( lRecord == NULL )
{
size_t lNumRecordToAllocate = mRecordPoolSize / 8 == 0 ? 2 : mRecordPoolSize / 8;
if( lNumRecordToAllocate < pRecordCount )
{
lNumRecordToAllocate = pRecordCount;
}
Reserve(lNumRecordToAllocate);
lRecord = AllocateRecords(pRecordCount);
}
return lRecord;
}
void FreeMemory(void* /*pRecord*/)
{
// "Hungry": release memory only when the allocator is destroyed.
}
size_t GetRecordSize() const
{
return mRecordSize;
}
FbxHungryAllocator& operator=(const FbxHungryAllocator& pOther)
{
if( this != &pOther )
{
// The next call to AllocateRecords() may skip over currently reserved
// records if the size changes drastically, but otherwise GetChunk()
// is size-oblivious.
if( mRecordSize < pOther.mRecordSize )
{
mRecordPoolSize = 0;
}
mRecordSize = pOther.mRecordSize;
}
return(*this);
}
private:
class MemoryBlock
{
public:
MemoryBlock(size_t pSize) :
mNextBlock(NULL),
mData(NULL),
mFreeData(NULL),
mEnd(NULL)
{
mData = FbxMalloc(pSize);
mFreeData = mData;
mEnd = reinterpret_cast<char*>(mData) + pSize;
}
~MemoryBlock()
{
FbxFree(mData);
}
void* GetChunk(const size_t pSize)
{
if( reinterpret_cast<char*>(mFreeData) + pSize < mEnd )
{
void* lChunk = mFreeData;
mFreeData = reinterpret_cast<char*>(mFreeData) + pSize;
return lChunk;
}
return NULL;
}
MemoryBlock* mNextBlock;
void* mData;
void* mFreeData;
void* mEnd;
};
size_t mRecordSize;
size_t mRecordPoolSize;
MemoryBlock* mData;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_CONTAINER_ALLOCATORS_H_ */

View File

@ -0,0 +1,324 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxdynamicarray.h
#ifndef _FBXSDK_CORE_BASE_DYNAMICARRAY_H_
#define _FBXSDK_CORE_BASE_DYNAMICARRAY_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxcontainerallocators.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Template class for dynamic array holding objects.
* \nosubgrouping
* \see FbxStaticArray
*/
template <typename Type, typename Allocator=FbxBaseAllocator> class FbxDynamicArray
{
public:
//! Default constructor.
FbxDynamicArray() :
mArray(NULL),
mCapacity(0),
mSize(0),
mAllocator(sizeof(Type))
{
}
/** Constructor.
* \param pInitialSize initial capacity of this array */
FbxDynamicArray(const size_t pInitialSize) :
mArray(NULL),
mCapacity(0),
mSize(0),
mAllocator(sizeof(Type))
{
Reserve(pInitialSize);
}
/** Copy constructor.
* \remarks The copy constructor of \c Type will be
* invoked in order to copy the value of elements to the
* new array.
*/
FbxDynamicArray(const FbxDynamicArray& pArray) :
mArray(NULL),
mCapacity(0),
mSize(0),
mAllocator(sizeof(Type))
{
Reserve(pArray.mCapacity);
CopyArray(mArray, pArray.mArray, pArray.mSize);
mSize = pArray.mSize;
}
//! Destructor.
~FbxDynamicArray()
{
for( size_t i = 0; i < mSize; ++i )
{
mArray[i].~Type();
}
mAllocator.FreeMemory(mArray);
}
//! Gets the current capacity of the array.
size_t Capacity() const
{
return mCapacity;
}
//! Gets the size of the array.
size_t Size() const
{
return mSize;
}
/** Assures that sufficient memory is allocated to hold n objects in the array, and increases the capacity if necessary.
* \param pCount Number of objects to reserve */
void Reserve(const size_t pCount)
{
if( pCount > mCapacity )
{
//We don't use mAllocator.PreAllocate, because we want our array to be continuous in memory.
Type* lNewArray = (Type*)mAllocator.AllocateRecords(pCount);
MoveArray(lNewArray, mArray, mSize);
mAllocator.FreeMemory(mArray);
mArray = lNewArray;
mCapacity = pCount;
}
}
/** Appends n objects at the end of the array.
* \param pItem object to append
* \param pNCopies number of copies to append */
void PushBack(const Type& pItem, const size_t pNCopies = 1)
{
if( mSize + pNCopies > mCapacity )
{
size_t lNewSize = mCapacity + mCapacity / 2; //grow by 50%
if( mSize + pNCopies > lNewSize )
{
lNewSize = mSize + pNCopies;
}
Reserve(lNewSize);
}
FBX_ASSERT(mSize + pNCopies <= mCapacity);
Fill(mArray + mSize, pItem, pNCopies);
mSize += pNCopies;
}
/** Inserts n objects at the specified position.
* \param pIndex position index
* \param pItem object to insert
* \param pNCopies number of copies to append */
void Insert(const size_t pIndex, const Type& pItem, const size_t pNCopies=1)
{
FBX_ASSERT(pIndex >= 0);
FBX_ASSERT(pIndex <= mSize);
Type lValue = pItem; // in case pItem is in array
if( pNCopies == 0 )
{
}
else if( pIndex >= mSize )
{
PushBack(pItem, pNCopies);
}
else if( mSize + pNCopies > mCapacity )
{
size_t lNewSize = mCapacity + mCapacity / 2; //not enough room, grow by 50%
if( mSize + pNCopies > lNewSize )
{
lNewSize = mSize + pNCopies;
}
Type* lNewArray = (Type*)mAllocator.AllocateRecords(lNewSize);
MoveArray(lNewArray, mArray, pIndex); // copy prefix
Fill(lNewArray + pIndex, pItem, pNCopies); // copy values
MoveArray(lNewArray + pIndex + pNCopies, mArray + pIndex, mSize - pIndex); // copy suffix
mAllocator.FreeMemory(mArray);
mArray = lNewArray;
mSize += pNCopies;
mCapacity = lNewSize;
}
else
{
// copy suffix backwards
MoveArrayBackwards(mArray + pIndex + pNCopies, mArray + pIndex, mSize - pIndex);
Fill(mArray + pIndex, pItem, pNCopies); // copy values
mSize += pNCopies;
}
}
/** Removes n objects at the end.
* \param pNElements number of objects to remove */
void PopBack(size_t pNElements=1)
{
FBX_ASSERT(pNElements <= mSize);
for( size_t i = mSize - pNElements; i < mSize; ++i )
{
mArray[i].~Type();
}
mSize -= pNElements;
}
/** Removes n objects at the specified position.
* \param pIndex position index
* \param pNElements number of objects to remove */
void Remove(const size_t pIndex, size_t pNElements=1)
{
FBX_ASSERT(pIndex >= 0);
FBX_ASSERT(pIndex <= mSize);
FBX_ASSERT(pIndex + pNElements <= mSize);
if( pIndex + pNElements >= mSize )
{
PopBack(pNElements);
}
else
{
for( size_t i = pIndex; i < pIndex + pNElements; ++i )
{
mArray[i].~Type();
}
MoveOverlappingArray(&mArray[pIndex], &mArray[pIndex + pNElements], mSize - pIndex - pNElements);
mSize -= pNElements;
}
}
/** Gets nth object in the array.
* \param pIndex position index */
Type& operator[](const size_t pIndex)
{
return mArray[pIndex];
}
/** Gets nth object in the array.
* \param pIndex position index */
const Type& operator[](const size_t pIndex) const
{
return mArray[pIndex];
}
/** Retrieve the first item in the array.
* \return The first item in the array. */
Type& First()
{
return operator[](0);
}
/** Retrieve the first item in the array.
* \return The first item in the array. */
const Type& First() const
{
return operator[](0);
}
/** Retrieve the last item in the array.
* \return The last item in the array. */
Type& Last()
{
return operator[](mSize-1);
}
/** Retrieve the last item in the array.
* \return The last item in the array. */
const Type& Last() const
{
return operator[](mSize-1);
}
/** Find first matching element, from first to last.
* \param pItem The item to try to find in the array.
* \param pStartIndex The index to start searching from.
* \return Index of the first matching item, otherwise returns -1 (equivalent of SIZE_MAX for size_t). */
size_t Find(const Type& pItem, const size_t pStartIndex=0) const
{
for( size_t i = pStartIndex; i < mSize; ++i )
{
if( operator[](i) == pItem ) return i;
}
return -1;
}
/** Assignment operator.
* \remarks The copy constructor of \c Type will be invoked in order to copy the value of elements to the new array. */
FbxDynamicArray& operator=(const FbxDynamicArray& pArray)
{
Reserve(pArray.mCapacity);
CopyArray(mArray, pArray.mArray, pArray.mSize);
mSize = pArray.mSize;
return *this;
}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
static void CopyArray(Type* pDest, const Type* pSrc, size_t pCount)
{
for( int i = 0; i < int(pCount); i++ )
{
new(&(pDest[i])) Type(pSrc[i]); //in-place new won't allocate memory, so it is safe
}
}
static void MoveArray(Type* pDest, const Type* pSrc, size_t pCount)
{
for( int i = 0; i < int(pCount); i++ )
{
new(&(pDest[i])) Type(pSrc[i]); //in-place new won't allocate memory, so it is safe
}
for( int i = 0; i < int(pCount); i++ )
{
pSrc[i].~Type();
}
}
static void MoveOverlappingArray(Type* pDest, const Type* pSrc, size_t pCount)
{
for( int i = 0; i < int(pCount); i++ )
{
new(&(pDest[i])) Type(pSrc[i]); //in-place new won't allocate memory, so it is safe
pSrc[i].~Type();
}
}
static void MoveArrayBackwards(Type* pDest, const Type* pSrc, size_t pCount)
{
for( int i = 0; i < int(pCount); ++i )
{
new(&(pDest[pCount-1-i])) Type(pSrc[pCount-1-i]); //in-place new won't allocate memory, so it is safe
pSrc[pCount-1-i].~Type();
}
}
static void Fill(Type* pDest, const Type& pItem, size_t pCount)
{
for( int i = 0; i < int(pCount); i++ )
{
new(&(pDest[i])) Type(pItem); //in-place new won't allocate memory, so it is safe
}
}
Type* mArray;
size_t mCapacity;
size_t mSize;
Allocator mAllocator;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_DYNAMICARRAY_H_ */

View File

@ -0,0 +1,257 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxfile.h
#ifndef _FBXSDK_CORE_BASE_FILE_H_
#define _FBXSDK_CORE_BASE_FILE_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxStream;
/**
Class for interfacing with files, providing a similar interface for files independant of the OS or filesystem.
*/
class FBXSDK_DLL FbxFile
{
public:
enum EMode {eNone, eReadOnly, eReadWrite, eCreateWriteOnly, eCreateReadWrite, eCreateAppend};
enum ESeekPos {eBegin, eCurrent, eEnd};
FbxFile();
virtual ~FbxFile();
/** Opens a file on disk using the specified read/write mode.
* \param pFileName_UTF8 Filename in UTF8 (compatible with ASCII)
* \param pMode Mode in which to open the file, e.g. eReadOnly, eCreateReadWrite, etc.
* \param pBinary Whether the file is to be opened in binary or text mode.
* \return True if opening is successful.
*/
virtual bool Open(const char* pFileName_UTF8, const EMode pMode=eCreateReadWrite, const bool pBinary=true);
/** Opens a file from a data stream using the specified read/write mode.
* \param pStream Stream instance with which the file will be read/written
* \param pStreamData User-defined data to pass as a parameter to the stream's Open() method.
* \param pMode Deprecated/Unused.
* \return True if opening is successful.
*/
virtual bool Open(FbxStream* pStream, void* pStreamData, const char* pMode);
/** Closes a file, freeing its handle.
* \return True if closing is successful.
*/
virtual bool Close();
/** Seek to a specific position in the file, starting from either beginning, current position or end
* \param pOffset Offset to seek to (advance the file position cursor) starting from pSeekPos
* \param pSeekPos Starting position from which to seek to. Beginning, current position or end.
*/
virtual void Seek(const FbxInt64 pOffset, const ESeekPos pSeekPos=eBegin);
/** Returns the position at which the file cursor currently is. For example, will be ==0 for beginning and ==FileSize for end.
* \return The position at which the file cursor currently is.
*/
virtual FbxInt64 Tell() const;
/** Read a part of the file into a buffer
* \param pDstBuf Pre-allocated buffer in which to read data
* \param pSize Size of the data chunk to be read in bytes
* \return Number of bytes read.
*/
virtual size_t Read(void* pDstBuf, const size_t pSize);
/** Read a part of the file as a string into a buffer
* \param pDstBuf Pre-allocated buffer in which to read the string
* \param pDstSize Size of the data chunk to be read in characters
* \param pStopAtFirstWhiteSpace If true, will stop reading at first white space, otherwise it will stop at the first line feed (\n)
* \return Pointer on the data read. Equivalent to parameter pDstBuf
*/
virtual char* ReadString(char* pDstBuf, const size_t pDstSize, bool pStopAtFirstWhiteSpace=false);
/** Write a buffer to an opened file
* \param pSrcBuf Pre-allocated buffer from which to write data
* \param pSize Size of the data chunk to be written in bytes
* \return Number of bytes written.
*/
virtual size_t Write(const void* pSrcBuf, const size_t pSize);
/** Write a formatted string to an opened file
* \param pFormat Pre-allocated format buffer from which to write data
* \param ... Variable number of arguments describing the values in the previous parameter.
* \return True if data was successfully written
*/
virtual bool WriteFormat(const char* pFormat, ...);
/** Modify the size of a file. Null characters ('\0') are appended if the file is extended.
* If the file is truncated, all data from the end of the shortened file to the original length of the file is lost.
* Please note that this function considers the current file cursor as the beginning of the file.
* It is therefore required to use Seek(0) prior to calling it if we want the size specified by the
* pSize parameter to be absolute.
* \param pSize New desired file size
* \return True if file was successfully truncated
*/
virtual bool Truncate(const FbxInt64 pSize);
/** Checks whether the current file cursor position is at the end of file.
* \return True if the cursor is at the end of file, false otherwise.
*/
virtual bool EndOfFile() const;
/** Gets the size of the currently opened file.
* \return File size
*/
virtual FbxInt64 GetSize();
/** Unused function in this default implementation. Must be implemented by memory files.
* \param pMemPtr Unused
* \param pSize Unused
*/
virtual void GetMemoryFileInfo(void** pMemPtr, size_t pSize);
/** Checks whether the file is currently opened.
* \return True if file is opened, false otherwise
*/
bool IsOpen() const;
/** Checks whether the file is currently opened with a user-provided streaming interface instead of just the file name
* \return True if file has been opened with a stream interface, false otherwise
*/
bool IsStream() const;
/** Returns the full file path name, as provided when opening it.
* \return File full path
*/
const char* GetFilePathName() const;
/** Returns the mode with which the file was opened, when calling the Open() method.
* \return Mode with which the file was opened
*/
EMode GetFileMode() const;
/** Returns last encountered error when performing any operation on the file.
* \return Last error code
*/
int GetLastError();
/** Resets the current error code and the end of file indicator of the opened file
*/
void ClearError();
protected:
FILE* mFilePtr;
FbxStream* mStreamPtr;
bool mIsOpen;
bool mIsStream;
EMode mMode;
FbxString mFileName;
};
class FBXSDK_DLL FbxFileUtils
{
public:
/** Delete a file from disk.
* \param pFileName_UTF8 The file to be deleted.
* \return True if delete is successful.
*/
static bool Delete(const char* pFileName_UTF8);
/** Rename a file on disk.
* \param pFileName_UTF8 The file to be renamed.
* \param pNewName_UTF8 The new file name upon rename.
* \return True if rename is successful.
*/
static bool Rename(const char* pFileName_UTF8, const char* pNewName_UTF8);
/** Copy one file's content to another file (if the destination file not exist, it will be created).
* \param pDestination_UTF8 The destination file path
* \param pSource_UTF8 The source file path
* \return Return true if copy is successfully.
*/
static bool Copy(const char* pDestination_UTF8, const char* pSource_UTF8);
//! Get given file's size.
static FbxInt64 Size(const char* pFilePath_UTF8);
/** Find if the specified file exist.
* \param pFilePath_UTF8 The file path to test against.
* \return Returns true if the file exist.
*/
static bool Exist(const char* pFilePath_UTF8);
/** Find if the specified file is in read-only mode.
* \param pFilePath_UTF8 The file path to test against.
* \return Returns true if the file is in read-only mode.
*/
static bool IsReadOnly(const char* pFilePath_UTF8);
// We return a KLong that in fact is a cast of a time_t.
//! Get given file's last date.
static FbxLong GetLastDate(const char* pPath_UTF8);
//! Set the given file's last date as the given date.
static bool SetLastDate(const char* pPath_UTF8, FbxLong pTime);
/** Get some content of a file.
* \param pStr The content get from file.
* \param pSize The size of content.
* \param pStream The opened stream of file.
*/
static char* FGets(char* pStr, int pSize, FILE* pStream);
};
template<class T> inline const T FbxSwab(const T x)
{
switch( sizeof(x) )
{
case 2:
{
FbxUInt8 t[2];
t[0] = ((FbxUInt8*)&x)[1];
t[1] = ((FbxUInt8*)&x)[0];
return *(T*)&t;
}
case 4:
{
FbxUInt8 t[4];
t[0] = ((FbxUInt8*)&x)[3];
t[1] = ((FbxUInt8*)&x)[2];
t[2] = ((FbxUInt8*)&x)[1];
t[3] = ((FbxUInt8*)&x)[0];
return *(T*)&t;
}
case 8:
{
FbxUInt8 t[8];
t[0] = ((FbxUInt8*)&x)[7];
t[1] = ((FbxUInt8*)&x)[6];
t[2] = ((FbxUInt8*)&x)[5];
t[3] = ((FbxUInt8*)&x)[4];
t[4] = ((FbxUInt8*)&x)[3];
t[5] = ((FbxUInt8*)&x)[2];
t[6] = ((FbxUInt8*)&x)[1];
t[7] = ((FbxUInt8*)&x)[0];
return *(T*)&t;
}
default:
return x;
}
}
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_FILE_H_ */

View File

@ -0,0 +1,80 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxfolder.h
#ifndef _FBXSDK_CORE_BASE_FOLDER_H_
#define _FBXSDK_CORE_BASE_FOLDER_H_
#include <fbxsdk/fbxsdk_def.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Class for iterating into file system folders and the items contained. */
class FBXSDK_DLL FbxFolder
{
public:
//! The different entry type that can be found in folders.
enum EEntryType
{
eRegularEntry, //!< Regular entry, such as file.
eFolderEntry //!< Folder entry that potentially contain more files.
};
/** Open the specified folder for browsing its content.
* \param pFolderPath_UTF8 The folder path to open.
* \return True if the folder path was successfully open, false otherwise. */
bool Open(const char* pFolderPath_UTF8);
/** Get the next item in the folder.
* \return True if another item was found after the current one. */
bool Next();
/** Get the type of the current entry in the folder.
* \return The entry type. */
EEntryType GetEntryType() const;
/** Retrieve the name of the current entry in the folder.
* \return The name of the current entry. */
FbxString GetEntryName() const;
/** Retrieve the extension name of the current entry.
* \return The extension name of the current entry. */
char* GetEntryExtension() const;
/** Close the folder when done browsing its content. */
void Close();
/** Find out if the folder was successfully opened the last time Open was called.
* \return True if the folder is currently open. */
bool IsOpen() const;
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxFolder();
~FbxFolder();
private:
struct FolderImpl;
FolderImpl* mImpl;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#endif /* _FBXSDK_CORE_BASE_FOLDER_H_ */

View File

@ -0,0 +1,411 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxhashmap.h
#ifndef _FBXSDK_CORE_BASE_HASHMAP_H_
#define _FBXSDK_CORE_BASE_HASHMAP_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxarray.h>
#include <fbxsdk/core/base/fbxmap.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
template<class T> class FbxNoOpDestruct { public: static inline void DoIt(T&) {} };
template<class T> class FbxPtrDestruct { public: static inline void DoIt(T& v) { FbxDelete(v); v = NULL; } };
//True if equal, false otherwise
template<class T> class FbxDefaultComparator{ public: static inline bool CompareIt( const T& t1, const T& t2 ) { return t1 == t2; } };
/** \brief This object represents a standard hash map. You must provide the typename of KEY and VALUE as well
as the typename of the class that contains the hash function to use to hash values. The hash class must
overload operator() and be built like this.
\code
class SimpleHash
{
public:
inline unsigned int operator() ( const int pKey ) const
{
return pKey;
}
};
\endcode
* \nosubgrouping
*/
template< typename KEY, typename VALUE, typename HASH, class Destruct = FbxNoOpDestruct<VALUE>, class Comparator = FbxDefaultComparator<KEY> >
class FbxHashMap
{
public:
typedef KEY KeyType;
typedef VALUE ValueType;
typedef HASH HashFunctorType;
private:
class ListItem
{
public:
ListItem* mNext;
ValueType mValue;
KeyType mKey;
ListItem()
:
mNext(NULL)
{
}
~ListItem()
{
Destruct::DoIt(mValue);
}
};
public:
/**
Iterate through every element in a hash map.
*/
class Iterator
{
public:
typedef ListItem ListItemType;
typedef FbxPair< KeyType, ValueType > KeyValuePair;
/**
Copy constructor
*/
Iterator( const Iterator& pOther )
:
mMap( pOther.mMap ),
mBucketIndex( pOther.mBucketIndex ),
mCurrentItem( pOther.mCurrentItem )
{
}
/**
Destructor
*/
~Iterator(){};
/**
Used to dereference an iterator and give it a behavior more similar to a pointer.
\return The KeyValuePair currently referenced by the iterator
*/
KeyValuePair operator*() const
{
KeyValuePair lItem;
if( mCurrentItem )
{
lItem.mFirst = mCurrentItem->mKey;
lItem.mSecond = mCurrentItem->mValue;
return lItem;
}
FBX_ASSERT_NOW("Accessing out of bounds iterator");
return lItem;
}
/**
Advances the iterator to the next keyvaluepair in the hashmap. It does not wrap around so
advancing after reaching the last element will not point back to the first one.
*/
void Next()
{
if( !mCurrentItem )
return;
if( mCurrentItem->mNext )
{
mCurrentItem = mCurrentItem->mNext;
return;
}
else
{
mBucketIndex++;
for( ; mBucketIndex < mMap->mBuckets.GetCount(); ++mBucketIndex )
{
if( mMap->mBuckets[ mBucketIndex ] )
{
mCurrentItem = mMap->mBuckets[ mBucketIndex ];
return;
}
}
if( mBucketIndex >= mMap->mBuckets.GetCount() )
{
*this = mMap->End();
return;
}
}
}
/**
Check equivalence between two iterators. There are 3 conditions for equivalence between 2 iterators:
1) Item being referenced by the iterator must be equivalent
2) They must point at the same index
3) They must point on the same map
\return true if both iterators are equal, false otherwise
*/
bool operator==( const Iterator& pOther ) const
{
return mCurrentItem == pOther.mCurrentItem &&
mBucketIndex == pOther.mBucketIndex &&
mMap == pOther.mMap;
}
/**
Check inequivalence between 2 iterators. Please see operator== for more information.
\return true if both iterators are NOT equal, false if they are
*/
bool operator!=( const Iterator& pOther ) const
{
return !(*this == pOther);
}
/**
Assign the current iterator to the one on the right hand side of the operator. After assignment they will
reference the same object, at the same index, in the same map.
\return The new iterator
*/
Iterator& operator=( const Iterator& pOther )
{
this->mBucketIndex = pOther.mBucketIndex;
this->mMap = pOther.mMap;
this->mCurrentItem = pOther.mCurrentItem;
return *this;
}
private:
const FbxHashMap* mMap;
int mBucketIndex;
ListItemType* mCurrentItem;
Iterator(const FbxHashMap* pMap, int pBucketIndex, ListItemType* pCurrentItem)
:
mMap( pMap ),
mBucketIndex(pBucketIndex),
mCurrentItem(pCurrentItem)
{
}
friend class FbxHashMap;
};
/**
Construct a FbxHashMap with an user-defined maximum number of elements.
\param pBucketSize Initial maximum number of elements.
*/
FbxHashMap( int pBucketSize )
{
mBuckets.Resize( pBucketSize );
}
/**
Construct a FbxHashMap with the default maximum number of elements (30)
*/
FbxHashMap()
{
mBuckets.Resize(30);
}
/**
Clear all elements in the hash map before destroying itself
*/
~FbxHashMap()
{
Clear();
mBuckets.Clear();
}
/**
Calls operator delete on all elements of the hashmap, de-allocating all memory and destroying them
*/
void Clear()
{
for( int i = 0; i < mBuckets.GetCount(); ++i)
{
if( mBuckets[i] )
{
ListItem* lNext = mBuckets[i]->mNext;
while( lNext )
{
ListItem* lNextNext = lNext->mNext;
FbxDelete(lNext);
lNext = lNextNext;
}
FbxDelete(mBuckets[i]);
mBuckets[i] = NULL;
}
}
}
/**
Find an element in the hashmap. If no element exist with the specified key, returns an iterator pointing on the
end of the map (not an actual KeyValuePair).
\param pKey The value of the key corresponding to the element
\return An Iterator referencing that element
*/
const Iterator Find( const KeyType& pKey ) const
{
unsigned int lIndex = mHashFunctor(pKey);
lIndex = lIndex % mBuckets.GetCount();
ListItem* lItem = mBuckets[lIndex];
while( lItem )
{
if( Comparator::CompareIt( lItem->mKey, pKey ) )
{
Iterator lIt( this, lIndex, lItem );
return lIt;
}
lItem = lItem->mNext;
}
return End();
}
/**
Remove an element in the hashmap.
\param pKey The key value of the element to remove
\return The value of the element that was just deleted. If the element does not exist, a value created with its default constructor will be returned
*/
VALUE Remove( const KEY& pKey )
{
unsigned int lIndex = mHashFunctor(pKey);
lIndex = lIndex % mBuckets.GetCount();
ListItem* lItem = mBuckets.GetAt(lIndex);
ListItem* lLastItem = NULL;
while( lItem )
{
if( lItem->mKey == pKey )
{
if( lLastItem )
lLastItem->mNext = lItem->mNext;
if( mBuckets.GetAt(lIndex) == lItem )
mBuckets.SetAt(lIndex, lItem->mNext );
VALUE lValue = lItem->mValue;
FbxDelete(lItem);
return lValue;
}
lLastItem = lItem;
lItem = lItem->mNext;
}
return VALUE();
}
/** Add or retrieve a KeyValuePair from the Hashmap. If there is already an entry in the map for an element
with key value specified in parameter, the value will be returned. Otherwise, a new entry will be created
with this key value and the default value for ValueType will be returned. It can be modified using the
assignment operator
\param pKey The key for which to retrieve/add a value.
\return Value of the element referenced by the key specified in parameter.
*/
ValueType& operator[]( const KeyType& pKey )
{
unsigned int lIndex = 0;
Iterator lIt = InternalFind( pKey, lIndex);
if( lIt != End() )
{
return lIt.mCurrentItem->mValue;
}
lIndex = lIndex % mBuckets.GetCount();
ListItem* lItem = FbxNew< ListItem >();
lItem->mNext = NULL;
lItem->mKey = pKey;
if( !mBuckets.GetAt(lIndex) )
{
mBuckets.SetAt(lIndex, lItem);
}
else
{
lItem->mNext = mBuckets.GetAt(lIndex);
mBuckets.SetAt(lIndex, lItem);
}
return lItem->mValue;
}
/** Returns an iterator pointing on the first non-null element in the map
\return An iterator pointing on the first non-null element in the map.
*/
Iterator Start() const
{
for( int i = 0; i < mBuckets.GetCount(); ++i )
{
if( mBuckets[i] )
{
Iterator lIt( this, i, mBuckets[i] );
return lIt;
}
}
return End();
}
/** Returns an iterator pointing on the last element in the map. This is not an actual KeyValuePair but
* but an iterator pointing on a null element.
\return Iterator pointing on a null value at the end of the map
*/
Iterator End() const
{
Iterator lIt( this, 0, NULL );
return lIt;
}
private:
// Avoid calculating the hashvalue twice
const Iterator InternalFind( const KeyType& pKey, unsigned int& pOutCalculatedIndex ) const
{
pOutCalculatedIndex = mHashFunctor(pKey);
unsigned int lIndex = pOutCalculatedIndex % mBuckets.GetCount();
ListItem* lItem = mBuckets[lIndex];
while( lItem )
{
if( Comparator::CompareIt( lItem->mKey, pKey ) )
{
Iterator lIt( this, lIndex, lItem );
return lIt;
}
lItem = lItem->mNext;
}
return End();
}
// not implemented yet!
FbxHashMap( const FbxHashMap& pOther ) {};
FbxArray<ListItem*> mBuckets;
HashFunctorType mHashFunctor;
friend class Iterator;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_HASHMAP_H_ */

View File

@ -0,0 +1,262 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxintrusivelist.h
#ifndef _FBXSDK_CORE_BASE_INTRUSIVE_LIST_H_
#define _FBXSDK_CORE_BASE_INTRUSIVE_LIST_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define FBXSDK_INTRUSIVE_LIST_NODE(Class, NodeCount)\
public: inline FbxListNode<Class>& GetListNode(int index = 0){ return this->mNode[index]; }\
private: FbxListNode<Class> mNode[NodeCount];
template <typename T> class FbxListNode
{
typedef FbxListNode<T> NodeT;
public:
explicit FbxListNode(T* pData = 0):mNext(0),mPrev(0),mData(pData){}
~FbxListNode(){ Disconnect(); }
void Disconnect()
{
if ( mPrev != 0 )
mPrev->mNext = mNext;
if ( mNext != 0 )
mNext->mPrev = mPrev;
mPrev = mNext = 0;
}
NodeT* mNext;
NodeT* mPrev;
T* mData;
};
//-----------------------------------------------------------------
// template arg T: Type listed
// arg NodeIndex: If an object listed has multiple list node, which
// index corresponds to the right node
template <typename T, int NodeIndex=0> class FbxIntrusiveList
{
public:
typedef T allocator_type;
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
typedef FbxListNode<T> NodeT;
// Construction / Destruction
FbxIntrusiveList():mHead(0)
{
mHead.mNext = mHead.mPrev = &mHead;
}
~FbxIntrusiveList()
{
while(!Empty())
Begin().Get()->Disconnect(); // LINUXNote: should be Erase(Begin()); but there's an issue with gcc 4.2
};
// true if the list's size is 0.
bool Empty() const
{
return ((mHead.mNext==&mHead)&&(mHead.mPrev==&mHead));
}
// Back Insertion Sequence Inserts a new element at the end.
void PushBack(T& pElement)
{
NodeT* pNode = &pElement.GetListNode(NodeIndex);
pNode->mData = &pElement;
if (Empty())
{
pNode->mNext = &mHead;
pNode->mPrev = &mHead;
mHead.mNext = pNode;
mHead.mPrev = pNode;
}
else
{
pNode->mNext = &mHead;
pNode->mPrev = mHead.mPrev;
pNode->mPrev->mNext = pNode;
mHead.mPrev = pNode;
}
}
void PushFront(T& pElement)
{
NodeT* pNode = &pElement.GetListNode(NodeIndex);
pNode->mData = &pElement;
if (Empty())
{
pNode->mNext = &mHead;
pNode->mPrev = &mHead;
mHead.mNext = pNode;
mHead.mPrev = pNode;
}
else
{
pNode->mNext = mHead.mNext;
pNode->mPrev = &mHead;
pNode->mNext->mPrev = pNode;
mHead.mNext = pNode;
}
}
void PopFront()
{
iterator begin = Begin();
Erase(begin);
}
void PopBack()
{
Erase(--(End()));
}
public:
class IntrusiveListIterator
{
public:
explicit IntrusiveListIterator(NodeT* ptr=0):mPtr(ptr){}
// pre-increment
IntrusiveListIterator& operator++()
{
mPtr = mPtr->mNext;return (*this);
}
// post-increment
const IntrusiveListIterator operator++(int)
{
IntrusiveListIterator temp = *this;
++*this;
return (temp);
}
// pre-decrement
IntrusiveListIterator& operator--()
{
mPtr = mPtr->mPrev;return *this;
}
// post-decrement
const IntrusiveListIterator operator--(int)
{
IntrusiveListIterator temp = *this;
--*this;
return (temp);
}
IntrusiveListIterator& operator=(const IntrusiveListIterator &other){mPtr = other.mPtr; return *this;}
reference operator*() const { return *(mPtr->mData); }
pointer operator->() const { return (&**this); }
bool operator==(const IntrusiveListIterator& other)const{ return mPtr==other.mPtr; }
bool operator!=(const IntrusiveListIterator& other)const{ return !(*this == other); }
inline NodeT* Get()const { return mPtr; }
private:
NodeT* mPtr;
};
class IntrusiveListConstIterator
{
public:
explicit IntrusiveListConstIterator(const NodeT* ptr=0):mPtr(ptr){}
// pre-increment
IntrusiveListConstIterator& operator++()
{
mPtr = mPtr->mNext;return (*this);
}
// post-increment
const IntrusiveListConstIterator operator++(int)
{
IntrusiveListConstIterator temp = *this;
++*this;
return (temp);
}
// pre-decrement
IntrusiveListConstIterator& operator--()
{
mPtr = mPtr->mPrev;return *this;
}
// post-decrement
const IntrusiveListConstIterator operator--(int)
{
IntrusiveListConstIterator temp = *this;
--*this;
return (temp);
}
IntrusiveListConstIterator& operator=(const IntrusiveListConstIterator &other){mPtr = other.mPtr; return *this;}
const_reference operator*() const { return *(mPtr->mData); }
const_pointer operator->() const { return (&**this); }
bool operator==(const IntrusiveListConstIterator& other)const{ return mPtr==other.mPtr; }
bool operator!=(const IntrusiveListConstIterator& other)const{ return !(*this == other); }
inline const NodeT* Get()const { return mPtr; }
private:
mutable const NodeT* mPtr;
};
// --- Iterator definitions ---
typedef IntrusiveListIterator iterator;
typedef IntrusiveListConstIterator const_iterator;
// iterator support
inline iterator Begin() { return iterator(mHead.mNext); }
inline const_iterator Begin() const { return const_iterator(mHead.mNext); }
inline iterator End() { return iterator(&mHead); }
inline const_iterator End() const { return const_iterator(&mHead); }
// Because there is no real use, for the reverse iterators,
// they have not been implemented.
reference Front(){return (*Begin());}
const_reference Front() const { return (*Begin()); }
reference Back(){ return (*(--End())); }
const_reference Back() const{ return (*(--End())); }
iterator& Erase(iterator& it)
{
it.Get()->Disconnect();
return (++it);
}
private:
NodeT mHead;
// Not copyable
FbxIntrusiveList(const FbxIntrusiveList&);
FbxIntrusiveList& operator=(const FbxIntrusiveList& Right){return (*this);}
};
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_INTRUSIVE_LIST_H_ */

View File

@ -0,0 +1,408 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxmap.h
#ifndef _FBXSDK_CORE_BASE_MAP_H_
#define _FBXSDK_CORE_BASE_MAP_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/core/base/fbxredblacktree.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxObject;
/** Default compare functor for FbxMap and FbxSet, which assumes operator < is defined.
Here is examples of different compare class implementations:
With Key = int
\code
class IntCompare
{
inline int operator()(int pKeyA, int pKeyB) const
{
return pKeyA < pKeyB ? -1 : (pKeyA > pKeyB ? 1 : 0);
}
};
\endcode
With Key = Class
\code
class ClassCompare
{
inline int operator()(const Class& pKeyA, const Class& pKeyB) const
{
return pKeyA < pKeyB ? -1 : (pKeyA > pKeyB ? 1 : 0);
}
};
\endcode
With Key = char*
\code
class StrCompare
{
inline int operator()(const char* pKeyA, const char* pKeyB) const
{
return strcmp(pKeyA, pKeyB);
}
};
\endcode
*/
template <typename Type> struct FbxLessCompare
{
inline int operator()(const Type& pLeft, const Type& pRight) const
{
return (pLeft < pRight) ? -1 : ((pRight < pLeft) ? 1 : 0);
}
};
/** This class implements an efficient map based on key comparison, which stores key-value pairs.
It executes insertion, deletion and query operations in O(log(n)) time. */
template <typename Key, typename Type, typename Compare=FbxLessCompare<Key>, typename Allocator=FbxBaseAllocator> class FbxMap
{
protected:
//! This class defines the key-value pairs used by the map.
class KeyValuePair : private FbxPair<const Key, Type>
{
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef const Key KeyType;
typedef const Key ConstKeyType;
typedef Type ValueType;
typedef const Type ConstValueType;
KeyValuePair(const Key& pFirst, const Type& pSecond) : FbxPair<const Key, Type>(pFirst, pSecond){}
ConstKeyType& GetKey() const { return this->mFirst; }
KeyType& GetKey(){ return this->mFirst; }
ConstValueType& GetValue() const { return this->mSecond; }
ValueType& GetValue(){ return this->mSecond; }
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
//! Declaration of the storage type used by the map.
typedef FbxRedBlackTree<KeyValuePair, Compare, Allocator> StorageType;
public:
typedef Type ValueType;
typedef Key KeyType;
typedef typename StorageType::RecordType RecordType;
typedef typename StorageType::IteratorType Iterator;
typedef typename StorageType::ConstIteratorType ConstIterator;
/** Preallocate memory.
* \param pRecordCount The number of elements. */
inline void Reserve(unsigned int pRecordCount)
{
mTree.Reserve(pRecordCount);
}
//! Retrieve the number of key-value pairs it holds.
inline int GetSize() const
{
return mTree.GetSize();
}
/** Insert a key-value pair.
* \param pKey The key.
* \param pValue The value.
* \return If the key is already present in the map, returns the existing pair and false; else returns the pointer to the new key-value and true. */
inline FbxPair<RecordType*, bool> Insert(const KeyType& pKey, const ValueType& pValue)
{
return mTree.Insert(KeyValuePair(pKey, pValue));
}
/** Delete a key-value pair.
* \param pKey The key.
* \return \c true if success, \c false if key is not found. */
inline bool Remove(const KeyType& pKey)
{
return mTree.Remove(pKey);
}
//! Clear the map.
inline void Clear()
{
mTree.Clear();
}
//! Query whether the map is empty.
inline bool Empty() const
{
return mTree.Empty();
}
//! Retrieve the begin iterator of the map.
Iterator Begin()
{
return Iterator(Minimum());
}
//! Retrieve the end iterator of the map.
Iterator End()
{
return Iterator();
}
//! Retrieve the begin iterator of the map.
ConstIterator Begin() const
{
return ConstIterator(Minimum());
}
//! Retrieve the end iterator of the map.
ConstIterator End() const
{
return ConstIterator();
}
/** Query a key.
* \param pKey The key.
* \return A key-value pair if success, NULL if the key is not found. */
inline const RecordType* Find(const KeyType& pKey) const
{
return mTree.Find(pKey);
}
/** Query a key.
* \param pKey The key.
* \return A key-value pair if success, NULL if it's not found. */
inline RecordType* Find(const KeyType& pKey)
{
return mTree.Find(pKey);
}
/** Find the key-value pair with the smallest key greater than a specified key.
* \param pKey The key.
* \return The found key-value pair. */
inline const RecordType* UpperBound(const KeyType& pKey) const
{
return mTree.UpperBound(pKey);
}
/** Find the key-value pair with the smallest key greater than a specified key.
* \param pKey The key.
* \return The found key-value pair. */
inline RecordType* UpperBound(const KeyType& pKey)
{
return mTree.UpperBound(pKey);
}
/** Retrieve the reference of the value in the key-value pairs in map.
* \param pKey The key.
* \return The reference of the value.
* \remark If the key is not found, a new key-value pair will be inserted. */
inline ValueType& operator[](const KeyType& pKey)
{
RecordType* lRecord = Find(pKey);
if( !lRecord )
{
lRecord = Insert(pKey, ValueType()).mFirst;
}
return lRecord->GetValue();
}
//! Retrieve the key-value pair which is the minimum key in map.
inline const RecordType* Minimum() const
{
return mTree.Minimum();
}
//! Retrieve the key-value pair which is the minimum key in map.
inline RecordType* Minimum()
{
return mTree.Minimum();
}
//! Retrieve the key-value pair which is the maximum key in map.
inline const RecordType* Maximum() const
{
return mTree.Maximum();
}
//! Retrieve the key-value pair which is the maximum key in map.
inline RecordType* Maximum()
{
return mTree.Maximum();
}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
inline FbxMap(){}
inline FbxMap(const FbxMap& pMap) : mTree(pMap.mTree){}
inline ~FbxMap(){ Clear(); }
private:
StorageType mTree;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
/** A simple map class representing a dictionary-like data structure.
* \nosubgrouping */
template <class Key, class Type, class Compare> class FbxSimpleMap
{
public:
typedef typename FbxMap<Key, Type, Compare>::RecordType* Iterator;
/** Add a key-value pair as an element.
* \param pKey The new key.
* \param pValue The new value. */
inline void Add(const Key& pKey, const Type& pValue)
{
mMap.Insert(pKey, pValue);
}
/** Find an element with a given key.
* \param pKey The given key.
* \return The iterator pointing to the found element or NULL if fails. */
inline Iterator Find(const Key& pKey) const
{
return (Iterator)mMap.Find(pKey);
}
/** Find an element with a given value.
* \param pValue The given value.
* \return The iterator pointing to the found element or NULL if fails. */
inline Iterator Find(const Type& pValue) const
{
Iterator lIterator = GetFirst();
while( lIterator )
{
if( lIterator->GetValue() == pValue )
{
return lIterator;
}
lIterator = GetNext(lIterator);
}
return 0;
}
/** Remove an element from the map.
* \param pIterator The given element. */
inline void Remove(Iterator pIterator)
{
if( pIterator ) mMap.Remove(pIterator->GetKey());
}
/** Get the first element.
* \return The the heading element. */
inline Iterator GetFirst() const
{
return (Iterator)mMap.Minimum();
}
/** Get the next element of a given element.
* \param pIterator The given element.
* \return The next element. */
inline Iterator GetNext(Iterator pIterator) const
{
return (Iterator)pIterator ? pIterator->Successor() : 0;
}
//! Remove all of the elements.
inline void Clear()
{
mMap.Clear();
}
/** Reserve the space for given number elements.
* \param pSize The given number. */
inline void Reserve(int pSize)
{
mMap.Reserve(pSize);
}
/** Query the count of elements in the map.
* \return The count of elements. */
inline int GetCount() const
{
return mMap.GetSize();
}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
inline FbxSimpleMap(){}
private:
FbxMap<Key, Type, Compare> mMap;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
/** This class template declare a simple FbxObject map.
* \nosubgrouping */
template <class Type, class Compare> class FbxObjectMap : public FbxSimpleMap<Type, FbxObject*, Compare>
{
public:
//! Constructor
inline FbxObjectMap(){}
/** Get the object contained in an element.
* \param pIterator The given element.
* \return The object.
*/
inline FbxObject* Get(typename FbxSimpleMap<Type, FbxObject*, Compare>::Iterator pIterator)
{
return pIterator ? pIterator->GetValue() : 0;
}
};
/** A class that maps strings to objects with a basic string comparator.
* \nosubgrouping */
class FbxObjectStringMap : public FbxObjectMap<FbxString, FbxStringCompare>
{
public:
//! Constructor
inline FbxObjectStringMap(){}
};
//! Call FbxFree on each element of the map, and then clear it.
template <typename K, typename V, typename C, typename A> inline void FbxMapFree(FbxMap<K, V, C, A>& pMap)
{
for( typename FbxMap<K, V, C, A>::Iterator i = pMap.Begin(); i != pMap.End(); ++i )
{
FbxFree(i->GetValue());
}
pMap.Clear();
}
//! Call FbxDelete on each element of the map, and then clear it.
template <typename K, typename V, typename C, typename A> inline void FbxMapDelete(FbxMap<K, V, C, A>& pMap)
{
for( typename FbxMap<K, V, C, A>::Iterator i = pMap.Begin(); i != pMap.End(); ++i )
{
FbxDelete(i->GetValue());
}
pMap.Clear();
}
//! Call Destroy on each element of the map, and then clear it.
template <typename K, typename V, typename C, typename A> inline void FbxMapDestroy(FbxMap<K, V, C, A>& pMap)
{
for( typename FbxMap<K, V, C, A>::Iterator i = pMap.Begin(); i != pMap.End(); ++i )
{
i->GetValue()->Destroy();
}
pMap.Clear();
}
template class FbxSimpleMap<FbxString, FbxObject*, FbxStringCompare>;
template class FbxObjectMap<FbxString, FbxStringCompare>;
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_MAP_H_ */

View File

@ -0,0 +1,67 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxmemorypool.h
#ifndef _FBXSDK_CORE_BASE_MEMORY_H_
#define _FBXSDK_CORE_BASE_MEMORY_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/sync/fbxatomic.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** \brief Class to create a simple fixed-size-blocks memory pool to allocate memory dynamically. */
class FBXSDK_DLL FbxMemoryPool
{
public:
/** Memory pool constructor.
* \param pBlockSize The size of one memory block.
* \param pBlockCount The count of block that should be pre-allocated.
* \param pResizable Whether memory pool can grow if no block are availalbe upon calling Allocate.
* \param pConcurrent Whether the pool supports concurrent allocation and release operations.
* \remark All memory blocks must be released before the memory pool is destroyed, otherwise a memory leak will occur. */
FbxMemoryPool(size_t pBlockSize, FbxInt64 pBlockCount=0, bool pResizable=true, bool pConcurrent=true);
/** Memory pool destructor. Upon destruction, all memory blocks of the pool will be de-allocated. */
~FbxMemoryPool();
/** Free memory of all memory blocks from this memory pool, also effectively resetting the block count to zero.
* \remark The block size and alignment/resize/concurrent support will remain unchanged. */
void Reset();
/** Allocate or lock a memory block for usage.
* \return An memory block pointer that can be NULL if the memory pool cannot grow in size and no blocks are available. */
void* Allocate();
/** Dispose or unlock a memory block.
* \param pMemBlock A pointer to the memory block to release. This will not free the block's memory, instead simply putting it back in the available stack. */
void Release(void* pMemBlock);
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
void* Pop();
FbxInt64 mMaxBlockCount;
FbxAtomic mFreeBlockCount;
void* mFreeBlocksStack;
size_t mBlockSize;
bool mResizable;
bool mSupportConcurrentAccess;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_MEMORY_H_ */

View File

@ -0,0 +1,115 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxmultimap.h
#ifndef _FBXSDK_CORE_BASE_MULTIMAP_H_
#define _FBXSDK_CORE_BASE_MULTIMAP_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Class to manipulate a map that can contain multiple times the same key.
* \nosubgrouping */
class FBXSDK_DLL FbxMultiMap
{
public:
struct Pair
{
FbxHandle mKey;
FbxHandle mItem;
};
/** If can't find the matching item,append a item at the end of the array.
* If find the matching item ,insert the new item before the matching item.
* \param pKey The value of Key in new item, also is the character for matching.
* \param pItem The value of Item in new item.
* \return If add successfully return true,otherwise return false.
*/
bool Add(FbxHandle pKey, FbxHandle pItem);
/** Remove the first matching item, whose reference is the same as given.
* \param pKey The given reference.
* \return If remove successfully return true,otherwise return false.
*/
bool Remove(FbxHandle pKey);
/** Remove all the matching item, whose item is the same as given.
* \param pItem The given item.
* \return If remove successfully return true,otherwise return false.
*/
bool RemoveItem(FbxHandle pItem);
/** Set first matching item with the given parameter.
* \param pKey The character for matching.
* \param pItem The value of Item that the matching item will be set.
* \return If set successfully return true,otherwise return false.
*/
bool SetItem(FbxHandle pKey, FbxHandle pItem);
/** Get first matching item with the given parameter.
* \param pKey The character for matching.
* \param pIndex The pointer to the index of the matching item.
* \return The value of Item in the matching item.
* \remarks If there are multiple elements that match the character, the index returned is unspecified.
*/
FbxHandle Get(FbxHandle pKey, int* pIndex=NULL);
//! Delete the array.
void Clear();
/** Get the item of the given index.
* \param pIndex The index for matching.
* \param pKey The pointer to the Key of the matching item.
* \return The value of Item in the matching item.
*/
FbxHandle GetFromIndex(int pIndex, FbxHandle* pKey=NULL);
/** Remove the item of the given index
* \param pIndex The given index.
* \return If remove successfully return true,otherwise return false.
*/
bool RemoveFromIndex(int pIndex);
/** Get number of items in the array.
* \return The number of items in the array. */
int GetCount() const { return mSetCount; }
/** Swap the value of Key and Item in every item of array, and sort the new array with the value of Key. */
void Swap();
/** Sort the array according the value of Key in each item. */
void Sort();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxMultiMap(int pItemPerBlock=20);
FbxMultiMap(const FbxMultiMap& pOther);
~FbxMultiMap();
FbxMultiMap& operator=(const FbxMultiMap&);
private:
Pair* FindEqual(FbxHandle pKey) const;
Pair* mSetArray;
int mSetCount;
int mBlockCount;
int mItemPerBlock;
bool mIsChanged;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_MULTIMAP_H_ */

View File

@ -0,0 +1,62 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxpair.h
#ifndef _FBXSDK_CORE_BASE_PAIR_H_
#define _FBXSDK_CORE_BASE_PAIR_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** This class template holds a pair of objects.
* \nosubgrouping */
template <typename First, typename Second> class FbxPair
{
public:
//! Constructor.
inline FbxPair() : mFirst(), mSecond() {}
/** Constructor.
* \param pFirst The first object.
* \param pSecond The second object. */
inline FbxPair(const First& pFirst, const Second& pSecond) : mFirst(pFirst), mSecond(pSecond) {}
/** Assignment operator.
* \param pOther The pair to be copied. */
inline FbxPair<First, Second>& operator=(const FbxPair<First, Second>& pOther)
{
mFirst = pOther.mFirst;
mSecond = pOther.mSecond;
return *this;
}
/** Comparison operator.
* \param pOther The pair to be compared. */
inline bool operator==(const FbxPair<First, Second>& pOther)
{
return mFirst == pOther.mFirst && mSecond == pOther.mSecond;
}
/** Inverse comparison operator.
* \param pOther The pair to be compared. */
inline bool operator!=(const FbxPair<First, Second>& pOther)
{
return !operator==(pOther);
}
First mFirst; //!< The first object in the pair.
Second mSecond; //!< The second object in the pair.
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_PAIR_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,227 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxset.h
#ifndef _FBXSDK_CORE_BASE_SET_H_
#define _FBXSDK_CORE_BASE_SET_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxredblacktree.h>
#include <fbxsdk/core/base/fbxmap.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** This class implements an efficient set based on value comparison, which stores values.
* It executes insertion, deletion and query operations in O(log(n)) time. */
template <typename Type, typename Compare=FbxLessCompare<Type>, typename Allocator=FbxBaseAllocator> class FbxSet
{
protected:
//! This class defines the value type used by the set.
class Value
{
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef const Type KeyType;
typedef const Type ConstKeyType;
typedef const Type ValueType;
typedef const Type ConstValueType;
inline Value(const Type& pValue) : mValue(pValue){}
inline KeyType& GetKey() const { return mValue; }
inline ConstKeyType& GetKey(){ return mValue; }
inline ValueType& GetValue() const { return mValue; }
inline ConstValueType& GetValue(){ return mValue; }
protected:
ValueType mValue;
private:
Value& operator=(const Value&);
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
//! Declaration of the storage type used by the set.
typedef FbxRedBlackTree<Value, Compare, Allocator> StorageType;
public:
typedef Type ValueType;
typedef typename StorageType::RecordType RecordType;
typedef typename StorageType::IteratorType Iterator;
typedef typename StorageType::ConstIteratorType ConstIterator;
/** Preallocate memory.
* \param pRecordCount The number of elements.
*/
inline void Reserve(unsigned int pRecordCount)
{
mTree.Reserve(pRecordCount);
}
//! Retrieve the number of values it holds.
inline int GetSize() const
{
return mTree.GetSize();
}
/** Insert a value.
* \param pValue The value.
* \return If the value is already present in the map, returns the existing value and false; else returns the pointer to the new value and true. */
inline FbxPair<RecordType*, bool> Insert(const ValueType& pValue)
{
return mTree.Insert(Value(pValue));
}
/** Delete a value.
* \param pValue The value.
* \return \c true if success, \c false if value is not found. */
inline int Remove(const ValueType& pValue)
{
return mTree.Remove(pValue);
}
//! Clear the set.
inline void Clear()
{
mTree.Clear();
}
//! Query whether the set is empty.
inline bool Empty() const
{
return mTree.Empty();
}
//! Retrieve the begin iterator of the set.
Iterator Begin()
{
return Iterator(Minimum());
}
//! Retrieve the end iterator of the set.
Iterator End()
{
return Iterator();
}
//! Retrieve the begin iterator of the set.
ConstIterator Begin() const
{
return ConstIterator(Minimum());
}
//! Retrieve the end iterator of the set.
ConstIterator End() const
{
return ConstIterator();
}
/** Find a given value in the set.
* \param pValue The value to find.
* \return The value in the set, or NULL if the value is not found in the set. */
inline const RecordType* Find(const ValueType& pValue) const
{
return mTree.Find(pValue);
}
/** Find a given value in the set.
* \param pValue The value to find.
* \return The value in the set, or NULL if the value is not found in the set. */
inline RecordType* Find(const ValueType& pValue)
{
return mTree.Find(pValue);
}
//! Retrieve the minimum value in the set.
inline const RecordType* Minimum() const
{
return mTree.Minimum();
}
//! Retrieve the minimum value in the set.
inline RecordType* Minimum()
{
return mTree.Minimum();
}
//! Retrieve the maximum value in the set.
inline const RecordType* Maximum() const
{
return mTree.Maximum();
}
//! Retrieve the maximum value in the set.
inline RecordType* Maximum()
{
return mTree.Maximum();
}
//! Equality operator.
inline bool operator==(const FbxSet<Type, Compare, Allocator>& pOther) const
{
return (this == &pOther) || (mTree == pOther.mTree);
}
//! Inequality operator.
inline bool operator != (const FbxSet<Type, Compare, Allocator>& pOther) const
{
return !(*this == pOther);
}
/** Intersect with another set.
* \param pOther The other set.
* \return The intersection set of the two sets. */
inline FbxSet Intersect(const FbxSet& pOther) const
{
FbxSet lReturn;
ConstIterator lBegin = Begin();
for (; lBegin != End(); ++lBegin)
{
if (pOther.Find(lBegin->GetValue()) != NULL)
lReturn.Insert(lBegin->GetValue());
}
return lReturn;
}
/** Unite with another set.
* \param pOther The other set.
* \return The union set of the two sets (no duplicated items). */
inline FbxSet Union(const FbxSet& pOther) const
{
FbxSet lReturn(*this);
ConstIterator lBegin = pOther.Begin();
for (; lBegin != End(); ++lBegin)
{
if (Find(lBegin->GetValue()) == NULL)
lReturn.Insert(lBegin->GetValue());
}
return lReturn;
}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
inline FbxSet(){}
inline FbxSet(const FbxSet& pSet) : mTree(pSet.mTree){}
inline ~FbxSet(){ Clear(); }
private:
StorageType mTree;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_SET_H_ */

View File

@ -0,0 +1,120 @@
/****************************************************************************************
Copyright (C) 2016 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxstatus.h
#ifndef _FBXSDK_CORE_BASE_STATUS_H_
#define _FBXSDK_CORE_BASE_STATUS_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** This class facilitates the testing/reporting of errors. It encapsulates the
* status code and the internal FBXSDK error code as returned by the API functions.
* \nosubgrouping
*/
class FBXSDK_DLL FbxStatus
{
public:
//! Available status codes.
enum EStatusCode {
eSuccess = 0, //!< Operation was successful
eFailure, //!< Operation failed
eInsufficientMemory, //!< Operation failed due to insufficient memory
eInvalidParameter, //!< An invalid parameter was provided
eIndexOutOfRange, //!< Index value outside the valid range
ePasswordError, //!< Operation on FBX file password failed
eInvalidFileVersion, //!< File version not supported (anymore or yet)
eInvalidFile, //!< Operation on the file access failed
eSceneCheckFail //!< Scene validation failure
};
//! Default constructor.
FbxStatus();
FbxStatus(EStatusCode pCode);
FbxStatus(const FbxStatus& rhs);
FbxStatus& operator=(const FbxStatus& rhs);
/** Equivalence operator.
* \param rhs Status object to compare.
* \return \c True if all the members of \e rhs are equal to this instance members and \c False otherwise.
*/
bool operator==(const FbxStatus& rhs) const { return (mCode == rhs.mCode); }
/** Equivalence operator.
* \param pCode Status code to compare.
* \return \c True if the code member of this instance equals \e pCode and \c False otherwise.
*/
bool operator==(const EStatusCode pCode) const { return (mCode == pCode); }
/** Non-Equivalence operator.
* \param rhs Status object to compare.
* \return \c True if at least one member of \e rhs is not equal to this instance member and \c True otherwise.
*/
bool operator!=(const FbxStatus& rhs) const { return (mCode != rhs.mCode); }
/** Non-Equivalence operator.
* \param rhs Status code to compare.
* \return \c True if the code member of this instance equals \e rhs and \c False otherwise.
*/
bool operator!=(const EStatusCode rhs) const { return (mCode != rhs); }
/** The conversion operator that converts a FbxStatus object to bool.
* The result it returns will be \c True if the FbxStatus does not contain
* an error, and \c False if it does.
*/
operator bool() const { return mCode==eSuccess; }
/** Determines whether there is an error.
* \return \c True if an error occured and \c False if the operation was sucessful.
*/
bool Error() const { return !this->operator bool(); }
//! Clear error code and message from the instance. After this call, it will behave as if it contained eSuccess.
void Clear();
//! Retrieve the type of error that occurred, as specified in the enumeration.
EStatusCode GetCode() const { return mCode; }
/** Change the current code of the instance.
* \param rhs New code value.
*/
void SetCode(const EStatusCode rhs);
/** Change the current code of the instance.
* \param rhs New code value.
* \param pErrorMsg Optional error description string. This string can have formatting characters
* The function will use the vsnprintf function to assemble the final string
* using an internal buffer of 4096 characters.
*/
void SetCode(const EStatusCode rhs, const char* pErrorMsg, ...);
//! Get the error message string corresponding to the current code.
const char* GetErrorString() const;
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
EStatusCode mCode;
FbxString mErrorString;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS */
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_STATUS_H_ */

View File

@ -0,0 +1,505 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxstring.h
#ifndef _FBXSDK_CORE_BASE_STRING_H_
#define _FBXSDK_CORE_BASE_STRING_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Convert string from UTF8 to wide-char
* \param pInUTF8 Input string
* \param pOutWideChar output string
* \param pOutWideCharSize size of the allocated output string buffer
* \remark Output buffer should be release by caller */
FBXSDK_DLL void FbxUTF8ToWC(const char* pInUTF8, wchar_t*& pOutWideChar, size_t* pOutWideCharSize=NULL);
/** Convert string from wide-char to UTF8
* \param pInWideChar input string
* \param pOutUTF8 output string
* \param pOutUTF8Size size of the allocated output string buffer
* \remark Output buffer should be release by caller */
FBXSDK_DLL void FbxWCToUTF8(const wchar_t* pInWideChar, char*& pOutUTF8, size_t* pOutUTF8Size=NULL);
#if defined(FBXSDK_ENV_WIN)
/** Convert string from wide-char to ANSI
* \param pInWideChar input string
* \param pOutANSI output string
* \param pOutANSISize size of the allocated output string buffer
* \remark Output buffer should be release by caller */
FBXSDK_DLL void FbxWCToAnsi(const wchar_t* pInWideChar, char*& pOutANSI, size_t* pOutANSISize=NULL);
/** Convert string from ANSI to wide-char
* \param pInANSI input string
* \param pOutWideChar output string
* \param pOutWideCharSize size of the allocated output string buffer
* \remark Output buffer should be release by caller */
FBXSDK_DLL void FbxAnsiToWC(const char* pInANSI, wchar_t*& pOutWideChar, size_t* pOutWideCharSize=NULL);
/** Convert string from ANSI to UTF8
* \param pInANSI input string
* \param outUTF8 output string
* \param pOutUTF8Size size of the allocated output string buffer
* \remark Output buffer should be release by caller */
FBXSDK_DLL void FbxAnsiToUTF8(const char* pInANSI, char*& pOutUTF8, size_t* pOutUTF8Size=NULL);
/** Convert string from UTF8 to ANSI
* \param pInUTF8 input string
* \param pOutANSI output string
* \param pOutANSISize size of the allocated output string buffer
* \remark Output buffer should be release by caller */
FBXSDK_DLL void FbxUTF8ToAnsi(const char* pInUTF8, char*& pOutANSI, size_t* pOutANSISize=NULL);
#endif
/** Utility class to manipulate strings.
* \nosubgrouping */
class FBXSDK_DLL FbxString
{
public:
/**
* \name Constructors and Destructor
*/
//@{
//! Default constructor.
FbxString();
/** Copy constructor.
* \param pString The FbxString to be copied. */
FbxString(const FbxString& pString);
/** String constructor.
* \param pString The string used to construct FbxString. */
FbxString(const char* pString);
/** Character constructor.
* \param pChar The character used to construct FbxString.
* \param pNbRepeat The number of times to repeat the character. Default value is 1 */
FbxString(char pChar, size_t pNbRepeat=1);
/** String constructor with maximum length.
* \param pCharPtr The string used to construct FbxString.
* \param pLength Maximum length. */
FbxString(const char* pCharPtr, size_t pLength);
/** Integer constructor.
* \param pValue The int value used to construct FbxString. */
FbxString(const int pValue);
/** Float constructor.
* \param pValue The float value used to construct FbxString. */
FbxString(const float pValue);
/** Double constructor.
* \param pValue The double value used to construct FbxString. */
FbxString(const double pValue);
//! Destructor.
~FbxString();
//@}
/**
* \name Buffer Access and Validation
*/
//@{
//! Get string length like "C" strlen().
size_t GetLen() const;
//! Get string length like "C" strlen().
size_t Size() const;
//! Return \c true if string length equal zero.
bool IsEmpty() const;
//! Discard the content of the string.
FbxString& Clear();
/** Access by reference.
* \param pIndex The index.
* \return The reference of the char at pIndex. */
char& operator[](int pIndex);
/** Access by copy.
* \param pIndex The index.
* \return The char at pIndex. */
char operator[](int pIndex) const;
//! Non-const buffer access.
char* Buffer();
//! Const buffer access.
const char* Buffer()const;
//@}
/**
* \name String Operations
*/
//@{
/** FbxString assignment operator.
* \param pString The FbxString to be assigned. */
const FbxString& operator=(const FbxString& pString);
/** Character assignment operator.
* \param pChar The character to be assigned. */
const FbxString& operator=(char pChar);
/** String assignment operator.
* \param pString The string to be assigned. */
const FbxString& operator=(const char* pString);
/** Int assignment operator.
* \param pValue The int value to be assigned. */
const FbxString& operator=(int pValue);
/** Float assignment operator.
* \param pValue The float value to be assigned. */
const FbxString& operator=(float pValue);
/** Double assignment operator.
* \param pValue The double value to be assigned. */
const FbxString& operator=(double pValue);
/** FbxString append.
* \param pString The FbxString to be appended. */
const FbxString& operator+=(const FbxString& pString);
/** Character append.
* \param pChar The character to be appended. */
const FbxString& operator+=(char pChar);
/** String append.
* \param pString The string to be appended. */
const FbxString& operator+=(const char* pString);
/** Integer append.
* \param pValue The int value to be appended. */
const FbxString& operator+=(int pValue);
/** Float append.
* \param pValue The float value to be appended. */
const FbxString& operator+=(float pValue);
/** Double append.
* \param pValue The double value to be appended. */
const FbxString& operator+=(double pValue);
/** Equality operator.
* \param pString The FbxString to be compared. */
bool operator== (const FbxString& pString) const;
/** Inequality operator.
* \param pString The FbxString to be compared. */
bool operator!= (const FbxString& pString) const;
/** Inferior to operator.
* \param pString The FbxString to be compared. */
bool operator< (const FbxString& pString) const;
/** Inferior or equal to operator.
* \param pString The FbxString to be compared. */
bool operator<= (const FbxString& pString) const;
/** Superior or equal to operator.
* \param pString The FbxString to be compared. */
bool operator>= (const FbxString& pString) const;
/** Superior to operator.
* \param pString The FbxString to be compared. */
bool operator> (const FbxString& pString) const;
/** Equality operator.
* \param pString The string to be compared. */
bool operator== (const char* pString) const;
/** Inequality operator.
* \param pString The string to be compared. */
bool operator!= (const char* pString) const;
/** Inferior to operator.
* \param pString The string to be compared. */
bool operator< (const char* pString) const;
/** Inferior or equal to operator.
* \param pString The string to be compared. */
bool operator<= (const char* pString) const;
/** Superior or equal to operator.
* \param pString The string to be compared. */
bool operator>= (const char* pString) const;
/** Superior to operator.
* \param pString The string to be compared. */
bool operator> (const char* pString) const;
/** FbxString concatenation.
* \param pString1 FbxString 1 to be concatenated to FbxString 2.
* \param pString2 FbxString 2 to be concatenated to FbxString 1 */
friend FBXSDK_DLL FbxString operator+(const FbxString& pString1, const FbxString& pString2);
/** Character concatenation.
* \param pString FbxString to be concatenated to Character.
* \param pChar Character to be concatenated to FbxString */
friend FBXSDK_DLL FbxString operator+(const FbxString& pString, char pChar);
/** Character concatenation.
* \param pChar Character to be concatenated to FbxString
* \param pString FbxString to be concatenated to Character. */
friend FBXSDK_DLL FbxString operator+(char pChar, const FbxString& pString);
/** String concatenation.
* \param pString1 FbxString to be concatenated to String.
* \param pString2 String to be concatenated to FbxString */
friend FBXSDK_DLL FbxString operator+(const FbxString& pString1, const char* pString2);
/** String concatenation.
* \param pString1 String to be concatenated to FbxString
* \param pString2 FbxString to be concatenated to String. */
friend FBXSDK_DLL FbxString operator+(const char* pString1, const FbxString& pString2);
/** Integer concatenation.
* \param pString FbxString to be concatenated to Integer.
* \param pValue Integer to be concatenated to FbxString */
friend FBXSDK_DLL FbxString operator+(const FbxString& pString, int pValue);
/** Integer concatenation.
* \param pValue Integer to be concatenated to FbxString
* \param pString FbxString to be concatenated to Integer. */
friend FBXSDK_DLL FbxString operator+(int pValue, const FbxString& pString);
/** Float concatenation.
* \param pString FbxString to be concatenated to Float.
* \param pValue Float to be concatenated to FbxString */
friend FBXSDK_DLL FbxString operator+(const FbxString& pString, float pValue);
/** Float concatenation.
* \param pValue Float to be concatenated to FbxString
* \param pString FbxString to be concatenated to Float. */
friend FBXSDK_DLL FbxString operator+( float pValue, const FbxString& pString);
/** Double concatenation.
* \param pString FbxString to be concatenated to Double.
* \param pValue Double to be concatenated to FbxString */
friend FBXSDK_DLL FbxString operator+(const FbxString& pString, double pValue);
//! Cast operator.
operator const char*() const;
/** String assignment function with maximum length.
* \param pString The string to be assigned.
* \param pLength The maximum length of string to be assigned. */
const FbxString& Copy(const char* pString, size_t pLength);
/** Append as "C" strncat().
* \param pString The string to be appended.
* \param pLength The length of chars to be appended. */
const FbxString& Append(const char* pString, size_t pLength);
/** Compare as "C" strcmp().
* \param pString The string to be compared. */
int Compare(const char* pString) const;
/** Compare as "C" stricmp().
* \param pString The string to be compared. */
int CompareNoCase(const char* pString) const;
/** Swap the contents of two strings.
* \param pString The FbxString to be swapped. */
void Swap(FbxString& pString);
//! Uppercase conversion.
FbxString Upper() const;
//! Lowercase conversion.
FbxString Lower() const;
//@}
/**
* \name Substring Extraction
*/
//@{
/** Extract middle string for a given length.
* \param pFirst The start index of FbxString to be extracted.
* \param pCount The length of sub-string to be extracted. */
FbxString Mid(size_t pFirst, size_t pCount) const;
/** Extract middle string up to the end.
* \param pFirst The start index of FbxString to be extracted. */
FbxString Mid(size_t pFirst) const;
/** Extract left string.
* \param pCount The length of sub-string to be extracted. */
FbxString Left(size_t pCount) const;
/** Extract right string.
* \param pCount The length of sub-string to be extracted. */
FbxString Right(size_t pCount) const;
//@}
/**
* \name Padding
*/
//@{
/** \enum EPaddingType Padding types.
* - \e eRight
* - \e eLeft
* - \e eBoth */
enum EPaddingType {eRight, eLeft, eBoth};
/** Add padding characters.
* \param pPadding The padding type.
* \param pLen The length limit of FbxString after padding.
* \param pCar The character to be padded. */
FbxString Pad(EPaddingType pPadding, size_t pLen, char pCar=' ') const;
/** Remove padding characters.
* \param pPadding The padding type.
* \param pCar The character to be padded.
* \remark If pCar == '\0' the function will remove all the characters that are tested by isspace(). */
FbxString UnPad(EPaddingType pPadding, char pCar='\0') const;
//@}
/**
* \name Search
*/
//@{
/** Look for a single character match, like "C" strchr().
* \param pChar The character to look for.
* \param pStartPosition Start position to look for.
* \return Index or -1 if not found. */
int Find(char pChar, size_t pStartPosition=0) const;
/** Look for a substring match, like "C" strstr().
* \param pStrSub The substring to look for.
* \param pStartPosition Start position to look for.
* \return Starting index or -1 if not found. */
int Find(const char* pStrSub, size_t pStartPosition=0) const;
/** Look for the last occurrence of character in string, like "C" strrchr().
* \param pChar The character to look for.
* \return Index or -1 if not found. */
int ReverseFind(char pChar) const;
/** Look for a single character match, like "C" strpbrk().
* \param pStrCharSet The character set.
* \param pStartPosition The start position.
* \return Index or -1 if not found. */
int FindOneOf(const char* pStrCharSet, size_t pStartPosition=0) const;
/** Replace a substring.
* \param pFind The substring to look for.
* \param pReplaceBy The string to replace by.
* \param pStartPosition The start position.
* \return \c true if substring found and replaced. */
bool FindAndReplace(const char* pFind, const char* pReplaceBy, size_t pStartPosition=0);
/** Replace all occurrence of a substring.
* \param pFind The substring to look for.
* \param pReplaceBy The string to replace by.
* \return \c true if something got replaced. */
bool ReplaceAll(const char* pFind, const char* pReplaceBy);
/** Replace all occurrence of character to find by replacement character.
* \param pFind The character to look for.
* \param pReplaceBy The character to replace by.
* \return \c true if character found and replaced. */
bool ReplaceAll(char pFind, char pReplaceBy);
//@}
/**
* \name Token Extraction
*/
//@{
/** Get number of tokens.
* \param pSpans The span
* \return The number of tokens. */
int GetTokenCount(const char* pSpans) const;
/** Get token at given index.
* \param pTokenIndex The token index.
* \param pSpans The span */
FbxString GetToken(int pTokenIndex, const char* pSpans) const;
//@}
private:
// Lengths/sizes in characters.
// Note: an extra character is always allocated.
char* mData; // Actual string (zero terminated).
FbxString(size_t pSrc1Len, const char* pSrc1Data, size_t pSrc2Len, const char* pSrc2Data); // Previously ConcatCopy
void Init();
//! Invalidate string.
void Invalidate();
void FreeBuffer();
void FreeBuffer(char *&pOldData);
bool AllocCopy(FbxString& pDest, size_t pCopyLen, size_t pCopyIndex) const;
bool AllocBuffer(size_t pLen);
bool AllocBuffer(size_t pLen, char*& pOldData);
bool AssignCopy(size_t pSrcLen, const char* pSrcData);
bool ConcatInPlace(size_t pSrcLen, const char* pSrcData);
bool IsIn(char pChar, const char* pString) const;
bool InternalFindAndReplace(const char* pFind, const char* pReplaceBy, size_t& pStartPosition);
};
FBXSDK_INCOMPATIBLE_WITH_ARRAY(FbxString);
//! FbxString concatenation.
FBXSDK_DLL FbxString operator+(const FbxString& pString1, const FbxString& pString2);
//! Character concatenation.
FBXSDK_DLL FbxString operator+(const FbxString& pString, char pChar);
//! String concatenation.
FBXSDK_DLL FbxString operator+(const FbxString& pString1, const char* pString2);
//! Integer concatenation.
FBXSDK_DLL FbxString operator+(const FbxString& pString, int pValue);
//! Float concatenation.
FBXSDK_DLL FbxString operator+(const FbxString& pString, float pValue);
//! Double concatenation.
FBXSDK_DLL FbxString operator+(const FbxString& pString, double pValue);
//! Functor to compare FbxString
struct FbxStringCompare { inline int operator()(const FbxString& pKeyA, const FbxString& pKeyB) const { return pKeyA.Compare(pKeyB); } };
//! Functor to compare FbxString without case sensitivity
struct FbxStringCompareNoCase { inline int operator()(const FbxString& pKeyA, const FbxString& pKeyB) const { return pKeyA.CompareNoCase(pKeyB); } };
//! Functor to compare "C" strings
struct FbxCharPtrCompare { inline int operator()(const char* pKeyA, const char* pKeyB) const { return strcmp(pKeyA, pKeyB); } };
//! Functor to compare "C" strings without case sensitivity
struct FbxCharPtrCompareNoCase { inline int operator()(const char* pKeyA, const char* pKeyB) const { return FBXSDK_stricmp(pKeyA, pKeyB); } };
/** Remove the given char in the given string.
* \param pString The given string.
* \param pToRemove The given char that ought to be removed.
* \remarks Strings used in this function are case-sensitive. */
inline void FbxRemoveChar(FbxString& pString, char pToRemove)
{
int lPos = pString.ReverseFind(pToRemove);
while( lPos >= 0 )
{
pString = pString.Left(lPos) + pString.Mid(lPos + 1);
lPos = pString.ReverseFind(pToRemove);
}
}
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_STRING_H_ */

View File

@ -0,0 +1,368 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxstringlist.h
#ifndef _FBXSDK_CORE_BASE_STRING_LIST_H_
#define _FBXSDK_CORE_BASE_STRING_LIST_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxarray.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
//! Wraps a string (FbxString) and a pointer (FbxHandle).
class FbxStringListItem
{
public:
FbxStringListItem(){ mReference = 0; }
FbxStringListItem(const char* pString, FbxHandle pRef=0){ mString = pString; mReference = pRef; }
FbxString mString;
FbxHandle mReference;
};
inline int FbxCompareStringListSort(const void* E1, const void* E2)
{
return FBXSDK_stricmp((*(FbxStringListItem**)E1)->mString.Buffer(), (*(FbxStringListItem**)E2)->mString.Buffer());
}
inline int FbxCompareStringListFindEqual(const void* E1, const void* E2)
{
return FBXSDK_stricmp((*(FbxStringListItem*)E1).mString.Buffer(), (*(FbxStringListItem**)E2)->mString.Buffer());
}
inline int FbxCompareCaseSensitiveStringList(const void *E1,const void *E2)
{
return strcmp((*(FbxStringListItem*)E1).mString.Buffer(), (*(FbxStringListItem**)E2)->mString.Buffer());
}
//! Base class of FbxStringList.
template <class Type> class FbxStringListT
{
protected:
FbxArray<Type*> mList;
public:
/**
* \name Operation With The Array
*/
//@{
/** Append a item at the end of the array.
* \return Index of appended pointer.
*/
int AddItem( Type* pItem ) { return mList.Add( pItem ); }
/** Insert a item in the array.
* \param pIndex Position where to insert the item.
* \param pItem Item to insert.
* \return Position of the inserted item in the array.
* \remarks If the given index is out of range, the pointer is appended at the end of the array.
*/
int InsertItemAt( int pIndex, Type* pItem ) { return mList.InsertAt( pIndex, pItem ); }
//! Access item at given index.
Type* GetItemAt( int pIndex ) const { return mList[pIndex]; }
/** Find first matching item.
* \return Index of first matching item found or -1 if there is no matching element.
*/
int FindItem( Type* pItem ) const { return mList.Find( pItem ); }
//}@
public :
/**
* \name Constructor and Destructor
*/
//@{
//! Default constructor.
FbxStringListT()
{
}
//! Destructor.
virtual ~FbxStringListT() { Clear(); }
//}@
//!Remove the item at the end of the array and delete the associated object.
void RemoveLast() { RemoveAt( mList.GetCount()-1 ); }
/** Get number of items in the array.
* \return The number of items in the array.
*/
inline int GetCount() const { return mList.GetCount(); }
//! Access the string in the item at given index.
FbxString& operator[](int pIndex) { return mList[pIndex]->mString; }
//! Access the value of reference in the item at given index.
FbxHandle GetReferenceAt(int pIndex) const { return mList[pIndex]->mReference; }
//! Set the value of reference at given index.
void SetReferenceAt(int pIndex, FbxHandle pRef) { mList[pIndex]->mReference = pRef; }
//! Access the pointer of string at given index.
char* GetStringAt(int pIndex) const { if (pIndex<mList.GetCount()) return mList[pIndex]->mString.Buffer(); else return NULL; }
//! Set string at given index.
virtual bool SetStringAt(int pIndex, const char* pString)
{
if (pIndex<mList.GetCount())
{
mList[pIndex]->mString = pString;
return true;
} else return false;
}
/** Find first matching item.
* \return Index of first matching item found or -1 if there is no
* matching element.
*/
int Find( Type& pItem ) const
{
for (int Count=0; Count<mList.GetCount(); Count++) {
if (mList[Count]==&pItem) {
return Count;
}
}
return -1;
}
/** Find first matching item which has the same reference as given parameter.
* \return Index of first matching item found or -1 if there is no
* matching element.
*/
int FindIndex( FbxHandle pReference ) const
{
for (int Count=0; Count<mList.GetCount(); Count++) {
if (mList[Count]->mReference==pReference) {
return Count;
}
}
return -1;
}
/** Find first matching item in array whose string address is the same as given pointer.
* \return Index of first matching item found or -1 if there is no
* matching element.
*/
int FindIndex( const char* pString ) const
{
for (int lCount=0; lCount<mList.GetCount(); lCount++) {
if (mList[lCount]->mString==pString) {
return lCount;
}
}
return -1;
}
/** Access the value of reference of the first matching item in array
* whose string address is the same as given pointer.
* \return The value of reference of the first matching item found or NULL if there is no
* matching element.
*/
FbxHandle FindReference(const char* pString ) const
{
int lIndex = FindIndex( pString );
if (lIndex!=-1) {
return mList[lIndex]->mReference;
}
return 0; // NULL
}
//! Remove first matching item.
bool Remove ( Type& pItem )
{
int lIndex = Find( pItem );
if (lIndex>=0) {
RemoveAt( lIndex );
return true;
}
return false;
}
//! Remove first matching item in array whose string address is the same as given pointer.
bool Remove (const char* pString )
{
int lIndex = FindIndex( pString );
if (lIndex>=0) {
RemoveAt( lIndex );
return true;
}
return false;
}
//! Remove first matching item.
bool RemoveIt ( Type& pItem )
{
int lIndex = Find( pItem );
if (lIndex>=0) {
RemoveAt( lIndex );
return true;
}
return false;
}
//! Sort the array by the string of every item,not case sensitive.
void Sort( )
{
qsort( &(mList.GetArray()[0]),mList.GetCount(),sizeof(FbxStringListItem*),FbxCompareStringListSort );
}
/** Find first matching item which has the same string as given parameter,not case sensitive.
* \return the pointer of matching item found or NULL if there is no
* matching element.
* \remark To cast the returned pointer to the FbxStringListItem you need a double indirection: (FbxStringListItem**)
*/
void* FindEqual(const char* pString) const
{
FbxStringListItem Key(pString);
if (mList.GetCount() != 0)
{
return bsearch ( &Key, &(mList.GetArray()[0]),mList.GetCount(),sizeof(FbxStringListItem*),FbxCompareStringListFindEqual );
}
else
{
return NULL ;
}
}
/** Find first matching item which has the same string as given parameter, case sensitive.
* \return the pointer of matching item found or NULL if there is no
* matching element.
* \remark To cast the returned pointer to the FbxStringListItem you need a double indirection: (FbxStringListItem**)
*/
void* FindCaseSensitive(const char* pString) const
{
FbxStringListItem Key(pString);
if (mList.GetCount() != 0)
{
return bsearch ( &Key, &(mList.GetArray()[0]),mList.GetCount(),sizeof(FbxStringListItem*), FbxCompareCaseSensitiveStringList);
}
else
{
return NULL ;
}
}
//! Add a new item at the end of array.
int Add( const char* pString, FbxHandle pItem=0 )
{
return InsertAt( mList.GetCount(),pString,pItem );
}
virtual int InsertAt( int pIndex, const char* pString, FbxHandle pItem=0 )
{
return mList.InsertAt( pIndex,FbxNew< Type >( pString,(FbxHandle)pItem ));
}
/** Remove the item at the given position in the array and delete the associated object.
* \param pIndex Position of the item to remove.
* \remarks If the index is not valid, nothing is performed. Otherwise,
* the item is removed from the array and the items are shifted to fill the
* empty slot.
*/
virtual void RemoveAt(int pIndex)
{
FbxDelete(mList.RemoveAt(pIndex));
}
//! Delete the array.
virtual void Clear()
{
FbxArrayDelete(mList);
}
/** Get the string of all the item.
* \return The text of string, each item's string separated by '~'.
*/
virtual void GetText(FbxString& pText) const
{
int lCount;
for (lCount=0; lCount<mList.GetCount(); lCount++)
{
pText += mList[lCount]->mString;
if (lCount<mList.GetCount()-1)
{
pText += "~";
}
}
}
/** Clear the array and set the array's new items with the substring separated by '~' from the given string.
* \param pList The string which used to generate the new items.
* \return The last index of the item in the new array.
* \remarks The number of items in the new array is the same as the number of substrings,
* and the string of each item is decided by the content of each substring.
*/
virtual int SetText(const char* pList)
{
int lPos=0, lOldPos = 0;
int lLastIndex=0;
FbxString lName=pList;
Clear();
for (lPos=0; lName.Buffer()[lPos]!=0; lPos++) {
if (lName.Buffer()[lPos]=='~') {
lName.Buffer()[lPos]=0;
lLastIndex = Add(lName.Buffer()+lOldPos);
lOldPos=lPos+1;
}
}
if(lOldPos != lPos)
{
lLastIndex = Add(lName.Buffer()+lOldPos);
}
return lLastIndex;
}
};
/** Array that stores pairs of FbxString and a pointer.
*/
class FBXSDK_DLL FbxStringList : public FbxStringListT<FbxStringListItem>
{
public:
/**
* \name Constructors
*/
//@{
//! Default constructor.
FbxStringList();
//! Copy constructor.
FbxStringList( const FbxStringList& pOriginal );
//@}
/**
* \name Assignment Operators
*/
//@{
//! FbxStringList assignment function.
void CopyFrom( const FbxStringList* pOriginal );
//! FbxStringList assignment operator.
FbxStringList& operator=(const FbxStringList& pOriginal);
//@}
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_STRING_LIST_H_ */

View File

@ -0,0 +1,648 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxtime.h
#ifndef _FBXSDK_CORE_BASE_TIME_H_
#define _FBXSDK_CORE_BASE_TIME_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxtimecode.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
#define FBXSDK_TIME_INFINITE FbxTime(FBXSDK_TC_INFINITY)
#define FBXSDK_TIME_MINUS_INFINITE FbxTime(FBXSDK_TC_MINFINITY)
#define FBXSDK_TIME_ZERO FbxTime(FBXSDK_TC_ZERO)
#define FBXSDK_TIME_EPSILON FbxTime(FBXSDK_TC_EPSILON)
#define FBXSDK_TIME_ONE_SECOND FbxTime(FBXSDK_TC_SECOND)
#define FBXSDK_TIME_ONE_MINUTE FbxTime(FBXSDK_TC_MINUTE)
#define FBXSDK_TIME_ONE_HOUR FbxTime(FBXSDK_TC_HOUR)
#define FBXSDK_TIME_ASSERT_EPSILON 0.5
#define FBXSDK_TIME_FORWARD 1
#define FBXSDK_TIME_BACKWARD -1
class FbxTimeModeObject;
/** Class to encapsulate time units.
* \nosubgrouping
* FbxTime can measure time in hour, minute, second, frame, field, residual and also combination of these units.
* It is recommended to use FbxTime for all time related operations. For example, currently it is used in FbxGlobalSettings,
* FbxGlobalTimeSettings, FbxCache, all curve filters and all animation-related classes, etc.
* FbxTime is just used to represent a moment, to represent a period of time, FbxTimeSpan should be used.
* \see FbxTimeSpan
*/
class FBXSDK_DLL FbxTime
{
public:
/** Long long constructor.
* \param pTime Initial value defined as a 64bit integer.
*/
FbxTime(const FbxLongLong pTime=0){ mTime = pTime; }
/**
* \name Time Modes and Protocols
*/
//@{
/** Time modes.
* \remarks
* EMode \c eNTSCDropFrame is used for broadcasting operations where
* clock time must be (almost) in sync with time code. To bring back color
* NTSC time code with clock time, this mode drops 2 frames per minute
* except for every 10 minutes (00, 10, 20, 30, 40, 50). 108 frames are
* dropped per hour. Over 24 hours the error is 2 frames and 1/4 of a
* frame. A time-code of 01:00:03:18 equals a clock time of 01:00:00:00
*
* \par
* EMode \c eNTSCFullFrame represents a time address and therefore is NOT
* IN SYNC with clock time. A time code of 01:00:00:00 equals a clock time
* of 01:00:03:18.
*
* - \e eDefaultMode
* - \e eFrames120 120 frames/s
* - \e eFrames100 100 frames/s
* - \e eFrames60 60 frames/s
* - \e eFrames50 50 frames/s
* - \e eFrames48 48 frame/s
* - \e eFrames30 30 frames/s (black and white NTSC)
* - \e eFrames30Drop 30 frames/s (use when display in frame is selected, equivalent to NTSC drop)
* - \e eNTSCDropFrame ~29.97 frames/s drop color NTSC
* - \e eNTSCFullFrame ~29.97 frames/s color NTSC
* - \e ePAL 25 frames/s PAL/SECAM
* - \e eFrames24 24 frames/s Film/Cinema
* - \e eFrames1000 1000 milli/s (use for date time)
* - \e eFilmFullFrame ~23.976 frames/s
* - \e eCustom Custom frame rate value
* - \e eFrames96 96 frames/s
* - \e eFrames72 72 frames/s
* - \e eFrames59dot94 ~59.94 frames/s
* - \e eModesCount Number of time modes
*/
enum EMode
{
eDefaultMode,
eFrames120,
eFrames100,
eFrames60,
eFrames50,
eFrames48,
eFrames30,
eFrames30Drop,
eNTSCDropFrame,
eNTSCFullFrame,
ePAL,
eFrames24,
eFrames1000,
eFilmFullFrame,
eCustom,
eFrames96,
eFrames72,
eFrames59dot94,
eModesCount
};
/** Time protocols enumaration
* - \e eSMPTE SMPTE EProtocol
* - \e eFrameCount Frame count
* - \e eDefaultProtocol Default protocol (initialized to eFRAMES)
*/
enum EProtocol {eSMPTE, eFrameCount, eDefaultProtocol};
/** Set default time mode.
* \param pTimeMode Time mode identifier.
* \param pFrameRate Custom framerate, only have effect in case of pTimeMode = FbxTime::eCustom
* \remarks It is meaningless to set default time mode to \c eDefaultMode.
*/
static void SetGlobalTimeMode(EMode pTimeMode, double pFrameRate=0.0);
/** Get default time mode.
* \return Currently set time mode identifier.
* \remarks Default time mode initial value is eFrames30.
*/
static EMode GetGlobalTimeMode();
/** Set default time protocol.
* \param pTimeProtocol Time protocol identifier.
* \remarks It is meaningless to set default time protocol to \c eDefaultProtocol.
*/
static void SetGlobalTimeProtocol(EProtocol pTimeProtocol);
/** Get default time protocol.
* \return Currently set time protocol identifier.
* \remarks Default time protocol initial value is eSMPTE.
*/
static EProtocol GetGlobalTimeProtocol();
/** Get frame rate associated with time mode, in frames per second.
* \param pTimeMode Time mode identifier.
* \return Frame rate value.
*/
static double GetFrameRate(EMode pTimeMode);
/** Get time mode associated with frame rate.
* \param pFrameRate The frame rate value.
* \param pPrecision The tolerance value.
* \return The corresponding time mode identifier or \c eDefaultMode if no time
* mode associated to the given frame rate is found.
*/
static EMode ConvertFrameRateToTimeMode(double pFrameRate, double pPrecision=0.00000001);
//@}
/**
* \name Time Conversion
*/
//@{
/** Set time in internal format.
* \param pTime Time value to set.
*/
inline void Set(FbxLongLong pTime){ mTime = pTime; }
/** Get time in internal format.
* \return Time value.
*/
inline FbxLongLong Get() const { return mTime; }
/** Set time in milliseconds.
* \param pMilliSeconds Time value to set.
*/
inline void SetMilliSeconds(FbxLongLong pMilliSeconds){ mTime = pMilliSeconds * FBXSDK_TC_MILLISECOND; }
/** Get time in milliseconds.
* \return Time value.
*/
inline FbxLongLong GetMilliSeconds() const { return mTime / FBXSDK_TC_MILLISECOND; }
/** Set time in seconds.
* \param pTime Time value to set.
*/
void SetSecondDouble(double pTime);
/** Get time in seconds.
* \return Time value.
*/
double GetSecondDouble() const;
/** Set time in hour/minute/second/frame/field format.
* \param pHour The hours value.
* \param pMinute The minutes value.
* \param pSecond The seconds value.
* \param pFrame The frames values.
* \param pField The field value.
* \param pTimeMode Time mode identifier.
* \remarks Parameters pHour, pMinute, pSecond, pFrame and pField are summed together.
* For example, it is possible to set the time to 83 seconds in the following
* ways: SetTime(0,1,23) or SetTime(0,0,83).
*/
void SetTime(int pHour, int pMinute, int pSecond, int pFrame=0, int pField=0, EMode pTimeMode=eDefaultMode);
/** Set time in hour/minute/second/frame/field/residual format.
* \param pHour The hours value.
* \param pMinute The minutes value.
* \param pSecond The seconds value.
* \param pFrame The frames values.
* \param pField The field value.
* \param pResidual The hundredths of frame value.
* \param pTimeMode Time mode identifier.
* \remarks Parameters pHour, pMinute, pSecond, pFrame, pField and pResidual
* are summed together, just like above.
* pResidual represents hundredths of frame, and won't necessarily
* correspond to an exact internal value.
*
* \remarks The time mode can't have a default value, because
* otherwise SetTime(int, int, int, int, int, int)
* would be ambiguous. Please specify DEFAULT_MODE.
*/
void SetTime(int pHour, int pMinute, int pSecond, int pFrame, int pField, int pResidual, EMode pTimeMode);
/** Get time in hour/minute/second/frame/field/residual format.
* \param pHour The returned hours value.
* \param pMinute The returned minutes value.
* \param pSecond The returned seconds value.
* \param pFrame The returned frames values.
* \param pField The returned field value.
* \param pResidual The returned hundredths of frame value.
* \param pTimeMode The time mode identifier which will dictate the extraction algorithm.
* \return \c true if the pTimeMode parameter is a valid identifier and thus the extraction
* succeeded. If the function returns \c false, all the values are set to 0.
*/
bool GetTime(int& pHour, int& pMinute, int& pSecond, int& pFrame, int& pField, int& pResidual, EMode pTimeMode=eDefaultMode) const;
/** Snaps a time value to the time value associated with the nearest frame.
* \param pRound If \c true the return value is rounded to the nearest integer.
* \return The snapped time value.
*/
FbxTime GetFramedTime(bool pRound=true) const;
/** Set time in frame format.
* \param pFrames The number of frames.
* \param pTimeMode The time mode identifier which will dictate the extraction algorithm.
*/
void SetFrame(FbxLongLong pFrames, EMode pTimeMode=eDefaultMode);
/** Set time in frame format, including fractions.
* \param pFrames The number of frames in decimal value.
* \param pTimeMode The time mode identifier which will dictate the extraction algorithm.
*/
void SetFramePrecise(FbxDouble pFrames, EMode pTimeMode=eDefaultMode);
/** Get number of hours in time.
* \return Hours value.
*/
int GetHourCount() const;
/** Get number of minutes in time.
* \return Minutes value.
*/
int GetMinuteCount() const;
/** Get number of seconds in time.
* \return Seconds value.
*/
int GetSecondCount() const;
/** Get number of frames in time.
* \param pTimeMode Time mode identifier.
* \return Integer value representing the frame count.
*/
FbxLongLong GetFrameCount(EMode pTimeMode=eDefaultMode) const;
/** Get precise number of frames in time, including fractions.
* \param pTimeMode Time mode identifier.
* \return Decimal value representing the frame count, including fractions.
*/
FbxDouble GetFrameCountPrecise(EMode pTimeMode=eDefaultMode) const;
/** Get number of fields in time.
* \param pTimeMode Time mode identifier.
* \return Fields value.
*/
FbxLongLong GetFieldCount(EMode pTimeMode=eDefaultMode) const;
/** Get residual time exceeding last full field.
* \param pTimeMode Time mode identifier.
* \return Residual value.
*/
int GetResidual(EMode pTimeMode=eDefaultMode) const;
/** Test for Drop Frame mode
* \param pTimeMode Time mode identifier.
* \return True if the pTimeMode is a Drop Frame mode.
*/
static bool IsDropFrame(EMode pTimeMode=eDefaultMode);
/** Separator char between second and frame.
* \param pTimeMode Time mode identifier.
* \return ';' is returned if pTimeMode is a DropFrame mode otherwise ':'.
*/
char GetFrameSeparator(EMode pTimeMode=eDefaultMode) const;
/** Get time in a human readable format.
* \param pTimeString An array large enough to contain a minimum of 19 characters.
* \param pTimeStringSize Size of the pTimeString buffer used with secure functions.
* \param pInfo The amount of information if time protocol is \c eSMPTE:
* <ul><li>1 means hours only
* <li>2 means hours and minutes
* <li>3 means hours, minutes and seconds
* <li>4 means hours, minutes, seconds and frames
* <li>5 means hours, minutes, seconds, frames and field
* <li>6 means hours, minutes, seconds, frames, field and residual value</ul>
* \param pTimeMode Requested time mode.
* \param pTimeFormat Requested time protocol.
* \return pTimeString parameter filled with a time value or set to a empty string
* if parameter pInfo is not valid.
*/
char* GetTimeString(char* pTimeString, const FbxUShort& pTimeStringSize, int pInfo=5, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol) const;
enum EElement {eHours, eMinutes, eSeconds, eFrames, eField, eResidual};
/** Get the time in a human readable format.
* \param pStart The starting element type used to format the time string.
* \param pEnd The last element type used to format the time string.
* \param pTimeMode The time mode requested.
* \param pTimeFormat The time format requested.
* \return The human readable time string. */
FbxString GetTimeString(EElement pStart=eHours, EElement pEnd=eResidual, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol) const;
/** Set time in a human readable format.
* \param pTime An array of a maximum of 18 characters.
* If time protocol is \c eSMPTE, pTimeString must be formatted this way:
* "[hours:]minutes[:seconds[.frames[.fields]]]". Hours, minutes, seconds,
* frames and fields are parsed as integers and brackets indicate optional
* parts.
* If time protocol is \c eFRAME, pTimeString must be formatted this way:
* "frames". Frames is parsed as a 64 bits integer.
* \param pTimeMode Given time mode.
* \param pTimeFormat Given time protocol.
* \return True if the set time string succeed, otherwise return false.
*/
bool SetTimeString(const char* pTime, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol);
//@}
/**
* \name Time Operators
*/
//@{
/** Equality operator.
* \param pTime The FbxTime to be compared.
* \return \c true if equal, \c false otherwise.
*/
inline bool operator==(const FbxTime& pTime) const { return mTime == pTime.mTime; }
/** Inequality operator.
* \param pTime The FbxTime to be compared.
* \return \c true if unequal, \c false otherwise.
*/
inline bool operator!=(const FbxTime& pTime) const { return mTime != pTime.mTime; }
/** Superior or equal to operator.
* \param pTime The FbxTime to be compared.
* \return \c true if this FbxTime is superior or equal to the passed FbxTime, \c false otherwise.
*/
inline bool operator>=(const FbxTime& pTime) const { return mTime >= pTime.mTime; }
/** Inferior or equal to operator.
* \param pTime The FbxTime to be compared.
* \return \c true if this FbxTime is inferior or equal to the passed FbxTime, \c false otherwise.
*/
inline bool operator<=(const FbxTime& pTime) const { return mTime <= pTime.mTime; }
/** Superior to operator.
* \param pTime The FbxTime to be compared.
* \return \c true if this FbxTime is superior to the passed FbxTime, \c false otherwise.
*/
inline bool operator>(const FbxTime& pTime) const { return mTime > pTime.mTime; }
/** Inferior to operator.
* \param pTime The FbxTime to be compared.
* \return \c true if this FbxTime is inferior to the passed FbxTime, \c false otherwise.
*/
inline bool operator<(const FbxTime& pTime) const { return mTime < pTime.mTime; }
/** Assignment operator.
* \param pTime The FbxTime to be assigned.
*/
inline FbxTime& operator=(const FbxTime& pTime) { mTime = pTime.mTime; return *this; }
/** Addition operator.
* \param pTime The FbxTime to be added.
* \return This FbxTime after addition.
*/
inline FbxTime& operator+=(const FbxTime& pTime) { mTime += pTime.mTime; return *this; }
/** Subtraction operator.
* \param pTime The FbxTime to be subtracted.
* \return This FbxTime after subtraction.
*/
inline FbxTime& operator-=(const FbxTime& pTime) { mTime -= pTime.mTime; return *this; }
/** Addition operator.
* \param pTime The FbxTime to be added.
* \return A temporary FbxTime after addition.
*/
FbxTime operator+(const FbxTime& pTime) const;
/** Subtraction operator.
* \param pTime The FbxTime to be subtracted.
* \return A temporary FbxTime after subtraction.
*/
FbxTime operator-(const FbxTime& pTime) const;
/** Multiplication operator.
* \param Mult Multiply this FbxTime by int Mult.
* \return A temporary FbxTime after multiplication.
*/
FbxTime operator*(const int Mult) const;
/** Division operator.
* \param pTime Divide this FbxTime by pTime.
* \return A temporary FbxTime after division.
*/
FbxTime operator/(const FbxTime& pTime) const;
/** Multiplication operator.
* \param pTime Multiply this FbxTime by pTime.
* \return A temporary FbxTime after multiplication.
*/
FbxTime operator*(const FbxTime& pTime) const;
/*
//! Increment time of one unit of the internal format (prefix form).
inline FbxTime& operator++() { mTime += 1; return (*this); }
//! Increment time of one unit of the internal format (postfix form).
inline const FbxTime operator++(int) { FbxTime lOld = *this; ++(*this); return lOld; }
//! Decrement time of one unit of the internal format (prefix form).
inline FbxTime& operator--() { mTime -= 1; return (*this); }
//! Decrement time of one unit of the internal format (postfix form).
inline const FbxTime operator--(int) { FbxTime lOld = *this; --(*this); return lOld; }*/
//@}
/** One frame value for a specified time mode.
* \param pTimeMode Time mode identifier.
* \return the time code of a one frame.
*/
static FbxLongLong GetOneFrameValue(EMode pTimeMode=eDefaultMode);
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Keep compatibility with old fbx format
enum EOldMode
{
eOLD_DEFAULT_MODE, //Default mode set using FbxTime::SetGlobalTimeMode(EMode pTimeMode)
eOLD_CINEMA, //24 frameOLD_s/s
eOLD_PAL, //25 frameOLD_s/s PAL/SECAM
eOLD_FRAMES30, //30 frameOLD_s/s BLACK & WHITE NTSC
eOLD_NTSC_DROP_FRAME, //29.97002617 frameOLD_s/s COLOR NTSC
eOLD_FRAMES50, //50 frameOLD_s/s
eOLD_FRAMES60, //60 frameOLD_s/s
eOLD_FRAMES100, //100 frameOLD_s/s
eOLD_FRAMES120, //120 frameOLD_s/s
eOLD_NTSC_FULL_FRAME, //29.97002617 frameOLD_s/s COLOR NTSC
eOLD_FRAMES30_DROP, //30 frameOLD_s/s
eOLD_FRAMES1000 //1000 frameOLD_s/s
};
private:
FbxLongLong mTime; //In 1 / 46,186,158,000 Seconds
static EMode gsGlobalTimeMode;
static EProtocol gsGlobalTimeProtocol;
static FbxTimeModeObject* gsTimeObject;
void InternalSetTime(int pHour, int pMinute, int pSecond, FbxLongLong pFrame, int pField, EMode pTimeMode);
friend FBXSDK_DLL FbxTime::EMode FbxGetGlobalTimeMode();
friend FBXSDK_DLL FbxTimeModeObject* FbxGetGlobalTimeModeObject();
friend FBXSDK_DLL FbxTime::EProtocol FbxGetGlobalTimeFormat();
friend FBXSDK_DLL void FbxSetGlobalTimeMode(FbxTime::EMode pTimeMode, double pFrameRate);
friend FBXSDK_DLL void FbxSetGlobalTimeFormat(FbxTime::EProtocol pTimeFormat);
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
/** FbxTime in seconds constructor.
* \param pTime
*/
FBXSDK_DLL inline FbxTime FbxTimeSeconds(const FbxDouble& pTime=0.0)
{
FbxTime lTime;
lTime.SetSecondDouble(pTime);
return lTime;
}
/** Class to encapsulate time intervals.
* \nosubgrouping
* \see FbxTime
*/
class FBXSDK_DLL FbxTimeSpan
{
public:
//! Constructor.
FbxTimeSpan() {}
/** Constructor.
* \param pStart Beginning of the time interval.
* \param pStop Ending of the time interval.
*/
FbxTimeSpan(FbxTime pStart, FbxTime pStop){ mStart = pStart; mStop = pStop; }
/** Set start and stop time.
* \param pStart Beginning of the time interval.
* \param pStop Ending of the time interval.
*/
inline void Set(FbxTime pStart, FbxTime pStop){ mStart = pStart; mStop = pStop; }
/** Set start time.
* \param pStart Beginning of the time interval.
*/
inline void SetStart(FbxTime pStart){ mStart = pStart; }
/** Set stop time.
* \param pStop Ending of the time interval.
*/
inline void SetStop(FbxTime pStop){ mStop = pStop; }
/** Get start time.
* \return Beginning of time interval.
*/
inline FbxTime GetStart() const { return mStart; }
/** Get stop time.
* \return Ending of time interval.
*/
inline FbxTime GetStop() const { return mStop; }
/** Get time interval in absolute value.
* \return Time interval.
*/
inline FbxTime GetDuration() const { if( mStop > mStart ) return mStop - mStart; else return mStart - mStop; }
/** Get time interval.
* \return Signed time interval.
*/
inline FbxTime GetSignedDuration() const { return mStop - mStart; }
/** Get direction of the time interval.
* \return \c FBXSDK_TIME_FORWARD if time interval is forward, \c FBXSDK_TIME_BACKWARD if backward.
*/
inline int GetDirection() const { if( mStop >= mStart ) return FBXSDK_TIME_FORWARD; else return FBXSDK_TIME_BACKWARD; }
/** Return \c true if the time is inside the timespan.
* \param pTime Judge whether pTime is inside the timespan.
* \return \c True if is, \c false otherwise.
*/
bool IsInside(FbxTime pTime) const;
/** Return the intersection of the two time spans.
* \param pTime
* \return The intersection of pTime and this FbxTimeSpan.
*/
FbxTimeSpan Intersect(const FbxTimeSpan& pTime) const;
/** Inequality operator.
* \param pTime FbxTimeSpan compared with this one.
* \return \c True if unequal, \c false otherwise.
*/
bool operator!=(const FbxTimeSpan& pTime) const;
/** Equality operator.
* \param pTime FbxTimeSpan compared with this one.
* \return \c True if equal, \c false otherwise.
*/
bool operator==(const FbxTimeSpan& pTime) const;
/** Unite with another FbxTimeSpan
* \param pSpan The FbxTimeSpan
* \param pDirection FBXSDK_TIME_FORWARD or FBXSDK_TIME_BACKWARD
* \remarks This function assumes both of the FbxTimeSpan objects are in the same direction.
* Use FBXSDK_TIME_FORWARD when start < stop in both timespan
* Use FBXSDK_TIME_BACKWARD when start > stop in both timespan
*/
void UnionAssignment(const FbxTimeSpan& pSpan, int pDirection=FBXSDK_TIME_FORWARD);
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
FbxTime mStart;
FbxTime mStop;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
class FBXSDK_DLL FbxLocalTime
{
public:
FbxLocalTime();
int mYear;
int mMonth;
int mDay;
int mHour;
int mMinute;
int mSecond;
int mMillisecond;
};
FBXSDK_DLL void FbxGetCurrentLocalTime(FbxLocalTime& pLocalTime);
FBXSDK_DLL FbxTime::EMode FbxGetGlobalTimeMode();
FBXSDK_DLL FbxTimeModeObject* FbxGetGlobalTimeModeObject();
FBXSDK_DLL FbxTime::EProtocol FbxGetGlobalTimeFormat();
FBXSDK_DLL void FbxSetGlobalTimeMode(FbxTime::EMode pTimeMode, double pFrameRate=0.0);
FBXSDK_DLL void FbxSetGlobalTimeFormat(FbxTime::EProtocol pTimeFormat);
// Use those functions to keep the compatibility with old time mode since we added new time mode.
FBXSDK_DLL FbxTime::EOldMode FbxGetOldTimeModeCorrespondance(FbxTime::EMode pMode);
FBXSDK_DLL FbxTime::EMode FbxGetTimeModeFromOldValue(FbxTime::EOldMode pOldMode);
// We now store the framerate instead of the time mode.
FBXSDK_DLL FbxTime::EMode FbxGetTimeModeFromFrameRate(char* pFrameRate);
FBXSDK_DLL void FbxGetControlStringList(char* pControlString, FbxTime::EProtocol pTimeFormat);
FBXSDK_DLL const char* FbxGetGlobalFrameRateString(FbxTime::EMode pTimeMode);
FBXSDK_DLL const char* FbxGetGlobalTimeModeString(FbxTime::EMode pTimeMode);
FBXSDK_DLL double FbxGetFrameRate(FbxTime::EMode pTimeMode);
// Time format
FBXSDK_DLL FbxTime::EProtocol FbxSelectionToTimeFormat(int pSelection);
FBXSDK_DLL FbxTime::EMode FbxSelectionToTimeMode(int pSelection);
FBXSDK_DLL int FbxTimeToSelection(FbxTime::EMode pTimeMode=FbxTime::eDefaultMode, int pTimeFormat=FbxTime::eDefaultProtocol);
FBXSDK_DLL const char* FbxGetTimeModeName(FbxTime::EMode pTimeMode);
FBXSDK_DLL int FbxGetFrameRateStringListIndex(FbxTime::EMode pTimeMode);
FBXSDK_DLL bool FbxIsValidCustomFrameRate(double pFramerate);
FBXSDK_DLL bool FbxGetNearestCustomFrameRate(double pFramerate, double& pNearestRate);
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_TIME_H_ */

View File

@ -0,0 +1,99 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxtimecode.h
#ifndef _FBXSDK_CORE_BASE_TIMECODE_H_
#define _FBXSDK_CORE_BASE_TIMECODE_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
#define FBXSDK_TC_ZERO FBXSDK_LONGLONG(0)
#define FBXSDK_TC_EPSILON FBXSDK_LONGLONG(1)
#define FBXSDK_TC_MINFINITY FBXSDK_LONGLONG(-0x7fffffffffffffff)
#define FBXSDK_TC_INFINITY FBXSDK_LONGLONG(0x7fffffffffffffff)
#define FBXSDK_TC_FIX_DEN FBXSDK_LONGLONG(100000000)
#define FBXSDK_TC_MILLISECOND FBXSDK_LONGLONG(46186158)
#define FBXSDK_TC_SECOND FbxLongLong(FBXSDK_TC_MILLISECOND*1000)
#define FBXSDK_TC_MINUTE FbxLongLong(FBXSDK_TC_SECOND*60)
#define FBXSDK_TC_HOUR FbxLongLong(FBXSDK_TC_MINUTE*60)
#define FBXSDK_TC_DAY FbxLongLong(FBXSDK_TC_HOUR*24)
// Frame @ 30 Hz
#define FBXSDK_TC_NTSC_FIELD FbxLongLong(FBXSDK_TC_SECOND/30/2)
#define FBXSDK_TC_NTSC_FRAME FbxLongLong(FBXSDK_TC_SECOND/30)
// Frame @ 29.9700299700 Hz
#define FBXSDK_TC_MNTSC_FIELD FbxLongLong(FBXSDK_TC_MNTSC_FRAME/2)
#define FBXSDK_TC_MNTSC_FRAME FbxLongLong(FBXSDK_TC_SECOND/30*1001/1000)
#define FBXSDK_TC_MNTSC_2_FRAMES FbxLongLong(FBXSDK_TC_MNTSC_FRAME*2)
#define FBXSDK_TC_MNTSC_30_FRAMES FbxLongLong(FBXSDK_TC_MNTSC_FRAME*30)
#define FBXSDK_TC_MNTSC_1798_FRAMES FbxLongLong(FBXSDK_TC_MNTSC_FRAME*1798) // leap minute
#define FBXSDK_TC_MNTSC_1800_FRAMES FbxLongLong(FBXSDK_TC_MNTSC_FRAME*1800) // ~1 minute
#define FBXSDK_TC_MNTSC_17982_FRAMES FbxLongLong(FBXSDK_TC_MNTSC_FRAME*17982) // ~10 minutes
#define FBXSDK_TC_MNTSC_107892_FRAMES FbxLongLong(FBXSDK_TC_MNTSC_FRAME*107892) // ~1 hour
#define FBXSDK_TC_MNTSC_108000_FRAMES FbxLongLong(FBXSDK_TC_MNTSC_FRAME*108000)
// For 29.9700299700 non-drop, btw : same values as with 23.976
#define FBXSDK_TC_MNTSC_1_SECOND FbxLongLong(FBXSDK_TC_MNTSC_FRAME*30) // 1 frame * 30
#define FBXSDK_TC_MNTSC_1_MINUTE FbxLongLong(FBXSDK_TC_MNTSC_1_SECOND*60) // 1 minute (1800 frames)
#define FBXSDK_TC_MNTSC_1_HOUR FbxLongLong(FBXSDK_TC_MNTSC_1_SECOND*3600) // 1 hour
#define FBXSDK_TC_MNTSC_NUM FbxULong(FBXSDK_TC_FIX_DEN*1000*30/1001)
#define FBXSDK_TC_MNTSC_DEN FBXSDK_TC_FIX_DEN
// Frame @ 25 Hz
#define FBXSDK_TC_PAL_FIELD FbxLongLong(FBXSDK_TC_SECOND/25/2)
#define FBXSDK_TC_PAL_FRAME FbxLongLong(FBXSDK_TC_SECOND/25)
// Frame @ 24 Hz
#define FBXSDK_TC_FILM_FRAME FbxLongLong(FBXSDK_TC_SECOND/24)
// Frame @ 23.9760239760 Hz
#define FBXSDK_TC_MFILM_FIELD FbxLongLong(FBXSDK_TC_MFILM_FRAME/2)
#define FBXSDK_TC_MFILM_FRAME FbxLongLong(FBXSDK_TC_SECOND/24*1001/1000)
#define FBXSDK_TC_MFILM_1_SECOND FbxLongLong(FBXSDK_TC_MFILM_FRAME*24) // 1 frame * 24
#define FBXSDK_TC_MFILM_1_MINUTE FbxLongLong(FBXSDK_TC_MFILM_1_SECOND*60) // 1 minute (1440 frames)
#define FBXSDK_TC_MFILM_1_HOUR FbxLongLong(FBXSDK_TC_MFILM_1_SECOND*3600) // 1 hour
#define FBXSDK_TC_MFILM_NUM FbxULong(FBXSDK_TC_FIX_DEN*1000*24/1001)
#define FBXSDK_TC_MFILM_DEN FBXSDK_TC_FIX_DEN
//////////////////////////////////////////////////////////////////////////////////////////
#define FBXSDK_TC_REM(quot, num, den) ((quot) = (num) / (den), (quot) * (den))
#define FBXSDK_TC_HOUR_REM(quot, num, den) ((quot) = ((num - (-FbxLongLong(num < 0) & (den - 1))) / (den)), (quot) * (den))
FBXSDK_DLL FbxLongLong FbxTCSeconds(FbxLongLong pTime);
FBXSDK_DLL FbxLongLong FbxTCMinutes(FbxLongLong pTime);
FBXSDK_DLL FbxLongLong FbxTCHours(FbxLongLong pTime);
FBXSDK_DLL FbxLongLong FbxTCSetRate(int pHour, int pMinute, int pSecond, FbxLongLong pFrame, FbxLongLong pPeriod);
FBXSDK_DLL FbxLongLong FbxTCGetRate(FbxLongLong pTime, int& pHour, int& pMinute, int& pSecond, int& pFrame, FbxLongLong pPeriod);
FBXSDK_DLL FbxLongLong FbxTCSetNTSC(int pHour, int pMinute, int pSecond, FbxLongLong pFrame, int pField);
FBXSDK_DLL FbxLongLong FbxTCGetNTSC(FbxLongLong pTime, int& pHour, int& pMinute, int& pSecond, int& pFrame, int& pField);
FBXSDK_DLL FbxLongLong FbxTCSetMNTSCnd(int pHour, int pMinute, int pSecond, FbxLongLong pFrame, int pField);
FBXSDK_DLL FbxLongLong FbxTCGetMNTSCnd(FbxLongLong pTime, int& pHour, int& pMinute, int& pSecond, int& pFrame, int& pField);
FBXSDK_DLL FbxLongLong FbxTCSetMNTSC_2Xnd(int pHour, int pMinute, int pSecond, FbxLongLong pFrame, int pField);
FBXSDK_DLL FbxLongLong FbxTCGetMNTSC_2Xnd(FbxLongLong pTime, int& pHour, int& pMinute, int& pSecond, int& pFrame, int& pField);
FBXSDK_DLL FbxLongLong FbxTCSetMNTSC(int pHour, int pMinute, int pSecond, FbxLongLong pFrame, int pField);
FBXSDK_DLL FbxLongLong FbxTCGetMNTSC(FbxLongLong pTime, int& pHour, int& pMinute, int& pSecond, int& pFrame, int& pField);
FBXSDK_DLL FbxLongLong FbxTCSetPAL(int pHour, int pMinute, int pSecond, FbxLongLong pFrame, int pField);
FBXSDK_DLL FbxLongLong FbxTCGetPAL(FbxLongLong pTime, int& pHour, int& pMinute, int& pSecond, int& pFrame, int& pField);
FBXSDK_DLL FbxLongLong FbxTCSetFILM(int pHour, int pMinute, int pSecond, FbxLongLong pFrame);
FBXSDK_DLL FbxLongLong FbxTCGetFILM(FbxLongLong pTime, int& pHour, int& pMinute, int& pSecond, int& pFrame);
FBXSDK_DLL FbxLongLong FbxTCSetFILMND(int pHour, int pMinute, int pSecond, FbxLongLong pFrame, int pField);
FBXSDK_DLL FbxLongLong FbxTCGetFILMND(FbxLongLong pTime, int& pHour, int& pMinute, int& pSecond, int& pFrame, int& pField);
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_TIMECODE_H_ */

View File

@ -0,0 +1,172 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxutils.h
#ifndef _FBXSDK_CORE_BASE_UTILITIES_H_
#define _FBXSDK_CORE_BASE_UTILITIES_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/core/base/fbxstatus.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
#ifndef FBXSDK_ENV_WINSTORE
/** Retrieve the environment variable value.
* \return A new string containing the environment variable value. */
FBXSDK_DLL FbxString FbxGetEnv(const char* pEnvVar);
/** Get the application directory
* \return The application directory. */
FBXSDK_DLL FbxString FbxGetApplicationDirectory();
#endif
/** Retrieve the system temporary folder path name.
* \return A new string containing the system temporary folder path name. */
FBXSDK_DLL FbxString FbxGetSystemTempPath();
/** Override the system temporary folder path name.
* \param pPathUTF8 The system temporary folder to use for override.
* \return True if the system temporary folder path has been set and False otherwise.
* \remark The system temporary folder is limited to _MAX_PATH characters. Trying to set
* a longer value will fail and the current system temporary folder path is left unchanged.
*/
FBXSDK_DLL bool FbxSetSystemTempPath(const char* pPathUTF8);
/** Retrieve the working directory of the system in UTF8 format.
* \return A string that contain the current working directory of the system. */
FBXSDK_DLL FbxString FbxGetCurrentWorkPath();
/** Change the working directory of the system. */
FBXSDK_DLL void FbxSetCurrentWorkPath(const char* pPath_UTF8);
class FBXSDK_DLL FbxPathUtils
{
public:
/** Bind together a root path with a file path.
* \param pRootPath The root path that will get binded to the file path.
* \param pFilePath The file path to bind to the root path.
* \param pCleanPath If true, the resulting path will be cleaned via FbxPathUtils::Clean().
* \return Both paths binded together forming a new file path.
* \remark If the file path is already a full valid path, pFilePath is returned.
*/
static FbxString Bind(const char* pRootPath, const char* pFilePath, bool pCleanPath=true);
/** Extract the folder name from the given file path.
* \param pFilePath The given file path.
* \return The folder name. If there isn't any '\\' or '/' in the given file path, it will return pFilePath.
*/
static FbxString GetFolderName(const char* pFilePath);
/** Extract file name from the given file path.
* \param pFilePath The given file path.
* \param pWithExtension Decide the file name with extension or without extension.
* If it is true, return the file name with extension;
* if it is false, return the file name without extension.
*/
static FbxString GetFileName(const char* pFilePath, bool pWithExtension=true);
/** Extract the file extension in the given file path.
* \param pFilePath The file path to extract the extension.
* \return The file extension without the '.' character.
* \remark Return empty string if the file path doesn't contain a valid extension.
*/
static FbxString GetExtensionName(const char* pFilePath);
/** Change or append a file extension to the specified file path.
* \param pFilePath The file path to change the file extension
* \param pExtension The extension to change or append to the file path.
* \return The file path with the file extension changed/added.
* \remark If the file path doesn't end with a valid file name, pFilePath is returned.
*/
static FbxString ChangeExtension(const char* pFilePath, const char* pExtension);
//! Test if the given path is relative path, if it is return true.
static bool IsRelative(const char* pPath);
/** Get the given new path's relative path to the given root path.
* \param pRootPath The given root path
* \param pNewPath The given new path. If it is only file name, the default directory is work directory.
* \return The relative path.
* \remarks If the given two paths have the same drive, the function will turn '\\' in the relative path to '/'.
*/
static FbxString GetRelativePath(const char* pRootPath, const char* pNewPath);
//! Get the given new path's relative path to the given root path.
static FbxString GetRelativeFilePath(const char* pRootPath, const char* pNewFilePath);
/** Get the full path of given path (if the given path is relative path,
* it will take current directory as default root path.)
*/
static FbxString Resolve(const char* pRelPath);
//! Clean the redundant and useless denotations in given path name.
static FbxString Clean(const char* pPath);
/** Generate full safe file path name you can use to create new file.
* \param pFolder The folder where the file name should be attempted to be created.
* \param pPrefix The prefix of generated file name.
* \return A valid file path that can safely be used to create a new file.
*/
static FbxString GenerateFileName(const char* pFolder, const char* pPrefix);
/** Verify if the specified folder path exist.
* \param pFolderPathUTF8 The folder path to test its existance.
* \return True if the folder path exist, false otherwise.
* \remark This function work for relative paths. It will search from the current work path. */
static bool Exist(const char* pFolderPathUTF8);
/** Create the specified folder path if it doesn't exist.
* \param pFolderPathUTF8 The folder path to create, in UTF8 encoding.
* \return True if folder path already exist, or if it was successfully created, false otherwise.
* \remark This function will create multiple folders if needed, and it also work for relative paths. */
static bool Create(const char* pFolderPathUTF8);
/** Delete the specified folder path and all its content recursively.
* \param pFolderPathUTF8 The folder path to delete, in UTF8 encoding.
* \return True if folder path was successfully deleted, false otherwise.
* \remark This function work for relative paths. It will search from the current work path. */
static bool Delete(const char* pFolderPathUTF8);
#ifndef FBXSDK_ENV_WINSTORE
/** Verify if the folder contains items or not.
* \param pFolderPath_UTF8 The folder path to test if it contains items.
* \return True if the folder contain any kind of entry type. */
static bool IsEmpty(const char* pFolderPath_UTF8);
#endif
};
/** Global accessor to an FbxStatus object.
* This object is not used internally by the FBX SDK. It is provided for convenience and its usage is shown in the custom reader/writers samples. */
class FBXSDK_DLL FbxStatusGlobal
{
public:
static FbxStatus& GetRef()
{
if( !mStatusPtr )
{
mStatusPtr = FbxNew<FbxStatus>();
}
return *mStatusPtr;
}
private:
FbxStatusGlobal(){ mStatusPtr = NULL; }
~FbxStatusGlobal(){ FbxDelete<FbxStatus>(mStatusPtr); }
static FbxStatusGlobal sgFbxStatusGlobal;
static FbxStatus* mStatusPtr;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_BASE_UTILITIES_H_ */

View File

@ -0,0 +1,166 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxclassid.h
#ifndef _FBXSDK_CORE_CLASSID_H_
#define _FBXSDK_CORE_CLASSID_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxClassIdInfo;
class FbxObject;
class FbxPropertyHandle;
class FbxManager;
//! The function pointer type for object constructor functions.
typedef FbxObject* (*FbxObjectCreateProc)(FbxManager& pManager, const char* pName, const FbxObject* pFrom);
/** Internal class used to differentiate objects during run-time. Essentially, each class has an unique ClassId, that the
* system can request in order to test if the class match the description. This class implement the necessary tools to be able
* to perform hierarchic class testing. This means that a class B that inherits from the class A will answer yes to a "Is A"
* query of type A or B, but will answer no to a class C that can still inherit from A. All class must inherit from FbxObject
* before they can have their own ClassId. When using the standard macros to create new types of objects in the FBX SDK, a
* static ClassId will automatically be generated for that new class.
*
* When objects are exported to an FBX file, their class type is maintained using 3 sort of strings. They are the Object Type
* string, the Object Sub Type string and the Object Type Prefix. There is no good or bad way to choose the value of these
* identifiers, but it is preferable to use meaningful values to keep the ASCII version of FBX readable and easy to understand.
* \see FbxObject */
class FBXSDK_DLL FbxClassId
{
public:
//! Constructor.
FbxClassId();
/** Advanced constructor were we can specify the general parameters for this ClassId.
* \param pClassName The name of the class represented.
* \param pParentClassId The parent ClassId of this class.
* \param pConstructor A function pointer to a construction method for this ClassId.
* \param pFBXType The FBX file Object Type string associated to this class.
* \param pFBXSubType The FBX file Object Sub Type string associated to this class. */
FbxClassId(const char* pClassName, const FbxClassId& pParentClassId, FbxObjectCreateProc pConstructor=0, const char* pFBXType=NULL, const char* pFBXSubType=NULL);
//! Destructor.
void Destroy();
/** Retrieve the class name.
* \return The class identification string name. */
const char* GetName() const;
/** Retrieve the parent ClassId.
* \return The parent ClassId. */
FbxClassId GetParent() const;
/** Create an instance of this class.
* \param pManager The FBX SDK Manager to be used to instantiate this object. This allow the object to use the same memory manager as the provided manager.
* \param pName The name to assign to this new object instance.
* \param pFrom An object to clone if it matches the same ClassId. This is an optional parameter.
* \return The newly created instance of this class. */
FbxObject* Create(FbxManager& pManager, const char* pName, const FbxObject* pFrom);
/** Override the function pointer method to construct this object.
* \param pConstructor A newly defined function pointer to a construction method to replace the existing one.
* \return True if the operation was successful. */
bool Override(FbxObjectCreateProc pConstructor);
/** Test if this class is a hierarchical children of the specified class type. This is the standard method to differentiate object classes.
* \param pId The class type to test against self.
* \return True if the object is a hierarchical children of the type specified.
* \remark This function will perform a complete search until it reaches the top level class, but it will stop as soon as one ClassId matches the test. */
bool Is(const FbxClassId& pId) const;
/** Equivalence operator.
* \param pClassId The class type to test against self.
* \return \c true if the ClassId is exactly the same, \c false otherwise.
* \remark This function only perform direct equality test, and doesn't test hierarchic children. */
bool operator==(const FbxClassId& pClassId) const;
/** Inequivalence operator.
* \param pClassId The class type to test against self.
* \return \c true if the ClassId is not the same, \c false otherwise.
* \remark This function only perform direct inequality test, and doesn't test hierarchic children. */
bool operator!=(const FbxClassId& pClassId) const;
/** Retrieve the FBX file Object Type string associated to this class.
* \param pAskParent If \c true, retrieve the parent ClassId, but only if self ClassId is not valid.
* \return The FBX file Object Type string associated to this class. */
const char* GetFbxFileTypeName(bool pAskParent=false) const;
/** Retrieve the FBX file Object Sub Type string associated to this class.
* \return The FBX file Object Sub Type string associated to this class. */
const char* GetFbxFileSubTypeName() const;
/** Find out if self ClassId is valid or not.
* \return \c true if self ClassId is valid, \c false otherwise. */
inline bool IsValid() const { return mClassInfo ? true : false; }
/** Set the Object Type Prefix string associated to this class. This will change the "ObjectTypePrefix::" found in front
* of object name in the FBX file. This is useful to differentiate objects by their name without using the Object Type or
* Sub Type strings in the file.
* \param pObjectTypePrefix The Object Type prefix string. */
void SetObjectTypePrefix(const char* pObjectTypePrefix);
/** Retrieve the Object Type Prefix string associated to this class.
* \return The Object Type Prefix string. */
const char* GetObjectTypePrefix();
/** Retrieve the root property handle of this class. This is useful to access the default property hierarchy for this
* class. This allow users to retrieve information such as the default value for all properties of this class.
* \return The root property handle for this class. */
FbxPropertyHandle* GetRootClassDefaultPropertyHandle();
/** Increase the instance reference count for this class type.
* \return the new count of reference to this class after increment. */
int ClassInstanceIncRef();
/** Decrease the instance reference count for this class type.
* \return the new count of reference to this class after decrement. */
int ClassInstanceDecRef();
/** Retrieve the instance reference count for this class type.
* \return The reference count of this class type. */
int GetInstanceRef();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
inline FbxClassIdInfo* GetClassIdInfo() { return mClassInfo; }
inline const FbxClassIdInfo* GetClassIdInfo() const { return mClassInfo; }
private:
FbxClassId(FbxClassIdInfo* mClassInfo);
bool SetFbxFileTypeName(const char* pName);
bool SetFbxFileSubTypeName(const char* pName);
FbxClassIdInfo* mClassInfo;
friend class FbxManager;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
//! Functor to compare FbxClassId
struct FbxClassIdCompare
{
inline int operator()(const FbxClassId& pKeyA, const FbxClassId& pKeyB) const
{
const FbxClassIdInfo* lKeyA = pKeyA.GetClassIdInfo();
const FbxClassIdInfo* lKeyB = pKeyB.GetClassIdInfo();
return lKeyA < lKeyB ? -1 : (lKeyA > lKeyB ? 1 : 0);
}
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_CLASSID_H_ */

View File

@ -0,0 +1,312 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxconnectionpoint.h
#ifndef _FBXSDK_CORE_CONNECTION_POINT_H_
#define _FBXSDK_CORE_CONNECTION_POINT_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxarray.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FBXSDK_DLL FbxConnection
{
public:
enum EType
{
eNone = 0,
// System or user
eSystem = 1 << 0,
eUser = 1 << 1,
eSystemOrUser = eUser | eSystem,
// Type of Link
eReference = 1 << 2,
eContains = 1 << 3,
eData = 1 << 4,
eLinkType = eReference | eContains | eData,
eDefault = eUser | eReference,
eUnidirectional = 1 << 7
};
};
class FbxConnectionPointFilter;
class FBXSDK_DLL FbxConnectionPoint
{
public:
enum EDirection
{
eDirSrc = 1 << 0, // Contains sources
eDirDst = 1 << 1, // Contains destinations
eDirUni = 1 << 2, // Connection is not 2 ways
eDirBoth = eDirSrc | eDirDst,
eDirMask = eDirSrc | eDirDst | eDirUni
};
enum EType
{
eStandard = 0,
eSubConnection = 1 << 3, // Connect is a sub Connect of another
eTypeMask = eSubConnection
};
enum EAttribute
{
eDefault = 0,
eCache = 1 << 4,
eAttributeMask = eCache
};
enum EAllocFlag
{
eNotAllocated = 0,
eAllocated = 1 << 5,
eAllocFlagMask = eAllocated
};
enum ECleanedFlag
{
eNotCleaned = 0,
eCleaned = 1 << 6,
eCleanedFlagMask = eCleaned
};
enum EEvent
{
eSrcConnectRequest,
eDstConnectRequest,
eSrcConnect,
eDstConnect,
eSrcConnected,
eDstConnected,
eSrcDisconnect,
eDstDisconnect,
eSrcDisconnected,
eDstDisconnected,
eSrcReplaceBegin,
eSrcReplaceEnd,
eDstReplaceBegin,
eDstReplaceEnd,
eSrcReorder,
eSrcReordered
};
// Constructor/Destructor
FbxConnectionPoint(void* pData=0);
virtual ~FbxConnectionPoint();
void SetFilter(FbxConnectionPointFilter* pConnectFilter, EType pType=eStandard);
void InternalClear();
//! Clear the ConnectList without any regards to what is connected
void WipeConnectionList();
void Destroy();
void SubConnectRemoveAll();
inline FbxConnectionPoint* GetSubOwnerConnect(){ return GetConnectType() == eSubConnection ? mOwner : NULL; }
inline FbxConnectionPointFilter* GetFilter(){ return mFilter; }
virtual bool IsInReplace(FbxConnectionPoint* p1, FbxConnectionPoint* p2);
inline void SetConnectType(EType pType){ mFlags = (mFlags & ~eTypeMask) | pType; }
inline EType GetConnectType(){ return EType(mFlags & eTypeMask); }
inline void SetDirection(int pDirections){ mFlags = (mFlags & ~eDirMask) | pDirections; }
inline EDirection GetDirection(){ return EDirection(mFlags & eDirMask); }
inline void SetAttribute(int pAttributes){ mFlags = (mFlags & ~eAttributeMask) | pAttributes; }
inline EAttribute GetAttribute(){ return EAttribute(mFlags & eAttributeMask); }
inline void SetAllocatedFlag(bool pBool){ mFlags = ( pBool ) ? mFlags | eAllocated : mFlags & ~eAllocFlagMask; }
inline bool GetAllocatedFlag(){ return ( mFlags & eAllocFlagMask ) ? true : false; }
inline void SetCleanedFlag(bool pBool){ mFlags = ( pBool ) ? mFlags | eCleaned : mFlags & ~eCleanedFlagMask; }
inline bool GetCleanedFlag(){ return ( mFlags & eCleanedFlagMask ) ? true : false; }
bool IsValidSrc(FbxConnectionPoint* pConnect);
bool IsValidDst(FbxConnectionPoint* pConnect);
bool IsValidSrcConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType);
bool IsValidDstConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType);
bool RequestValidSrcConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType );
bool RequestValidDstConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType );
bool ConnectSrc(FbxConnectionPoint* pSrc,FbxConnection::EType pConnectionType=FbxConnection::eNone);
bool ConnectDst(FbxConnectionPoint* pDst,FbxConnection::EType pConnectionType=FbxConnection::eNone);
bool ConnectSrcAt(int pDst_SrcIndex, FbxConnectionPoint* pSrc, FbxConnection::EType pConnectionType=FbxConnection::eNone);
bool ConnectDstAt(int pSrc_DstIndex, FbxConnectionPoint* pDst, FbxConnection::EType pConnectionType=FbxConnection::eNone);
static bool ConnectConnect(FbxConnectionPoint* pSrc,FbxConnectionPoint* pDst,FbxConnection::EType pConnectionType);
static bool ConnectAt(FbxConnectionPoint* pSrc, int pSrc_DstIndex, FbxConnectionPoint* pDst, int pDst_SrcIndex, FbxConnection::EType pConnectionType);
bool DisconnectDst(FbxConnectionPoint* pSrc);
bool DisconnectSrc(FbxConnectionPoint* pSrc);
void DisconnectAllSrc();
void DisconnectAllDst();
static bool DisconnectConnect(FbxConnectionPoint* pSrc,FbxConnectionPoint* pDst);
bool DisconnectDstAt(int pIndex);
bool DisconnectSrcAt(int pIndex);
bool ReplaceInDst(FbxConnectionPoint* pDstOld, FbxConnectionPoint* pDstNew, int pIndexInNew);
bool ReplaceInSrc(FbxConnectionPoint* pSrcOld, FbxConnectionPoint* pSrcNew, int pIndexInNew);
bool ReplaceDstAt(int pIndex, FbxConnectionPoint* pDst);
bool ReplaceSrcAt(int pIndex, FbxConnectionPoint* pSrc);
bool SwapSrc(int pIndexA, int pIndexB);
/** Change the position of a source Connect.
* \param pIndex Position of the Connect to move.
* \param pAtIndex Position where to move the Connect.
* \return \c True if the Connect was moved.
* \remarks After the move, the Connect will be precisely at position pAtIndex.
*/
bool MoveSrcAt(int pIndex, int pAtIndex);
/** Change the position of a source Connect.
* \param pSrc Connect to move.
* \param pAtSrc Connect at which position to move.
* \return \c True if the Connect was moved.
* \remarks After the move, the Connect will be precisely at the position where pAtSrc was before the move.
*/
bool MoveSrcAt(FbxConnectionPoint* pSrc, FbxConnectionPoint* pAtSrc);
// Access services
bool IsConnectedSrc(FbxConnectionPoint*);
bool IsConnectedDst(FbxConnectionPoint*);
inline bool IsConnected(FbxConnectionPoint* pConnect) { return IsConnectedSrc(pConnect) || IsConnectedDst(pConnect); }
inline int GetSrcCount() const { return mConnectionList.GetSrcCount(); }
inline FbxConnectionPoint* GetSrc(int pIndex) const { return mConnectionList.GetSrc(pIndex);}
inline FbxConnection::EType GetSrcType(int pIndex) const { return mConnectionList.GetSrcType(pIndex);}
inline int GetDstCount() const { return mConnectionList.GetDstCount(); }
inline FbxConnectionPoint* GetDst(int pIndex) const { return mConnectionList.GetDst(pIndex);}
inline FbxConnection::EType GetDstType(int pIndex) const { return mConnectionList.GetDstType(pIndex);}
inline int FindSrc(FbxConnectionPoint* pConnect){ return mConnectionList.FindSrc(pConnect); }
inline int FindDst(FbxConnectionPoint* pConnect){ return mConnectionList.FindDst(pConnect); }
// Filtered versions
inline int GetSrcCount(FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetSrcCount() : GetSrcCount(); }
inline FbxConnectionPoint* GetSrc(int pIndex,FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetSrc(pIndex) : GetSrc(pIndex); }
inline FbxConnection::EType GetSrcType(int pIndex,FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetSrcType(pIndex) : GetSrcType(pIndex); }
inline int GetDstCount(FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetDstCount() : GetDstCount(); }
inline FbxConnectionPoint* GetDst(int pIndex,FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetDst(pIndex): GetDst(pIndex); }
inline FbxConnection::EType GetDstType(int pIndex,FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetDstType(pIndex) : GetDstType(pIndex); }
void* GetData(){ return mData; }
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
class ConnectionList
{
public:
ConnectionList();
~ConnectionList();
void Clear();
void InsertSrcAt(int pIndex, FbxConnectionPoint* pConnect, FbxConnection::EType pType);
void AddSrc(FbxConnectionPoint* pConnect, FbxConnection::EType pType);
void RemoveSrcAt(int pIndex);
int FindSrc(FbxConnectionPoint* pConnect) const;
int GetSrcCount() const;
FbxConnectionPoint* GetSrc(int pIndex) const;
FbxConnection::EType GetSrcType(int pIndex) const;
void InsertDstAt(int pIndex, FbxConnectionPoint* pConnect, FbxConnection::EType pType);
void AddDst(FbxConnectionPoint* pConnect, FbxConnection::EType pType);
void RemoveDstAt(int pIndex);
int FindDst(FbxConnectionPoint* pConnect) const;
int GetDstCount() const;
FbxConnectionPoint* GetDst(int pIndex) const;
FbxConnection::EType GetDstType(int pIndex) const;
protected:
struct Connection {
Connection(FbxConnectionPoint* pPoint, FbxConnection::EType pType) : mPoint(pPoint), mType(pType){}
FbxConnectionPoint* mPoint; FbxConnection::EType mType;
};
FbxArray<Connection> mSrcList;
FbxArray<Connection> mDstList;
};
void SubConnectAdd(FbxConnectionPoint* pConnect);
void SubConnectRemove(FbxConnectionPoint* pConnect);
FbxConnectionPoint* SubConnectFind(FbxConnectionPointFilter* pFilter);
FbxConnectionPoint* SubConnectGetOrCreate(FbxConnectionPointFilter* pFilter);
void SubConnectFill(FbxConnectionPoint* pConnect);
virtual bool ConnectNotify(EEvent pAction, FbxConnectionPoint* pThis, int pIndex, FbxConnectionPoint* pConnect=NULL, FbxConnection::EType pConnectionType=FbxConnection::eNone, FbxConnectionPoint* pNewConnect=NULL);
virtual void ConnectCleanUp(FbxConnectionPoint* pThis);
int FindSrcIndexFromOwnerConnectIndex(FbxConnectionPoint* pOwner, int pOwnerIndex);
int FindDstIndexFromOwnerConnectIndex(FbxConnectionPoint* pOwner, int pOwnerIndex);
bool InternalMoveSrcBefore(int pIndex, int pBeforeIndex);
private:
inline void InsertSrcAt(int pIndex, FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType){ mConnectionList.InsertSrcAt(pIndex, pConnect, pConnectionType); }
inline void InsertDstAt(int pIndex, FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType){ mConnectionList.InsertDstAt(pIndex, pConnect, pConnectionType); }
inline void RemoveSrcAt(int pIndex){ mConnectionList.RemoveSrcAt(pIndex); }
inline void RemoveDstAt(int pIndex){ mConnectionList.RemoveDstAt(pIndex); }
static bool InternalConnectBefore(FbxConnectionPoint* pSrc, FbxConnectionPoint* pSrc_BeforeDst, FbxConnectionPoint* pDst, FbxConnectionPoint* pDst_BeforeSrc, FbxConnection::EType pConnectionType);
static bool UserConnectBefore(FbxConnectionPoint* pSrc, FbxConnectionPoint* pSrc_BeforeDst, FbxConnectionPoint* pDst, FbxConnectionPoint* pDst_BeforeSrc, FbxConnection::EType pConnectionType);
static bool EmitReplaceNotify(FbxConnectionPoint* pDstOwner, FbxConnectionPoint* pSrcOwner, FbxConnectionPoint* pDst, FbxConnectionPoint* pSrc, EEvent pConnectAction, FbxConnectionPoint* pNew);
virtual bool SetOwnerConnect(FbxConnectionPoint* pConnect);
inline FbxConnectionPoint* GetOwnerConnect(){ return mOwner; }
bool ConnectOwnedConnect(FbxConnectionPoint* pConnect);
bool DisconnectOwnedConnect(FbxConnectionPoint* pConnect);
void* mData;
int mFlags;
FbxConnectionPoint* mOwner;
ConnectionList mConnectionList;
FbxArray<FbxConnectionPoint*> mSubConnectList;
FbxArray<FbxConnectionPoint*> mSubConnectCreatedList;
FbxConnectionPointFilter* mFilter;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
/** Class to manage Connect Filter */
class FBXSDK_DLL FbxConnectionPointFilter
{
public:
virtual ~FbxConnectionPointFilter() {};
//! Return reference ConnectionPoint filter.
virtual FbxConnectionPointFilter* Ref();
//! Cancel reference
virtual void Unref();
//! Get unique filter ID
virtual FbxInt GetUniqueId() const { return 0; }
/** Judge if the given Connection Point is valid
* \param pConnect The given Connection Point.
* \return \c True if valid, \c false if not valid. */
virtual bool IsValid(FbxConnectionPoint* pConnect) const;
/** Judge if the given Connection Point is a valid connection
* \param pConnect The given Connection Point.
* \param pType Connection type.
* \return \c True if valid, \c false if not valid. */
virtual bool IsValidConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pType) const;
/** Judge if it is equal with the given ConnectionPoint filter.
* \param pConnectFilter The given ConnectionPoint filter.
* \return \c True if equal, \c false if unequal. */
virtual bool IsEqual(FbxConnectionPointFilter* pConnectFilter) const;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_CONNECTION_POINT_H_ */

View File

@ -0,0 +1,267 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxdatatypes.h
#ifndef _FBXSDK_CORE_DATA_TYPES_H_
#define _FBXSDK_CORE_DATA_TYPES_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxpropertytypes.h>
#include <fbxsdk/core/fbxpropertyhandle.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** FBX SDK data type class
* \nosubgrouping
*/
class FBXSDK_DLL FbxDataType
{
public:
static FbxDataType Create(const char* pName, const EFbxType pType);
static FbxDataType Create(const char* pName, const FbxDataType& pDataType);
/**
*\name Constructor and Destructor.
*/
//@{
//! Constructor.
FbxDataType();
/** Copy constructor.
* \param pDataType Another FbxDataType object copied to this one.
*/
FbxDataType(const FbxDataType& pDataType);
//! Destroy this datatype.
void Destroy();
/** Constructor.
* \param pTypeInfoHandle Type information handle
*/
FbxDataType(const FbxPropertyHandle& pTypeInfoHandle);
//! Destructor.
~FbxDataType();
//@}
/** Assignment operator
* \param pDataType Datatype whose value is assigned to this datatype.
* \return This datatype
*/
inline FbxDataType& operator=(const FbxDataType& pDataType){ mTypeInfoHandle=pDataType.mTypeInfoHandle; return *this; }
/**
* \name boolean operation
*/
//@{
/** Equality operator
* \param pDataType Datatype to compare to.
* \return \c true if equal,\c false otherwise.
*/
inline bool operator==(const FbxDataType& pDataType) const { return mTypeInfoHandle==pDataType.mTypeInfoHandle; }
/** Non-equality operator
* \param pDataType Datatype to compare to.
* \return \c true if unequal,\c false otherwise.
*/
inline bool operator!=(const FbxDataType& pDataType) const { return mTypeInfoHandle!=pDataType.mTypeInfoHandle; }
//@}
/** Test whether this datatype is a valid datatype.
* \return \c true if valid, \c false otherwise.
*/
inline bool Valid() const { return mTypeInfoHandle.Valid(); }
/** Test if this datatype is the specified datatype.
* \param pDataType Datatype to compare to.
* \return \c true if this datatype is the specified datatype, \c false otherwise.
*/
inline bool Is(const FbxDataType& pDataType) const { return mTypeInfoHandle.Is(pDataType.mTypeInfoHandle); }
/** Retrieve this data type.
* \return This data type.
*/
EFbxType GetType() const;
/** Retrieve data type name.
* \return Data type name.
*/
const char* GetName() const;
/** Retrieve the information handle of this data type.
* \return Information handle of this data type.
*/
inline const FbxPropertyHandle& GetTypeInfoHandle() const { return mTypeInfoHandle; }
private:
FbxPropertyHandle mTypeInfoHandle;
friend class FbxManager;
};
/** Retrieve data type from type enumeration index
* \param pType The type enumeration index
* \return The corresponding data type
*/
FBXSDK_DLL const FbxDataType& FbxGetDataTypeFromEnum(const EFbxType pType);
/** Retrieve data type name string used by I/O operations
* \param pDataType The data type instance to retrieve its I/O name string
* \return The data type name string
* \remark This function is only used during I/O operations. It is not equal
* to the actual data type name.
*/
FBXSDK_DLL const char* FbxGetDataTypeNameForIO(const FbxDataType& pDataType);
//! \name Basic Data Types
//@{
extern FBXSDK_DLL FbxDataType FbxUndefinedDT;
extern FBXSDK_DLL FbxDataType FbxBoolDT;
extern FBXSDK_DLL FbxDataType FbxCharDT;
extern FBXSDK_DLL FbxDataType FbxUCharDT;
extern FBXSDK_DLL FbxDataType FbxShortDT;
extern FBXSDK_DLL FbxDataType FbxUShortDT;
extern FBXSDK_DLL FbxDataType FbxIntDT;
extern FBXSDK_DLL FbxDataType FbxUIntDT;
extern FBXSDK_DLL FbxDataType FbxLongLongDT;
extern FBXSDK_DLL FbxDataType FbxULongLongDT;
extern FBXSDK_DLL FbxDataType FbxFloatDT;
extern FBXSDK_DLL FbxDataType FbxHalfFloatDT;
extern FBXSDK_DLL FbxDataType FbxDoubleDT;
extern FBXSDK_DLL FbxDataType FbxDouble2DT;
extern FBXSDK_DLL FbxDataType FbxDouble3DT;
extern FBXSDK_DLL FbxDataType FbxDouble4DT;
extern FBXSDK_DLL FbxDataType FbxDouble4x4DT;
extern FBXSDK_DLL FbxDataType FbxEnumDT;
extern FBXSDK_DLL FbxDataType FbxStringDT;
extern FBXSDK_DLL FbxDataType FbxTimeDT;
extern FBXSDK_DLL FbxDataType FbxReferenceDT;
extern FBXSDK_DLL FbxDataType FbxBlobDT;
extern FBXSDK_DLL FbxDataType FbxDistanceDT;
extern FBXSDK_DLL FbxDataType FbxDateTimeDT;
//@}
//! \name Extended Data Types
//@{
extern FBXSDK_DLL FbxDataType FbxColor3DT;
extern FBXSDK_DLL FbxDataType FbxColor4DT;
extern FBXSDK_DLL FbxDataType FbxCompoundDT;
extern FBXSDK_DLL FbxDataType FbxReferenceObjectDT;
extern FBXSDK_DLL FbxDataType FbxReferencePropertyDT;
extern FBXSDK_DLL FbxDataType FbxVisibilityDT;
extern FBXSDK_DLL FbxDataType FbxVisibilityInheritanceDT;
extern FBXSDK_DLL FbxDataType FbxUrlDT;
extern FBXSDK_DLL FbxDataType FbxXRefUrlDT;
//@}
//! \name Transform Data Types
//@{
extern FBXSDK_DLL FbxDataType FbxTranslationDT;
extern FBXSDK_DLL FbxDataType FbxRotationDT;
extern FBXSDK_DLL FbxDataType FbxScalingDT;
extern FBXSDK_DLL FbxDataType FbxQuaternionDT;
extern FBXSDK_DLL FbxDataType FbxLocalTranslationDT;
extern FBXSDK_DLL FbxDataType FbxLocalRotationDT;
extern FBXSDK_DLL FbxDataType FbxLocalScalingDT;
extern FBXSDK_DLL FbxDataType FbxLocalQuaternionDT;
extern FBXSDK_DLL FbxDataType FbxTransformMatrixDT;
extern FBXSDK_DLL FbxDataType FbxTranslationMatrixDT;
extern FBXSDK_DLL FbxDataType FbxRotationMatrixDT;
extern FBXSDK_DLL FbxDataType FbxScalingMatrixDT;
//@}
//! \name Material Data Types
//@{
extern FBXSDK_DLL FbxDataType FbxMaterialEmissiveDT;
extern FBXSDK_DLL FbxDataType FbxMaterialEmissiveFactorDT;
extern FBXSDK_DLL FbxDataType FbxMaterialAmbientDT;
extern FBXSDK_DLL FbxDataType FbxMaterialAmbientFactorDT;
extern FBXSDK_DLL FbxDataType FbxMaterialDiffuseDT;
extern FBXSDK_DLL FbxDataType FbxMaterialDiffuseFactorDT;
extern FBXSDK_DLL FbxDataType FbxMaterialBumpDT;
extern FBXSDK_DLL FbxDataType FbxMaterialNormalMapDT;
extern FBXSDK_DLL FbxDataType FbxMaterialTransparentColorDT;
extern FBXSDK_DLL FbxDataType FbxMaterialTransparencyFactorDT;
extern FBXSDK_DLL FbxDataType FbxMaterialSpecularDT;
extern FBXSDK_DLL FbxDataType FbxMaterialSpecularFactorDT;
extern FBXSDK_DLL FbxDataType FbxMaterialShininessDT;
extern FBXSDK_DLL FbxDataType FbxMaterialReflectionDT;
extern FBXSDK_DLL FbxDataType FbxMaterialReflectionFactorDT;
extern FBXSDK_DLL FbxDataType FbxMaterialDisplacementDT;
extern FBXSDK_DLL FbxDataType FbxMaterialVectorDisplacementDT;
extern FBXSDK_DLL FbxDataType FbxMaterialCommonFactorDT;
extern FBXSDK_DLL FbxDataType FbxMaterialCommonTextureDT;
//@}
//! \name Layer Element Data Types
//@{
extern FBXSDK_DLL FbxDataType FbxLayerElementUndefinedDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementNormalDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementBinormalDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementTangentDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementMaterialDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementTextureDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementPolygonGroupDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementUVDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementVertexColorDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementSmoothingDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementCreaseDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementHoleDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementUserDataDT;
extern FBXSDK_DLL FbxDataType FbxLayerElementVisibilityDT;
//@}
//! \name I/O Specialized Data Types
//@{
extern FBXSDK_DLL FbxDataType FbxAliasDT;
extern FBXSDK_DLL FbxDataType FbxPresetsDT;
extern FBXSDK_DLL FbxDataType FbxStatisticsDT;
extern FBXSDK_DLL FbxDataType FbxTextLineDT;
extern FBXSDK_DLL FbxDataType FbxUnitsDT;
extern FBXSDK_DLL FbxDataType FbxWarningDT;
extern FBXSDK_DLL FbxDataType FbxWebDT;
//@}
//! \name External Support Data Types
//@{
extern FBXSDK_DLL FbxDataType FbxActionDT;
extern FBXSDK_DLL FbxDataType FbxCameraIndexDT;
extern FBXSDK_DLL FbxDataType FbxCharPtrDT;
extern FBXSDK_DLL FbxDataType FbxConeAngleDT;
extern FBXSDK_DLL FbxDataType FbxEventDT;
extern FBXSDK_DLL FbxDataType FbxFieldOfViewDT;
extern FBXSDK_DLL FbxDataType FbxFieldOfViewXDT;
extern FBXSDK_DLL FbxDataType FbxFieldOfViewYDT;
extern FBXSDK_DLL FbxDataType FbxFogDT;
extern FBXSDK_DLL FbxDataType FbxHSBDT;
extern FBXSDK_DLL FbxDataType FbxIKReachTranslationDT;
extern FBXSDK_DLL FbxDataType FbxIKReachRotationDT;
extern FBXSDK_DLL FbxDataType FbxIntensityDT;
extern FBXSDK_DLL FbxDataType FbxLookAtDT;
extern FBXSDK_DLL FbxDataType FbxOcclusionDT;
extern FBXSDK_DLL FbxDataType FbxOpticalCenterXDT;
extern FBXSDK_DLL FbxDataType FbxOpticalCenterYDT;
extern FBXSDK_DLL FbxDataType FbxOrientationDT;
extern FBXSDK_DLL FbxDataType FbxRealDT;
extern FBXSDK_DLL FbxDataType FbxRollDT;
extern FBXSDK_DLL FbxDataType FbxScalingUVDT;
extern FBXSDK_DLL FbxDataType FbxShapeDT;
extern FBXSDK_DLL FbxDataType FbxStringListDT;
extern FBXSDK_DLL FbxDataType FbxTextureRotationDT;
extern FBXSDK_DLL FbxDataType FbxTimeCodeDT;
extern FBXSDK_DLL FbxDataType FbxTimeWarpDT;
extern FBXSDK_DLL FbxDataType FbxTranslationUVDT;
extern FBXSDK_DLL FbxDataType FbxWeightDT;
//@}
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_DATA_TYPES_H_ */

View File

@ -0,0 +1,94 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxemitter.h
#ifndef _FBXSDK_CORE_EMITTER_H_
#define _FBXSDK_CORE_EMITTER_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxintrusivelist.h>
#include <fbxsdk/core/fbxeventhandler.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxListener;
/** Base class to emit event with the specified event type.
* The event type could be a specific class which derived from FbxEvent. Please read FbxEmitter::Emit() for more details.
* Event emitter contains a list of event handlers.
* FBX object could be used as emitter, since FbxObject is derived from FbxEmitter.
* Before using emitter to emit an event, one or more event handlers must be added to the handlers list of current emitter.
* In other words, it's "bind event handlers to emitter".
* There are two ways to bind event handlers to emitter.
* \li 1. If you already got an event handler and would like to bind it to current emitter, please call FbxEmitter::AddListener().
* \li 2. Or you can create an event listener first and then call FbxListener::Bind().
* It will create an event handler automatically and bind the handler to the specified emitter.
* It's similar to unbind or remove an even handler. For more details,
* \see FbxEmitter::RemoveListener()
* \see FbxListener::Unbind()
* \remarks An object(emitter) can emit a certain type of event, the plug-in(listener) who are listening to that type of event,
* will receive a signal and take action to process the event data.
* \par The whole process of event is:
* \li 1. Create an emitter and a listener, then bind them together via the same event handler.
* \li 2. Emitter can emit an event at certain conditions. The event could be handled by event handler.
* \li 3. Once an event is emitted, the listener to this event will receive a signal.
* \li 4. And then the listener could process the event data according to the types of event, by calling event handler.
* \note The event data is process by the callback function of event handler.
* \nosubgrouping
* \see FbxListener FbxEventHandler FbxEvent FbxEventBase
*/
class FBXSDK_DLL FbxEmitter
{
public:
/** Add the specified event handler to current emitter list.
* \param pHandler The event handler will be added to the handlers list of current emitter. */
void AddListener(FbxEventHandler& pHandler);
/** Remove the specified event handler from current emitter list.
* \param pHandler The event handler will be removed from the handlers list of current emitter. */
void RemoveListener(FbxEventHandler& pHandler);
/** Emit an event with the specified the event type. One the event is emitted, the listener to this event will receive a signal.
* \param pEvent Specify the event type to emit. Could be a specific class which derived from FbxEvent, such as FbxObjectPropertyChanged.
* \see FbxEventBase FbxObjectPropertyChanged FbxEventReferencedDocument FbxEventPostExport
* \see FbxEventPostImport FbxEventPreExport FbxEventPreImport FbxEventPopulateSystemLibrary */
template <typename EventType> void Emit(const EventType& pEvent) const
{
if( !mData ) return;
EventHandlerList::iterator itBegin = mData->mEventHandlerList.Begin();
EventHandlerList::iterator itEnd = mData->mEventHandlerList.End();
for( EventHandlerList::iterator it = itBegin; it != itEnd; ++it )
{
if ((*it).GetHandlerEventType() == pEvent.GetTypeId())
{
(*it).FunctionCall(pEvent);
}
}
}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxEmitter();
~FbxEmitter();
protected:
typedef FbxIntrusiveList<FbxEventHandler, FbxEventHandler::eEmitter> EventHandlerList;
struct EventData { EventHandlerList mEventHandlerList; };
EventData* mData;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_EMITTER_H_ */

View File

@ -0,0 +1,188 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxevent.h
#ifndef _FBXSDK_CORE_EVENT_H_
#define _FBXSDK_CORE_EVENT_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxpropertytypes.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** FBX SDK event base class.
* An event is something that is emitted by an emitter, with the goal of being filled by the listener that listen to it.
* You can see that like a form that you send to some people. If those people know how to fill the form, they fill it and return
* it to you with the right information in it. FBX object could be used as emitter, since FbxObject is derived from FbxEmitter.
* Meanwhile, plug-in could be used as listener, since FbxPlugin is derived from FbxListener.
* The derived class of FbxEventBase contains a type ID to distinguish different types of events.
* FBX object can emit different types of FBX events at different conditions.
* \par The whole process of event is:
* \li 1. Create an emitter and a listener, then bind them together via the same event handler.
* \li 2. Emitter can emit an event at certain conditions. The event could be handled by event handler.
* \li 3. Once an event is emitted, the listener to this event will receive a signal.
* \li 4. And then the listener could process the event data according to the types of event, by calling event handler.
* \note The event data is process by the callback function of event handler.
* For example, if a certain property of a FBX object is changed, the FBX object(emitter) can emit an event which type is FbxObjectPropertyChanged.
* The plug-in(listener) who are listening to FbxObjectPropertyChanged, will receive a signal and take action to process the event data.
* \nosubgrouping
* \see FbxEvent FbxEventHandler FbxListener FbxEmitter
*/
class FBXSDK_DLL FbxEventBase
{
public:
/**
* \name Constructor and Destructor
*/
//@{
//!Destructor
virtual ~FbxEventBase();
//@}
/** Retrieve the event type ID
* \return type id
*/
virtual int GetTypeId() const = 0;
/** Force events to give us a name
* \return event name
*/
virtual const char* GetEventName() const = 0;
protected:
static int GetStaticTypeId(const char*);
};
// Force events to declare a name by using an abstract method, and force them to use
// the proper name by making the call from FbxEvent<> go through the private static
// method.
#define FBXSDK_EVENT_DECLARE(Class) \
public: virtual const char* GetEventName() const { return FbxEventName(); } \
private: static const char* FbxEventName() { return #Class; } \
friend class FbxEvent<Class>; \
//
// Similar to above, but to be used when you've got an event template, and the
// type is something know to FBX
//
#define FBXSDK_EVENT_TYPE_DECLARE(Class, FBXType) \
public: virtual const char* GetEventName() const { return FbxEventName(); } \
private: \
static const char* FbxEventName() { \
static FbxString lEventName = FbxString(#Class) + FbxString("<") + \
FbxGetDataTypeFromEnum(FbxTypeOf(FBXType())).GetName() + ">"; \
\
return lEventName.Buffer(); \
} \
friend class FbxEvent< Class<FBXType> >;
//This is for templates classes that will uses non fbxtypes in their templates
//We force the the creation of an UNIQUE string for each types so that we can
//retrieve the event within multiple DLLs
//to be able to use this, the char EventName[] = "uniqueEventName"; must be declared
//globally.
#define FBXSDK_EVENT_TEMPLATE_HEADER(ClassName, TemplateName)\
template < class TemplateName, const char* T > \
class ClassName: public FbxEvent< ClassName <TemplateName,T> >\
{\
public: virtual const char* GetEventName() const {return FbxEventName();}\
private: static const char* FbxEventName() {\
static FbxString lEventName = (FbxString(#ClassName) +"<"+ FbxString(T) +">");\
return lEventName.Buffer();\
}\
friend class FbxEvent< ClassName<TemplateName, T> >;
//This is the footer macro, to put at the end to close the template class
//created by FBXSDK_EVENT_TEMPLATE_HEADER
#define FBXSDK_EVENT_TEMPLATE_FOOTER()\
};
/** FBX event class, derived from FbxEventBase, and it contains a type ID for event.
* It's a template class. You can derive your own types of even. Such as:
* \code class FbxEventCustom : public FbxEvent<FbxEventCustom> \endcode
* \see FbxObjectPropertyChanged FbxEventReferencedDocument FbxEventPostExport
* \see FbxEventPostImport FbxEventPreExport FbxEventPreImport FbxEventPopulateSystemLibrary
* \nosubgrouping
* \remarks A FBX event is something that is emitted by an emitter, with the goal of being filled by the listener that listen to it.
* An object(emitter) can emit a certain type of event, the plug-in(listener) who are listening to that type of event,
* will receive a signal and take action to process the event data.
* \par The whole process of event is:
* \li 1. Create an emitter and a listener, then bind them together via the same event handler.
* \li 2. Emitter can emit an event at certain conditions. The event could be handled by event handler.
* \li 3. Once an event is emitted, the listener to this event will receive a signal.
* \li 4. And then the listener could process the event data according to the types of event, by calling event handler.
* \note The event data is process by the callback function of event handler.
* \see FbxEventBase FbxEventHandler FbxListener FbxEmitter
*/
//---------------------------------------------------
// T : We use the curiously recurring template pattern
// to initialize the typeId of each event type
template<typename T> class FbxEvent : public FbxEventBase
{
public:
//!Destructor
virtual ~FbxEvent(){}
/** Update the type ID of current event with the given type ID.
* \param pTypeId the new type ID.
*/
static void ForceTypeId(int pTypeId)
{
// This is to handle specific cases where the type ID must be hard coded
// It is useful for shared event across DLL. We can then guarantee that
// The ID of a certain type will always have the same ID
smTypeId = pTypeId;
}
/** Retrieve the event type ID
* \note This may be called from multiple threads.
* \return type id
*/
virtual int GetTypeId() const
{
return GetStaticTypeId();
}
/** Retrieve the event type ID
* \return type id
*/
static int GetStaticTypeId()
{
if( !smTypeId )
{
if( !smTypeId )
{
// If this does not compile, you need to add
// FBXSDK_EVENT_DECLARE(YourEventClassName) to your class declaration
smTypeId = FbxEventBase::GetStaticTypeId(T::FbxEventName());
}
}
return smTypeId;
}
private:
//! The type ID of event
static int smTypeId;
};
// Static members implementation
template<typename T> int FbxEvent<T>::smTypeId = 0;
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_EVENT_H_ */

View File

@ -0,0 +1,129 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxeventhandler.h
#ifndef _FBXSDK_CORE_EVENT_HANDLER_H_
#define _FBXSDK_CORE_EVENT_HANDLER_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxevent.h>
#include <fbxsdk/core/base/fbxintrusivelist.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxListener;
/** Event handler class contains a listener and a callback function.
* Event handler is used to bind emitter and listener together. Its callback function can process event data.
* To generate a valid event handler, you can create an event emitter and event listener first and then call FbxListener::Bind().
* It will create an event handler automatically and bind the handler to the listener and the created emitter.
* After that, the emitter and listener are bound together via event handler.
* \remarks An object(emitter) can emit a certain type of event, the object(listener) who are listening to that type of event,
* will receive a signal and take action to process the event data.
* \par The whole process of event is:
* \li 1. Create an emitter and a listener, then bind them together via the same event handler.
* \li 2. Emitter can emit an event at certain conditions. The event could be handled by event handler.
* \li 3. Once an event is emitted, the listener to this event will receive a signal.
* \li 4. And then the listener could process the event data according to the types of event, by calling event handler.
* \note The event data is process by the callback function of event handler.
* \nosubgrouping
* \see FbxListener FbxEventBase FbxEvent FbxEmitter
*/
class FbxEventHandler
{
public:
//! Event handler base type.
enum EType
{
eListener, //!< Listener event handler type.
eEmitter, //!< Emitter event handler type.
eCount //!< Count of different event handler types.
};
/** Get event type of current handler.
* \return The type ID of event. */
virtual int GetHandlerEventType()=0;
/** Call function that process event data.
* \param pEvent specify the event type. pEvent could be a specific class which derived from FbxEventBase.
* \see FbxEventBase */
virtual void FunctionCall(const FbxEventBase& pEvent)=0;
/** Get listener of current handler.
* \return A pointer to the listener object. */
virtual FbxListener* GetListener()=0;
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxEventHandler(){}
virtual ~FbxEventHandler(){}
FBXSDK_INTRUSIVE_LIST_NODE(FbxEventHandler, eCount);
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <typename EventType, typename ListenerType> class FbxMemberFuncEventHandler : public FbxEventHandler
{
typedef void (ListenerType::*CallbackFnc)(const EventType*);
public:
FbxMemberFuncEventHandler(ListenerType* pListenerInstance, CallbackFnc pFunction) : mListener(pListenerInstance), mFunction(pFunction){}
virtual int GetHandlerEventType(){ return EventType::GetStaticTypeId(); }
virtual void FunctionCall(const FbxEventBase& pEvent){ (*mListener.*mFunction)(reinterpret_cast<const EventType*>(&pEvent)); }
virtual FbxListener* GetListener(){ return mListener; }
private:
ListenerType* mListener;
CallbackFnc mFunction;
};
template <typename EventType, typename ListenerType> class FbxConstMemberFuncEventHandler : public FbxEventHandler
{
typedef void (ListenerType::*CallbackFnc)(const EventType*) const;
public:
FbxConstMemberFuncEventHandler(ListenerType* pListenerInstance, CallbackFnc pFunction) : mListener(pListenerInstance), mFunction(pFunction){}
virtual int GetHandlerEventType(){ return EventType::GetStaticTypeId(); }
virtual void FunctionCall(const FbxEventBase& pEvent){ (*mListener.*mFunction)(reinterpret_cast<const EventType*>(&pEvent)); }
virtual FbxListener* GetListener(){ return mListener; }
private:
ListenerType* mListener;
CallbackFnc mFunction;
};
template <typename EventType> class FbxFuncEventHandler : public FbxEventHandler
{
typedef void (*CallbackFnc)(const EventType*, FbxListener*);
public:
FbxFuncEventHandler(FbxListener* pListener, CallbackFnc pFunction) : mListener(pListener), mFunction(pFunction){}
virtual int GetHandlerEventType(){ return EventType::GetStaticTypeId(); }
virtual void FunctionCall(const FbxEventBase& pEvent){ (*mFunction)(reinterpret_cast<const EventType*>(&pEvent), mListener); }
virtual FbxListener* GetListener(){ return mListener; }
private:
FbxListener* mListener;
CallbackFnc mFunction;
};
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_EVENT_HANDLER_H_ */

View File

@ -0,0 +1,121 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxlistener.h
#ifndef _FBXSDK_CORE_LISTENER_H_
#define _FBXSDK_CORE_LISTENER_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxemitter.h>
#include <fbxsdk/core/fbxeventhandler.h>
#include <fbxsdk/core/base/fbxintrusivelist.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/**FBX SDK listener class. Once an event is emitted by an emitter, a listener should be created to listen to the event.
* The listener could receive a signal and take action to process the event data.
* \note The data will be process by the callback function of FbxListener::Bind().
* Plug-in could be used as listener, since FbxPlugin is derived from FbxListener.
* To emit event, you could create an emitter and a listener, and then bind them together via event handler.
* To listen to an event which is emitted by an emitter, you should bind current listener to the emitter by calling FbxListener::Bind().
* Event listener contains a list of event handlers.
* \remarks An object(emitter) can emit a certain type of event, the plug-in(listener) who are listening to that type of event,
* will receive a signal and take action to process the event data.
* \par The whole process of event is:
* \li 1. Create an emitter and a listener, then bind them together via the same event handler.
* \li 2. Emitter can emit an event at certain conditions. The event could be handled by event handler.
* \li 3. Once an event is emitted, the listener to this event will receive a signal.
* \li 4. And then the listener could process the event data according to the types of event, by calling event handler.
* \note The event data is process by the callback function of event handler.
* \see FbxEmitter FbxEventHandler FbxEvent FbxEventBase
*/
class FBXSDK_DLL FbxListener
{
public:
/**
* \name Constructor and Destructor
*/
//@{
//!Destructor.
~FbxListener();
//!Constructor.
FbxListener(){}
//@}
////////////////////////////////////////////////////////////////////////////////////////
/**
* \name Bind and unbind methods
*/
//@{
/**Bind current listener and the specified emitter together via an automatically created event handler.
* An event handler will be created automatically and added to the handlers list of current listener and the specified emitter.
* After that, the listener can listen to the event which is emitted by the specified emitter.
* \param pEmitter Event emitter to bind. Current listener can listen to the event which is emitted by pEmitter.
* \param pFunc The callback function to process event date.
* \return The automatically created event handler.
*/
template <typename EventType,typename ListenerType> FbxEventHandler* Bind(FbxEmitter& pEmitter, void (ListenerType::*pFunc)(const EventType*))
{
FbxMemberFuncEventHandler<EventType,ListenerType>* eventHandler =
FbxNew< FbxMemberFuncEventHandler<EventType,ListenerType> >(static_cast<ListenerType*>(this),pFunc);
pEmitter.AddListener(*eventHandler);
mEventHandler.PushBack(*eventHandler);
return eventHandler;
}
/**Bind current listener and the specified emitter together via an automatically created event handler.
* An event handler will be created automatically and added to the handlers list of current listener and the specified emitter.
* After that, the listener can listen to the event which is emitted by the specified emitter.
* \param pEmitter Event emitter to bind. Current listener can listen to the event which is emitted by pEmitter.
* \param pFunc The callback function to process event date.
* \return The automatically created event handler.
*/
template <typename EventType,typename ListenerType> FbxEventHandler* Bind(FbxEmitter& pEmitter, void (ListenerType::*pFunc)(const EventType*)const)
{
FbxConstMemberFuncEventHandler<EventType,ListenerType>* eventHandler =
FbxNew< FbxConstMemberFuncEventHandler<EventType,ListenerType> >(static_cast<ListenerType*>(this),pFunc);
pEmitter.AddListener(*eventHandler);
mEventHandler.PushBack(*eventHandler);
return eventHandler;
}
/**Bind current listener and the specified emitter together via an automatically created event handler.
* An event handler will be created automatically and added to the handlers list of current listener and the specified emitter.
* After that, the listener can listen to the event which is emitted by the specified emitter.
* \param pEmitter Event emitter to bind. Current listener can listen to the event which is emitted by pEmitter.
* \param pFunc The callback function to process event date.
* \return The automatically created event handler.
*/
template <typename EventType> FbxEventHandler* Bind(FbxEmitter& pEmitter, void (*pFunc)(const EventType*,FbxListener*))
{
FbxFuncEventHandler<EventType>* eventHandler =
FbxNew< FbxFuncEventHandler<EventType> >(this, pFunc);
pEmitter.AddListener(*eventHandler);
mEventHandler.PushBack(*eventHandler);
return eventHandler;
}
/**Unbind an event handler. The specified event handler will be removed from the handlers list of current listener.
* \param aBindId The event handler to unbind.
*/
void Unbind(const FbxEventHandler* aBindId);
//@}
private:
typedef FbxIntrusiveList<FbxEventHandler, FbxEventHandler::eListener> EventHandlerList;
EventHandlerList mEventHandler;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_LISTENER_H_ */

View File

@ -0,0 +1,86 @@
/****************************************************************************************
Copyright (C) 2016 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxloadingstrategy.h
#ifndef _FBXSDK_CORE_LOADING_STRATEGY_H_
#define _FBXSDK_CORE_LOADING_STRATEGY_H_
#include <fbxsdk/fbxsdk_def.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/fbxplugin.h>
#include <fbxsdk/core/fbxplugincontainer.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/**
* Abstract class used to implemented some plug-in loading strategy.
* A loading strategy dictate how some plug-ins will be loaded for instance.
* We could have a simple strategy that loads only a single dll on PC.
* We could also implement a strategy that load multiple dlls from a directory.
*/
class FBXSDK_DLL FbxLoadingStrategy : public FbxPluginContainer
{
public:
/** Result state of loading plug-in.
*/
enum EState
{
eAllLoaded, //!< Plug-ins are loaded.
eNoneLoaded, //!< No plug-ins are loaded.
eAllFailed, //!< Plug-ins failed to load.
eSomeFailed //!< Not all found plug-ins are loaded.
};
/**
*\name Public interface
*/
//@{
/** Execute the operation of loading the plug-in(s). The way it is executed is determined by the specific implementations.
* \param pData Plug in data that can be access inside the plug-ins.
* \return The state of the loading action.
*/
EState Load(FbxPluginData& pData);
/** Execute the operation of unloading the plug-in(s). The way it is executed is determined by the specific implementations.
*/
void Unload();
//@}
protected:
/**
*\name User implementation
*/
//@{
/** Called by the Load method, it contains the specific user implementation strategy to load the desired plug-in(s).
* \param pData Plug in data that can be access inside the plug-ins.
* \return If the plugin loading is successful return \c true, otherwise return \c false
*/
virtual bool SpecificLoad(FbxPluginData& pData) = 0;
/** Called by the Unload method, it contains the specific user implementation strategy to unload the desired plug-in(s).
*/
virtual void SpecificUnload(FbxPluginData& pData) = 0;
//@}
//! Whether the plugin is loaded or not.
EState mPluginsLoadedState;
private:
FbxPluginData mData;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#endif /* _FBXSDK_CORE_LOADING_STRATEGY_H_ */

View File

@ -0,0 +1,555 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxmanager.h
#ifndef _FBXSDK_CORE_MANAGER_H_
#define _FBXSDK_CORE_MANAGER_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxobject.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxIOSettings;
class FbxIOPluginRegistry;
class FbxAnimEvaluator;
class FbxSceneReference;
class FbxUserNotification;
class FbxMessageEmitter;
class FbxLocalizationManager;
class FbxXRefManager;
class FbxManager_internal;
#ifndef FBXSDK_ENV_WINSTORE
class FbxPlugin;
#endif
/** SDK object manager.
* The SDK manager is in charge of:
* \li scene element allocation, for example, FbxScene::Create(pSdkManager, "").
* \li scene element deallocation, call FbxManager::Destroy() to deallocates all object created by the SDK manager.
* \li scene element search and access, please see \ref GlobalObjectManagement section.
*
* It is possible to override memory allocation functions throughout the FBX SDK by
* providing system memory allocation functions using the handler set functions below.
* It must be done before the first FbxManager creation.
*
* FbxSetMallocHandler();
* FbxSetCallocHandler();
* FbxSetReallocHandler();
* FbxSetFreeHandler();
*
* Upon destruction, all objects allocated by the SDK manager and not explicitly destroyed are destroyed as well.
* A derived class can be defined to allocate and deallocate specialized scene elements.
* \remarks You could create more than one SDK manager. However, it's better to NOT share the same object among different managers.
* \nosubgrouping
*/
class FBXSDK_DLL FbxManager
{
public:
/**
* \name FBX SDK Manager Creation/Destruction
*/
//@{
/** SDK manager allocation method.
* \return A pointer to the SDK manager or \c NULL if this is an
* evaluation copy of the FBX SDK and it is expired.
*/
static FbxManager* Create();
/** Destructor.
* Deallocates all object previously created by the SDK manager.
*/
virtual void Destroy();
//@}
/**
* \name Versions Queries
*/
//@{
/** Get FBX SDK version string.
* \param pFull If true, the complete version string including revision number and release date will be returned,
* otherwise only the version numbering is returned.
*/
static const char* GetVersion(bool pFull=true);
/** Get the current default FBX file format version number for this version of the FBX SDK.
* \param pMajor Version major number.
* \param pMinor Version minor number.
* \param pRevision Version revision number.
*/
static void GetFileFormatVersion(int& pMajor, int& pMinor, int& pRevision);
//@}
/**
* \name Object Registration, Definition and Management
*/
//@{
/** Class registration.
* \param pName The class name. For example, "FbxMesh" for FbxMesh class.
* \param T1 FBX type of the specified class.
* \param T2 FBX type of parent class.
* \param pFbxFileTypeName The type name of the class in FBX file.
* \param pFbxFileSubTypeName The sub type name of the class in FBX file.
* \return The class Id of the newly register class.
* Such as:
* \code RegisterFbxClass("FbxCamera", FBX_TYPE(FbxCamera), FBX_TYPE(FbxNodeAttribute)); \endcode
*/
template <typename T1, typename T2> inline FbxClassId RegisterFbxClass(const char* pName, const T1* /*T1*/, const T2* /*T2*/, const char* pFbxFileTypeName=0, const char* pFbxFileSubTypeName=0)
{
T1::ClassId = Internal_RegisterFbxClass(pName, T2::ClassId, (FbxObjectCreateProc)T1::Allocate, pFbxFileTypeName, pFbxFileSubTypeName);
return T1::ClassId;
}
/** Runtime class registration.
* \param pName The class name. For example, "FbxUIWidgetBoolean".
* \param T FBX type of parent class.
* \param pFbxFileTypeName The type name of the class in FBX file.
* \param pFbxFileSubTypeName The sub type name of the class in FBX file.
* \return The class Id of the newly register class.
* Such as:
* \code RegisterRuntimeFbxClass( "FbxUIWidgetBoolean", FBX_TYPE(FbxUIWidgetDefinition), NULL, "FbxUIWidgetBoolean"); \endcode
*/
template <typename T> inline FbxClassId RegisterRuntimeFbxClass(const char* pName, const T* /*T*/, const char* pFbxFileTypeName=0,const char* pFbxFileSubTypeName=0)
{
return Internal_RegisterFbxClass(pName, T::ClassId, (FbxObjectCreateProc)T::Allocate, pFbxFileTypeName, pFbxFileSubTypeName);
}
/** Runtime class unregistration.
* \param pName The class name.
*/
inline void UnregisterRuntimeFbxClass(const char* pName)
{
FbxClassId lClassId = FindClass(pName);
if( !(lClassId == FbxClassId()) )
{
Internal_UnregisterFbxClass(lClassId);
}
}
/** Override class.
* \param pFBX_TYPE_Class FBX type of class.
* \param pFBX_TYPE_OverridenClass FBX type of overridden class.
* \return The class Id
*/
template <typename T1,typename T2> inline FbxClassId OverrideFbxClass(const T1* pFBX_TYPE_Class, const T2* pFBX_TYPE_OverridenClass)
{
T1::ClassId = Internal_OverrideFbxClass(T2::ClassId,(FbxObjectCreateProc)T1::Allocate );
return T1::ClassId;
}
/** Create a new object of the specified ClassId.
* \param pClassId The ClassId of the object to be created.
* \param pName The name given to the newly created object.
* \param pContainer An optional parameter to specify which object will "contain" the new object. By contain, we mean
* the new object will become a source to the container, connection-wise.
* \param pCloneFrom A valid object pointer to use as the reference for cloning the object upon construction.
* \return If not null, a new instance of the specified class.
* \remark This function will return NULL if the ClassId used is invalid. New ClassId can be registered using
* the function RegisterFbxClass().
*/
FbxObject* CreateNewObjectFromClassId(FbxClassId pClassId, const char* pName, FbxObject* pContainer=NULL, const FbxObject* pCloneFrom=NULL);
/** Find class by the specified name.
* \param pClassName Class Name to find.
*/
FbxClassId FindClass(const char* pClassName) const;
/** Find file class.
* \param pFbxFileTypeName Specify the type name in FBX file to find.
* \param pFbxFileSubTypeName Specify by The sub type name in FBX file to find.
*/
FbxClassId FindFbxFileClass(const char* pFbxFileTypeName, const char* pFbxFileSubTypeName) const;
/** Class unregistration.
* \param pFBX_TYPE_Class FBX type of unregistered class.
*/
template <typename T> inline void UnregisterFbxClass(const T*)
{
Internal_UnregisterFbxClass(T::ClassId);
T::ClassId = FbxClassId();
}
//@}
/**
* \name Data Type Management
*/
//@{
/** Register a new data type to the manager
* \param pName The type name.
* \param pType The data type.
* \return The newly created FbxDataType
*/
FbxDataType CreateDataType(const char* pName, const EFbxType pType);
/** List the data types
* \return the number of registered datatypes
*/
int GetDataTypeCount() const;
/** Find a data types at pIndex.
* \param pIndex The data type index.
* \return the found datatype. return null if not found
*/
FbxDataType& GetDataType(const int pIndex) const;
/** Find a data type from the type name.
* \param pDataType The type name.
* \return the found datatype. return null if not found
*/
FbxDataType& GetDataTypeFromName(const char* pDataType) const;
//@}
/**
* \name User Notification Object
*/
//@{
/** Access to the unique UserNotification object.
* \return The pointer to the user notification or \c NULL \c if the object
* has not been allocated.
*/
FbxUserNotification* GetUserNotification() const;
/** Set the user notification
* \param pUN
*/
void SetUserNotification(FbxUserNotification* pUN);
//@}
/**
* \name IOSettings Object
*/
//@{
/** Access to a IOSettings object.
* \return The pointer to IOSettings or \c NULL \c if the object
* has not been allocated.
*/
virtual FbxIOSettings* GetIOSettings() const;
/** Set the IOSettings pointer
* \param pIOSettings
*/
virtual void SetIOSettings(FbxIOSettings* pIOSettings);
//@}
/**
* \name Message Emitter (for Message Logging)
*/
//@{
/** Access to the unique FbxMessageEmitter object.
* \return The pointer to the message emitter.
*/
FbxMessageEmitter& GetMessageEmitter();
/** Sets to the unique FbxMessageEmitter object.
* \param pMessageEmitter the emitter to use, passing NULL will reset to the default emitter.
* The object will be deleted when the SDK manager is destroyed, thus ownership is transfered.
*/
bool SetMessageEmitter(FbxMessageEmitter* pMessageEmitter);
//@}
/**
* \name Localization Hierarchy
*/
//@{
/** Add a localization object to the known localization providers.
* \param pLocManager the localization object to register.
*/
void AddLocalization(FbxLocalizationManager* pLocManager);
/** Remove a localization object from the known localization providers.
* \param pLocManager the localization object to remove.
*/
void RemoveLocalization(FbxLocalizationManager* pLocManager);
/** Select the current locale for localization.
* \param pLocale the locale name, for example "fr" or "en-US".
*/
bool SetLocale(const char* pLocale);
/** Localization helper function. Calls each registered localization manager
* until one can localizes the text.
* \param pID the identifier for the text to localize.
* \param pDefault the default text. Uses pID if NULL.
* \return the potentially localized text. May return the parameter passed in.
*/
const char* Localize(const char* pID, const char* pDefault=NULL) const;
//@}
/**
* \name XRef Manager
*/
//@{
/** Retrieve the manager responsible for managing object XRef resolution.
* \return The XRef manager for this SDK manager.
*/
FbxXRefManager& GetXRefManager();
//@}
/**
* \name Library Management
*/
//@{
/** Retrieve the main object Libraries
* \return The Root library
*/
FbxLibrary* GetRootLibrary() const;
FbxLibrary* GetSystemLibraries() const;
FbxLibrary* GetUserLibraries() const;
//@}
/**
* \name Plug-in Registry Object
*/
//@{
/** Access to the unique FbxIOPluginRegistry object.
* \return The pointer to the user FbxIOPluginRegistry
*/
FbxIOPluginRegistry* GetIOPluginRegistry() const;
//@}
/**
* \name Fbx Generic Plugins Management
*/
//@{
#ifndef FBXSDK_ENV_WINSTORE
/** Load plug-ins directory
* \param pFilename The directory path.
* \param pExtensions The plug in extension.
* \return \c True
*/
bool LoadPluginsDirectory(const char* pFilename, const char* pExtensions=NULL);
/** Load plug-in
* \param pFilename The file name
* \return \c True
*/
bool LoadPlugin(const char* pFilename);
/** Unload all plug-ins
*/
bool UnloadPlugins();
/** Emit plugins event.
* \param pEvent The event to be emitted.
*/
bool EmitPluginsEvent(const FbxEventBase& pEvent);
//!Get plugins.
FbxArray<const FbxPlugin*> GetPlugins() const;
/** get plugins count
* \return The number of plugins.
*/
int GetPluginCount() const;
/** Find plug in.
* \param pName The plug in name.
* \param pVersion The plug in version.
* \return The plugin, \c null if not found.
*/
FbxPlugin* FindPlugin(const char* pName, const char* pVersion) const;
#endif /* !FBXSDK_ENV_WINSTORE */
//@}
/**
* \name IO Settings
*/
//@{
// Add IOSettings in hierarchy from different modules
/** Fill IO Settings for registered readers.
* \param pIOS The properties hierarchies to fill.
*/
void FillIOSettingsForReadersRegistered(FbxIOSettings& pIOS);
/** Fill IO Settings for registered writers.
* \param pIOS The properties hierarchies to fill.
*/
void FillIOSettingsForWritersRegistered(FbxIOSettings& pIOS);
/** Fill common IO Settings
* \param pIOS The properties hierarchies to fill.
* \param pImport If \c true, import properties are set, otherwise export properties are set.
*/
void FillCommonIOSettings(FbxIOSettings& pIOS, bool pImport);
//@}
/**
* \name Global Object Management
*/
//@{
/** Register object with the manager.
* \internal
* \param pObject The object to be registered.
* \anchor GlobalObjectManagement
*/
void RegisterObject(FbxObject* pObject);
/** Unregister object with the manager.
* \internal
* \param pObject The object to be unregistered.
*/
void UnregisterObject(FbxObject* pObject);
/** Register a list of objects with the manager.
* \internal
* \param pArray The list of object to be registered.
*/
void RegisterObjects(const FbxArray<FbxObject*>& pArray);
/** Unregister a list of objects with the manager.
* \internal
* \param pArray The list of object to be unregistered.
*/
void UnregisterObjects(const FbxArray<FbxObject*>& pArray);
/** Increment the scene destroying counter.
* \remarks Call this function before the destroying list is changed.
*/
void IncreaseDestroyingSceneFlag();
/** Shrink the object list and decrements the scene destroying counter.
* \remarks Call this function after the destroying is changed.
* Use IncreasDestroyingSceneFlag() and DecreaseDestroyingSceneFlag() in pairs.
*/
void DecreaseDestroyingSceneFlag();
/**
* \name Reference Management
*/
//@{
/** Get number of references.
* \return Number of references.
*/
int GetReferenceCount() const;
/** Get reference at given index.
* \param pIndex Position in the list of references.
* \return Pointer to the reference or \c NULL if index is out of bounds.
*/
FbxSceneReference* GetReference(int pIndex) const;
/** Add a reference.
* \param pReference The reference to be added.
* \return If the reference is correctly added to the scene, return \c true otherwise, if the reference is
* already there, returns \c false.
*/
int AddReference(FbxSceneReference* pReference);
/** Remove the specified reference from reference list.
* \param pReference The reference to be removed.
* \return If the reference was successfully removed, return \c true otherwise, if the
* reference could not be found returns \c false.
*/
bool RemoveReference(FbxSceneReference* pReference);
/** Clear the specified reference from the SDK manager.
* \param pReference The reference to be removed.
* \return If the reference was successfully cleared from the SDK manager, return \c true otherwise, if the
* reference could not be found returns \c false.
*/
bool ClearReference(FbxSceneReference* pReference);
//@}
/** Add a prefix to a name.
* \param pPrefix The prefix to be added to the \c pName. This
* string must contain the "::" characters in order to be considered
* as a prefix.
* \param pName The name to be prefix.
* \return The prefixed string
* \remarks If a prefix already exists, it is removed before
* adding \c pPrefix.
*/
static FbxString PrefixName(const char* pPrefix, const char* pName);
/** Get the count of document available in this manager
* \return The count of document owned by this manager.
*/
int GetDocumentCount();
/** Get the document at pIndex in the manager's list.
* \param pIndex The index of the document to retrieve.
* \return The document at the specified index. Will return NULL if index is invalid.
*/
FbxDocument* GetDocument(int pIndex);
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static FbxManager* GetDefaultManager();
void CreateMissingBindPoses(FbxScene* pScene);
int GetBindPoseCount(FbxScene *pScene) const;
int GetFbxClassCount() const;
FbxClassId GetNextFbxClass(FbxClassId pClassId /* invalid id: first one */) const;
protected:
FbxManager();
virtual ~FbxManager();
void Clear();
void ClassInit();
void ClassRelease();
void DataTypeInit();
void DataTypeRelease();
private:
bool CanAutoDestroySrcObject(FbxObject* pObject, FbxObject* pSrcObject, bool pRecursive) const;
void Create_Common_Import_IOSettings_Groups(FbxIOSettings& pIOS);
void Create_Common_Export_IOSettings_Groups(FbxIOSettings& pIOS);
void Add_Common_Import_IOSettings(FbxIOSettings& pIOS);
void Add_Common_Export_IOSettings(FbxIOSettings& pIOS);
void Add_Common_RW_Import_IOSettings(FbxIOSettings& pIOS);
void Add_Common_RW_Export_IOSettings(FbxIOSettings& pIOS);
FbxClassId Internal_RegisterFbxClass(const char* pClassName, FbxClassId pParentClassId, FbxObjectCreateProc=0, const char* pFbxFileTypeName=0, const char* pFbxFileSubTypeName=0);
bool Internal_RegisterFbxClass(FbxClassId pClassId);
FbxClassId Internal_OverrideFbxClass(FbxClassId pClassId, FbxObjectCreateProc=0);
void Internal_UnregisterFbxClass(FbxClassId pClassId);
void RemoveObjectsOfType(const FbxClassId& pClassId);
FbxAnimEvaluator* GetDefaultAnimationEvaluator();
FbxArray<FbxObject*> mObjects;
FbxArray<FbxDocument*> mDocuments;
FbxIOSettings* mIOSettings;
FbxIOPluginRegistry* mRegistry;
FbxUserNotification* mUserNotification;
FbxMessageEmitter* mMessageEmitter;
FbxArray<FbxLocalizationManager*> mLocalizationManagerArray;
FbxArray<FbxSceneReference*> mSceneReferenceArray;
FbxAnimEvaluator* mDefaultAnimationEvaluator;
FbxArray<FbxObject*> mDestroyingObjects;
FbxArray<FbxDocument*> mDestroyingDocuments;
int mIsDestroyingScene;
FbxManager_internal* mInternal;
static FbxManager* smDefaultManager;
FBXSDK_FRIEND_NEW();
friend class FbxObject;
friend class FbxProperty; //For GetDefaultAnimationEvaluator()
friend class FbxNode; //For GetDefaultAnimationEvaluator()
friend class FbxScene; //For GetDefaultAnimationEvaluator()
friend class FbxAnimEvaluator; //For GetDefaultAnimationEvaluator()
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_MANAGER_H_ */

View File

@ -0,0 +1,49 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxmodule.h
#ifndef _FBXSDK_CORE_MODULE_H_
#define _FBXSDK_CORE_MODULE_H_
#include <fbxsdk/fbxsdk_def.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/fbxsdk_nsbegin.h>
typedef void* FbxModule;
/** Loads the specified module into the address space of the calling process.
* \param pFilePath The full file path name of the module to load.
* \return The module handle if it successfully loaded, otherwise NULL.
* \remark The specified module may cause other modules to be loaded.
*/
FBXSDK_DLL FbxModule FbxModuleLoad(const char* pFilePath);
/** Retrieves the address of an exported function or variable from the specified module.
* \param pModuleHandle A valid module handle.
* \param pProcName The procedure name to search.
* \return The procedure handle if valid, otherwise NULL.
*/
FBXSDK_DLL void* FbxModuleGetProc(FbxModule pModuleHandle, const char* pProcName);
/** Frees the loaded module and, if necessary, decrements its reference count.
* \param pModuleHandle A valid module handle.
* \return \c true on success, \c false otherwise.
* \remark When the reference count reaches zero, the module is unloaded from the address space of the calling process and the handle is no longer valid.
*/
FBXSDK_DLL bool FbxModuleFree(FbxModule pModuleHandle);
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#endif /* _FBXSDK_CORE_MODULE_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxperipheral.h
#ifndef _FBXSDK_CORE_PERIPHERAL_H_
#define _FBXSDK_CORE_PERIPHERAL_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxObject;
/** FbxPeripheral is an interface to load/unload content of FbxObject from memory to
somewhere you defined, for example, to a temporary file on disk .
* \nosubgrouping
* You need to inherited your own peripheral class from this class and overload
* the functions to control what information of a FbxObject you want to load/unload,
* and where you are going to load/unload these information to.
* For example, you can ask an object to dump itself on disk to free some memory and vice-versa
* when you want to load/unload this object from your scene flexibly.
*/
class FBXSDK_DLL FbxPeripheral
{
public:
/**
* \name Constructor and Destructor
*/
//@{
//!Constructor.
FbxPeripheral();
//!Destructor.
virtual ~FbxPeripheral();
//@}
/** Reset the peripheral to its initial state.
*/
virtual void Reset() = 0;
/** Unload the content of pObject.
* \param pObject Object whose content is to be offloaded into
* the peripheral storage area.
* \return \c true if the object content has been successfully transferred.
* \c false otherwise.
*/
virtual bool UnloadContentOf(FbxObject* pObject) = 0;
/** Load the content of pObject.
* \param pObject Object whose content is to be loaded from
* the peripheral storage area.
* \return \c true if the object content has been successfully transferred.
* \c false otherwise.
*/
virtual bool LoadContentOf(FbxObject* pObject) = 0;
/** Check if this peripheral can unload the given object content.
* \param pObject Object whose content has to be transferred.
* \return \c true if the peripheral can handle this object content and
* has enough space in its storage area.\c false otherwise.
*/
virtual bool CanUnloadContentOf(FbxObject* pObject) = 0;
/** Check if this peripheral can load the given object content.
* \param pObject Object whose content has to be transferred.
* \return \c true if the peripheral can handle this object content.
* \c false otherwise.
*/
virtual bool CanLoadContentOf(FbxObject* pObject) = 0;
/** Initialize the connections of an object
* \param pObject Object on which the request for connection is done.
*/
virtual void InitializeConnectionsOf(FbxObject* pObject) = 0;
/** Uninitialize the connections of an object
* \param pObject Object on which the request for disconnection is done.
*/
virtual void UninitializeConnectionsOf(FbxObject* pObject) = 0;
};
// predefined offload peripherals
extern FBXSDK_DLL FbxPeripheral* NULL_PERIPHERAL;
extern FBXSDK_DLL FbxPeripheral* TMPFILE_PERIPHERAL;
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_PERIPHERAL_H_ */

View File

@ -0,0 +1,264 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxplugin.h
#ifndef _FBXSDK_CORE_PLUGIN_H_
#define _FBXSDK_CORE_PLUGIN_H_
#include <fbxsdk/fbxsdk_def.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/fbxobject.h>
#include <fbxsdk/core/fbxmodule.h>
#include <fbxsdk/core/fbxlistener.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxManager;
class FbxPluginContainer;
//! Plug-in declaration macro that must to be used when defining new FbxPlugin objects.
#define FBXSDK_PLUGIN_DECLARE(Plugin)\
FBXSDK_FRIEND_NEW();\
public:\
static Plugin * Create(const FbxPluginDef& pDefinition, FbxModule pModuleHandle);\
void Destroy();
//! Plug-in implementation macro that must be used when implementing new FbxPlugin objects.
#define FBXSDK_PLUGIN_IMPLEMENT(Plugin)\
Plugin* Plugin::Create(const FbxPluginDef& pDefinition, FbxModule pModuleHandle){ return FbxNew<Plugin>(pDefinition, pModuleHandle); }\
void Plugin::Destroy(){ FbxDelete(this); }
/** Structure used by plug-ins for identification purposes.
* \note To avoid confusions in the system, it is recommended to choose an appropriate unique identifier string name when
* defining your plug-in, as well as incrementing the version string to a correct value whenever something changes in the
* implementation of the plug-in. Both of these string are used when comparing plug-ins for searches, as well as
* identification in FBX files.
*/
struct FBXSDK_DLL FbxPluginDef
{
//! Constructor
FbxPluginDef() :
mName("Unknown Name"),
mVersion("Unknown Version")
{
}
FbxString mName; //!< The identifier name string of the plug-in. If the name is already used by another plug-in, the plug-in will still register.
FbxString mVersion; //!< The version string of the plug-in.
};
/** Data used to communicate information between an application and the plug-in.
*/
struct FBXSDK_DLL FbxPluginData
{
//! Constructor
FbxPluginData() :
mQueryEmitter(NULL),
mSDKManager(NULL),
mPluginContainer(NULL)
{
}
//! Copy Constructor
explicit FbxPluginData(const FbxPluginData& pOther) :
mQueryEmitter(pOther.mQueryEmitter),
mSDKManager(pOther.mSDKManager),
mPluginContainer(pOther.mPluginContainer)
{
}
FbxEmitter* mQueryEmitter; //!< The emitter on which the plug-in can listen to receive events.
FbxManager* mSDKManager; //!< The FBX SDK Manager on which the plug-in was instanced.
FbxPluginContainer* mPluginContainer; //!< The container which will have the ownership of the plug-in.
};
/** The base class to inherit from when creating new plug-ins for the FBX SDK. Plug-ins for the FBX SDK are extremely flexible
* allowing a wide-range of possibilities. For example, one can write his own plug-in to add new readers/writers to the current list
* of supported I/O formats, or add new dynamic classes to instantiate custom objects that can later be stored in FBX files. We also use the same
* interface for plug-ins written using the FBX Extension SDK, which allow additional callbacks for other various Autodesk products
* enabling greater interoperability with multiple various SDKs.
*
* Here is typical implementation of an FBX SDK plug-in that doesn't do anything else than just registering itself:
* \code
* class MyPlugin : public FbxPlugin
* {
* FBXSDK_PLUGIN_DECLARE(MyPlugin); //This macro is mandatory for any plug-in definition
*
* protected:
* explicit MyPlugin(const FbxPluginDef& pDefinition, FbxModule pModuleHandle) : FbxPlugin(pDefinition, pModuleHandle)
* {
* }
*
* //Abstract functions that *must* be implemented
* virtual bool SpecificInitialize()
* {
* //For example, here we could register as many new I/O readers/writers as we would like, or classes, etc.
* return true;
* }
*
* virtual bool SpecificTerminate()
* {
* //Here we would have to unregister whatever we registered to the FBX SDK
* return true;
* }
* };
*
* FBXSDK_PLUGIN_IMPLEMENT(MyPlugin); //This macro is mandatory for any plug-in implementation
*
* //Standard C export needed for any new FBX SDK plug-in
* extern "C"
* {
* static MyPlugin* sMyPluginInstance = NULL; //The module is owner of the plug-in
*
* //This function will be called when an application will request the plug-in
* #ifdef FBXSDK_ENV_WIN
* __declspec(dllexport) void FBXPluginRegistration(FbxPluginContainer& pContainer, FbxModule pModuleHandle)
* #else
* void FBXPluginRegistration(FbxPluginContainer& pContainer, FbxModule pModuleHandle)
* #endif
* {
* if( sPlugin == NULL )
* {
* //Create the plug-in definition which contains the information about the plug-in
* FbxPluginDef sPluginDef;
* sPluginDef.mName = "My Plugin";
* sPluginDef.mVersion = "1.0";
*
* //Create an instance of the plug-in
* sMyPluginInstance = MyPlugin::Create(sPluginDef, pLibHandle);
*
* //Register the plug-in with the FBX SDK
* pContainer.Register(*sPlugin);
* }
* }
* }
* \endcode
* \see FbxPluginDef, FbxPluginData
*/
class FBXSDK_DLL FbxPlugin : public FbxListener
{
FBXSDK_INTRUSIVE_LIST_NODE(FbxPlugin, 1);
public:
/** Abstract function called once at the end of the plug-in construction. At that moment, plug-in data have been properly initialized.
* This function must be implemented by anyone who writes a new plug-in for the FBX SDK.
*/
virtual bool SpecificInitialize()=0;
/** Abstract function called once at the beginning of the plug-in destruction. At that moment, plug-in data is fully available.
* This function must be implemented by anyone who writes a new plug-in for the FBX SDK.
*/
virtual bool SpecificTerminate()=0;
/** Virtual function called once when the FBX SDK is about to write an FBX file. Users can re-implement it in their plug-in if they need
* to perform tasks at that moment. The scene provided in parameter can be altered. If not re-implemented, this function does nothing.
* \param pScene The scene that is about to be written in the FBX file.
*/
virtual void WriteBegin(FbxScene& pScene);
/** Virtual function called once when the FBX SDK is about to write plug-in's parameters. Users can re-implement it in their plug-in if they need
* to store properties in the FBX file for their own usage. The object in parameter is used to store those properties.
* If not re-implemented, this function does nothing.
* \param pParams An abstract object that can be used as a property container, to allow the plug-in to store properties about the plug-in.
*/
virtual void WriteParameters(FbxObject& pParams);
/** Virtual function called once after the FBX SDK wrote an FBX file. Users can re-implement it in their plug-in if they need
* to perform tasks at that moment. The scene provided in parameter can be altered, but the changes will not appear in the FBX file.
* If not re-implemented, this function does nothing.
* \param pScene The scene that was written in the FBX file.
*/
virtual void WriteEnd(FbxScene& pScene);
/** Virtual function called once when the FBX SDK is about to read an FBX file. Users can re-implement it in their plug-in if they need
* to perform tasks at that moment. The scene provided in parameter can be altered. If not re-implemented, this function does nothing.
* \param pScene The scene that is about to be read in the FBX file.
*/
virtual void ReadBegin(FbxScene& pScene);
/** Virtual function called once after the FBX SDK reads the plug-in's parameters. Users can re-implement it in their plug-in if they need
* to retrieve properties for their own usage. The object in parameter is used to retrieve those properties.
* If not re-implemented, this function does nothing.
* \param pParams An abstract object that can be used as a property container, to allow the plug-in to read properties about the plug-in.
*/
virtual void ReadParameters(FbxObject& pParams);
/** Virtual function called once after the FBX SDK read an FBX file. Users can re-implement it in their plug-in if they need
* to perform tasks at that moment. The scene provided in parameter can be altered. If not re-implemented, this function does nothing.
* \param pScene The scene that was read in the FBX file.
*/
virtual void ReadEnd(FbxScene& pScene);
/** Accessor to the plug-in definition structure that contains basic information on the plug-in like its name or version. This is
* the only method available to differentiate plug-ins.
* \return The definition structure for this plug-in.
*/
const FbxPluginDef& GetDefinition() const;
/** Retrieve the module address pointer for this plug-in. With this module instance handle, for example someone can query procedures addresses,
* allowing more complex interactions, as well as other operating system module specific functions.
*/
FbxModule GetModuleHdl();
protected:
/** Use the Create() and Destroy() methods declared and implemented in the FBXSDK_PLUGIN_DECLARE and FBXSDK_PLUGIN_IMPLEMENT macros to construct and destroy FbxPlugin objects.
* \param pDefinition The definition associated with this plug-in. Each plug-in must have its own definition to differentiate it with other plug-ins.
* \param pModuleHandle A pointer to the plug-in module address.
*/
explicit FbxPlugin(const FbxPluginDef& pDefinition, FbxModule pModuleHandle);
/** Accessor to the plug-in private data.
* \return The data for the current plug-in.
*/
FbxPluginData& GetData();
/** Const accessor to the plug-in private data.
* \return The const data for the current plug-in.
*/
const FbxPluginData& GetData() const;
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
inline FbxObject& GetPluginSettings() { return *mPluginSettings; }
inline const FbxObject& GetPluginSettings() const { return *mPluginSettings; }
template <typename EventType, typename ListernerType> inline FbxEventHandler* Bind(void (ListernerType::*pFunc)(const EventType*))
{
return FbxListener::Bind<EventType,ListernerType>(*(GetData().mQueryEmitter), pFunc );
}
virtual void Destroy() = 0;
protected:
virtual ~FbxPlugin();
private:
bool Initialize(const FbxPluginData& pData);
bool Terminate();
bool mInitialized;
FbxPluginData mData;
FbxPluginDef mDefinition;
FbxModule mModuleHandle;
FbxObject* mPluginSettings;
friend class FbxLoadingStrategy;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#endif /* _FBXSDK_CORE_PLUGIN_H_ */

View File

@ -0,0 +1,74 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxplugincontainer.h
#ifndef _FBXSDK_CORE_PLUGIN_CONTAINER_H_
#define _FBXSDK_CORE_PLUGIN_CONTAINER_H_
#include <fbxsdk/fbxsdk_def.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/fbxplugin.h>
#include <fbxsdk/core/fbxemitter.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Manages registration and ownership of FBX SDK plug-ins (FbxPlugin).
* The FBX SDK will provide a pointer to FbxPluginContainer as an argument
* to the FBXPluginRegistration() function exported from a plug-in's DLL.
* A plug-in must register itself explicitly with the FbxPluginContainer
* by calling FbxPluginContainer::Register() after it is constructed.
* For an example of this process see the code example in the FbxPlugin
* class documentation.
* \see FbxPlugin
*/
class FBXSDK_DLL FbxPluginContainer : public FbxEmitter
{
public:
//! Definition of a plug-in list.
typedef FbxIntrusiveList<FbxPlugin> PluginList;
/** The registration function that must be called when the module containing the plug-in is loaded.
* \param pPlugin The plug-in to register.
*/
void Register(FbxPlugin& pPlugin);
/** The unregistration function that must be called when the module containing the plug-in is unloaded.
* \param pPlugin The plug-in to unregister.
*/
void Unregister(FbxPlugin& pPlugin);
/** Const accessor to the list of plug-ins owned by the container.
* \return A list of plug-in registered to this container.
*/
const PluginList& GetPlugins() const;
/** Accessor to the list of plug-ins owned by the container.
* \return A list of plug-in registered to this container.
*/
PluginList& GetPlugins();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
virtual ~FbxPluginContainer();
PluginList mPlugins;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#endif /* _FBXSDK_CORE_PLUGIN_CONTAINER_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,146 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxpropertydef.h
#ifndef _FBXSDK_CORE_PROPERTY_DEFINITION_H_
#define _FBXSDK_CORE_PROPERTY_DEFINITION_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxpropertytypes.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
#define FBXSDK_PROPERTY_ID_NULL -1
#define FBXSDK_PROPERTY_ID_ROOT 0
class FbxPropertyPage;
class FBXSDK_DLL FbxPropertyFlags
{
public:
//! Property inherit types
enum EInheritType
{
eOverride, //!< Property override this flag from its reference property.
eInherit, //!< Property inherit this flag from its reference property.
eDeleted //!< Property has been deleted, so inheritance is invalid.
};
//! Property flags that affect their behaviors
enum EFlags
{
eNone = 0, //!< No flag.
eStatic = 1 << 0, //!< Property is defined in the class declaration, so it wasn't created dynamically.
eAnimatable = 1 << 1, //!< Property can be animated, thus is can have am animation curve node connected.
eAnimated = 1 << 2, //!< Property is animated, so it also has an animation curve node connected.
eImported = 1 << 3, //!< Property has been created during import process when reading FBX file.
eUserDefined = 1 << 4, //!< Property has been defined by user, not by the FBX SDK.
eHidden = 1 << 5, //!< Property should not be displayed on user interface.
eNotSavable = 1 << 6, //!< Property value must not be exported when writing FBX files.
eLockedMember0 = 1 << 7, //!< This property has its member #0 locked.
eLockedMember1 = 1 << 8, //!< This property has its member #1 locked.
eLockedMember2 = 1 << 9, //!< This property has its member #2 locked.
eLockedMember3 = 1 << 10, //!< This property has its member #3 locked.
eLockedAll = eLockedMember0 | eLockedMember1 | eLockedMember2 | eLockedMember3,
eMutedMember0 = 1 << 11, //!< This property has its member #0 muted.
eMutedMember1 = 1 << 12, //!< This property has its member #1 muted.
eMutedMember2 = 1 << 13, //!< This property has its member #2 muted.
eMutedMember3 = 1 << 14, //!< This property has its member #3 muted.
eMutedAll = eMutedMember0 | eMutedMember1 | eMutedMember2 | eMutedMember3,
//Private flags
eUIDisabled = 1 << 15, //!< Private flag for dynamic UI in FBX plug-ins.
eUIGroup = 1 << 16, //!< Private flag for dynamic UI in FBX plug-ins.
eUIBoolGroup = 1 << 17, //!< Private flag for dynamic UI in FBX plug-ins.
eUIExpanded = 1 << 18, //!< Private flag for dynamic UI in FBX plug-ins.
eUINoCaption = 1 << 19, //!< Private flag for dynamic UI in FBX plug-ins.
eUIPanel = 1 << 20, //!< Private flag for dynamic UI in FBX plug-ins.
eUILeftLabel = 1 << 21, //!< Private flag for dynamic UI in FBX plug-ins.
eUIHidden = 1 << 22, //!< Private flag for dynamic UI in FBX plug-ins.
eCtrlFlags = eStatic | eAnimatable | eAnimated | eImported | eUserDefined | eHidden | eNotSavable | eLockedAll | eMutedAll,
eUIFlags = eUIDisabled | eUIGroup | eUIBoolGroup | eUIExpanded | eUINoCaption | eUIPanel | eUILeftLabel | eUIHidden,
eAllFlags = eCtrlFlags | eUIFlags,
eFlagCount = 23,
};
bool SetFlags(FbxPropertyFlags::EFlags pMask, FbxPropertyFlags::EFlags pFlags);
FbxPropertyFlags::EFlags GetFlags() const;
FbxPropertyFlags::EFlags GetMergedFlags(FbxPropertyFlags::EFlags pFlags) const;
bool ModifyFlags(FbxPropertyFlags::EFlags pFlags, bool pValue);
FbxPropertyFlags::EInheritType GetFlagsInheritType(FbxPropertyFlags::EFlags pFlags) const;
bool SetMask(FbxPropertyFlags::EFlags pFlags);
bool UnsetMask(FbxPropertyFlags::EFlags pFlags);
FbxPropertyFlags::EFlags GetMask() const;
bool Equal(const FbxPropertyFlags& pOther, FbxPropertyFlags::EFlags pFlags) const;
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxPropertyFlags();
explicit FbxPropertyFlags(FbxPropertyFlags::EFlags pFlags);
FbxPropertyFlags Clone(FbxPropertyPage* pPage);
static const int sLockedMembersMax = 4; //Maximum number of property sub-member that can be locked.
static const int sLockedMembersBitOffset = 7; //Number of bits to shift to get to the first locked member flag.
static const int sMutedMembersMax = 4; //Maximum number of property sub-member that can be muted.
static const int sMutedMembersBitOffset = 11; //Number of bits to shift to get to the first muted member flag.
private:
FbxUInt32 mFlagData, mMaskData;
FBX_ASSERT_STATIC(sizeof(FbxUInt32) * 8 >= FbxPropertyFlags::eFlagCount);
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
class FBXSDK_DLL FbxPropertyValue
{
public:
static FbxPropertyValue* Create(void* pData, EFbxType pType);
void Destroy();
FbxPropertyValue* Clone(FbxPropertyPage*);
bool Get(void* pValue, EFbxType pValueType);
bool Set(const void* pValue, EFbxType pValueType);
size_t GetSizeOf() const;
size_t GetComponentCount() const;
void IncRef();
void DecRef();
int GetRef();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxPropertyValue();
private:
FbxPropertyValue(void* pValue, EFbxType pType);
~FbxPropertyValue();
int mRef;
EFbxType mType;
void* mValue;
FBXSDK_FRIEND_NEW();
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_PROPERTY_DEFINITION_H_ */

View File

@ -0,0 +1,576 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxpropertyhandle.h
#ifndef _FBXSDK_CORE_PROPERTY_HANDLE_H_
#define _FBXSDK_CORE_PROPERTY_HANDLE_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxconnectionpoint.h>
#include <fbxsdk/core/fbxpropertytypes.h>
#include <fbxsdk/core/fbxpropertydef.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxPropertyPage;
class FbxPropertyHandle;
class FbxConnectionPointFilter;
//! \brief Class to manage property handle.
class FBXSDK_DLL FbxPropertyHandle
{
public:
/**
* \name Constructor and Destructor
*/
//@{
//! Create an instance
static FbxPropertyHandle Create();
/** Create an instance with given instance.
* \param pInstanceOf The given instance. */
static FbxPropertyHandle Create(const FbxPropertyHandle& pInstanceOf);
/** Create an instance with given name and type.
* \param pName Property name.
* \param pType Property type. */
static FbxPropertyHandle Create(const char* pName, EFbxType pType=eFbxUndefined);
/** Create an instance with given name and type info.
* \param pName
* \param pTypeInfo */
static FbxPropertyHandle Create(const char* pName, FbxPropertyHandle pTypeInfo);
/** If this property is root property, delete the property page, otherwise delete the property.
* \return If succeed, return true. */
bool Destroy();
//! Default constructor.
FbxPropertyHandle();
/** Copy constructor.
* \param pAddress FbxPropertyHandle copied to this one. */
FbxPropertyHandle(const FbxPropertyHandle& pAddress);
//! Destructor
~FbxPropertyHandle();
/** Character constructor.
* \param pPage
* \param pId */
FbxPropertyHandle(FbxPropertyPage* pPage, FbxInt pId=FBXSDK_PROPERTY_ID_ROOT);
//@}
/**
* \name Assignment and basic info
*/
//@{
/** FbxPropertyHandle assignment operator.
* \param pHandle FbxPropertyHandle assigned to this one. */
FbxPropertyHandle& operator=(const FbxPropertyHandle& pHandle);
/** Equality operator.
* \param pHandle FbxPropertyHandle compared with this one.
* \return \c True if equal, \c false otherwise. */
bool operator==(const FbxPropertyHandle& pHandle) const;
/** Inequality operator.
* \param pHandle FbxPropertyHandle compared with this one.
* \return \c True if unequal, \c false otherwise. */
bool operator!=(const FbxPropertyHandle& pHandle) const;
/** Lesser operator, used to sort property handle in map.
* \param pHandle The property handle compared to this property handle.
* \return \c true if less, \c false otherwise. */
bool operator< (const FbxPropertyHandle& pHandle) const;
/** Greater operator, used to sort property handle in map.
* \param pProperty The property handle compared to this property handle.
* \return \c true if greater, \c false otherwise. */
bool operator> (const FbxPropertyHandle& pHandle) const;
/** Compare type info together
* \param pHandle FbxPropertyHandle compared with this one.
* \return \c True if equal, \c false otherwise. */
bool Is(const FbxPropertyHandle& pHandle) const;
//! Judge validity
bool Valid() const;
//! Get the property name
const char* GetName() const;
//! Get the property label
const char* GetLabel() const;
/** Set a label to the property
* \param pLabel The given label string
* \return \c true if successful. */
bool SetLabel(const char* pLabel);
//! Get the property type
EFbxType GetType() const;
//! Get the property type info
FbxPropertyHandle GetTypeInfo() const;
//! Get the property attribute state
FbxPropertyFlags::EFlags GetFlags() const;
/** Gets the inheritance type for the given flag.
* \param pFlags The flag to query
* \param pCheckReferences Decide whether check instance. If it is true, check instance.
* \return The inheritance type */
FbxPropertyFlags::EInheritType GetFlagsInheritType(FbxPropertyFlags::EFlags pFlags, bool pCheckReferences) const;
/** According the given parameter Change the attributes of the property.
* \param pFlags The given flags used as mask.
* \param pValue If pValue is true, set mask with given flags, otherwise unset mask with given flags.
* \return If succeed, return true. */
bool ModifyFlags(FbxPropertyFlags::EFlags pFlags, bool pValue);
/**Sets the inheritance type for the given flag
* \param pFlags The flag to set
* \param pType The inheritance type to set
* \return If succeed, return true. */
bool SetFlagsInheritType(FbxPropertyFlags::EFlags pFlags, FbxPropertyFlags::EInheritType pType);
//! Get the property user data.
void* GetUserData() const;
/** Set user data to the property
* \param pUserData The given user data
* \return If succeed, return true. */
bool SetUserData(const void* pUserData);
//! Get the property user tag
int GetUserTag() const;
/** Set user tag to the property
* \param pUserData The given user tag
* \return If succeed, return true. */
bool SetUserTag(int pUserData);
//@}
/**
* \name Enum management
*/
//@{
/** Add new value at the end of the enum list in the property.
* \param pStringValue The given new value
* \return The index of the value. */
int AddEnumValue(const char* pStringValue);
/** Insert new value at the given index of the enum list in property.
* \param pIndex The given index
* \param pStringValue The given new value */
void InsertEnumValue(int pIndex, const char* pStringValue);
/** Get the enum count of enum list in property
* \return The enum count of enum list in property */
int GetEnumCount();
/** Set value at the given index of the enum list in the property.
* \param pIndex The given index
* \param pStringValue The given new value used to instead the old value. */
void SetEnumValue(int pIndex, const char* pStringValue);
/** Remove the value at the index of the enum list in the property.
* \param pIndex The given index */
void RemoveEnumValue(int pIndex);
/** Get the value at the index of enum list in the property.
* \param pIndex The given index
* \return The value at the given index */
char* GetEnumValue(int pIndex);
//@}
/**
* \name Child and Struct management
*/
//@{
//! Create the map for find property in the property page
void BeginCreateOrFindProperty();
//! Clear the map which created for find property.
void EndCreateOrFindProperty();
/** Judge if the property is the root property.
* \return Return true if this property is root property. */
inline bool IsRoot() const { return ( mPage && mId == 0 ) ? true : false; }
/** Judge if the property is the child property of the given parent property.
* \param pParent The given parent property handle
* \return Return true if this property is child of given property. */
bool IsChildOf(const FbxPropertyHandle& pParent) const;
/** Judge if the property is descendent property of the given property.
* \param pParent The given parent property handle
* \return Return true if this property is descendant of given property. */
bool IsDescendentOf(const FbxPropertyHandle& pParent) const;
/** Set parent property handle.No matter what enters,the result is always false.
* \param pOther
* \return False */
bool SetParent(const FbxPropertyHandle& pOther );
/** Add a property to the property page.
* \param pName The name of property.
* \param pTypeInfo The added property's type info.
* \return The handle of the new added property */
FbxPropertyHandle Add(const char* pName, const FbxPropertyHandle& pTypeInfo);
/** Get parent property
* \return If the parent property exists, return the property handle,otherwise return -1. */
FbxPropertyHandle GetParent() const;
/** Get child property
* \return If the child property is exist, return the property handle,otherwise return -1. */
FbxPropertyHandle GetChild() const;
/** Get sibling property
* \return If the sibling property is exist, return the property handle,otherwise return -1. */
FbxPropertyHandle GetSibling() const;
/** Get first descendent property
* \return If the descendent property is exist, return the first descendent property handle,otherwise return -1. */
FbxPropertyHandle GetFirstDescendent() const;
/** Get first descendent property which after the given property
* \param pHandle The given property handle
* \return If the descendent property can be found after the given property,
* return the first found property handle,otherwise return -1. */
FbxPropertyHandle GetNextDescendent(const FbxPropertyHandle& pHandle) const;
/** Find the property with given name
* \param pName The given property name
* \param pCaseSensitive Decide if the given property name is case sensitive
* \return Return a property handle which be created with the found property. */
FbxPropertyHandle Find(const char* pName, bool pCaseSensitive) const;
/** Find the property with given name and type info.
* \param pName The given property name
* \param pTypeInfo The given property type info
* \param pCaseSensitive Decide if the given property name is case sensitive
* \return Return a property handle which be created with the found property. */
FbxPropertyHandle Find(const char* pName, const FbxPropertyHandle& pTypeInfo, bool pCaseSensitive) const;
/** Separate the given name by children separator string and then find the property.The step is
* strip the first part of the name and search, if the property can be found, strip the second part
* of the name and continue search, until no property be found,then return the last found property.
* \param pName The given property name
* \param pChildrenSeparator The given children separator string
* \param pCaseSensitive Decide if the given property name is case sensitive
* \return Return a property handle which be created with the found property. */
FbxPropertyHandle Find(const char* pName, const char* pChildrenSeparator, bool pCaseSensitive) const;
/** Separate the given name by children separator string and then find the property.The step is
* strip the first part of the name and search, if the property can be found, strip the second part
* of the name and continue search, until no property be found,then return the last found property.
* \param pName The given property name
* \param pChildrenSeparator The given children separator string
* \param pTypeInfo The given property type info
* \param pCaseSensitive Decide if the given property name is case sensitive
* \return Return a property handle which be created with the found property. */
FbxPropertyHandle Find(const char* pName, const char* pChildrenSeparator, const FbxPropertyHandle& pTypeInfo, bool pCaseSensitive) const;
//@}
/**
* \name Connection management
*/
//@{
/** Connect source property.
* \param pSrc The given source property
* \param pType The given property type
* \return If connect successfully, return true,otherwise, return false. */
bool ConnectSrc(const FbxPropertyHandle& pSrc, const FbxConnection::EType pType=FbxConnection::eDefault);
/** Get source properties' count.
* \param pFilter The filter used to get sub connection point. If it is not zero, return the source count of the sub connection point.
* Otherwise, return the src count of this property.
* \return The count of source properties */
int GetSrcCount(FbxConnectionPointFilter* pFilter=0) const;
/** Get source property with the given index.
* \param pFilter The filter used to get sub connection point. If it is not zero, return the source property of the sub connection point.
* Otherwise, return the source property of this property.
* \param pIndex The given index
* \return The source property handle. */
FbxPropertyHandle GetSrc(FbxConnectionPointFilter* pFilter=0, int pIndex=0) const;
/** Disconnect source property.
* \param pSrc The given source property
* \return If disconnect successfully, return true, otherwise return false. */
bool DisconnectSrc(const FbxPropertyHandle& pSrc);
/** Judge if it is connected with the given source property.
* \param pSrc The given source property
* \return If it is connected, return true, otherwise return false. */
bool IsConnectedSrc(const FbxPropertyHandle& pSrc);
/** Connect destination property.
* \param pDst The given destination property
* \param pType The given property type
* \return If connect successfully, return true,otherwise, return false. */
bool ConnectDst(const FbxPropertyHandle& pDst, const FbxConnection::EType pType=FbxConnection::eDefault);
/** Get destination properties' count.
* \param pFilter The filter used to get sub connection point.If it is not zero,return the destination count of the sub connection point.
* Otherwise, return the destination count of this property.
* \return The count of destination properties */
int GetDstCount(FbxConnectionPointFilter* pFilter=0) const;
/** Get destination property with the given index.
* \param pFilter The filter used to get sub connection point.If it is not zero,return the destination property of the sub connection point.
* Otherwise, return the destination property of this property.
* \param pIndex The given index
* \return The destination property handle. */
FbxPropertyHandle GetDst(FbxConnectionPointFilter* pFilter=0, int pIndex=0) const;
/** Disconnect destination property.
* \param pDst The given destination property
* \return If disconnect successfully, return true,otherwise, return false. */
bool DisconnectDst(const FbxPropertyHandle& pDst);
/** Judge if it is connected with the given destination property.
* \param pDst The given destination property
* \return If it is connected, return true,otherwise, return false. */
bool IsConnectedDst(const FbxPropertyHandle& pDst);
//! Clear connect cache
void ClearConnectCache();
//! Clear all connect without sending any notification (Internal use ONLY)
void WipeAllConnections();
//@}
/** \name Limits Functions
* Minimum and maximum value limits can be associated with properties, but FBX
* will not verify that these limits are respected. FBX however will store and
* retrieve limits from files, and will assure that they are persistent in memory
* while the property handle object exists.
*
* Soft minimums and maximums values are specifying a second set of limits that can be
* used for UI objects such as sliders. FBX will handle them the same way it does
* with the normal limits. */
//@{
/** Judge if this property has a minimum value.
* \return If the minimum value exist, return true,otherwise, return false. */
bool HasMin() const;
/** Get the minimum value and value type of this property.
* \param pValue The minimum value of this property.
* \param pValueType The value type of this property.
* \return If the minimum value exist, return true,otherwise, return false. */
bool GetMin(void* pValue, EFbxType pValueType) const;
/** Set the minimum value and value type for this property.
* \param pValue The given minimum value .
* \param pValueType The given value type .
* \return If it be set successfully, return true,otherwise, return false. */
bool SetMin(const void* pValue, EFbxType pValueType);
/** According the given value and its value type, set the minimum value and value type for this property.
* \param pValue The given value .
* \return If it be set successfully, return true,otherwise, return false.
*/
template <class T> inline bool SetMin(const T& pValue){ return SetMin(&pValue, FbxTypeOf(pValue)); }
/** Get the minimum value of this property.
* \param pFBX_TYPE Not used in this function. This is a dummy argument for
* the correct instantiation of the templated function.
* \return The minimum value of this property */
template <class T> inline T GetMin(const T* pFBX_TYPE) const { T lValue; GetMin(&lValue, FbxTypeOf(lValue)); return lValue; }
/** Judge if this property has soft minimum value.
* \return If the soft minimum value exist, return true,otherwise, return false. */
bool HasSoftMin() const;
/** Get the soft minimum value and value type of this property.
* \param pValue The soft minimum value of this property.
* \param pValueType The value type of this property.
* \return If the soft minimum value exist, return true,otherwise, return false. */
bool GetSoftMin(void* pValue, EFbxType pValueType) const;
/** Set the soft minimum value and value type for this property.
* \param pValue The given soft minimum value .
* \param pValueType The given value type .
* \return If it be set successfully, return true,otherwise, return false. */
bool SetSoftMin(const void* pValue, EFbxType pValueType);
/** According the given value and its value type, set the soft minimum value and value type for this property.
* \param pValue The given value .
* \return If it be set successfully, return true,otherwise, return false. */
template <class T> inline bool SetSoftMin(const T& pValue){ return SetSoftMin(&pValue, FbxTypeOf(pValue)); }
/** Get the soft minimum value of this property.
* \param pFBX_TYPE Not used in this function. This is a dummy argument for
* the correct instantiation of the templated function.
* \return The soft minimum value of this property */
template <class T> inline T GetSoftMin(const T* pFBX_TYPE) const { T lValue; GetSoftMin(&lValue, FbxTypeOf(lValue)); return lValue; }
/** Judge if this property has maximum value.
* \return If the maximum value exist, return true,otherwise, return false. */
bool HasMax() const;
/** Get the maximum value and value type of this property.
* \param pValue The maximum value of this property.
* \param pValueType The value type of this property.
* \return If the maximum value exist, return true,otherwise, return false. */
bool GetMax(void* pValue, EFbxType pValueType) const;
/** Set the maximum value and value type for this property.
* \param pValue The given maximum value .
* \param pValueType The given value type .
* \return If it be set successfully, return true,otherwise, return false. */
bool SetMax(const void* pValue, EFbxType pValueType);
/** According the given value and its value type, set the maximum value and value type for this property.
* \param pValue The given value .
* \return If it be set successfully, return true,otherwise, return false. */
template <class T> inline bool SetMax(const T& pValue){ return SetMax(&pValue, FbxTypeOf(pValue)); }
/** Get the maximum value of this property.
* \param pFBX_TYPE Not used in this function. This is a dummy argument for
* the correct instantiation of the templated function.
* \return The maximum value of this property */
template <class T> inline T GetMax(const T* pFBX_TYPE) const { T lValue; GetMax(&lValue, FbxTypeOf(lValue)); return lValue; }
/** Judge if this property has soft maximum value.
* \return If the soft maximum value exist, return true,otherwise, return false. */
bool HasSoftMax() const;
/** Get the soft maximum value and value type of this property.
* \param pValue The soft maximum value of this property.
* \param pValueType The value type of this property.
* \return If the soft maximum value exist, return true,otherwise, return false. */
bool GetSoftMax(void* pValue, EFbxType pValueType) const;
/** Set the soft maximum value and value type for this property.
* \param pValue The given soft maximum value .
* \param pValueType The given value type .
* \return If it be set successfully, return true,otherwise, return false. */
bool SetSoftMax(const void* pValue, EFbxType pValueType);
/** According the given value and its value type, set the soft maximum value and value type for this property.
* \param pValue The given value .
* \return If it be set successfully, return true,otherwise, return false. */
template <class T> inline bool SetSoftMax(const T& pValue){ return SetSoftMax(&pValue, FbxTypeOf(pValue)); }
/** Get the soft maximum value of this property.
* \param pFBX_TYPE Not used in this function. This is a dummy argument for
* the correct instantiation of the templated function.
* \return The soft maximum value of this property */
template <class T> inline T GetSoftMax(const T* pFBX_TYPE) const { T lValue; GetSoftMax(&lValue, FbxTypeOf(lValue)); return lValue; }
//@}
/**
* \name Value
*/
//@{
/** Get value inherit type of this property.
* \param pCheckReferences If it is true,check instance of this property page,otherwise,only check this page.
* \return The value inherit type of this property */
FbxPropertyFlags::EInheritType GetValueInheritType(bool pCheckReferences) const;
/** Set value inherit type for this property .
* \param pType The given value inherit type.
* \return If set successfully, return true,otherwise, return false. */
bool SetValueInheritType(FbxPropertyFlags::EInheritType pType);
/** Get default value and value type of this property .
* \param pValue The gotten default value of this property.
* \param pValueType The gotten default value type of this property.
* \return If default value be gotten successfully, return true,otherwise, return false. */
bool GetDefaultValue(void* pValue, EFbxType pValueType) const;
/** Get value and value type of this property .
* \param pValue The gotten value of this property.
* \param pValueType The gotten value type of this property.
* \return If value be gotten successfully, return true,otherwise, return false. */
bool Get(void* pValue, EFbxType pValueType) const;
/** Set property value and value type for this property.
* \param pValue The given property value .
* \param pValueType The given property value type
* \param pCheckValueEquality If it is true, when the given value is equal with
* the property value, the property value will not be set.
* \return If the property value be set successfully, return true,otherwise, return false. */
bool Set(const void* pValue, EFbxType pValueType, bool pCheckValueEquality);
/** Set property value with the given value .
* \param pValue The given value .
* \return If set successfully, return true,otherwise, return false. */
template <class T> inline bool Set(const T& pValue){ return Set(&pValue, FbxTypeOf(pValue)); }
/** get property value.
* \param pFBX_TYPE Not be used.
* \return The gotten property value. */
template <class T> inline T Get(const T* pFBX_TYPE) const { T lValue; Get(&lValue, FbxTypeOf(lValue)); return lValue; }
//@}
/**
* \name Page settings
*/
//@{
/** Set the property page data pointer.
* \param pData The given page data pointer. */
void SetPageDataPtr(void* pData);
/** Get property page data pointer.
* \return The gotten property page data pointer. */
void* GetPageDataPtr() const;
//@}
/**
* \name Page Internal Entry Management
*/
//@{
/** Push properties to parent instance.
* \return If push successful return true,otherwise,return false. */
bool PushPropertiesToParentInstance();
//@}
/**
* \name Reference Management
*/
//@{
/** Judge if this property page is a instance of other page.
* \return If this property page is a instance of other page, return true,otherwise,return false. */
bool IsAReferenceTo(void) const;
/** Get the property page which this property page make reference to
* \return The property page which this property page make reference to */
void* GetReferenceTo(void) const;
/** Judge if this property page is referenced by other pages.
* \return If this property page is referenced by other pages, return true,otherwise,return false. */
bool IsReferencedBy(void) const;
/** Get the count of property pages which make reference to this property page.
* \return The count of property pages which make reference to this property page. */
int GetReferencedByCount(void) const;
/** According the given index,get the property page which make reference to this property page.
* \param pIndex The given index
* \return The pointer to the property page which reference to this property page and be found by index. */
void* GetReferencedBy(int pIndex) const;
//@}
private:
FbxPropertyPage* mPage;
FbxInt mId;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_PROPERTY_HANDLE_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,260 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxquery.h
#ifndef _FBXSDK_CORE_QUERY_H_
#define _FBXSDK_CORE_QUERY_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxclassid.h>
#include <fbxsdk/core/fbxconnectionpoint.h>
#include <fbxsdk/core/base/fbxmap.h>
#include <fbxsdk/core/base/fbxmemorypool.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
#define FBXSDK_QUERY_UNIQUE_ID 0x14000000
class FbxProperty;
/** Base class to manage query. A query contains a filter and reference ID, which will be used to search and retrieve objects.
* The derived query classes are used to create FbxCriteria.
* \nosubgrouping */
class FBXSDK_DLL FbxQuery
{
public:
//! Get unique filter Id
virtual FbxInt GetUniqueId() const { return FBXSDK_QUERY_UNIQUE_ID; }
/** Judge if the given property is valid.
* \param pProperty The given property.
* \return \c true always, not implemented. */
virtual bool IsValid(const FbxProperty& pProperty) const;
/** This compares whether two FbxQuery are the same, NOT whether the query matches or not. It's strictly the equivalent of an operator==, but virtual.
* \param pOtherQuery The given FbxQuery */
virtual bool IsEqual(FbxQuery* pOtherQuery) const;
//! Add one to ref count.
void Ref();
//! Minus one to ref count, if ref count is zero, delete this query object.
void Unref();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
FbxQuery();
virtual ~FbxQuery();
private:
class InternalFilter : public FbxConnectionPointFilter
{
public:
InternalFilter(FbxQuery* pQuery);
~InternalFilter();
public:
FbxConnectionPointFilter* Ref();
void Unref();
FbxInt GetUniqueId() const { return mQuery->GetUniqueId(); }
bool IsValid(FbxConnectionPoint* pConnect) const;
bool IsEqual(FbxConnectionPointFilter* pConnectFilter) const;
FbxQuery* mQuery;
};
InternalFilter mFilter;
int mRefCount;
FBXSDK_FRIEND_NEW();
friend class FbxProperty;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
/** Defines a filtering criteria for a query of objects, connections and properties, so that only those satisfying the criteria are
* affected by the query. Some examples of kinds of criteria are object type, connection type, or property. Criteria can be combined
* using logical operators such as "and" and "or".
* \note
* Objects are basic elements in FBX. Each of them has a hierarchy type and some properties. Objects and properties can be connected
* through a connection to represent a relationship between them. (e.g. child-parent, container membership, reference, etc.,). In a
* query, you could select object or properties based on these criteria.
* Here are some examples:
* \code
* FbxObject* lObject = FbxObject::Create(lManager, "Object");
* int lSrcLightCount = lObject->RootProperty.GetSrcObjectCount(FbxCriteria::ObjectType(FbxLight::ClassId));
* int lSrcDeformerCount = lObject->RootProperty.GetSrcObjectCount(FbxCriteria::ObjectTypeStrict(FbxDeformer::ClassId));
* int lSrcPropertyCount = lObject->RootProperty.GetSrcCount(FbxCriteria::IsProperty());
* \endcode
* \see FbxQuery
* \see FbxProperty::GetSrcObjectCount(const FbxCriteria&) const
* \see FbxCollection::GetMemberCount(const FbxCriteria&) const
* \nosubgrouping */
class FBXSDK_DLL FbxCriteria
{
public:
/** Creates a new query criteria that only selects objects which have a specific
* class ID or derive from a class with a specific class ID.
* \param pClassId The base type class ID */
static FbxCriteria ObjectType(const FbxClassId& pClassId);
/** Creates a new query criteria that only selects objects which have a specific class ID.
* \param pClassId The type class ID */
static FbxCriteria ObjectTypeStrict(const FbxClassId& pClassId);
//! Creates a new query criteria that only selects properties.
static FbxCriteria IsProperty();
/** Gets a logical conjunction (and) criteria from this and the specified criteria.
* \param pCriteria The specified criteria */
FbxCriteria operator&&(const FbxCriteria& pCriteria) const;
/** Gets a logical disjunction (or) criteria from this and the specified criteria.
* \param pCriteria The specified criteria */
FbxCriteria operator||(const FbxCriteria& pCriteria) const;
//! Returns a negated version of the criteria.
FbxCriteria operator!() const;
/** Retrieves the query.
* \return The query of this criteria */
FbxQuery* GetQuery() const;
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxCriteria();
FbxCriteria(const FbxCriteria& pCriteria);
FbxCriteria(FbxQuery* pQuery);
~FbxCriteria();
FbxCriteria& operator=(const FbxCriteria& pCriteria);
private:
FbxQuery* mQuery;
static void FreeGlobalCache();
FBXSDK_FRIEND_NEW();
friend class FbxManager;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
//! Functor to compare FbxCriteria
struct FbxCriteriaCompare
{
inline int operator()(const FbxCriteria& pKeyA, const FbxCriteria& pKeyB) const
{
const FbxQuery* lKeyA = pKeyA.GetQuery();
const FbxQuery* lKeyB = pKeyB.GetQuery();
return lKeyA < lKeyB ? -1 : (lKeyA > lKeyB ? 1 : 0);
}
};
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
class FBXSDK_DLL FbxQueryOperator : public FbxQuery
{
public:
FBXSDK_FRIEND_NEW();
enum EType {eAND, eOR};
static FbxQueryOperator* Create(FbxQuery* pA, EType pOperator, FbxQuery* pB);
virtual FbxInt GetUniqueId() const { return FBXSDK_QUERY_UNIQUE_ID+1; }
virtual bool IsValid(const FbxProperty& pProperty) const;
virtual bool IsEqual(FbxQuery* pOtherQuery) const;
protected:
FbxQueryOperator(FbxQuery* pA, EType pOperator, FbxQuery* pB);
virtual ~FbxQueryOperator();
private:
FbxQuery *mA, *mB;
EType mOperator;
};
class FBXSDK_DLL FbxQueryOperatorUnary : public FbxQuery
{
public:
FBXSDK_FRIEND_NEW();
static FbxQueryOperatorUnary* Create(FbxQuery* pA);
virtual FbxInt GetUniqueId() const{ return FBXSDK_QUERY_UNIQUE_ID+2; }
virtual bool IsValid(const FbxProperty& pProperty) const;
virtual bool IsEqual(FbxQuery* pOtherQuery) const;
protected:
FbxQueryOperatorUnary(FbxQuery* pA);
virtual ~FbxQueryOperatorUnary();
private:
FbxQuery* mA;
};
class FBXSDK_DLL FbxQueryClassId : public FbxQuery
{
public:
FBXSDK_FRIEND_NEW();
static FbxQueryClassId* Create(const FbxClassId& pClassId);
virtual FbxInt GetUniqueId() const{ return FBXSDK_QUERY_UNIQUE_ID+3; }
virtual bool IsValid(const FbxProperty& pProperty) const;
virtual bool IsEqual(FbxQuery* pOtherQuery) const;
protected:
FbxQueryClassId(const FbxClassId& pClassId);
private:
FbxClassId mClassId;
};
class FBXSDK_DLL FbxQueryIsA : public FbxQuery
{
public:
FBXSDK_FRIEND_NEW();
static FbxQueryIsA* Create(const FbxClassId& pClassId);
virtual FbxInt GetUniqueId() const{ return FBXSDK_QUERY_UNIQUE_ID+4; }
virtual bool IsValid(const FbxProperty& pProperty) const;
virtual bool IsEqual(FbxQuery* pOtherQuery) const;
protected:
FbxQueryIsA(const FbxClassId& pClassId);
private:
FbxClassId mClassId;
};
class FBXSDK_DLL FbxQueryIsProperty : public FbxQuery
{
public:
FBXSDK_FRIEND_NEW();
static FbxQueryIsProperty* Create();
virtual FbxInt GetUniqueId() const{ return FBXSDK_QUERY_UNIQUE_ID+5; }
virtual bool IsValid(const FbxProperty& pProperty) const;
virtual bool IsEqual(FbxQuery* pOtherQuery) const;
protected:
FbxQueryIsProperty();
};
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_QUERY_H_ */

View File

@ -0,0 +1,57 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxqueryevent.h
#ifndef _FBXSDK_CORE_QUERY_EVENT_H_
#define _FBXSDK_CORE_QUERY_EVENT_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxevent.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** A query event is something that is emitted by an entity, with the goal of being filled by someone that listen to it.
* You can see that like a form that you send to some people. If those people know how to fill the form, they fill it and return
* it to you with the right information in it. A query event is emitted, and plug-in who are listening to that type of query,
* fill the data that can be accessed by the query emitter.
*/
template <typename QueryT> class FbxQueryEvent : public FbxEvent<FbxQueryEvent<QueryT> >
{
public:
/**
*\name Public interface
*/
//@{
/** Constructor.
* \param pData The requested data.
*/
explicit FbxQueryEvent(QueryT* pData):mData(pData){}
/** Accessor to a mutable reference to the data. Event are usually const and can't be modified by listener.
* This special type of event can have is content modified via this accessor.
* \return A mutable reference the requested data.
*/
QueryT& GetData()const { return *mData; }
//@}
private:
mutable QueryT* mData;
private:
virtual const char* GetEventName() const { FBX_ASSERT(false); return ""; }
static const char* FbxEventName() { FBX_ASSERT(false); return ""; }
friend class FbxEvent< FbxQueryEvent<QueryT> >;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_QUERY_EVENT_H_ */

View File

@ -0,0 +1,58 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxscopedloadingdirectory.h
#ifndef _FBXSDK_CORE_SCOPED_LOADING_DIRECTORY_H_
#define _FBXSDK_CORE_SCOPED_LOADING_DIRECTORY_H_
#include <fbxsdk/fbxsdk_def.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/fbxloadingstrategy.h>
#include <fbxsdk/core/fbxmodule.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxPluginHandle;
//! A plug-in loading strategy that loads all DLLs with a specific extension from a specific directory. When this class is destroyed all of the plug-ins are unloaded.
class FBXSDK_DLL FbxScopedLoadingDirectory : public FbxLoadingStrategy
{
public:
/** Constructor, which also load plug-ins in the folder specified.
* \param pDirectoryPath The directory path.
* \param pPluginExtension The plug-in extension. */
FbxScopedLoadingDirectory(const char* pDirectoryPath, const char* pPluginExtension);
/** Destructor. Unload plug-ins. */
virtual ~FbxScopedLoadingDirectory();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
virtual bool SpecificLoad(FbxPluginData& pData);
virtual void SpecificUnload(FbxPluginData& pData);
FbxString mDirectoryPath;
FbxString mExtension;
FbxArray<FbxModule> mPluginHandles;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#endif /* _FBXSDK_CORE_SCOPED_LOADING_DIRECTORY_H_ */

View File

@ -0,0 +1,64 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxscopedloadingfilename.h
#ifndef _FBXSDK_CORE_SCOPED_LOADING_FILENAME_H_
#define _FBXSDK_CORE_SCOPED_LOADING_FILENAME_H_
#include <fbxsdk/fbxsdk_def.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/core/fbxloadingstrategy.h>
#include <fbxsdk/core/fbxmodule.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/**
* A plug-in loading strategy that loads a single DLL by specifying the file name in the constructor, and unloads the DLL in its destructor.
*/
class FBXSDK_DLL FbxScopedLoadingFileName : public FbxLoadingStrategy
{
public:
/**
*\name Public interface
*/
//@{
/** Constructor.
* Load plug-in.
* \param pPath The file path.
*/
explicit FbxScopedLoadingFileName(const char* pPath);
/** Destructor.
* Unload plug-in.
*/
virtual ~FbxScopedLoadingFileName();
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
virtual bool SpecificLoad(FbxPluginData& pData);
virtual void SpecificUnload(FbxPluginData& pData);
FbxModule mInstance;
FbxString mPath;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#endif /* _FBXSDK_CORE_SCOPED_LOADING_FILENAME_H_ */

View File

@ -0,0 +1,126 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxstream.h
#ifndef _FBXSDK_CORE_STREAM_H_
#define _FBXSDK_CORE_STREAM_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxfile.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Abstract class for implementing I/O operations through a stream of data.
* For instance, it can be used to read data from a memory source, thus making it possible to import files from memory. However,
* for the time being, the FbxStream class is only supported with FBX files.
*/
class FBXSDK_DLL FbxStream
{
public:
/** Current stream state. */
enum EState
{
eClosed, //!< The stream is closed.
eOpen, //!< The stream is open.
eEmpty //!< The stream is empty.
};
/** Query the current state of the stream. */
virtual EState GetState() = 0;
/** Open the stream.
* \return True if successful.
* \remark Each time the stream is open or closed, the stream position must be reset to zero. */
virtual bool Open(void* pStreamData) = 0;
/** Close the stream.
* \return True if successful.
* \remark Each time the stream is open or closed, the stream position must be reset to zero. */
virtual bool Close() = 0;
/** Empties the internal data of the stream.
* \return True if successful. */
virtual bool Flush() = 0;
/** Writes a memory block.
* \param pData Pointer to the memory block to write.
* \param pSize Size (in bytes) of the memory block to write.
* \return The number of bytes written in the stream. */
virtual int Write(const void* /*pData*/, int /*pSize*/) = 0;
/** Read bytes from the stream and store them in the memory block.
* \param pData Pointer to the memory block where the read bytes are stored.
* \param pSize Number of bytes read from the stream.
* \return The actual number of bytes successfully read from the stream. */
virtual int Read(void* /*pData*/, int /*pSize*/) const = 0;
/** Read a string from the stream.
* The default implementation is written in terms of Read() but does not cope with DOS line endings.
* Subclasses may need to override this if DOS line endings are to be supported.
* \param pBuffer Pointer to the memory block where the read bytes are stored.
* \param pMaxSize Maximum number of bytes to be read from the stream.
* \param pStopAtFirstWhiteSpace Stop reading when any whitespace is encountered. Otherwise read to end of line (like fgets()).
* \return pBuffer, if successful, else NULL.
* \remark The default implementation terminates the \e pBuffer with a null character and assumes there is enough room for it.
* For example, a call with \e pMaxSize = 1 will fill \e pBuffer with the null character only. */
virtual char* ReadString(char* pBuffer, int pMaxSize, bool pStopAtFirstWhiteSpace=false);
/** If not specified by KFbxImporter::Initialize(), the importer will ask
* the stream to select an appropriate reader ID to associate with the stream.
* FbxIOPluginRegistry can be used to locate id by extension or description.
* Return -1 to allow FBX to select an appropriate default. */
virtual int GetReaderID() const = 0;
/** If not specified by KFbxExporter::Initialize(), the exporter will ask
* the stream to select an appropriate writer ID to associate with the stream.
* KFbxIOPluginRegistry can be used to locate id by extension or description.
* Return -1 to allow FBX to select an appropriate default. */
virtual int GetWriterID() const = 0;
/** Adjust the current stream position.
* \param pSeekPos Pre-defined position where offset is added (FbxFile::eBegin, FbxFile::eCurrent:, FbxFile::eEnd)
* \param pOffset Number of bytes to offset from pSeekPos. */
virtual void Seek(const FbxInt64& pOffset, const FbxFile::ESeekPos& pSeekPos)=0;
/** Get the current stream position.
* \return Current number of bytes from the beginning of the stream. */
virtual long GetPosition() const = 0;
/** Set the current stream position.
* \param pPosition Number of bytes from the beginning of the stream to seek to. */
virtual void SetPosition(long pPosition)=0;
/** Return 0 if no errors occurred. Otherwise, return 1 to indicate
* an error. This method will be invoked whenever FBX needs to verify
* that the last operation succeeded. */
virtual int GetError() const = 0;
/** Clear current error condition by setting the current error value to 0. */
virtual void ClearError() = 0;
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxStream(){};
virtual ~FbxStream(){};
int Write(const char* pData, int pSize){ return Write((void*)pData, pSize); }
int Write(const int* pData, int pSize){ return Write((void*)pData, pSize); }
int Read(char* pData, int pSize) const { return Read((void*)pData, pSize); }
int Read(int* pData, int pSize) const { return Read((void*)pData, pSize); }
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_STREAM_H_ */

View File

@ -0,0 +1,135 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxsymbol.h
#ifndef _FBXSDK_CORE_SYMBOL_H_
#define _FBXSDK_CORE_SYMBOL_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/core/base/fbxmap.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Defines a symbol string. A symbol string is a string that is unique and stored in a global symbol table.
* \nosubgrouping */
class FBXSDK_DLL FbxSymbol
{
public:
/**
* \name Constructors and Destructor
*/
//@{
/** Constructor.
* Construct a symbol and add it to global symbol table.
* \param pName Symbol name.
* \param pRealm The real value for this symbol.
*/
FbxSymbol(const char* pName, const char* pRealm);
//! Destructor.
~FbxSymbol();
//@}
/**
* \name Access function.
*/
//@{
/**
* Get ID in global symbol table.
* \return Symbol ID in global symbol table.
*/
unsigned int GetID() const;
//@}
/**
* \name Symbol comparison
*/
//@{
/** Equality operator.
* \param pSymbol The symbol to be compared.
*/
bool operator==(FbxSymbol const& pSymbol) const;
/** Inequality operator.
* \param pSymbol The symbol to be compared.
*/
bool operator!=(FbxSymbol const& pSymbol) const;
//@}
private:
unsigned int mID;
};
typedef FbxMap< FbxString, int, FbxStringCompare > FbxStringSymbolMap;
/** This class is to mark a string as symbol.
* String Symbol only has its name.
* /remarks Each symbol is unique. That means there are no symbols which have the same name.
* \nosubgrouping */
class FBXSDK_DLL FbxStringSymbol
{
public:
/**
* \name Constructors and Destructor
*/
//@{
//! Default constructor.
FbxStringSymbol();
/** Constructor.
* Construct a symbol and add it to global symbol table.
* \param pName Symbol name.
*/
FbxStringSymbol(const char* pName);
//! Copy constructor.
FbxStringSymbol(const FbxStringSymbol& pOther);
//! Destructor.
~FbxStringSymbol();
//@}
//! Cast operator to const char* type.
inline operator const char*() const { return mItem ? ((const char*) mItem->GetKey()) : NULL; }
/** Determine the symbol empty or not.
* \return \c true if empty. \c false otherwise.
*/
inline bool IsEmpty() const
{
return !mItem || mItem->GetKey().IsEmpty();
}
//! Static function to allocate global string symbol map.
static void AllocateGlobalStringSymbolMap();
//! Static function to deallocate global string symbol map.
static void FreeGlobalStringSymbolMap();
/** Assignment operator.
* \param pName The symbol value.
* \return The self after assignment.
*/
FbxStringSymbol& operator=(const char* pName);
private:
FbxStringSymbolMap::RecordType* mItem;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_SYMBOL_H_ */

View File

@ -0,0 +1,219 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxsystemunit.h
#ifndef _FBXSDK_CORE_SYSTEM_UNIT_H_
#define _FBXSDK_CORE_SYSTEM_UNIT_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/core/base/fbxarray.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxAMatrix;
class FbxScene;
class FbxNode;
class FbxAnimCurveNode;
/** \brief This class describes the units of measurement used within a particular scene.
* \nosubgrouping
*/
class FBXSDK_DLL FbxSystemUnit
{
public:
/** Struct to define various options that you can use to convert the system unit of a scene.
* The default values are:
* mConvertRrsNodes = true
* mConvertLimits = true
* mConvertClusters = true
* mConvertLightIntensity = true
* mConvertPhotometricLProperties = true
* mConvertCameraClipPlanes = true
*
* The default configuration have been tested to give the best conversion results in the majority of the case.
* \remark Changing any of these values will have a direct impact on the whole scene behavior.
*/
struct ConversionOptions
{
//! This flag indicates whether or not to convert the nodes that do not inherit their parent's scale.
bool mConvertRrsNodes;
//! This flag indicates whether or not to convert limits.
bool mConvertLimits;
//! This flag indicates whether or not to convert clusters.
bool mConvertClusters;
//! This flag indicates whether or not to convert the light intensity property.
bool mConvertLightIntensity;
//! This flag indicates whether or not to convert photometric lights properties.
bool mConvertPhotometricLProperties;
//! This flag indicates whether or not to convert the cameras clip planes.
bool mConvertCameraClipPlanes;
};
FbxSystemUnit();
/** Constructor.
* \param pScaleFactor The equivalent number of centimeters in the new system unit.
* For example, an inch unit uses a scale factor of 2.54.
* \param pMultiplier A multiplier factor of pScaleFactor.
*/
FbxSystemUnit(double pScaleFactor, double pMultiplier = 1.0);
/** Destructor.
*/
~FbxSystemUnit();
//! Predefined system unit for millimeters.
static const FbxSystemUnit mm;
//! Predefined system unit for decimeters.
static const FbxSystemUnit dm;
//! Predefined system unit for centimeters.
static const FbxSystemUnit cm;
//! Predefined system unit for meters.
static const FbxSystemUnit m;
//! Predefined system unit for kilometers.
static const FbxSystemUnit km;
//! Predefined system unit for inches.
static const FbxSystemUnit Inch;
//! Predefined system unit for feet.
static const FbxSystemUnit Foot;
//! Predefined system unit for miles.
static const FbxSystemUnit Mile;
//! Predefined system unit for yards.
static const FbxSystemUnit Yard;
#define FBXSDK_SYSTEM_UNIT_PREDEF_COUNT 9
//! Points to a FbxSystemUnit array to store the predefined system units. The array size is FBXSDK_SYSTEM_UNIT_PREDEF_COUNT.
static const FbxSystemUnit *sPredefinedUnits;
//! Stores the default conversion options.
static const ConversionOptions DefaultConversionOptions;
/** Converts a scene from its system units to this system unit.
* \param pScene The scene to convert.
* \param pOptions Conversion options, see:FbxSystemUnit::ConversionOptions.
*/
void ConvertScene( FbxScene* pScene, const ConversionOptions& pOptions = DefaultConversionOptions ) const;
/** Converts the child (or children) of the given node from the system unit to this system unit.
* Unlike the ConvertScene() method, this method does not set the axis system
* of the scene to which the pRoot node belongs. It also does not adjust FbxPose
* as they are not stored under the scene, and not under a particular node.
* \param pRoot The given node.
* \param pSrcUnit The source system unit.
* \param pOptions Conversion options, see:FbxSystemUnit::ConversionOptions.
*/
void ConvertChildren( FbxNode* pRoot, const FbxSystemUnit& pSrcUnit, const ConversionOptions& pOptions = DefaultConversionOptions ) const;
/** Converts a scene from its system unit to this system unit, using the specified
* Fbx_Root node. This method is provided for backwards compatibility only
* and instead you should use ConvertScene( FbxScene* , const ConversionOptions& ) whenever possible.
* \param pScene The scene to convert.
* \param pFbxRoot The Fbx_Root node to use for conversion.
* \param pOptions Conversion options, see:FbxSystemUnit::ConversionOptions
*/
void ConvertScene( FbxScene* pScene, FbxNode* pFbxRoot, const ConversionOptions& pOptions = DefaultConversionOptions ) const;
/** Returns the system unit's scale factor, relative to centimeters.
* This factor scales system unit values to centimeters. If you want to scale values to centimeters, use this value.
* Ignore the "multiplier" (returned by GetMultiplier()) value.
* \return The the system unit's scale factor, relative to centimeters.
*/
double GetScaleFactor() const;
/** Returns a unit label for the current scale factor.
* \param pAbbreviated If \c true, returns abbreviated string.
* \return The unit label for the current scale factor.
*/
FbxString GetScaleFactorAsString(bool pAbbreviated = true) const;
/** Returns a unit label for the current scale factor.
* The first letter of the label is in upper case and the label should be pluralized.
* \return The unit label for the current scale factor.
*/
FbxString GetScaleFactorAsString_Plurial() const;
/** Returns the multiplier factor of the system unit.
*/
double GetMultiplier() const;
/** Equivalence operator.
* \param pOther Another system unit compared with this system unit.
* \return \c True if equal, \c false otherwise.
*/
bool operator==(const FbxSystemUnit& pOther) const;
/** Non-equivalence operator.
* \param pOther Another system unit compared with this system unit.
* \return \c True if unequal, \c false otherwise.
*/
bool operator!=(const FbxSystemUnit& pOther) const;
/** Assignment operation.
* \param pSystemUnit Unit system assigned to this one.
*/
FbxSystemUnit& operator=(const FbxSystemUnit& pSystemUnit);
/** Returns the conversion factor from this system unit to the target system unit, excluding the multiplier factor.
* \param pTarget The target system unit.
*/
double GetConversionFactorTo( const FbxSystemUnit& pTarget ) const;
/** Returns the conversion factor from the source system unit to this system unit, excluding the multiplier factor.
* \param pSource The source system unit.
*/
double GetConversionFactorFrom( const FbxSystemUnit& pSource ) const;
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
void ApplyMultiplier(FbxNode* pRoot, bool pSubChildrenOnly) const;
void ConvertSTProperties(FbxArray<FbxNode*>& pNodes, double pConversionFactor) const;
void ConvertSProperty(FbxArray<FbxNode*>& pNodes, double pConversionFactor) const;
void ConvertAnimCurveNode(FbxArray<FbxAnimCurveNode*>& pFCurves, double pConversionFactor) const;
double GetConversionFactor(double pTargetScaleFactor, double pSourceScaleFactor) const;
void AdjustPivots(FbxNode* pNode, double pConversionFactor, FbxAMatrix& pOriginalGlobalM ) const;
void AdjustLimits(FbxNode* pNode, double pConversionFactor) const;
void AdjustPoses(FbxScene* pScene, double pConversionFactor) const;
void AdjustCluster(FbxNode* pNode, double pConversionFactor) const;
void AdjustLightIntensity(FbxNode* pNode, const double pConversionFactor) const;
void AdjustPhotometricLightProperties(FbxNode* pNode, const double pConversionFactor) const;
void AdjustCameraClipPlanes(FbxNode* pNode, const double pConversionFactor) const;
void ConvertChildren(FbxNode* pRoot, const FbxSystemUnit& pSrcUnit, bool pSubChildrenOnly, const ConversionOptions& pOptions) const;
double mScaleFactor;
double mMultiplier;
friend class FbxGlobalSettings;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_SYSTEM_UNIT_H_ */

View File

@ -0,0 +1,227 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxxref.h
#ifndef _FBXSDK_CORE_XREF_H_
#define _FBXSDK_CORE_XREF_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxarray.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxProperty;
class FbxDocument;
class FbxXRefManagerProject;
/** This class manages external references to files.
* \nosubgrouping
*/
class FBXSDK_DLL FbxXRefManager
{
public:
//! Default constructor.
FbxXRefManager();
//! Destructor.
virtual ~FbxXRefManager();
/**
* \name Predefined Project Types
*/
//@{
//! This project represents an URL for storing temporary files.
static const char* sTemporaryFileProject;
//! This project represents an URL for configuration files.
static const char* sConfigurationProject;
//! This project represents an URL for storing localization files (that is not part of the asset library).
static const char* sLocalizationProject;
/** This project is used for creating the ".fbm" folders that are used for
* storing embedded resources in FBX files.
*
* When not set, or if the folder is not writable, the ".fbm"
* folder is created alongside the FBX file.
*
* If we cannot write in that folder, we look at the sTemporaryFileProject location.
* If no folder is set in the sTemporaryFileProject location, or it is not
* writable, the operating system's Temp folder becomes the location.
*/
static const char* sEmbeddedFileProject;
//@}
/**
* \name XRef URL properties
*/
//@{
/** Returns the number of URLs that are stored in a property.
* \param pProperty The property.
* \return The URL count.
*/
static int GetUrlCount(FbxProperty const &pProperty);
/** Returns the number of URLs that are stored in a string.
* \param pUrl The string.
* \return The URL count.
*/
static int GetUrlCount(FbxString const& pUrl);
/** Checks whether the URL at the given index stored in the property is relative or not.
* \param pProperty The property.
* \param pIndex The URL index.
* \return \c True if the URL is relative, \c false if the URL is not relative.
*/
static bool IsRelativeUrl (FbxProperty const &pProperty,int pIndex);
/** Returns the URL stored in the property at the given index.
* \param pProperty The property.
* \param pIndex The URL index.
* \return The URL
*/
static FbxString GetUrl(FbxProperty const &pProperty,int pIndex);
/** Tries to resolve the URL stored in the property at the given index.
* \param pProperty The property.
* \param pIndex The URL index.
* \param pResolvedPath Filled with the resolved path.
* \return \c True if the URL is resolved, return \c false if the URL is not resolved.
*/
bool GetResolvedUrl (FbxProperty const &pProperty,int pIndex,FbxString & pResolvedPath) const;
/** Tries to resolve the specified URL.
* \param pUrl The specified URL.
* \param pDoc The document whose ".fbm" folder is used to resolve the URL.
* \param pResolvedPath Filled with the resolved path.
* \return \c True if the URL is resolved, return \c false if the URL is not resolved.
*/
bool GetResolvedUrl (const char* pUrl, FbxDocument* pDoc, FbxString& pResolvedPath) const;
//@}
/** Looks for the first file that matches a specified "pattern",
* which is built as:
*
* if pOptExt is given: prefix*.ext
* If pOptExt is NULL: prefix*
* if pOptExt is "" or ".": prefix*.
*
* Returns the URL of the first matching files. This function cannot be
* used to resolve folders, only files.
*
* If a document is given, we start by looking at the document's ".fbm" folder.
* \param pPrefix The prefix of the pattern.
* \param pOptExt The extension of the pattern.
* \param pDoc The given document.
* \param pResolvedPath Filled with the first matching URL.
* \return \c True if one matching file is found, returns \c false if no matching file is found.
*/
bool GetFirstMatchingUrl(const char* pPrefix, const char* pOptExt, const FbxDocument* pDoc, FbxString& pResolvedPath) const;
/**
* \name XRef Resolve URL and Projects
*/
//@{
/** Adds an XRef Project.
* Note:Only one URL is associated with a project. Calling
* this on an existing project replaces the project's existing URL.
* \param pName The name of the project
* \param pUrl The URL to be associated with the project.
* \return \c True if the project is added successfully, \c false if no project is added.
*/
bool AddXRefProject (const char *pName,const char *pUrl);
/** Adds an XRef Project.
* Note:Only one URL is associated with a project. Calling
* this on an existing project replaces the project's existing URL.
* \param pName The name of the project
* \param pExtension The extension of the project.
* \param pUrl The URL to be associated with the project.
* \return \c True if the project is added successfully, returns \c false if no project is added.
*/
bool AddXRefProject (const char *pName,const char *pExtension,const char *pUrl);
/** Adds an XRef project based on the document's EmbeddedUrl
* property if set, if EmbeddedUrl is not set, based on its current URL property.
* \param pDoc The document used to name the project and to specify the URL.
* \return \c True if the project is added successfully, returns \c false if no project is added.
* \remarks The project name is set as the document name and the URL is set as EmbeddedUrl or URL of the document.
*/
bool AddXRefProject (FbxDocument* pDoc);
/** Removes an XRef Projects.
* \param pName The name of the project to be removed.
* \return \c True if the project is removed successfully, returns \c false if the project with the name does not exist.
*/
bool RemoveXRefProject(const char *pName);
/** Removes all XRef Projects.
* \return \c True always.
*/
bool RemoveAllXRefProjects();
/** Returns the number of XRef Projects.
* \return The number of XRef Projects.
*/
int GetXRefProjectCount() const;
/** Returns the name of the XRef project at the specified index.
* \param pIndex The XRef project index.
* \return The XRef project name.
*/
const char *GetXRefProjectName(int pIndex) const;
/** Returns the base URL for the given project.
* \param pName The name of the given project
* \return The base URL of the project or returns NULL if the project with the name is not found.
*/
const char* GetXRefProjectUrl(const char* pName); // FIXME: Should be const, will break AV.
/** Returns the base URL for the given project.
* \param pName The name of the given project
* \return The base URL of the project or returns NULL if the project with the name is not found.
*/
const char* GetXRefProjectUrl(const char* pName) const;
/** Returns the base URL for the given project.
* \param pIndex The index of the project.
* \return The base URL of the project or NULL if the index is out of bounds.
*/
const char* GetXRefProjectUrl(int pIndex) const;
/** Checks if a project with the given name is defined in this manager.
* \param pName The name of the project.
* \return \c True if the project is defined in this manager, returns \c false if it isn't defined in this manager.
*/
inline bool HasXRefProject( const char* pName ) { return GetXRefProjectUrl(pName) != NULL; }
/** Tries to resolve an relative URL
* \param pUrl The relative URL to be resolved.
* \param pResolvePath Filled with the resolved path.
* \return \c True if the URL is resolved, returns \c false if the URL is not resolved.
*/
bool GetResolvedUrl (const char* pUrl,FbxString & pResolvePath) const;
//@}
private:
FbxArray<FbxXRefManagerProject*> mProjects;
static bool UrlExist(const char* pUrl);
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_XREF_H_ */

View File

@ -0,0 +1,340 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxaffinematrix.h
#ifndef _FBXSDK_CORE_MATH_AFFINE_MATRIX_H_
#define _FBXSDK_CORE_MATH_AFFINE_MATRIX_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/math/fbxvector4.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** FBX SDK affine matrix class.
* \nosubgrouping
* Matrices are defined using the Column Major scheme. When a FbxAMatrix represents a transformation (translation, rotation and scale),
* the last row of the matrix represents the translation part of the transformation.
*
* \remarks It is important to realize that an affine matrix must respect a certain structure. To be sure the structure is respected,
* use SetT, SetR, SetS, SetQ, SetTRS or SetTQS. If by mistake bad data is entered in this affine matrix, some functions such as
* Inverse() will yield wrong results. If a matrix is needed to hold values that aren't associate with an affine matrix, please use FbxMatrix instead.
*/
class FBXSDK_DLL FbxAMatrix : public FbxDouble4x4
{
public:
/**
* \name Constructors and Destructor
*/
//@{
//! Constructor.
FbxAMatrix();
/** Copy constructor.
* \param pOther FbxAMatrix copied to this one.
*/
FbxAMatrix(const FbxAMatrix& pOther);
/** Constructor.
* \param pT Translation vector.
* \param pR Euler rotation vector.
* \param pS Scale vector.
*/
FbxAMatrix(const FbxVector4& pT, const FbxVector4& pR, const FbxVector4& pS);
//! Destructor.
~FbxAMatrix();
//@}
/**
* \name Access
*/
//@{
/** Retrieve matrix element.
* \param pY Row index.
* \param pX Column index.
* \return Cell [ pX, pY ] value.
*/
double Get(int pY, int pX) const;
/** Extract translation vector.
* \return Translation vector.
*/
FbxVector4 GetT() const;
/** Extract rotation vector.
* \return Rotation vector.
* \remarks The returned rotation vector is in Euler angle and the rotation order is XYZ.
*/
FbxVector4 GetR() const;
/** Extract quaternion vector.
* \return Quaternion vector.
*/
FbxQuaternion GetQ() const;
/** Extract scale vector.
* \return Scale vector.
*/
FbxVector4 GetS() const;
/** Extract a row vector.
* \param pY Row index.
* \return The row vector.
*/
FbxVector4 GetRow(int pY) const;
/** Extract a column vector.
* \param pX Column index.
* \return The column vector.
*/
FbxVector4 GetColumn(int pX) const;
//! Set matrix to identity.
void SetIdentity();
/** Set matrix's translation.
* \param pT Translation vector.
*/
void SetT(const FbxVector4& pT);
/** Set matrix's Euler rotation.
* \param pR X, Y and Z rotation values expressed as a vector.
* \remarks The rotation transform is constructed in rotation order XYZ.
*/
void SetR(const FbxVector4& pR);
/** Set matrix's quaternion.
* \param pQ The new quaternion.
*/
void SetQ(const FbxQuaternion& pQ);
/** Set matrix's scale.
* \param pS X, Y and Z scaling factors expressed as a vector.
*/
void SetS(const FbxVector4& pS);
/** Set matrix.
* \param pT Translation vector.
* \param pR Rotation vector.
* \param pS Scale vector.
*/
void SetTRS(const FbxVector4& pT, const FbxVector4& pR, const FbxVector4& pS);
/** Set matrix.
* \param pT Translation vector.
* \param pQ Quaternion vector.
* \param pS Scale vector.
*/
void SetTQS(const FbxVector4& pT, const FbxQuaternion& pQ, const FbxVector4& pS);
/** Assignment operator.
* \param pM FbxAMatrix assigned to this one.
*/
FbxAMatrix& operator=(const FbxAMatrix& pM);
//@}
/**
* \name Scalar Operations
*/
//@{
/** Multiply matrix by a scalar value.
* \param pValue Scalar value.
* \return The scaled matrix.
* \remarks The passed value is not checked.
* This operator operates on the first three rows and columns of the matrix.
* So only the rotation and scaling are scaled, not the translation part.
* After operation, the translation vector will be set as (0,0,0,1);
*/
FbxAMatrix operator*(double pValue) const;
/** Divide matrix by a scalar value.
* \param pValue Scalar value.
* \return The divided matrix.
* \remarks The passed value is not checked.
* This operator operates on the first three rows and columns of the matrix.
* So only the rotation and scaling are scaled, not the translation part.
* After operation, the translation vector will be set as (0,0,0,1);
*/
FbxAMatrix operator/(double pValue) const;
/** Multiply matrix by a scalar value.
* \param pValue Scalar value.
* \return \e this updated with the result of the multiplication.
* \remarks The passed value is not checked.
* This operator operates on the first three rows and columns of the matrix.
* So only the rotation and scaling are scaled, not the translation part.
* After operation, the translation vector will keep original value.
*/
FbxAMatrix& operator*=(double pValue);
/** Divide matrix by a scalar value.
* \param pValue Scalar value.
* \return \e this updated with the result of the division.
* \remarks The passed value is not checked.
* This operator operates on the first three rows and columns of the matrix.
* So only the rotation and scaling are scaled, not the translation part.
* After operation, the translation vector will keep original value.
*/
FbxAMatrix& operator/=(double pValue);
//@}
/**
* \name Vector Operations
*/
//@{
/** Multiply matrix by a translation vector.
* \param pVector4 Translation vector.
* \return t' = M * t
*/
FbxVector4 MultT(const FbxVector4& pVector4) const;
/** Multiply matrix by an Euler rotation vector.
* \param pVector4 Euler Rotation vector.
* \return r' = M * r
*/
FbxVector4 MultR(const FbxVector4& pVector4) const;
/** Multiply matrix by a quaternion.
* \param pQuaternion Rotation value.
* \return q' = M * q
*/
FbxQuaternion MultQ(const FbxQuaternion& pQuaternion) const;
/** Multiply matrix by a scale vector.
* \param pVector4 Scaling vector.
* \return s' = M * s
*/
FbxVector4 MultS(const FbxVector4& pVector4) const;
//@}
/**
* \name Matrix Operations
*/
//@{
/** Unary minus operator.
* \return A matrix where each element is multiplied by -1.
*/
FbxAMatrix operator-() const;
/** Multiply two matrices together.
* \param pOther A Matrix.
* \return this * pMatrix.
* \remarks Transformations are pre-multiplied.
* That means to scale, then rotate, and then translate a vector V, the transform should be T * R * S * V. \n
* Below is an example of code that shows how to construct rotation transform in XYZ rotation order.
* \code
* FbxAMatrix lRotateXM, lRotateYM, lRotateZM, lRotateXYZM, lRotateM;
* // Construct rotation matrix around X, Y and Z axises separately and then combine them.
* FbxVector4 lRotateX(10, 0, 0);
* FbxVector4 lRotateY(0, 10, 0);
* FbxVector4 lRotateZ(0, 0, 10);
* lRotateXM.SetR(lRotateX);
* lRotateYM.SetR(lRotateY);
* lRotateZM.SetR(lRotateZ);
* lRotateXYZM = lRotateZM * lRotateYM * lRotateXM;
*
* // Alternatively, we can use SetR() directly.
* // lRotateXYZM and lRotateM will be the same.
* FbxVector4 lRotateXYZ (10, 10, 10);
* lRotateM.SetR(lRotateXYZ);
* \endcode
* \note Please refer to the FBX SDK programmers guide for more details.
*/
FbxAMatrix operator*(const FbxAMatrix& pOther) const;
/** Multiply two matrices together.
* \param pOther A Matrix.
* \return \e this updated with the result of the multiplication.
*/
FbxAMatrix& operator*=(const FbxAMatrix& pOther);
/** Calculate the matrix inverse.
* \return The inverse matrix of \e this.
*/
FbxAMatrix Inverse() const;
/** Calculate the matrix transpose.
* \return The transposed matrix of \e this.
*/
FbxAMatrix Transpose() const;
/** Calculate a spherical linear interpolation matrix.
* \param pOther The other rotation matrix to interpolate with.
* \param pWeight A value between 0.0 and 1.0 to specify the interpolation amount.
* \remark This matrix and other matrix should contain only rotations, otherwise result may be undefined. */
FbxAMatrix Slerp(const FbxAMatrix& pOther, double pWeight) const;
//@}
/**
* \name Boolean Operations
*/
//@{
/** Equivalence operator.
* \param pOther The matrix to be compared to \e this.
* \return \c true if the two matrices are equal (each element is within a FBXSDK_TOLERANCE tolerance) and \c false otherwise.
*/
bool operator==(const FbxAMatrix& pOther) const;
/** Non-equivalence operator.
* \param pOther The matrix to be compared to \e this.
* \return \c false if the two matrices are equal (each element is within a FBXSDK_TOLERANCE tolerance) and \c true otherwise.
*/
bool operator!=(const FbxAMatrix& pOther) const;
//@}
/**
* \name Casting
*/
//@{
//! Cast the matrix in a double pointer.
operator double* ();
//! Cast the matrix in a const double pointer.
operator const double* () const;
//! Define 4*4 array as a new type
typedef const double(kDouble44)[4][4] ;
//! Cast the matrix in a reference to a 4*4 array.
inline kDouble44 & Double44() const { return *((kDouble44 *)&mData[0][0]); }
//@}
/** Find out if the matrix is equal to identity matrix.
* \return \c true if the matrix is equal to identity matrix, \c false otherwise. */
bool IsIdentity(const double pThreshold=FBXSDK_TOLERANCE);
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxAMatrix(const FbxVector4& pT, const FbxQuaternion& pQ, const FbxVector4& pS);
void SetTRS(const FbxVector4& pT, const FbxAMatrix& pRM, const FbxVector4& pS);
void SetRow(int pY, const FbxVector4& pRow);
void SetTOnly(const FbxVector4& pT);
void SetROnly(const FbxVector4& pR);
void SetQOnly(const FbxQuaternion& pQ);
FbxVector4 GetROnly() const;
FbxQuaternion GetUnnormalizedQ() const;
// pOrd is assumed to be an FbxEuler::EOrder (or its synonym EFbxRotationOrder)
void SetR(const FbxVector4& pV, const int pOrd);
FbxVector4 GetR(const int pOrd) const;
void MultRM(const FbxVector4& pR);
void MultSM(const FbxVector4& pS);
bool IsRightHand() const;
double Determinant() const;
int Compare(const FbxAMatrix pM, const double pThreshold=FBXSDK_TOLERANCE) const;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_MATH_AFFINE_MATRIX_H_ */

View File

@ -0,0 +1,325 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxdualquaternion.h
#ifndef _FBXSDK_CORE_MATH_DUAL_QUATERNION_H_
#define _FBXSDK_CORE_MATH_DUAL_QUATERNION_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/math/fbxquaternion.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** FBX SDK dual quaternion class to represent rigid transformation, which is combined by two quaternions.
* A transformation is said to be rigid if it preserves relative distances and angles.
* That means rotation and translation.
* \nosubgrouping
*/
class FBXSDK_DLL FbxDualQuaternion
{
public:
/**
* \name Constructors and Destructor
*/
//@{
//! Constructor.
FbxDualQuaternion();
/** Constructor.
* \param pV1 FbxQuaternion object.
* \param pV2 FbxQuaternion object.
*/
FbxDualQuaternion(const FbxQuaternion& pV1, const FbxQuaternion& pV2);
/** Copy constructor.
* \param pV FbxQuaternion object copied to this one.
*/
FbxDualQuaternion(const FbxDualQuaternion& pV);
/** Constructor.
* \param pRotation The rotation the dual quaternion is going to represent.
* \param pTranslation The translation the dual quaternion is going to represent.
*/
FbxDualQuaternion(const FbxQuaternion& pRotation, const FbxVector4& pTranslation);
/** Constructor.
* \param pX1 The X component of the first quaternion.
* \param pY1 The Y component of the first quaternion.
* \param pZ1 The Z component of the first quaternion.
* \param pW1 The W component of the first quaternion.
* \param pX2 The X component of the second quaternion.
* \param pY2 The Y component of the second quaternion.
* \param pZ2 The Z component of the second quaternion.
* \param pW2 The W component of the second quaternion.
*/
FbxDualQuaternion(double pX1, double pY1, double pZ1, double pW1, double pX2, double pY2, double pZ2, double pW2);
//! Destructor.
~FbxDualQuaternion();
//@}
/**
* \name Access
*/
//@{
/** Assignment operation.
* \param pDualQuaternion FbxDualQuaternion object assigned to this one.
*/
FbxDualQuaternion& operator=(const FbxDualQuaternion& pDualQuaternion);
/** Set vector.
* \param pX1 The X component of the first quaternion.
* \param pY1 The Y component of the first quaternion.
* \param pZ1 The Z component of the first quaternion.
* \param pW1 The W component of the first quaternion.
* \param pX2 The X component of the second quaternion.
* \param pY2 The Y component of the second quaternion.
* \param pZ2 The Z component of the second quaternion.
* \param pW2 The W component of the second quaternion.
*/
void Set(double pX1, double pY1, double pZ1, double pW1, double pX2, double pY2, double pZ2, double pW2);
/** Get the first quaternion of the dual quaternion.
* \return The first quaternion of the dual quaternion.
*/
FbxQuaternion& GetFirstQuaternion();
/** Get the second quaternion of the dual quaternion.
* \return The second quaternion of the dual quaternion.
*/
FbxQuaternion& GetSecondQuaternion();
/** Get the first quaternion of the dual quaternion.
* \return The first quaternion of the dual quaternion.
*/
const FbxQuaternion& GetFirstQuaternion() const;
/** Get the second quaternion of the dual quaternion.
* \return The second quaternion of the dual quaternion.
*/
const FbxQuaternion& GetSecondQuaternion() const;
/** Get the rotation part from the dual quaternion.
* \return FbxQuaternion object to represent rotation.
*/
FbxQuaternion GetRotation() const;
/** Get the translation part from the dual quaternion.
* \return FbxVector4 object to represent translation.
* \remarks A dual quaternion can represent rotation followed by translation, or translation followed by rotation.
* This method assumes that the rotation is expressed first, followed by translation, as is done by most DCC tools.
*/
FbxVector4 GetTranslation() const;
//@}
/**
* \name Scalar Operations
*/
//@{
/** Add a value to all vector components.
* \param pValue The value to add to each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxDualQuaternion operator+(double pValue) const;
/** Subtract a value from all vector components.
* \param pValue The value to subtract from each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxDualQuaternion operator-(double pValue) const;
/** Multiply all vector components by a value.
* \param pValue The value multiplying each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxDualQuaternion operator*(double pValue) const;
/** Divide all vector components by a value.
* \param pValue The value dividing each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxDualQuaternion operator/(double pValue) const;
/** Add a value to all vector components.
* \param pValue The value to add to each component of the vector.
* \return The result of adding pValue to each component of the vector, replacing this dual quaternion.
* \remarks The passed value is not checked.
*/
FbxDualQuaternion& operator+=(double pValue);
/** Subtract a value from all vector components.
* \param pValue The value to subtract from each component of the vector.
* \return The result of subtracting pValue from each component of the vector, replacing this dual quaternion.
* \remarks The passed value is not checked.
*/
FbxDualQuaternion& operator-=(double pValue);
/** Multiply a value to all vector elements.
* \param pValue The value multiplying each component of the vector.
* \return The result of multiplying each component of the vector by pValue, replacing this dual quaternion.
* \remarks The passed value is not checked.
*/
FbxDualQuaternion& operator*=(double pValue);
/** Divide all vector elements by a value.
* \param pValue The value dividing each component of the vector.
* \return The result of dividing each component of the vector by pValue, replacing this dual quaternion.
* \remarks The passed value is not checked.
*/
FbxDualQuaternion& operator/=(double pValue);
//@}
/**
* \name Vector Operations
*/
//@{
/** Unary minus operator.
* \return A dual quaternion where each component is multiplied by -1.
*/
FbxDualQuaternion operator-() const;
/** Add two vectors together.
* \param pDualQuaternion Dual quaternion to add.
* \return The dual quaternion v' = this + pDualQuaternion.
* \remarks The values in pDualQuaternion are not checked.
*/
FbxDualQuaternion operator+(const FbxDualQuaternion& pDualQuaternion) const;
/** Subtract a quaternion from another quaternion.
* \param pDualQuaternion Dual quaternion to subtract.
* \return The dual quaternion v' = this - pDualQuaternion.
* \remarks The values in pDualQuaternion are not checked.
*/
FbxDualQuaternion operator-(const FbxDualQuaternion& pDualQuaternion) const;
/** Memberwise multiplication of two vectors.
* \param pDualQuaternion Multiplying dual quaternion.
* \return The dual quaternion v' = this * pQuaternion.
* \remarks The values in pDualQuaternion are not checked.
*/
FbxDualQuaternion operator*(const FbxDualQuaternion& pDualQuaternion) const;
/** Memberwise division of a dual quaternion with another dual quaternion.
* \param pDualQuaternion Dividing dual quaternion.
* \return The dual quaternion v' = this / pQuaternion.
* \remarks The values in pDualQuaternion are not checked.
*/
FbxDualQuaternion operator/(const FbxDualQuaternion& pDualQuaternion) const;
/** Add two quaternions together.
* \param pDualQuaternion Dual quaternion to add.
* \return The dual quaternion v' = this + pQuaternion, replacing this dual quaternion.
* \remarks The values in pDualQuaternion are not checked.
*/
FbxDualQuaternion& operator+=(const FbxDualQuaternion& pDualQuaternion);
/** Subtract a dual quaternion from another vector.
* \param pDualQuaternion Dual quaternion to subtract.
* \return The dual quaternion v' = this - pQuaternion, replacing this dual quaternion.
* \remarks The values in pDualQuaternion are not checked.
*/
FbxDualQuaternion& operator-=(const FbxDualQuaternion& pDualQuaternion);
/** Memberwise multiplication of two quaternions.
* \param pDualQuaternion Multiplying dual quaternion.
* \return The dual quaternion v' = this * pQuaternion, replacing this dual quaternion.
* \remarks The values in pDualQuaternion are not checked.
*/
FbxDualQuaternion& operator*=(const FbxDualQuaternion& pDualQuaternion);
/** Memberwise division of a dual quaternion by another dual quaternion.
* \param pDualQuaternion Dividing dual quaternion.
* \return The dual quaternion v' = this / pQuaternion, replacing this dual quaternion.
* \remarks The values in pDualQuaternion are not checked.
*/
FbxDualQuaternion& operator/=(const FbxDualQuaternion& pDualQuaternion);
/** Multiplication of a dual quaternion by a FbxVector4.
* \param pVector The FbxVector4 to multiply with.
* \return The dual quaternion v' = FbxDualQuaternion(mQ1, (mQ1 * pVector) + mQ2).
* \remarks The values in pDualQuaternion are not checked.
*/
FbxDualQuaternion operator*(const FbxVector4 pVector) const;
/** Return dual quaternion product.
* \param pDualQuaternion Product dual quaternion.
* \return The dual quaternion that is the product of this and pDualQuaternion.
*/
FbxDualQuaternion Product(const FbxDualQuaternion& pDualQuaternion) const;
/** Normalize the dual quaternion, length set to 1.
*/
void Normalize();
/** Calculate the dual quaternion's inverse.
* \return The inverse of this dual quaternion.
*/
void Inverse();
/** Deform a point by this dual quaternion.
* \return The inverse of this quaternion.
*/
FbxVector4 Deform(FbxVector4& pPoint);
//@}
/**
* \name Conjugate Operations
* \brief Dual quaternion has three types of conjugate.
*/
//@{
/** Conjugate both quaternions of this dual quaternion.
*/
void Conjugate();
/** Conjugate in dual space.
*/
void Dual();
/** Conjugate both quaternions of this dual quaternion in dual space.
*/
void DualConjugate();
//@}
/**
* \name Boolean Operations
*/
//@{
/** Equivalence operator.
* \param pV The quaternion to be compared to this quaternion.
* \return \c true if the two quaternions are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c false otherwise.
*/
bool operator==(const FbxDualQuaternion & pV) const;
/** Non equivalence operator.
* \param pV The quaternion to be compared to \e this.
* \return \c false if the two quaternions are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c true otherwise.
*/
bool operator!=(const FbxDualQuaternion & pV) const;
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
FbxQuaternion mQ1;
FbxQuaternion mQ2;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_MATH_DUAL_QUATERNION_H_ */

View File

@ -0,0 +1,512 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxmath.h
#ifndef _FBXSDK_CORE_MATH_H_
#define _FBXSDK_CORE_MATH_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/math/fbxvector2.h>
#include <fbxsdk/core/math/fbxvector4.h>
#include <fbxsdk/core/math/fbxmatrix.h>
#include <fbxsdk/core/math/fbxaffinematrix.h>
//On Mac OS, cmath will include math.h and undef "isnan"
#if defined(FBXSDK_ENV_MAC)
#include <cmath>
extern "C" int isnan (double);
#endif
#include <fbxsdk/fbxsdk_nsbegin.h>
#if defined(FBXSDK_ENV_WIN)
#ifndef isnan
#define isnan _isnan
#endif
#ifndef finite
#define finite _finite
#endif
#endif
//---------------------------------------------------------------------------------------
//Common Constants
#define FBXSDK_PI 3.1415926535897932384626433832795028841971693993751 //!< PI mathematic constant
#define FBXSDK_PI_DIV_2 1.5707963267948966192313216916397514420985846996875 //!< PI divided by 2
#define FBXSDK_PI_DIV_180 0.017453292519943295769236907684886127134428718885417 //!< PI divived by 180
#define FBXSDK_180_DIV_PI 57.295779513082320876798154814105170332405472466565 //!< 180 divided by PI
#define FBXSDK_1_DIV_LN2 1.4426950408889634073599246810018921374266459541530 //!< 1 divided by LogN2
//---------------------------------------------------------------------------------------
//Unit Convertion Ratio
#define FBXSDK_DEG_TO_RAD FBXSDK_PI_DIV_180 //!< Degree to Radian
#define FBXSDK_RAD_TO_DEG FBXSDK_180_DIV_PI //!< Radian to Degree
#define FBXSDK_IN_TO_CM 2.54 //!< Inch to Centimeter
#define FBXSDK_MM_TO_CM 0.1 //!< Millimeter to Centimeter
#define FBXSDK_CM_TO_IN 0.393700787 //!< Centimeter to Inch
#define FBXSDK_IN_TO_MM 25.4 //!< Inch to Millimeter
#define FBXSDK_MM_TO_IN 0.0393700787 //!< Millimeter to Inch
#define FBXSDK_FT_TO_M 0.3048 //!< Feet to Meter
#define FBXSDK_M_TO_FT 3.2808399 //!< Meter to Feet
#define FBXSDK_YD_TO_FT 3 //!< Yard to Feet
#define FBXSDK_FT_TO_YD 0.333333333 //!< Feet to Yard
#define FBXSDK_KM_TO_MILE 0.621371192 //!< Kilometer to Mile
#define FBXSDK_MILE_TO_KM 1.609344 //!< Mile to Kilometer
#define FBXSDK_YD_TO_M 0.9144 //!< Yard to Meter
#define FBXSDK_M_TO_YD 1.0936133 //!< Meter to Yard
//---------------------------------------------------------------------------------------
//Euler Definition
#define FBXSDK_EULER_DEGENERATE FbxEuler::DegenerateThreshold() //!< Euler degenerate threshold can be changed with a call to FbxEuler::SetDegenerateThreshold.
class FBXSDK_DLL FbxEuler
{
public:
enum EAxis {eAxisX=0, eAxisY=1, eAxisZ=2};
enum EOrder
{
eOrderXYZ,
eOrderXZY,
eOrderYZX,
eOrderYXZ,
eOrderZXY,
eOrderZYX,
eOrderSphericXYZ
};
static bool IsParityOdd(EOrder pOrder);
static bool IsRepeat(EOrder pOrder);
static const int AxisTableSize;
static const int AxisTable[][3];
// Used to detect Euler gimbal locks when extracting the rotation vector from
// the FbxAMatrix. This value should only be changed when the user system stores
// single floating point values into the FbxAMatrix with a very low precision.
// In this case, the default threshold value would be too small for a proper detection
// and the extracted values can quickly become off target by a huge amount.
static void SetDegenerateThreshold(double pThreshold=16.0*FBXSDK_FLOAT_EPSILON);
static inline double DegenerateThreshold() { return FbxEuler::mDegenerateThreshold; }
private:
static double mDegenerateThreshold;
};
/** Rotation order flags.
* Each rotate order produces a different end orientation. For example, if the rotation order for an object is set to XYZ,
* the object first rotates about its X-axis, then its Y-axis, and finally its Z-axis.
*/
#define EFbxRotationOrder FbxEuler::EOrder
#define eEulerXYZ FbxEuler::eOrderXYZ
#define eEulerXZY FbxEuler::eOrderXZY
#define eEulerYZX FbxEuler::eOrderYZX
#define eEulerYXZ FbxEuler::eOrderYXZ
#define eEulerZXY FbxEuler::eOrderZXY
#define eEulerZYX FbxEuler::eOrderZYX
#define eSphericXYZ FbxEuler::eOrderSphericXYZ
/** Quaternion interpolation modes. */
enum EFbxQuatInterpMode
{
eQuatInterpOff, //!< Do not evaluate using quaternion interpolation.
eQuatInterpClassic, //!< Legacy quaternion interpolation mode.
eQuatInterpSlerp, //!< Spherical linear interpolation.
eQuatInterpCubic, //!< Cubic interpolation.
eQuatInterpTangentDependent, //!< Mix between Slerp and cubic interpolation, depending on the specified tangents for each key.
eQuatInterpCount //!< Number of quaternion interpolation modes. Mark the end of this enum.
};
extern FBXSDK_DLL const FbxDouble FbxIdentityMatrix[4][4];
extern FBXSDK_DLL const FbxVector4 FbxZeroVector4;
inline float FbxFloor(const float x)
{
return float(floor(x));
}
inline double FbxFloor(const double x)
{
return floor(x);
}
inline float FbxCeil(const float x)
{
return float(ceil(x));
}
inline double FbxCeil(const double x)
{
return ceil(x);
}
template<class T> inline T FbxSign(const T x)
{
return (x < 0) ? T(-1) : T(1);
}
template<class T> inline T FbxRound(const T x)
{
T y = FbxFloor(x);
return (x - y < T(0.5)) ? y : y + T(1);
}
inline FbxUChar FbxAbs(const FbxUChar x)
{
return x;
}
inline FbxUShort FbxAbs(const FbxUShort x)
{
return x;
}
inline FbxUInt FbxAbs(const FbxUInt x)
{
return x;
}
#ifndef FBXSDK_SYSTEM_IS_LP64
inline FbxULong FbxAbs(const FbxULong x)
{
return x;
}
#endif
inline FbxULongLong FbxAbs(const FbxULongLong x)
{
return x;
}
inline FbxFloat FbxAbs(const FbxFloat x)
{
return (FbxFloat)fabs(x);
}
inline FbxDouble FbxAbs(const FbxDouble x)
{
return fabs(x);
}
template<class T> inline T FbxAbs(const T x)
{
return (x >= 0) ? x : ((x > FbxMin(x)) ? -x : FbxMax(x));
}
template<class T> inline T FbxClamp(const T value, const T min, const T max)
{
return (value < min) ? min : ((value > max) ? max : value);
}
template<class T> inline bool FbxEqual(const T x, const T y, const T e=(T)FBXSDK_TOLERANCE)
{
return FbxAbs(x - y) <= e;
}
inline bool FbxEqual(const FbxDouble2& x, const FbxDouble2& y, const double e=FBXSDK_TOLERANCE)
{
return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) );
}
inline bool FbxEqual(const FbxDouble3& x, const FbxDouble3& y, const double e=FBXSDK_TOLERANCE)
{
return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) && FbxEqual(x.mData[2], y.mData[2], e) );
}
inline bool FbxEqual(const FbxDouble4& x, const FbxDouble4& y, const double e=FBXSDK_TOLERANCE)
{
return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) && FbxEqual(x.mData[2], y.mData[2], e) && FbxEqual(x.mData[3], y.mData[3], e) );
}
inline bool FbxEqual(const FbxDouble4x4& x, const FbxDouble4x4& y, const double e=FBXSDK_TOLERANCE)
{
return ( FbxEqual(x[0], y[0], e) && FbxEqual(x[1], y[1], e) && FbxEqual(x[2], y[2], e) && FbxEqual(x[3], y[3], e) );
}
inline bool FbxEqual(const FbxVector2& x, const FbxVector2& y, const double e=FBXSDK_TOLERANCE)
{
return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) );
}
inline bool FbxEqual(const FbxVector4& x, const FbxVector4& y, const double e=FBXSDK_TOLERANCE)
{
return ( FbxEqual(x.mData[0], y.mData[0], e) && FbxEqual(x.mData[1], y.mData[1], e) && FbxEqual(x.mData[2], y.mData[2], e) && FbxEqual(x.mData[3], y.mData[3], e) );
}
inline bool FbxEqual(const FbxMatrix& x, const FbxMatrix& y, const double e=FBXSDK_TOLERANCE)
{
return ( FbxEqual(x[0], y[0], e) && FbxEqual(x[1], y[1], e) && FbxEqual(x[2], y[2], e) && FbxEqual(x[3], y[3], e) );
}
inline bool FbxEqual(const FbxAMatrix& x, const FbxAMatrix& y, const double e=FBXSDK_TOLERANCE)
{
return ( FbxEqual(x[0], y[0], e) && FbxEqual(x[1], y[1], e) && FbxEqual(x[2], y[2], e) && FbxEqual(x[3], y[3], e) );
}
inline FbxDouble FbxMod(const FbxFloat x, FbxFloat& i)
{
return modff(x, &i);
}
inline FbxDouble FbxMod(const FbxDouble x, FbxDouble& i)
{
return modf(x, &i);
}
inline FbxDouble FbxMod(const FbxFloat x)
{
FbxFloat i;
return modff(x, &i);
}
inline FbxDouble FbxMod(const FbxDouble x)
{
FbxDouble i;
return modf(x, &i);
}
template<class T> inline T FbxReciprocal(const T x)
{
return T(1) / x;
}
inline double FbxSqrt(const double x)
{
return sqrt(x);
}
inline float FbxSqrt(const float x)
{
return sqrtf(x);
}
template<class T> inline T FbxSqrt(const T x)
{
if( x > 1 )
{
T z, y = x >> 1;
do
{
z = y;
y = (y + (x / y)) >> 1;
}
while(y < z);
return z;
}
else
{
return x;
}
}
inline float FbxExp(const float x)
{
return expf(x);
}
inline double FbxExp(const double x)
{
return exp(x);
}
inline float FbxLog(const float x)
{
return float(log(x));
}
inline double FbxLog(const double x)
{
return log(x);
}
template<class T> inline T FbxPow(const T x, const T y)
{
return (T)FbxExp(y * FbxLog((double)x));
}
template<class T> inline T FbxLog2(const T x)
{
return (T)(FbxLog(x) * FBXSDK_1_DIV_LN2);
}
inline float FbxSin(const float x)
{
return sinf(x);
}
inline double FbxSin(const double x)
{
return sin(x);
}
inline float FbxCos(const float x)
{
return cosf(x);
}
inline double FbxCos(const double x)
{
return cos(x);
}
inline float FbxTan(const float x)
{
return tanf(x);
}
inline double FbxTan(const double x)
{
return tan(x);
}
// *y = cos(x), sin(x)
template<class T> inline T FbxSinCos(const T x, T* y)
{
return *y = FbxCos(x), FbxSin(x);
}
// *y = cos(x * pi/180), sin(x * pi/180)
template<class T> inline T FbxSinCosd(const T x, T* y)
{
return FbxSinCos(T(x * FBXSDK_PI_DIV_180), y);
}
inline float FbxASin(const float x)
{
return asinf(x);
}
inline double FbxASin(const double x)
{
return asin(x);
}
template<class T> inline T FbxASind(const T x)
{
return (T)(FbxASin((double)x) * FBXSDK_180_DIV_PI);
}
inline float FbxACos(const float x)
{
return acosf(x);
}
inline double FbxACos(const double x)
{
return acos(x);
}
template<class T> inline T FbxACosd(const T x)
{
return (T)(FbxACos(x) * FBXSDK_180_DIV_PI);
}
inline float FbxATan(const float x)
{
return atanf(x);
}
inline double FbxATan(const double x)
{
return atan(x);
}
template<class T> inline T FbxATand(const T x)
{
return (T)(FbxATan(x) * FBXSDK_180_DIV_PI);
}
inline float FbxATan(const float y, const float x)
{
return atan2f(y, x);
}
inline double FbxATan(const double y, const double x)
{
return atan2(y, x);
}
template<class T> inline T FbxATand(const T y, const T x)
{
return (T)(FbxATan(y, x) * FBXSDK_180_DIV_PI);
}
template<class T> inline T FbxNorm(const T x, const T y)
{
return FbxSqrt(x * x + y * y);
}
template<class T> inline T FbxNorm(const T x, const T y, const T z)
{
return FbxSqrt(x * x + y * y + z * z);
}
template<class T> inline T FbxNorm(const T w, const T x, const T y, const T z)
{
return FbxSqrt(w * w + x * x + y * y + z * z);
}
template<class T> inline T FbxHypot(const T x, const T y)
{
return FbxSqrt(x * x + y * y);
}
template<class T> inline T FbxHypot(const T x, const T y, const T z)
{
return FbxSqrt(x * x + y * y + z * z);
}
template<class T> inline T FbxHypot(const T w, const T x, const T y, const T z)
{
return FbxSqrt(w * w + x * x + y * y + z * z);
}
inline FbxVector4 FbxRejection(const FbxVector4& a, const FbxVector4& b)
{
return a - b * (a.DotProduct(b) / b.DotProduct(b));
}
template<class T> inline int FbxBitCount(const T x)
{
int n = 0;
T c = x;
while( c )
{
n += int(c & 1);
c = (c >> 1);
}
return n;
}
template<class T> inline void FbxFixInfinite(T& x)
{
if( x != x || x > FbxMax(x) || x < -FbxMax(x) )
{
x = T(0);
}
}
template<class T> inline T FbxExp(const T x);
template<class T> inline T FbxLog(const T x);
template<class T> inline T FbxSin(const T x);
template<class T> inline T FbxCos(const T x);
template<class T> inline T FbxASin(const T x);
template<class T> inline T FbxACos(const T x);
template<class T> inline T FbxATan(const T x);
template<class T> inline T FbxATan(const T y, const T x);
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_MATH_H_ */

View File

@ -0,0 +1,281 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxmatrix.h
#ifndef _FBXSDK_CORE_MATH_MATRIX_H_
#define _FBXSDK_CORE_MATH_MATRIX_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/math/fbxvector4.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxAMatrix;
/** FBX SDK basic 4x4 double matrix class.
* \nosubgrouping
*/
class FBXSDK_DLL FbxMatrix : public FbxDouble4x4
{
public:
//! \name Constructors and Destructor
//@{
//! Constructor (initialize to an identity matrix)
FbxMatrix();
/** Copy constructor.
* \param pM Another FbxMatrix object copied to this one. */
FbxMatrix(const FbxMatrix& pM);
/** Copy constructor for affine matrix.
* \param pM Affine matrix */
FbxMatrix(const FbxAMatrix& pM);
/** TRS Constructor.
* \param pT Translation vector.
* \param pR Euler rotation vector.
* \param pS Scale vector. */
FbxMatrix(const FbxVector4& pT, const FbxVector4& pR, const FbxVector4& pS);
/** TQS Constructor.
* \param pT Translation vector.
* \param pQ Quaternion.
* \param pS Scale vector. */
FbxMatrix(const FbxVector4& pT, const FbxQuaternion& pQ, const FbxVector4& pS);
/** 16 double constructor.
* \param p00 Value at column 0 row 0.
* \param p10 Value at column 1 row 0.
* \param p20 Value at column 2 row 0.
* \param p30 Value at column 3 row 0.
* \param p01 Value at column 0 row 1.
* \param p11 Value at column 1 row 1.
* \param p21 Value at column 2 row 1.
* \param p31 Value at column 3 row 1.
* \param p02 Value at column 0 row 2.
* \param p12 Value at column 1 row 2.
* \param p22 Value at column 2 row 2.
* \param p32 Value at column 3 row 2.
* \param p03 Value at column 0 row 3.
* \param p13 Value at column 1 row 3.
* \param p23 Value at column 2 row 3.
* \param p33 Value at column 3 row 3. */
FbxMatrix( const double p00, const double p10, const double p20, const double p30,
const double p01, const double p11, const double p21, const double p31,
const double p02, const double p12, const double p22, const double p32,
const double p03, const double p13, const double p23, const double p33);
//! Destructor.
~FbxMatrix();
//@}
//! \name Access
//@{
/** Retrieve matrix element.
* \param pY Row index.
* \param pX Column index.
* \return Value at element [ pX, pY ] of the matrix. */
double Get(int pY, int pX) const;
/** Extract a row vector.
* \param pY Row index.
* \return The row vector. */
FbxVector4 GetRow(int pY) const;
/** Extract a column vector.
* \param pX Column index.
* \return The column vector. */
FbxVector4 GetColumn(int pX) const;
/** Set matrix element.
* \param pY Row index.
* \param pX Column index.
* \param pValue New component value. */
void Set(int pY, int pX, double pValue);
/** Set matrix.
* \param pT Translation vector.
* \param pR Euler rotation vector.
* \param pS Scale vector. */
void SetTRS(const FbxVector4& pT, const FbxVector4& pR, const FbxVector4& pS);
/** Set matrix.
* \param pT Translation vector.
* \param pQ Quaternion.
* \param pS Scale vector. */
void SetTQS(const FbxVector4& pT, const FbxQuaternion& pQ, const FbxVector4& pS);
/** Set a matrix row.
* \param pY Row index.
* \param pRow Row vector. */
void SetRow(int pY, const FbxVector4& pRow);
/** Set a matrix column.
* \param pX Column index.
* \param pColumn Column vector. */
void SetColumn(int pX, const FbxVector4& pColumn);
/** Decompose the affine matrix into elements of translation, rotation, shearing, scaling and sign of determinant.
* \param pTranslation Translation element.
* \param pRotation Rotation element.
* \param pShearing Shearing element.
* \param pScaling Scaling element.
* \param pSign Sign of determinant. */
void GetElements(FbxVector4& pTranslation, FbxQuaternion& pRotation, FbxVector4& pShearing, FbxVector4& pScaling, double& pSign) const;
/** Decompose the affine matrix into elements of translation, rotation, shearing, scaling and sign of determinant.
* \param pTranslation Translation element.
* \param pRotation Rotation element.
* \param pShearing Shearing element.
* \param pScaling Scaling element.
* \param pSign Sign of determinant. */
void GetElements(FbxVector4& pTranslation, FbxVector4& pRotation, FbxVector4& pShearing, FbxVector4& pScaling, double& pSign) const;
//@}
//! \name Operators
//@{
/** Assignment operator.
* \param pMatrix Source matrix. */
FbxMatrix& operator=(const FbxMatrix& pMatrix);
/** Unary minus operator.
* \return A matrix where each element is multiplied by -1. */
FbxMatrix operator-() const;
/** Add two matrices together.
* \param pMatrix A matrix.
* \return The result of this matrix + pMatrix. */
FbxMatrix operator+(const FbxMatrix& pMatrix) const;
/** Subtract a matrix from another matrix.
* \param pMatrix A matrix.
* \return The result of this matrix - pMatrix. */
FbxMatrix operator-(const FbxMatrix& pMatrix) const;
/** Multiply two matrices.
* \param pMatrix A matrix.
* \return The result of this matrix * pMatrix. */
FbxMatrix operator*(const FbxMatrix& pMatrix) const;
/** Add two matrices together.
* \param pMatrix A matrix.
* \return The result of this matrix + pMatrix, replacing this matrix. */
FbxMatrix& operator+=(const FbxMatrix& pMatrix);
/** Subtract a matrix from another matrix.
* \param pMatrix A matrix.
* \return The result of this matrix - pMatrix, replacing this matrix. */
FbxMatrix& operator-=(const FbxMatrix& pMatrix);
/** Multiply two matrices.
* \param pMatrix A matrix.
* \return The result of this matrix * pMatrix, replacing this matrix. */
FbxMatrix& operator*=(const FbxMatrix& pMatrix);
/** Equivalence operator.
* \param pM The matrix to be compared against this matrix.
* \return \c true if the two matrices are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c false otherwise. */
bool operator==(const FbxMatrix& pM) const;
/** Equivalence operator.
* \param pM The affine matrix to be compared against this matrix.
* \return \c true if the two matrices are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c false otherwise. */
bool operator==(const FbxAMatrix& pM) const;
/** Non-equivalence operator.
* \param pM The matrix to be compared against this matrix.
* \return \c false if the two matrices are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c true otherwise. */
bool operator!=(const FbxMatrix& pM) const;
/** Non-equivalence operator.
* \param pM The affine matrix to be compared against this matrix.
* \return \c false if the two matrices are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c true otherwise. */
bool operator!=(const FbxAMatrix& pM) const;
//@}
//! \name Casting
//@{
//! Cast the vector in a double pointer.
operator double* ();
//! Cast the vector in a const double pointer.
operator const double* () const;
//! Define 4*4 array as a new type.
typedef const double(kDouble44)[4][4] ;
//! Cast the matrix in a reference to a 4*4 array.
inline kDouble44 & Double44() const { return *((kDouble44 *)&mData[0][0]); }
//@}
//! \name Math Operations
//@{
/** Calculate the matrix inverse.
* \return The inverse matrix. */
FbxMatrix Inverse() const;
/** Calculate the matrix transpose.
* \return This matrix transposed. */
FbxMatrix Transpose() const;
//! Set matrix to identity.
void SetIdentity();
/** Set the matrix to a "Look To" left handed.
* \param pEyePosition The position of the eye.
* \param pEyeDirection The direction of the eye.
* \param pUpDirection The up direction of the eye. */
void SetLookToLH(const FbxVector4& pEyePosition, const FbxVector4& pEyeDirection, const FbxVector4& pUpDirection);
/** Set the matrix to a "Look To" right handed.
* \param pEyePosition The position of the eye.
* \param pEyeDirection The direction of the eye.
* \param pUpDirection The up direction of the eye. */
void SetLookToRH(const FbxVector4& pEyePosition, const FbxVector4& pEyeDirection, const FbxVector4& pUpDirection);
/** Set the matrix to a "Look At" left handed.
* \param pEyePosition The position of the eye.
* \param pLookAt The look at position of the eye focus.
* \param pUpDirection The up direction of the eye. */
void SetLookAtLH(const FbxVector4& pEyePosition, const FbxVector4& pLookAt, const FbxVector4& pUpDirection);
/** Set the matrix values as a "Look At" right handed.
* \param pEyePosition The position of the eye.
* \param pLookAt The look at position of the eye focus.
* \param pUpDirection The up direction of the eye. */
void SetLookAtRH(const FbxVector4& pEyePosition, const FbxVector4& pLookAt, const FbxVector4& pUpDirection);
/** Multiply this matrix by pVector, the w component is normalized to 1.
* \param pVector A vector.
* \return The result of this matrix * pVector. */
FbxVector4 MultNormalize(const FbxVector4& pVector) const;
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
int Compare(const FbxMatrix pM, const double pThreshold = FBXSDK_TOLERANCE) const;
int Compare(const FbxAMatrix pM, const double pThreshold = FBXSDK_TOLERANCE) const;
FbxMatrix operator*(double pValue) const;
FbxMatrix& operator*=(double pValue);
double LUDecomposition(FbxVector4& pVector);
FbxMatrix LUMult(FbxMatrix pM, const FbxVector4& pVector) const;
double Determinant() const;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_MATH_MATRIX_H_ */

View File

@ -0,0 +1,333 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxquaternion.h
#ifndef _FBXSDK_CORE_MATH_QUATERNION_H_
#define _FBXSDK_CORE_MATH_QUATERNION_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/math/fbxvector4.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** FBX SDK quaternion class.
* \nosubgrouping
* Quaternions form a four-dimensional normed division algebra over the real numbers.
* It is for calculations involving three-dimensional rotations.
*/
class FBXSDK_DLL FbxQuaternion : public FbxDouble4
{
public:
/**
* \name Constructors and Destructor
*/
//@{
/** Constructor.
* Initialize to the multiplicative identity.
*/
FbxQuaternion();
/** Copy constructor.
* \param pV FbxQuaternion object copied to this one.
*/
FbxQuaternion(const FbxQuaternion& pV);
/** Constructor.
* \param pX The X component.
* \param pY The Y component.
* \param pZ The Z component.
* \param pW The W component.
*/
FbxQuaternion(double pX, double pY, double pZ, double pW = 1.0);
/** From axis degree constructor
* \param pAxis The axis to rotate around.
* \param pDegree The amount of degree to rotate around the axis. */
FbxQuaternion(const FbxVector4& pAxis, double pDegree);
//! Destructor.
~FbxQuaternion();
//@}
/**
* \name Access
*/
//@{
/** Assignment operation.
* \param pQuaternion FbxQuaternion object assigned to this one.
*/
FbxQuaternion& operator=(const FbxQuaternion& pQuaternion);
/** Accessor.
* \param pIndex The index of the component to access.
* \return The reference to the indexed component.
* \remarks The index parameter is not checked for values out of bounds. The valid range is [0,3].
*/
double& operator[](int pIndex);
/** Accessor.
* \param pIndex The index of the component to access.
* \return The const reference to the indexed component.
* \remarks The index parameter is not checked for values out of bounds. The valid range is [0,3].
*/
const double& operator[](int pIndex) const;
/** Get a vector element.
* \param pIndex The index of the component to access.
* \return The value of the indexed component.
* \remarks The index parameter is not checked for values out of bounds. The valid range is [0,3].
*/
double GetAt(int pIndex) const;
/** Set a vector element.
* \param pIndex The index of the component to set.
* \param pValue The new value to set the component.
* \remarks The index parameter is not checked for values out of bounds. The valid range is [0,3].
*/
void SetAt(int pIndex, double pValue);
/** Set vector.
* \param pX The X component value.
* \param pY The Y component value.
* \param pZ The Z component value.
* \param pW The W component value.
*/
void Set(double pX, double pY, double pZ, double pW = 1.0);
//@}
/**
* \name Scalar Operations
*/
//@{
/** The addition operator between the scalar part of this quaternion and a scalar value, no influence on the vector part of the quaternion.
* \param pValue The scalar value to be added.
* \return The sum of addition.
*/
FbxQuaternion operator+(double pValue) const;
/** The subtraction operator between the scalar part of this quaternion and a scalar value, no influence on the vector part of the quaternion.
* \param pValue The scalar subtrahend.
* \return The difference of subtraction.
*/
FbxQuaternion operator-(double pValue) const;
/** Multiply all vector components by a value.
* \param pValue The value multiplying each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxQuaternion operator*(double pValue) const;
/** Divide all vector components by a value.
* \param pValue The value dividing each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxQuaternion operator/(double pValue) const;
/** The in place addition operator between the real part of this quaternion and a scalar value.
* \param pValue The value to be added.
* \return The sum of addition.
*/
FbxQuaternion& operator+=(double pValue);
/** The subtraction operator between the real part of this quaternion and a scalar value.
* \param pValue The scalar subtrahend.
* \return The difference of subtraction.
*/
FbxQuaternion& operator-=(double pValue);
/** Multiply a value to all vector elements.
* \param pValue The value multiplying each component of the vector.
* \return The result of multiplying each component of the vector by pValue, replacing this quaternion.
* \remarks The passed value is not checked.
*/
FbxQuaternion& operator*=(double pValue);
/** Divide all vector elements by a value.
* \param pValue The value dividing each component of the vector.
* \return The result of dividing each component of the vector by pValue, replacing this quaternion.
* \remarks The passed value is not checked.
*/
FbxQuaternion& operator/=(double pValue);
//@}
/**
* \name Vector Operations
*/
//@{
/** Unary minus operator.
* \return A quaternion where each component is multiplied by -1.
*/
FbxQuaternion operator-() const;
/** Add two vectors together.
* \param pQuaternion Quaternion to add.
* \return The quaternion v' = this + pQuaternion.
* \remarks The values in pQuaternion are not checked.
*/
FbxQuaternion operator+(const FbxQuaternion& pQuaternion) const;
/** Subtract a quaternion from another quaternion.
* \param pQuaternion Quaternion to subtract.
* \return The quaternion v' = this - pQuaternion.
* \remarks The values in pQuaternion are not checked.
*/
FbxQuaternion operator-(const FbxQuaternion& pQuaternion) const;
/** The quaternion multiplication operator.
* \param pOther The quaternion to be multiplied with this quaternion.
* \return The product of two quaternions.
* \remarks In general, quaternion multiplication does not commute.
*/
FbxQuaternion operator*(const FbxQuaternion& pOther) const;
/** The quaternion division operator.
* \param pOther The divisor quaternion.
* \return The quotient quaternion.
* \remarks If the divisor has a zero length, return zero quaternion.
*/
FbxQuaternion operator/(const FbxQuaternion& pOther) const;
/** Add two quaternions together.
* \param pQuaternion Quaternion to add.
* \return The quaternion v' = this + pQuaternion, replacing this quaternion.
* \remarks The values in pQuaternion are not checked.
*/
FbxQuaternion& operator+=(const FbxQuaternion& pQuaternion);
/** Subtract a quaternion from another vector.
* \param pQuaternion Quaternion to subtract.
* \return The quaternion v' = this - pQuaternion, replacing this quaternion.
* \remarks The values in pQuaternion are not checked.
*/
FbxQuaternion& operator-=(const FbxQuaternion& pQuaternion);
/** The in place quaternion multiplication operator.
* \param pOther The quaternion to be multiplied with this quaternion.
* \return The product of two quaternions.
* \remarks In general, quaternion multiplication does not commute.
*/
FbxQuaternion& operator*=(const FbxQuaternion& pOther);
/** The in place quaternion division operator.
* \param pOther The divisor quaternion.
* \return The quotient quaternion.
* \remarks If the divisor has a zero length, return zero quaternion.
*/
FbxQuaternion& operator/=(const FbxQuaternion& pOther);
/** Return quaternion product.
* \param pOther The quaternion to be multiplied with this quaternion.
* \return The product of two quaternions.
*/
FbxQuaternion Product(const FbxQuaternion& pOther) const;
/** Return quaternion dot product.
* \param pQuaternion Dot product quaternion.
* \return The dot product of this quaternion and pQuaternion.
*/
double DotProduct(const FbxQuaternion& pQuaternion) const;
/** Normalize the quaternion, length set to 1.
*/
void Normalize();
/** Calculate the quaternion conjugate.
* \return The conjugate of this quaternion.
*/
void Conjugate();
/** Calculate the length (norm) of the quaternion.
* \return The length of the quaternion.
*/
double Length();
/** Calculate the inverse of the quaternion.
* \return The inverse of this quaternion.
* \remarks If this quaternion has a zero length, retain the original value.
* \remarks If the quaternion is normalized, then its inverse is equal to its conjugate.
*/
void Inverse();
/** Set the quaternion rotation from an axis degree angle.
* \param pAxis The axis to rotate around.
* \param pDegree The amount of degree to rotate around the axis. */
void SetAxisAngle(const FbxVector4& pAxis, double pDegree);
/** Calculate a spherical linear interpolation quaternion.
* \param pOther The other quaternion to interpolate with.
* \param pWeight A value between 0.0 and 1.0 to specify the interpolation amount. */
FbxQuaternion Slerp(const FbxQuaternion& pOther, double pWeight) const;
/** Create a Quaternion equivalent to the supplied Euler XYZ in spherical coordinate.
* \param pEuler The Euler XYZ angle (in degrees).
*/
void ComposeSphericalXYZ(const FbxVector4 pEuler);
/** Create an Euler XYZ equivalent to the current quaternion.
* \return The Euler XYZ angle (in degrees) equivalent to the current quaternion in spherical coordinate.
*/
FbxVector4 DecomposeSphericalXYZ() const;
//@}
/**
* \name Boolean Operations
*/
//@{
/** Equivalence operator.
* \param pV The quaternion to be compared to this quaternion.
* \return \c true if the two quaternions are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c false otherwise.
*/
bool operator==(const FbxQuaternion & pV) const;
/** Non equivalence operator.
* \param pV The quaternion to be compared to \e this.
* \return \c false if the two quaternions are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c true otherwise.
*/
bool operator!=(const FbxQuaternion & pV) const;
//@}
/**
* \name Casting
*/
//@{
//! Cast the vector in a double pointer.
operator double* ();
//! Cast the vector in a const double pointer.
operator const double* () const;
//@}
/**
* \name Comparison methods
*/
//@{
/** Comparison method.
* \param pQ2 Quaternion to compare with this
* \param pThreshold Epsilon for small number comparison
* \return 0 if quaternions are equal, non-zero value otherwise.
*/
int Compare(const FbxQuaternion &pQ2, const double pThreshold = FBXSDK_TOLERANCE) const;
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
void GetQuaternionFromPositionToPosition(const FbxVector4 &pP0, const FbxVector4 &pP1);
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_MATH_QUATERNION_H_ */

View File

@ -0,0 +1,282 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxtransforms.h
#ifndef _FBXSDK_CORE_MATH_TRANSFORMS_H_
#define _FBXSDK_CORE_MATH_TRANSFORMS_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/math/fbxmath.h>
#include <fbxsdk/core/math/fbxquaternion.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** FbxLimits defines a limit range for one transform component, either translation, rotation or scaling.
* One transform component limit contains two part: a min value and a max value limit, which means
* that each value of the corresponding transform component cannot go beyond the range set by the
* min and max values. Although the members are identified as X, Y and Z (the W component is ignored)
* at this level, they are unitless values and will only have meaning within the context they are queried.
*
* For each limit, there is one flag to indicate if the limit is active or not. Before accessing the
* limit info, the caller need to query the flag first to make sure that the retrieved values will be
* meaningful.
* \nosubgrouping
*/
class FBXSDK_DLL FbxLimits
{
public:
//! Constructor
FbxLimits();
//! Assignment Operator
FbxLimits& operator=(const FbxLimits& pLimits);
/** Retrieve the active state of this limit.
* \return True if the limit is active.
*/
bool GetActive() const;
/** Set the active state of this limit.
* \param pActive If true, this limit will become globally active.
*/
void SetActive(const bool pActive);
/** Get the active state of the minimum X component.
* \return True if the X component minimum limit is active.
*/
bool GetMinXActive() const;
/** Get the active state of the minimum Y component.
* \return True if the Y component minimum limit is active.
*/
bool GetMinYActive() const;
/** Get the active state of the minimum Z component.
* \return True if the Z component minimum limit is active.
*/
bool GetMinZActive() const;
/** Get the active states of the three components of the minimum limit.
* \param pXActive \c True if the X component minimum limit is active.
* \param pYActive \c True if the Y component minimum limit is active.
* \param pZActive \c True if the Z component minimum limit is active.
*/
void GetMinActive(bool& pXActive, bool& pYActive, bool& pZActive) const;
/** Get the minimum limits.
* \return The current X, Y and Z values for the minimum limits.
*/
FbxDouble3 GetMin() const;
/** Set the active state of the minimum X component.
* \param pActive If true, the X component minimum limit will be active.
*/
void SetMinXActive(bool pActive);
/** Set the active state of the minimum Y component.
* \param pActive If true, the Y component minimum limit will be active.
*/
void SetMinYActive(bool pActive);
/** Set the active state of the minimum Z component.
* \param pActive If true, the Z component minimum limit will be active.
*/
void SetMinZActive(bool pActive);
/** Set the active states of the three components of the minimum limits.
* \param pXActive If true, the X component minimum limit will be active.
* \param pYActive If true, the Y component minimum limit will be active.
* \param pZActive If true, the Z component minimum limit will be active.
*/
void SetMinActive(bool pXActive, bool pYActive, bool pZActive);
/** Set the minimum limits.
* \param pMin The X, Y and Z values for the minimum limits.
*/
void SetMin(const FbxDouble3& pMin);
/** Get the active state of the maximum X component.
* \return True if the X component maximum limit is active.
*/
bool GetMaxXActive() const;
/** Get the active state of the maximum Y component.
* \return True if the Y component maximum limit is active.
*/
bool GetMaxYActive() const;
/** Get the active state of the maximum Z component.
* \return True if the Z component maximum limit is active.
*/
bool GetMaxZActive() const;
/** Get the active states of the three components of the maximum limit.
* \param pXActive \c True if the X component maximum limit is active.
* \param pYActive \c True if the Y component maximum limit is active.
* \param pZActive \c True if the Z component maximum limit is active.
*/
void GetMaxActive(bool& pXActive, bool& pYActive, bool& pZActive) const;
/** Get the maximum limits.
* \return The current X, Y and Z values for the maximum limits.
*/
FbxDouble3 GetMax() const;
/** Set the active state of the maximum X component.
* \param pActive If true, the X component maximum limit will be active.
*/
void SetMaxXActive(bool pActive);
/** Set the active state of the maximum Y component.
* \param pActive If true, the Y component maximum limit will be active.
*/
void SetMaxYActive(bool pActive);
/** Set the active state of the maximum Z component.
* \param pActive If true, the Z component maximum limit will be active.
*/
void SetMaxZActive(bool pActive);
/** Set the active states of the three components of the maximum limits.
* \param pXActive If true, the X component maximum limit will be active.
* \param pYActive If true, the Y component maximum limit will be active.
* \param pZActive If true, the Z component maximum limit will be active.
*/
void SetMaxActive(bool pXActive, bool pYActive, bool pZActive);
/** Set the maximum limits.
* \param pMax The X, Y and Z values for the maximum limits.
*/
void SetMax(const FbxDouble3& pMax);
/** Find if any of the minimum or maximum active state are set.
* \return If any component of the minimum or maximum active state are set, true is returned.
* \remarks The global active state will not count when resolving this.
*/
bool GetAnyMinMaxActive() const;
/** Apply the active limits to the components of the vector provided.
* \return The new vector clamped by active limits.
*/
FbxDouble3 Apply(const FbxDouble3& pVector);
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
enum EMask {eActive=1<<0, eMinX=1<<1, eMinY=1<<2, eMinZ=1<<3, eMaxX=1<<4, eMaxY=1<<5, eMaxZ=1<<6, eAll=eMinX|eMinY|eMinZ|eMaxX|eMaxY|eMaxZ};
FbxUInt8 mMask;
FbxDouble3 mMin;
FbxDouble3 mMax;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
class FBXSDK_DLL FbxRotationOrder
{
public:
FbxRotationOrder(FbxEuler::EOrder pOrder=FbxEuler::eOrderXYZ);
FbxEuler::EOrder GetOrder() const;
void SetOrder(FbxEuler::EOrder pOrder);
void V2M(FbxAMatrix& pRM, const FbxVector4& pV);
void M2V(FbxVector4& pV, const FbxAMatrix& pRM);
bool V2VRef(FbxVector4& pVOut, const FbxVector4& pVIn, const FbxVector4& pVRef);
private:
FbxEuler::EOrder mOrder;
};
/** Handle transform behaviors such as pivots, limits and offets, etc.
*/
class FBXSDK_DLL FbxTransform
{
public:
enum EInheritType {eInheritRrSs, eInheritRSrs, eInheritRrs};
FbxTransform();
EInheritType GetInheritType() const;
void SetInheritType(EInheritType pType);
FbxLimits& GetTranslationLimits();
FbxLimits& GetRotationLimits();
FbxLimits& GetScalingLimits();
FbxRotationOrder& GetRotationOrder();
bool HasROffset() const;
bool HasRPivot() const;
bool HasSOffset() const;
bool HasSPivot() const;
bool HasPreRM() const;
bool HasPostRM() const;
void SetROffset(const FbxVector4& pROffset);
void SetRPivot(const FbxVector4& pRPivot);
void SetSOffset(const FbxVector4& pSOffset);
void SetSPivot(const FbxVector4& pSPivot);
void SetPreRM(const FbxVector4& pPreR);
void SetPostRM(const FbxVector4& pPostR);
bool GetRotationSpaceForLimitOnly() const;
void SetRotationSpaceForLimitOnly(bool pRotationSpaceForLimitOnly);
void DoF2LT(FbxVector4& pLT, const FbxVector4& pDoF, const FbxAMatrix& pLRM, const FbxAMatrix& pLSM);
void LT2DoF(FbxVector4& pDoF, const FbxVector4& pLT, const FbxAMatrix& pLRM, const FbxAMatrix& pLSM);
void DoF2LRM(FbxAMatrix& pLRM, const FbxVector4& pRDoF, bool pForLimit=false);
void LRM2DoF(FbxVector4& pRDoF, const FbxAMatrix& pLRM, bool pForLimit=false);
void LSM2GSM(FbxAMatrix& pGSM, const FbxAMatrix& pPGSM, const FbxAMatrix& pLSM, const FbxAMatrix& pLRM, const FbxVector4& pPLS);
void GTRSM2GX(FbxAMatrix& pGX, const FbxVector4& pGT, const FbxAMatrix& pGRM, const FbxAMatrix& pGSM);
private:
void SumPivots(FbxVector4& pSum, const FbxAMatrix& pLRM, const FbxAMatrix& pLSM);
class RotationSpace
{
public:
enum EMask {eHasNothing=0, eHasPreRotM=1<<0, eHasPostRotM=1<<1};
RotationSpace();
bool HasPreRM() const;
bool HasPostRM() const;
void GetPreRM(FbxAMatrix& pPreRM) const;
void GetPostRM(FbxAMatrix& pPostRM) const;
void SetPreRM(const FbxVector4& pPreR);
void SetPostRM(const FbxVector4& pPostR);
void DoF2LRM(FbxAMatrix& pLRM, const FbxVector4& pRDoF);
void LRM2DoF(FbxVector4& pRDoF, const FbxAMatrix& pLRM);
FbxUInt8 mMask;
FbxAMatrix mPreRM;
FbxAMatrix mPostRM;
FbxRotationOrder mRotationOrder;
};
enum EMask {eHasNothing=0, eHasRotOffset=1<<0, eHasRotPivot=1<<1, eHasScaleOffset=1<<2, eHasScalePivot=1<<3};
FbxUInt8 mMask;
EInheritType mInheritType;
FbxVector4 mROffset;
FbxVector4 mRPivot;
FbxVector4 mSOffset;
FbxVector4 mSPivot;
FbxLimits mTranslationLimits;
FbxLimits mRotationLimits;
FbxLimits mScalingLimits;
bool mRotationSpaceForLimitOnly;
RotationSpace mRotationSpace;
};
FBXSDK_DLL bool FbxGetContinuousRotation(FbxVector4& pRes, const FbxVector4& pRot, const FbxVector4& pRef, const int* pOrder);
FBXSDK_DLL void FbxGetContinuousRotation(FbxVector4& pRes, const FbxVector4& pRot, const FbxVector4& pRef);
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_MATH_TRANSFORMS_H_ */

View File

@ -0,0 +1,259 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxvector2.h
#ifndef _FBXSDK_CORE_MATH_VECTOR_2_H_
#define _FBXSDK_CORE_MATH_VECTOR_2_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** A two double mathematic vector class.
* \nosubgrouping
*/
class FBXSDK_DLL FbxVector2 : public FbxDouble2
{
public:
/**
* \name Constructors and Destructor
*/
//@{
//! Constructor.
FbxVector2();
/** Copy constructor.
* \param pVector2 The vector copied to this one.
*/
FbxVector2(const FbxVector2& pVector2);
/** Constructor.
* \param pX X component.
* \param pY Y component.
*/
FbxVector2(double pX, double pY);
//@}
/**
* \name Access
*/
//@{
/** Assignment operation.
* \param pVector2 The vector assigned to this one.
* \return This vector after assignment.
*/
FbxVector2& operator=(const FbxVector2& pVector2);
/** Set vector.
* \param pX The X component value.
* \param pY The Y component value.
*/
void Set(double pX, double pY);
//@}
/**
* \name Scalar Operations
*/
//@{
/** Add a value to all vector components.
* \param pValue The value to add to each component of the vector.
* \return A new vector with the result of adding pValue to each component of this vector.
* \remarks The pValue parameter is not checked.
*/
FbxVector2 operator+(double pValue) const;
/** Subtract a value from all vector components.
* \param pValue The value to subtract from each component of the vector.
* \return A new vector with the result of subtracting pValue from each component of this vector.
* \remarks The pValue parameter is not checked.
*/
FbxVector2 operator-(double pValue) const;
/** Multiply a value to all vector components.
* \param pValue The value multiplying each component of the vector.
* \return A new vector with the result of multiplying each component of this vector by pValue.
* \remarks The pValue parameter is not checked.
*/
FbxVector2 operator*(double pValue) const;
/** Divide all vector components by a value.
* \param pValue The value dividing each component of the vector.
* \return A new vector with the result of dividing each component of this vector by pValue.
* \remarks The pValue parameter is not checked.
*/
FbxVector2 operator/(double pValue) const;
/** Add a value to all vector components.
* \param pValue The value to add to each component of the vector.
* \return The result of adding pValue to each component of this vector, replacing this vector.
* \remarks The pValue parameter is not checked.
*/
FbxVector2& operator+=(double pValue);
/** Subtract a value from all vector components.
* \param pValue The value to subtract from each component of the vector.
* \return The result of subtracting pValue from each component of this vector, replacing this vector.
* \remarks The pValue parameter is not checked.
*/
FbxVector2& operator-=(double pValue);
/** Multiply a value to all vector elements.
* \param pValue The value multiplying each component of the vector.
* \return The result of multiplying each component of this vector by pValue, replacing this vector.
* \remarks The pValue parameter is not checked.
*/
FbxVector2& operator*=(double pValue);
/** Divide all vector elements by a value.
* \param pValue The value dividing each component of the vector.
* \return The result of multiplying each component of this vector by pValue, replacing this vector.
* \remarks The pValue parameter is not checked.
*/
FbxVector2& operator/=(double pValue);
//@}
/**
* \name Vector Operations
*/
//@{
/** Unary minus operator.
* \return The vector that is the negation of \c this.
*/
FbxVector2 operator-() const;
/** Add two vectors together.
* \param pVector Vector to add.
* \return The result of this vector + pVector.
* \remarks The values in pVector are not checked.
*/
FbxVector2 operator+(const FbxVector2& pVector) const;
/** Subtract a vector from another vector.
* \param pVector Vector to subtract.
* \return The result of this vector - pVector.
* \remarks The values in pVector are not checked.
*/
FbxVector2 operator-(const FbxVector2& pVector) const;
/** Memberwise multiplication of two vectors.
* \param pVector Multiplying vector.
* \return The result of this vector * pVector.
* \remarks The values in pVector are not checked.
*/
FbxVector2 operator*(const FbxVector2& pVector) const;
/** Memberwise division of a vector with another vector.
* \param pVector Dividing vector.
* \return The result of this vector / pVector.
* \remarks The values in pVector are not checked.
*/
FbxVector2 operator/(const FbxVector2& pVector) const;
/** Add two vectors together.
* \param pVector Vector to add.
* \return The result of this vector + pVector, replacing this vector.
* \remarks The values in pVector are not checked.
*/
FbxVector2& operator+=(const FbxVector2& pVector);
/** Subtract a vector from another vector.
* \param pVector Vector to subtract.
* \return The result of this vector - pVector, replacing this vector.
* \remarks The values in pVector are not checked.
*/
FbxVector2& operator-=(const FbxVector2& pVector);
/** Memberwise multiplication of two vectors.
* \param pVector Multiplying vector.
* \return The result of this vector * pVector, replacing this vector.
* \remarks The values in pVector are not checked.
*/
FbxVector2& operator*=(const FbxVector2& pVector);
/** Memberwise division of a vector with another vector.
* \param pVector Dividing vector.
* \remarks The values in pVector are not checked.
* \return The result of this vector / pVector, replacing this vector.
* \remarks The values in pVector are not checked.
*/
FbxVector2& operator/=(const FbxVector2& pVector);
/** Calculate the dot product of two vectors.
* \param pVector The second vector.
* \return The dot product value.
*/
double DotProduct(const FbxVector2& pVector) const;
//@}
/**
* \name Boolean Operations
*/
//@{
/** Equivalence operator.
* \param pVector The vector to be compared to \e this.
* \return \c true if the two vectors are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c false otherwise.
*/
bool operator==(const FbxVector2 & pVector) const;
/** Non-equivalence operator.
* \param pVector The vector to be compared to \e this.
* \return \c false if the two vectors are equal (each element is within a FBXSDK_TOLERANCE tolerance), \c true otherwise.
*/
bool operator!=(const FbxVector2 & pVector) const;
//@}
/**
* \name Length
*/
//@{
/** Get the vector's length.
* \return The mathematical length of the vector.
*/
double Length() const;
/** Get the vector's length squared.
* \return The mathematical square length of the vector.
*/
double SquareLength() const;
/** Find the distance between 2 vectors.
* \param pVector The second vector.
* \return The mathematical distance between the two vectors.
*/
double Distance(const FbxVector2& pVector) const;
//! Normalize the vector, length set to 1.
void Normalize();
//@}
/**
* \name Casting
*/
//@{
//! Cast the vector in a double pointer.
operator double* ();
//! Cast the vector in a const double pointer.
operator const double* () const;
//@}
/** Find out if the vector is equal to zero.
* \param pSize The number of element to test, starting at beginning. Value must range between [1, 2].
* \return \c true if all elements of the vector are zero, \c false otherwise. */
bool IsZero(int pSize=2) const;
// Fix value like 1.#IND, 1.#INF, nan, and inf
void FixIncorrectValue();
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_MATH_VECTOR_2_H_ */

View File

@ -0,0 +1,324 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxvector4.h
#ifndef _FBXSDK_CORE_MATH_VECTOR_4_H_
#define _FBXSDK_CORE_MATH_VECTOR_4_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxQuaternion;
/** A four double mathematic vector class.
* \nosubgrouping
*/
class FBXSDK_DLL FbxVector4 : public FbxDouble4
{
public:
/**
* \name Constructors and Destructor
*/
//@{
//! Constructor.
FbxVector4();
/** Copy constructor.
* \param pVector4 The vector copied to this one.
*/
FbxVector4(const FbxVector4& pVector4);
/** Constructor.
* \param pX X component.
* \param pY Y component.
* \param pZ Z component.
* \param pW W component.
*/
FbxVector4(double pX, double pY, double pZ, double pW=1.0);
/** Constructor.
* \param pValue X,Y,Z,W components.
*/
FbxVector4(const double pValue[4]);
/** Constructor.
* \param pValue X,Y,Z components.
* \remarks The fourth component of this object is assigned 1.
*/
FbxVector4(const FbxDouble3& pValue);
//@}
/**
* \name Access
*/
//@{
/** Assignment operation.
* \param pVector4 The vector assigned to this one.
* \return This vector after assignment.
*/
FbxVector4& operator=(const FbxVector4& pVector4);
/** Assignment operation.
* \param pValue The pointer to an array whose elements are assigned to this vector.
* \return This vector after assignment.
*/
FbxVector4& operator=(const double* pValue);
/** Assignment operation.
* \param pValue The vector with 3 elements assigned to this vector.
* \return This vector after assignment.
* \remarks The first three elements are assigned with pValue. The fourth element is set as 1.0
*/
FbxVector4& operator=(const FbxDouble3& pValue);
/** Set vector.
* \param pX The X component value.
* \param pY The Y component value.
* \param pZ The Z component value.
* \param pW The W component value.
*/
void Set(double pX, double pY, double pZ, double pW=1.0);
//@}
/**
* \name Scalar Operations
*/
//@{
/** Add a value to all vector components.
* \param pValue The value to add to each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxVector4 operator+(double pValue) const;
/** Subtract a value from all vector components.
* \param pValue The value to subtract from each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxVector4 operator-(double pValue) const;
/** Multiply a value to all vector components.
* \param pValue The value multiplying each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxVector4 operator*(double pValue) const;
/** Divide all vector components by a value.
* \param pValue The value dividing each component of the vector.
* \return New vector.
* \remarks The passed value is not checked.
*/
FbxVector4 operator/(double pValue) const;
/** Add a value to all vector components.
* \param pValue The value to add to each component of the vector.
* \return \e this updated with the operation result.
* \remarks The passed value is not checked.
*/
FbxVector4& operator+=(double pValue);
/** Subtract a value from all vector components.
* \param pValue The value to subtract from each component of the vector.
* \return \e this updated with the operation result.
* \remarks The passed value is not checked.
*/
FbxVector4& operator-=(double pValue);
/** Multiply a value to all vector elements.
* \param pValue The value multiplying each component of the vector.
* \return \e this updated with the operation result.
* \remarks The passed value is not checked.
*/
FbxVector4& operator*=(double pValue);
/** Divide all vector elements by a value.
* \param pValue The value dividing each component of the vector.
* \return \e this updated with the operation result.
* \remarks The passed value is not checked.
*/
FbxVector4& operator/=(double pValue);
//@}
/**
* \name Vector Operations
*/
//@{
/** Unary minus operator.
* \return The vector that is the negation of \c this.
*/
FbxVector4 operator-() const;
/** Add two vectors together.
* \param pVector Vector to add.
* \return The vector v' = this + pVector.
* \remarks The values in pVector are not checked.
*/
FbxVector4 operator+(const FbxVector4& pVector) const;
/** Subtract a vector from another vector.
* \param pVector Vector to subtract.
* \return The vector v' = this - pVector.
* \remarks The values in pVector are not checked.
*/
FbxVector4 operator-(const FbxVector4& pVector) const;
/** Memberwise multiplication of two vectors.
* \param pVector Multiplying vector.
* \return The vector v' = this * pVector.
* \remarks The values in pVector are not checked.
*/
FbxVector4 operator*(const FbxVector4& pVector) const;
/** Memberwise division of a vector with another vector.
* \param pVector Dividing vector.
* \return The vector v[i]' = this[i] / pVector[i].
* \remarks The values in pVector are not checked.
*/
FbxVector4 operator/(const FbxVector4& pVector) const;
/** Add two vectors together.
* \param pVector Vector to add.
* \return \e this updated with the operation result.
* \remarks The values in pVector are not checked.
*/
FbxVector4& operator+=(const FbxVector4& pVector);
/** Subtract a vector from another vector.
* \param pVector Vector to subtract.
* \return \e this updated with the operation result.
* \remarks The values in pVector are not checked.
*/
FbxVector4& operator-=(const FbxVector4& pVector);
/** Memberwise multiplication of two vectors.
* \param pVector Multiplying vector.
* \return \e this updated with the operation result.
* \remarks The values in pVector are not checked.
*/
FbxVector4& operator*=(const FbxVector4& pVector);
/** Memberwise division of a vector with another vector.
* \param pVector Dividing vector.
* \return \e this updated with the operation result.
* \remarks The values in pVector are not checked.
*/
FbxVector4& operator/=(const FbxVector4& pVector);
/** Calculate the dot product of two vectors.
* \param pVector The second vector.
* \return The dot product value.
* \remarks Being considered as a XYZ vector with a weight, only the 3 first elements are considered in this operation.
*/
double DotProduct(const FbxVector4& pVector) const;
/** Calculate the cross product of two vectors.
* \param pVector The second vector.
* \return The cross product vector.
* \remarks Being considered as a XYZ vector with a weight, only the first 3 elements are considered in this operation.
*/
FbxVector4 CrossProduct(const FbxVector4& pVector) const;
/** Calculate the Euler rotation required to align axis pAB-pA on pAB-pB.
* \param pAB The intersection of the 2 axis.
* \param pA A point on axis to be aligned.
* \param pB A point on reference axis.
* \param pAngles Resulting euler angles.
* \return \c true on success.
* \remarks Being considered as a XYZ vector with a weight, only the first 3 elements are considered in this operation.
*/
static bool AxisAlignmentInEulerAngle(const FbxVector4& pAB, const FbxVector4& pA, const FbxVector4& pB, FbxVector4& pAngles);
//@}
/**
* \name Boolean Operations
*/
//@{
/** Equivalence operator.
* \param pVector The vector to be compared to \e this.
* \return \c true if the two vectors are equal (each element is within a FBXSDK_TOLERANCE tolerance) and \c false otherwise.
*/
bool operator==(const FbxVector4 & pVector) const;
/** Non equivalence operator.
* \param pVector The vector to be compared to \e this.
* \return \c false if the two vectors are equal (each element is within a FBXSDK_TOLERANCE tolerance) and \c true otherwise.
*/
bool operator!=(const FbxVector4 & pVector) const;
//@}
/**
* \name Length
*/
//@{
/** Get the vector's length.
* \return The mathematical length of the vector.
* \remarks Being considered as a XYZ vector with a weight, only the first 3 elements are considered in this operation.
*/
double Length() const;
/** Get the vector's length squared.
* \return The mathematical square length of the vector.
* \remarks Being considered as a XYZ vector with a weight, only the first 3 elements are considered in this operation.
*/
double SquareLength() const;
/** Find the distance between 2 vectors.
* \param pVector The second vector.
* \return The mathematical distance between the two vectors.
* \remarks Being considered as a XYZ vector with a weight, only the 3 first elements are considered in this operation.
*/
double Distance(const FbxVector4& pVector) const;
/** Normalize the vector, length set to 1.
* \remarks Being considered as a XYZ vector with a weight, only the first 3 elements are considered in this operation.
*/
void Normalize();
/** Set the Euler XYZ from a Quaternion.
*\param pQuat Quaternion from which Euler XYZ information is got.
*/
void SetXYZ(const FbxQuaternion pQuat);
//@}
/**
* \name Casting
*/
//@{
//! Cast the vector in a double pointer.
operator double* ();
//! Cast the vector in a const double pointer.
operator const double* () const;
//@}
/** Find out if the vector is equal to zero.
* \param pSize The number of element to test, starting at beginning. Value must range between [1, 4].
* \return \c true if all elements of the vector are zero, \c false otherwise. */
bool IsZero(int pSize=4) const;
// Fix value like 1.#IND, 1.#INF, nan, and inf
void FixIncorrectValue();
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
int Compare(const FbxVector4& pV, const double pThreshold=FBXSDK_TOLERANCE) const;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_CORE_MATH_VECTOR_4_H_ */

View File

@ -0,0 +1,58 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxatomic.h
#ifndef _FBXSDK_CORE_SYNC_ATOMIC_H_
#define _FBXSDK_CORE_SYNC_ATOMIC_H_
#include <fbxsdk/fbxsdk_def.h>
#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
#include <fbxsdk/fbxsdk_nsbegin.h>
class FBXSDK_DLL FbxAtomOp
{
public:
static void Inc(volatile FbxAtomic* pPtr);
static void Dec(volatile FbxAtomic* pPtr);
static bool Add(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static bool Sub(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static bool And(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static bool Or(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static bool Nand(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static bool Xor(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static bool CompareAndSwap(volatile FbxAtomic* pPtr, FbxAtomic pOld, FbxAtomic pSwap);
static FbxAtomic TestAndSet(volatile FbxAtomic* pPtr);
static FbxAtomic FetchAndSwap(volatile FbxAtomic* pPtr, FbxAtomic pSwap);
static FbxAtomic FetchAndInc(volatile FbxAtomic* pPtr);
static FbxAtomic FetchAndDec(volatile FbxAtomic* pPtr);
static FbxAtomic FetchAndAdd(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic FetchAndSub(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic FetchAndOr(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic FetchAndAnd(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic FetchAndXor(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic FetchAndNand(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic IncAndFetch(volatile FbxAtomic* pPtr);
static FbxAtomic DecAndFetch(volatile FbxAtomic* pPtr);
static FbxAtomic AddAndFetch(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic SubAndFetch(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic OrAndFetch(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic AndAndFetch(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic XorAndFetch(volatile FbxAtomic* pPtr, FbxAtomic pVal);
static FbxAtomic NandAndFetch(volatile FbxAtomic* pPtr, FbxAtomic pVal);
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE && !FBXSDK_ENV_EMSCRIPTEN */
#endif /* _FBXSDK_CORE_SYNC_ATOMIC_H_ */

View File

@ -0,0 +1,44 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxclock.h
#ifndef _FBXSDK_CORE_SYNC_CLOCK_H_
#define _FBXSDK_CORE_SYNC_CLOCK_H_
#include <fbxsdk/fbxsdk_def.h>
#ifndef FBXSDK_ENV_WINSTORE
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Put the current thread to sleep.
* \param pMilliseconds The duration of the sleep in milli-seconds.
*/
FBXSDK_DLL void FbxSleep(int pMilliseconds);
/** Retrieves the current value of the high-resolution performance counter.
* \return The current value of the high-resolution performance counter, in "counts".
* \remarks To convert "counts" into time, divide it by the frequency available from FbxGetHighResFrequency().
*/
FBXSDK_DLL FbxLongLong FbxGetHighResCounter();
/** Retrieves the frequency of the high-resolution performance counter.
* \return The frequency of the high-resolution performance counter value, in "counts" per second.
* \remarks The first time this function is called, the frequency is queried from the system and then cached
* so that further requests are fast. This means it is guaranteed to not change during run-time.
*/
FBXSDK_DLL FbxLongLong FbxGetHighResFrequency();
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE */
#endif /* _FBXSDK_CORE_SYNC_CLOCK_H_ */

View File

@ -0,0 +1,188 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxsync.h
#ifndef _FBXSDK_CORE_SYNC_H_
#define _FBXSDK_CORE_SYNC_H_
#include <fbxsdk/fbxsdk_def.h>
#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
#include <fbxsdk/core/sync/fbxclock.h>
#include <fbxsdk/core/sync/fbxthread.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxMutexImpl;
class FbxSemaphoreImpl;
class FbxGateImpl;
/** A spinlock is the fastest and most simple thread lock mechanism available.
* It is very efficient since it does not use any operating system calls; it is only a test and set on an atomic variable,
* thus it is the fastest thread lock available. Spinlocks are efficient if threads are only likely to be blocked for a
* short period of time, as they avoid overhead from operating system process re-scheduling or context switching. However,
* spinlocks become wasteful if held for longer durations, both preventing other threads from running and requiring
* re-scheduling.
* \note Spinlocks does not support recursive locking. A thread attempting to lock the same spinlock twice will wait
* indefinitely.
*/
class FBXSDK_DLL FbxSpinLock
{
public:
FbxSpinLock();
/** Acquire the lock; thread will wait indefinitely until it is available. */
void Acquire();
/** Release the lock; this will allow other threads to acquire the lock if they are waiting. */
void Release();
private:
FbxAtomic mSpinLock;
};
/** Mutually excluding thread lock mechanism.
* While the mutex is a much heavier implementation than a spinlock, it supports recursive locking; the same thread
* can safely lock the same mutex more than once without blocking. But it will have to be released as many times as
* it as been acquired before other threads can acquire the context. It is sometimes referred as a critical section.
* This is the heaviest thread lock implementation, but also the most secure.
*/
class FBXSDK_DLL FbxMutex
{
public:
/** Constructor
* \param pInitialOwnership If pInitialOwnership is true, the lock will be initialized as being locked by the
* current thread.
*/
FbxMutex(bool pInitialOwnership=false);
virtual ~FbxMutex(); //!< Destructor
/** Acquire the lock; thread will wait indefinitely until it is available.
* \remarks The same thread can acquire the lock multiple times without blocking.
*/
void Acquire();
/** Try acquiring the lock; thread will not wait if it is not available.
* \param pRetryCount The number of retries in case the lock is not available.
* \return True if the lock is acquired, false otherwise.
* \remarks The same thread can acquire the lock multiple times without blocking.
*/
bool TryAcquire(unsigned int pRetryCount);
/** Release the lock; this will allow other threads to acquire the lock if they are waiting.
* \remarks Only the owner thread should call Release(), and it needs to be released as many times as it was
* acquired.
*/
void Release();
private:
FbxMutexImpl* mImpl;
};
/** Mutually excluding thread waiting mechanism with a counter.
* Semaphore are generally used in situations when the current thread needs to wait for other threads before
* proceeding to the next step. In other words, that thread waits a number of signals from other threads. This
* is the best mechanism to use to synchronize threads since it doesn't require an heavy critical section.
*/
class FBXSDK_DLL FbxSemaphore
{
public:
FbxSemaphore(); //!< Constructor
virtual ~FbxSemaphore(); //!< Destructor
/** Wait indefinitely until the semaphore as been signaled as many times as specified.
* \param pCount Number of signal to wait before this function returns.
* \return True if the wait exit without errors.
* \remarks If pCount is set to zero, this function returns immediately without waiting.
*/
bool Wait(unsigned int pCount=1);
/** Signal the semaphore as many times as specified.
* \param pCount The number of signal to send to the semaphore.
* \return True if the semaphore was signaled without errors.
*/
bool Signal(unsigned int pCount=1);
private:
FbxSemaphoreImpl* mImpl;
};
/** A gate thread locking mechanism is very similar to a semaphore, except that when it is opened, any
* further call to wait will not wait until it is closed. It is generally used to block multiple threads
* until one of them open the gate to release them all.
*/
class FBXSDK_DLL FbxGate
{
public:
FbxGate(); //!< Constructor
virtual ~FbxGate(); //!< Destructor
/** Open the gate to release all threads waiting.
* \remarks All waiting threads will unblock until the gate is closed.
*/
void Open();
/** Close the gate so that the next time a thread call Wait() it will be blocked. */
void Close();
/** Check if the gate is open.
* \return True if the gate is open, otherwise false.
*/
bool IsOpen();
/** Wait indefinitely until the gate open.
* \return True if the wait completed without errors.
* \remarks If the gate is already open, this function returns immediately.
*/
bool Wait();
private:
FbxGateImpl* mImpl;
};
/** A simple stack of linked items that is multi-thread safe, protected by a spinlock.
*/
class FBXSDK_DLL FbxSyncStack
{
public:
//! A single link item to be used to construct the stack
struct Item
{
Item* mNext;
inline Item(){ mNext = NULL; }
inline Item* Set(Item* pNext){ return mNext = pNext; }
inline Item* Next(){ return mNext; }
};
//! Constructor
FbxSyncStack();
/** Add an item on the top of the stack.
* \param pItem The item to add on top of the stack.
*/
void Push(Item* pItem);
/** Remove the item on the top of the stack.
* \return Returns the item on top of the stack, otherwise NULL if stack empty.
*/
Item* Pop();
private:
FbxSpinLock mLock;
Item* mTop;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE && !FBXSDK_ENV_EMSCRIPTEN */
#endif /* _FBXSDK_CORE_SYNC_H_ */

View File

@ -0,0 +1,99 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxthread.h
#ifndef _FBXSDK_CORE_SYNC_THREAD_H_
#define _FBXSDK_CORE_SYNC_THREAD_H_
#include <fbxsdk/fbxsdk_def.h>
#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxThreadImpl;
//! Definition of a thread procedure function signature.
typedef void (*FbxThreadProc)(void*);
/** This class implement a standard way to use threads across platforms.
*/
class FBXSDK_DLL FbxThread
{
public:
enum EState {eUnknown, eRunning, eDead};
enum EPriority {eNone, eIdle, eLowest, eLow, eNormal, eHigh, eHighest, eRealTime};
/** Constructor
* \param pProc The procedure called upon thread startup.
* \param pArg The arguments passed to the procedure.
* \param pSuspend Start the thread suspended.
*/
FbxThread(FbxThreadProc pProc, void* pArg, bool pSuspend=false);
/** Constructor
* \param pProc The procedure called upon thread startup.
* \param pArg The arguments passed to the procedure.
* \param pPriority The thread priority to set upon creation.
* \param pSuspend Start the thread suspended.
*/
FbxThread(FbxThreadProc pProc, void* pArg, EPriority pPriority, bool pSuspend=false);
//! Destructor
virtual ~FbxThread();
/** Suspend the execution of the thread.
* \return Return true if the thread was successfully suspended, otherwise false.
* \remarks It should be used only if you can control where the thread will be suspended in its procedure,
* otherwise the state of the thread and its memory is unknown, since the code will stop anywhere.
*/
bool Suspend();
/** Resume the execution of the thread.
* \return Return true if the thread was successfully resumed, otherwise false.
*/
bool Resume();
/** Wait for the thread completion.
* \return True if the thread successfully returned from its procedure.
*/
bool Join();
/** Do not wait for the thread completion and terminate it.
* \return True if the thread successfully died.
*/
bool Kill();
/** Retrieve the priority of the thread.
* \return The thread's priority.
*/
EPriority GetPriority();
/** Set the thread priority.
* \param pPriority The priority to set to this thread.
* \return True if the thread priority was successfully changed.
*/
bool SetPriority(EPriority pPriority);
/** Retrieve the thread current state.
* \return The state of the thread.
*/
EState GetState();
private:
FbxThreadImpl* mImpl;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* !FBXSDK_ENV_WINSTORE && !FBXSDK_ENV_EMSCRIPTEN */
#endif /* _FBXSDK_CORE_SYNC_THREAD_H_ */

View File

@ -0,0 +1,55 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
/** \file fbxsdk_def.h
* FBX SDK environment definition.
*
* This file is the principal FBX SDK environment definition. It is used at the top of
* every header and source file so that every unit is using the same definitions.
*/
#ifndef _FBXSDK_DEFINITION_H_
#define _FBXSDK_DEFINITION_H_
//---------------------------------------------------------------------------------------
//System Includes
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <wchar.h>
#include <locale.h>
#include <float.h>
#include <math.h>
#include <time.h>
//---------------------------------------------------------------------------------------
//Define Version and Namespace
#include <fbxsdk/fbxsdk_version.h>
//---------------------------------------------------------------------------------------
//Define Architecture
#include <fbxsdk/core/arch/fbxarch.h>
#include <fbxsdk/core/arch/fbxtypes.h>
#include <fbxsdk/core/arch/fbxdebug.h>
#include <fbxsdk/core/arch/fbxalloc.h>
#include <fbxsdk/core/arch/fbxnew.h>
#include <fbxsdk/core/arch/fbxstdcompliant.h>
//---------------------------------------------------------------------------------------
//Useful Macros
#define FBX_SAFE_DELETE(p) {FbxDelete(p);(p)=NULL;}
#define FBX_SAFE_DELETE_ARRAY(a) {FbxDeleteArray(a);(a)=NULL;}
#define FBX_SAFE_DESTROY(p) if(p){(p)->Destroy();(p)=NULL;}
#define FBX_SAFE_FREE(p) if(p){FbxFree(p);(p)=NULL;}
#endif /* _FBXSDK_DEFINITION_H_ */

View File

@ -0,0 +1,17 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxsdk_nsbegin.h
#include <fbxsdk/fbxsdk_version.h>
#if FBXSDK_DEFINE_NAMESPACE == 1
namespace FBXSDK_NAMESPACE {
#endif

View File

@ -0,0 +1,16 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxsdk_nsend.h
#if FBXSDK_DEFINE_NAMESPACE == 1
}
#endif

View File

@ -0,0 +1,57 @@
/****************************************************************************************
Copyright (C) 2018 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
/** \file fbxsdk_version.h
* FBX SDK version definition.
*
* This file defines the version string and numbers for this release of the FBX SDK.
* \note This file should never be included directly, please include fbxsdk_def.h
* instead.
*/
#ifndef _FBXSDK_VERSION_H_
#define _FBXSDK_VERSION_H_
//FBX SDK version defines
#define FBXSDK_VERSION_MAJOR 2019 //<! Integer, version major number
#define FBXSDK_VERSION_MINOR 2 //<! Integer, version minor number
#define FBXSDK_VERSION_POINT 0 //<! Integer, version point number
#define FBXSDK_VERSION_NAME "Release" //<! String, version name, example: Alpha, Beta, RC, Release
#ifndef FBXSDK_VERSION_REVISION
#define FBXSDK_VERSION_REVISION 0 //<! Integer, version revision number, set by build environment. Do not edit here!
#endif
//FBX SDK version string macros
#define FBX_STRING(x) #x
#define FBX_STRINGIFY(x) FBX_STRING(x)
#if FBXSDK_VERSION_POINT == 0
#define FBXSDK_VER_TO_STR(a, b, c) FBX_STRING(a.b)
#else
#define FBXSDK_VER_TO_STR(a, b, c) FBX_STRING(a.b.c)
#endif
//FBX SDK version strings
#define FBXSDK_VERSION_STRING FBXSDK_VER_TO_STR(FBXSDK_VERSION_MAJOR, FBXSDK_VERSION_MINOR, FBXSDK_VERSION_POINT)
#define FBXSDK_VERSION_STRING_FULL FBXSDK_VERSION_STRING " " FBXSDK_VERSION_NAME " (" FBX_STRINGIFY(FBXSDK_VERSION_REVISION) ")"
//FBX SDK namespace definition
#ifndef FBXSDK_DEFINE_NAMESPACE
#define FBXSDK_DEFINE_NAMESPACE 1
#endif
#if FBXSDK_DEFINE_NAMESPACE == 1
#define FBXSDK_NAMESPACE fbxsdk
#else
#define FBXSDK_NAMESPACE
#endif
#endif /* _FBXSDK_VERSION_H_ */

View File

@ -0,0 +1,90 @@
/****************************************************************************************
Copyright (C) 2016 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxcolladaanimationelement.h
#ifndef _FBXSDK_FILEIO_COLLADA_ANIMATION_ELEMENT_H_
#define _FBXSDK_FILEIO_COLLADA_ANIMATION_ELEMENT_H_
#include <fbxsdk.h>
#include <fbxsdk/fileio/collada/fbxcolladaelement.h>
#include <map>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Representing a COLLADA animation element.
*/
class AnimationElement : public ElementBase
{
public:
typedef ElementBase base_type;
AnimationElement();
virtual ~AnimationElement();
/** Get the count of animation channels in the element.
* \return Return the channel count.
*/
int GetChannelCount() const;
/** Initialize with the content of a COLLADA element.
* This method should be called before ToFBX.
*/
bool FromCOLLADA(xmlNode * pElement, const SourceElementMapType & pSourceElements);
/** Initialize with an animation curve.
* This method should be called before ToCOLLADA.
* \param pCurve The specific animation curve.
* \param pUnitConversion The unit conversion for key value.
*/
bool FromFBX(const FbxAnimCurve * pCurve, double pUnitConversion = 1.0);
/** Copy the channel with specific index to the FBX animation curve.
* \param pFBXCurve The destination FBX animation curve.
* \param pChannelIndex The index of the source channel.
* \param pUnitConversion The unit conversion from local element to global.
*/
bool ToFBX(FbxAnimCurve * pFBXCurve, int pChannelIndex,
double pUnitConversion = 1.0) const;
/** Copy the matrix animation to the FBX node TRS properties.
* \param pFBXNode The destination FBX node.
* \param pAnimLayer The animation layer whose X, Y and Z curves will be set up.
* \param pUnitConversion The unit conversion from local element to global.
*/
bool ToFBX(FbxNode * pFBXNode, FbxAnimLayer * pAnimLayer,
double pUnitConversion = 1.0) const;
/** Add the content to COLLADA animation library.
* \param pAnimationLibrary The COLLADA animation library element.
* \param pNodeID The ID of the element to who this curve is belong.
* \param pAttributeSID The ID the attribute to who this curve is belong.
*/
bool ToCOLLADA(xmlNode * pAnimationLibrary, const char * pNodeID,
const char * pAttributeSID);
private:
int mKeyCount;
double * mInputArray;
double * mOutputArray;
int mOutputStride;
FbxString * mInterpolationArray;
int mInterpolationStride;
double * mInTangentArray;
int mInTangentStride;
double * mOutTangentArray;
int mOutTangentStride;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_COLLADA_ANIMATION_ELEMENT_H_ */

View File

@ -0,0 +1,275 @@
/****************************************************************************************
Copyright (C) 2016 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxcolladaelement.h
#ifndef _FBXSDK_FILEIO_COLLADA_ELEMENT_H_
#define _FBXSDK_FILEIO_COLLADA_ELEMENT_H_
#include <fbxsdk.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
// Utility functions to convert type to array tag used in COLLADA source element
template <typename T>
inline const FbxString TypeToArrayTag()
{
return COLLADA_FLOAT_ARRAY_STRUCTURE;
}
template <>
inline const FbxString TypeToArrayTag<bool>()
{
return COLLADA_BOOL_ARRAY_STRUCTURE;
}
template <>
inline const FbxString TypeToArrayTag<int>()
{
return COLLADA_INT_ARRAY_STRUCTURE;
}
template <>
inline const FbxString TypeToArrayTag<FbxString>()
{
return COLLADA_NAME_ARRAY_STRUCTURE;
}
// Utility functions to convert type to parameter tag used in COLLADA source element
template <typename T>
inline const FbxString TypeToParameterTag()
{
return COLLADA_FLOAT_TYPE;
}
template <>
inline const FbxString TypeToParameterTag<bool>()
{
return COLLADA_BOOL_TYPE;
}
template <>
inline const FbxString TypeToParameterTag<int>()
{
return COLLADA_INT_TYPE;
}
template <>
inline const FbxString TypeToParameterTag<FbxString>()
{
return COLLADA_NAME_TYPE;
}
//----------------------------------------------------------------------------//
/** A struct for convenient access to the content of common COLLADA element.
*/
struct ElementContentAccessor
{
ElementContentAccessor();
ElementContentAccessor(xmlNode * pElement);
virtual ~ElementContentAccessor();
template <typename TYPE>
bool GetNext(TYPE * pData)
{
return FromString(pData, mPointer, &mPointer);
}
template <typename TYPE>
int GetArray(TYPE * pArray, int pArraySize,
int pSourceUnitOffset = 0, int pSourceUnitValidCount = 1, int pSourceUnitSize = 1,
int pDestUnitOffset = 0, int pDestUnitValidCount = 1, int pDestUnitSize = 1,
TYPE pDefaultValue = TYPE())
{
if (pArray)
{
return FromStringToArray(mPointer, pArray, pArraySize,
pSourceUnitOffset, pSourceUnitValidCount, pSourceUnitSize,
pDestUnitOffset, pDestUnitValidCount, pDestUnitSize, pDefaultValue);
}
return 0;
}
xmlChar * mContent;
const char * mPointer;
};
//----------------------------------------------------------------------------//
/** A struct for convenient access to the content of COLLADA source element.
*/
template <typename TYPE>
struct SourceElementContentAccessor : public ElementContentAccessor
{
SourceElementContentAccessor(xmlNode * pSourceElement)
: mCount(0), mStride(1), mOffset(0)
{
bool lReadCount = true;
xmlNode* lTechniqueElement = DAE_FindChildElementByTag(pSourceElement, COLLADA_TECHNIQUE_COMMON_ELEMENT);
if (lTechniqueElement)
{
xmlNode* lAccessorElement = DAE_FindChildElementByTag(lTechniqueElement, COLLADA_ACCESSOR_STRUCTURE);
if (lAccessorElement)
{
DAE_GetElementAttributeValue(lAccessorElement, COLLADA_COUNT_PROPERTY, mCount);
DAE_GetElementAttributeValue(lAccessorElement, COLLADA_STRIDE_PROPERTY, mStride);
DAE_GetElementAttributeValue(lAccessorElement, COLLADA_OFFSET_PROPERTY, mOffset);
}
lReadCount = false;
}
xmlNode * lDataArrayElement = DAE_FindChildElementByTag(pSourceElement, TypeToArrayTag<TYPE>());
// Some COLLADA exporters use IDREF_array instead of Name_array
if (!lDataArrayElement && TypeToArrayTag<TYPE>() == COLLADA_NAME_ARRAY_STRUCTURE)
lDataArrayElement = DAE_FindChildElementByTag(pSourceElement, COLLADA_IDREF_ARRAY_STRUCTURE);
FBX_ASSERT(lDataArrayElement);
if (lDataArrayElement && lReadCount)
DAE_GetElementAttributeValue(lDataArrayElement, COLLADA_COUNT_PROPERTY, mCount);
mContent = xmlNodeGetContent(lDataArrayElement);
mPointer = (const char *)mContent;
}
int mCount;
int mStride;
int mOffset;
};
//----------------------------------------------------------------------------//
/** Representing a common COLLADA element.
*/
class ElementBase
{
public:
enum
{
MATRIX_STRIDE = 16,
};
// The name of user property in FBX which is used to preserve the ID of COLLADA element
static const char* smID_PROPERTY_NAME;
/** Constructor & Destructor.
*/
ElementBase();
virtual ~ElementBase();
/** Access for XML element.
*/
void SetXMLElement(xmlNode * pElement) { mXMLElement = pElement; }
xmlNode * GetXMLElement() const { return mXMLElement; }
/** Get the ID of the element.
* \return Return the ID string.
*/
const FbxString & GetID() const;
/** Get the unit of the element,
* which takes effect in this element and its children elements.
* \return Return the unit.
*/
const FbxSystemUnit * GetUnit() const;
private:
xmlNode * mXMLElement;
mutable FbxString * mID;
mutable FbxSystemUnit * mUnit;
};
/** Convert from ID to URL, just add a prefix "#".
* \param pID The ID string.
* \return Return the URL string.
*/
inline const FbxString URL(const FbxString & pID)
{
return FbxString("#") + pID;
}
/** Convert the array data to a source element under specific parent element.
* \param pParentElement The parent element.
* \param pID The ID of the new source element.
* \param pData The array data.
* \param pCount The length of the array.
* \param pStride The stride of each unit in the array. For example, when you
* export an array of FbxDouble3 of size 10, you convert it to a double array
* of size 30 with a stride 3 and call this method.
* \return The new source element.
*/
template <typename T>
xmlNode * AddSourceElement(xmlNode * pParentElement, const char * pID,
const T * pData, int pCount, int pStride = 1)
{
FBX_ASSERT(pParentElement && pData);
if (!pParentElement || !pData)
return NULL;
xmlNode * lSourceElement = DAE_AddChildElement(pParentElement, COLLADA_SOURCE_STRUCTURE);
DAE_AddAttribute(lSourceElement, COLLADA_ID_PROPERTY, pID);
FbxString lContent;
const int lDataCount = pCount * pStride;
for (int lIndex = 0; lIndex < lDataCount; ++lIndex)
{
lContent += ToString(pData[lIndex]);
if (lIndex != lDataCount - 1)
lContent += " ";
}
const FbxString lArrayID = FbxString(pID) + "-array";
xmlNode * lArrayElement = DAE_AddChildElement(lSourceElement, TypeToArrayTag<T>(), lContent);
DAE_AddAttribute(lArrayElement, COLLADA_ID_PROPERTY, lArrayID);
DAE_AddAttribute(lArrayElement, COLLADA_COUNT_PROPERTY, lDataCount);
xmlNode * lTechniqueCommonElement = DAE_AddChildElement(lSourceElement,
COLLADA_TECHNIQUE_COMMON_ELEMENT);
xmlNode * lAccessElement = DAE_AddChildElement(lTechniqueCommonElement,
COLLADA_ACCESSOR_STRUCTURE);
DAE_AddAttribute(lAccessElement, COLLADA_SOURCE_PROPERTY, URL(lArrayID));
DAE_AddAttribute(lAccessElement, COLLADA_COUNT_PROPERTY, pCount);
DAE_AddAttribute(lAccessElement, COLLADA_STRIDE_PROPERTY, pStride);
for (int lStrideIndex = 0; lStrideIndex < pStride; ++lStrideIndex)
{
xmlNode * lParamElement = DAE_AddChildElement(lAccessElement, COLLADA_PARAMETER_STRUCTURE);
DAE_AddAttribute(lParamElement, COLLADA_TYPE_PROPERTY, TypeToParameterTag<T>());
}
return lSourceElement;
}
/** Populate the layer element with direct array and return index array for later use.
* \param pLayerElement The layer element to be populated.
* \param pSourceElement The source element containing the direct array data.
* \param pSize The count of double data of direct array element.
* \return Return the index array of the layer element.
*/
template <typename TYPE> FbxLayerElementArray * PopulateLayerElementDirectArray(FbxLayerElement * pLayerElement, xmlNode * pSourceElement, int pSize)
{
SourceElementContentAccessor<TYPE> lSourceElementAccessor(pSourceElement);
FbxLayerElementTemplate<TYPE> * lLayerElement = (FbxLayerElementTemplate<TYPE> *)pLayerElement;
lLayerElement->SetMappingMode(FbxLayerElement::eByPolygonVertex);
lLayerElement->SetReferenceMode(FbxLayerElement::eIndexToDirect);
lLayerElement->GetDirectArray().SetCount(lSourceElementAccessor.mCount);
TYPE * lArray = NULL;
lArray = lLayerElement->GetDirectArray().GetLocked(lArray);
lSourceElementAccessor.GetArray((double *)lArray, lSourceElementAccessor.mCount*pSize, 0, pSize,
lSourceElementAccessor.mStride, 0, pSize, sizeof(TYPE)/sizeof(double), 1.0);
lLayerElement->GetDirectArray().Release(&lArray, lArray);
return &(lLayerElement->GetIndexArray());
}
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_COLLADA_ELEMENT_H_ */

View File

@ -0,0 +1,133 @@
/****************************************************************************************
Copyright (C) 2017 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxcolladaiostream.h
#ifndef _FBXSDK_FILEIO_COLLADA_IO_STREAM_H_
#define _FBXSDK_FILEIO_COLLADA_IO_STREAM_H_
#include <fbxsdk.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
//----------------------------------------------------------------------------//
/** Convert part of the source string into destination type.
* \param pDest The destination with a specific type.
* \param pSourceBegin The begin of the source string.
* \param pSourceEnd Return the end of the part of the source string.
* \return Return \c true on success and \c false if else.
*/
template <typename T> bool FromString(T * pDest, const char * pSourceBegin, const char ** pSourceEnd = NULL);
template <> bool FromString(int * pDest, const char * pSourceBegin, const char ** pSourceEnd);
template <> bool FromString(double * pDest, const char * pSourceBegin, const char ** pSourceEnd);
template <> bool FromString(FbxString * pDest, const char * pSourceBegin, const char ** pSourceEnd);
template <> bool FromString(FbxDouble2 * pDest, const char * pSourceBegin, const char ** pSourceEnd);
template <> bool FromString(FbxDouble3 * pDest, const char * pSourceBegin, const char ** pSourceEnd);
template <> bool FromString(FbxDouble4 * pDest, const char * pSourceBegin, const char ** pSourceEnd);
template <> bool FromString(FbxVector4 * pDest, const char * pSourceBegin, const char ** pSourceEnd);
template <> bool FromString(FbxAMatrix * pDest, const char * pSourceBegin, const char ** pSourceEnd);
template <> bool FromString(FbxAMatrix * pDest, const char * pSourceBegin, const char ** pSourceEnd);
/** Parse the string into an array.
* The source string is made up with many groups and each group contains pSourceGroupSize units separated by spaces;
* The destination array is also made up with many groups and each unit contains pDestGroupSize units.
* The valid unit range in each source group is [pSourceUnitOffset, pSourceUnitOffset + pSourceValidUnitCount).
* The valid unit range in each destination unit is [pDestUnitOffset, pDestUnitOffset + pDestValidUnitCount).
* The units in invalid range of destination is set to a default value.
*/
template <typename TYPE> int FromStringToArray(const char * pString, TYPE * pArray, int pArraySize, int pSourceUnitOffset, int pSourceValidUnitCount, int pSourceGroupSize, int pDestUnitOffset, int pDestValidUnitCount, int pDestGroupSize, TYPE pDefaultValue = TYPE())
{
if (pString == 0 || pArray == 0)
return 0;
FBX_ASSERT(pSourceUnitOffset >= 0 && pSourceUnitOffset < pSourceGroupSize);
FBX_ASSERT(pSourceValidUnitCount >= 0 && pSourceUnitOffset + pSourceValidUnitCount <= pSourceGroupSize);
FBX_ASSERT(pDestUnitOffset >= 0 && pDestUnitOffset < pDestGroupSize);
FBX_ASSERT(pDestValidUnitCount >= 0 && pDestUnitOffset + pDestValidUnitCount <= pDestGroupSize);
const char * lSource = pString;
TYPE * lDest = pArray;
int lReadCount = 0;
int lSourceCounter = 0;
int lDestCounter = 0;
const int lSourceUnitValidEnd = pSourceUnitOffset + pSourceValidUnitCount;
const int lDestUnitGap = pDestGroupSize - pDestValidUnitCount - pDestUnitOffset;
while (lSource && *lSource)
{
TYPE lData;
const char * lSourceStart = lSource;
if (FromString(&lData, lSource, &lSource) && lSourceCounter >= pSourceUnitOffset && lSourceCounter < lSourceUnitValidEnd)
{
if (lReadCount >= pArraySize)
{
// we are trying to write past the allocated buffer
return 0;
}
if (lDestCounter == 0)
{
for (int lIndex = 0; lIndex < pDestUnitOffset; ++lIndex)
*(lDest++) = pDefaultValue;
}
*lDest++ = lData;
++lReadCount;
++lDestCounter;
if (lDestCounter == pDestValidUnitCount)
{
lDestCounter = 0;
for (int lIndex = 0; lIndex < lDestUnitGap; ++lIndex)
*lDest++ = pDefaultValue;
}
}
else
{
// we met a stop condition of FromString. In the normal case, lSource should now be "" or ' '. If not,
// the converted string is corrupted and we have to break the loop. We can detect this by checking
// if lSource pointer has moved.
if (lSource == lSourceStart)
{
break;
}
}
++lSourceCounter;
if (lSourceCounter == pSourceGroupSize)
lSourceCounter = 0;
}
return lReadCount;
}
//----------------------------------------------------------------------------//
template <typename T>
const FbxString ToString(const T & pValue)
{
return FbxString(pValue);
}
template <>
const FbxString ToString(const FbxVector4 & pValue);
template <>
const FbxString ToString(const FbxAMatrix & pValue);
//----------------------------------------------------------------------------//
/** Decode percent encoded characters, returns an empty string if there's an error.
* For example, a string like "abc%20abc" is converted into "abc abc".
* \param pEncodedString The percent encoded string.
* \return The decoded string.
*/
const FbxString DecodePercentEncoding(const FbxString & pEncodedString);
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_COLLADA_IO_STREAM_H_ */

View File

@ -0,0 +1,71 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxcolladanamespace.h
#ifndef _FBXSDK_FILEIO_COLLADA_NAMESPACE_H_
#define _FBXSDK_FILEIO_COLLADA_NAMESPACE_H_
#include <fbxsdk.h>
#include <libxml/globals.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Containing the valid parameter definition and modification in local scope.
*/
struct FbxColladaNamespace
{
public:
/** Push the newparam and setparam elements found in this element.
* Call this method at the beginning of importing an element.
* \param pElement The specific element.
*/
void Push(xmlNode * pElement);
/** Pop the newparam and setparam elements found in this element.
* Call this method at the end of importing an element.
*/
void Pop();
/** Find the specific newparam element with given SID.
* \param pSID The given SID.
* \return Return the found element or NULL if fail.
*/
xmlNode * FindParamDefinition(const char * pSID) const;
/** Find the specific setparam element with given SID.
* \param pSID The given SID.
* \return Return the found element or NULL if fail.
*/
xmlNode * FindParamModification(const char * pSID) const;
/** Get the count of all the setparam elements in local scope.
* \return The count.
*/
int GetParamModificationCount() const;
/** Get the setparam element with given index.
* \param pIndex The given index.
* \return The element.
*/
xmlNode * GetParamModification(int pIndex) const;
private:
FbxArray<xmlNode*> mParamDefinition;
FbxArray<int> mParamDefinitionCount;
FbxArray<xmlNode*> mParamModification;
FbxArray<int> mParamModificationCount;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_COLLADA_NAMESPACE_H_ */

View File

@ -0,0 +1,472 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxcolladatokens.h
#ifndef _FBXSDK_FILEIO_COLLADA_TOKENS_H_
#define _FBXSDK_FILEIO_COLLADA_TOKENS_H_
#define XML_STR (const xmlChar*)
// In COLLADA, 1 means total control, while 100 means total control in FBX.
const int COLLADA_MORPH_WEIGHT_TO_FBX_RATIO = 100;
#define COLLADA_VERSION_PROPERTY "version"
#define COLLADA_VERSION "1.4.1"
#define COLLADA_SCHEMA "http://www.collada.org/2005/11/COLLADASchema"
// COLLADA 1.4 elements
#define COLLADA_LIBRARY_ANIMATION_ELEMENT "library_animations"
#define COLLADA_LIBRARY_ANIMATION_CLIP_ELEMENT "library_animation_clips"
#define COLLADA_LIBRARY_CAMERA_ELEMENT "library_cameras"
#define COLLADA_LIBRARY_CONTROLLER_ELEMENT "library_controllers"
#define COLLADA_LIBRARY_EFFECT_ELEMENT "library_effects"
#define COLLADA_LIBRARY_FFIELDS_ELEMENT "library_force_fields"
#define COLLADA_LIBRARY_GEOMETRY_ELEMENT "library_geometries"
#define COLLADA_LIBRARY_IMAGE_ELEMENT "library_images"
#define COLLADA_LIBRARY_LIGHT_ELEMENT "library_lights"
#define COLLADA_LIBRARY_MATERIAL_ELEMENT "library_materials"
#define COLLADA_LIBRARY_NODE_ELEMENT "library_nodes"
#define COLLADA_LIBRARY_PMATERIAL_ELEMENT "library_physics_materials"
#define COLLADA_LIBRARY_PMODEL_ELEMENT "library_physics_models"
#define COLLADA_LIBRARY_PSCENE_ELEMENT "library_physics_scenes"
#define COLLADA_LIBRARY_VSCENE_ELEMENT "library_visual_scenes"
#define COLLADA_INSTANCE_ANIMATION_ELEMENT "instance_animation"
#define COLLADA_INSTANCE_CAMERA_ELEMENT "instance_camera"
#define COLLADA_INSTANCE_CONTROLLER_ELEMENT "instance_controller"
#define COLLADA_INSTANCE_EFFECT_ELEMENT "instance_effect"
#define COLLADA_INSTANCE_GEOMETRY_ELEMENT "instance_geometry"
#define COLLADA_INSTANCE_LIGHT_ELEMENT "instance_light"
#define COLLADA_INSTANCE_NODE_ELEMENT "instance_node"
#define COLLADA_INSTANCE_VSCENE_ELEMENT "instance_visual_scene"
#define COLLADA_INSTANCE_PSCENE_ELEMENT "instance_physics_scene"
#define COLLADA_INSTANCE_MATERIAL_ELEMENT "instance_material"
#define COLLADA_ANIMCLIP_ELEMENT "animation_clip"
#define COLLADA_BINDMATERIAL_ELEMENT "bind_material"
#define COLLADA_EFFECT_ELEMENT "effect"
#define COLLADA_INITFROM_ELEMENT "init_from"
#define COLLADA_SAMPLER_ELEMENT "sampler"
#define COLLADA_SKELETON_ELEMENT "skeleton"
#define COLLADA_TARGETS_ELEMENT "targets"
#define COLLADA_TECHNIQUE_COMMON_ELEMENT "technique_common"
#define COLLADA_VSCENE_ELEMENT "visual_scene"
#define COLLADA_WEIGHTS_ELEMENT "vertex_weights"
#define COLLADA_VERTEXCOUNT_ELEMENT "vcount"
#define COLLADA_FX_PROFILE_COMMON_ELEMENT "profile_COMMON"
#define COLLADA_FX_PROFILE_CG_ELEMENT "profile_CG"
#define COLLADA_FX_PROFILE_HLSL_ELEMENT "profile_HLSL"
#define COLLADA_FX_PROFILE_GLSL_ELEMENT "profile_GLSL"
#define COLLADA_FX_PROFILE_GLES_ELEMENT "profile_GLES"
#define COLLADA_FXCMN_FLOAT_ELEMENT "float"
#define COLLADA_FXCMN_FLOAT4_ELEMENT "float4"
#define COLLADA_FXCMN_FLOAT4X4_ELEMENT "float4x4"
#define COLLADA_FXCMN_INCLUDE_ELEMENT "include"
#define COLLADA_FXCMN_SURFACE_ELEMENT "surface"
#define COLLADA_FXCMN_SAMPLER1D_ELEMENT "sampler1D"
#define COLLADA_FXCMN_SAMPLER2D_ELEMENT "sampler2D"
#define COLLADA_FXCMN_SAMPLER3D_ELEMENT "sampler3D"
#define COLLADA_FXCMN_SAMPLERCUBE_ELEMENT "samplerCUBE"
#define COLLADA_FXCMN_NEWPARAM_ELEMENT "newparam"
#define COLLADA_FXCMN_SETPARAM_ELEMENT "setparam"
#define COLLADA_FXCMN_STRING_ELEMENT "string"
#define COLLADA_TECHNIQUE_STANDARD_PARAMETER "standard"
#define COLLADA_FXSTD_CONSTANT_ELEMENT "constant"
#define COLLADA_FXSTD_LAMBERT_ELEMENT "lambert"
#define COLLADA_FXSTD_PHONG_ELEMENT "phong"
#define COLLADA_FXSTD_BLINN_ELEMENT "blinn"
#define COLLADA_FXSTD_COLOR_ELEMENT "color"
#define COLLADA_FXSTD_FLOAT_ELEMENT "float"
#define COLLADA_FXSTD_SAMPLER_ELEMENT "texture"
#define COLLADA_FXSTD_TEXTURE_ATTRIBUTE "texture"
#define COLLADA_FXSTD_TEXTURESET_ATTRIBUTE "texcoord"
#define COLLADA_CONTROLLER_SKIN_ELEMENT "skin"
#define COLLADA_CONTROLLER_MORPH_ELEMENT "morph"
#define COLLADA_CAMERA_PERSP_ELEMENT "perspective"
#define COLLADA_CAMERA_ORTHO_ELEMENT "orthographic"
#define COLLADA_ASPECT_CAMERA_PARAMETER "aspect_ratio"
#define COLLADA_XFOV_CAMERA_PARAMETER "xfov"
#define COLLADA_YFOV_CAMERA_PARAMETER "yfov"
#define COLLADA_ZNEAR_CAMERA_PARAMETER "znear"
#define COLLADA_ZFAR_CAMERA_PARAMETER "zfar"
#define COLLADA_XMAG_CAMERA_PARAMETER "xmag"
#define COLLADA_YMAG_CAMERA_PARAMETER "ymag"
#define COLLADA_CAMERA_VERTICAL_APERTURE_PARAMETER "vertical_aperture"
#define COLLADA_CAMERA_HORIZONTAL_APERTURE_PARAMETER "horizontal_aperture"
#define COLLADA_CAMERA_LENS_SQUEEZE_PARAMETER "lens_squeeze"
#define COLLADA_AMBIENT_MATERIAL_PARAMETER "ambient"
#define COLLADA_BUMP_MATERIAL_PARAMETER "bump"
#define COLLADA_DIFFUSE_MATERIAL_PARAMETER "diffuse"
#define COLLADA_EMISSION_MATERIAL_PARAMETER "emission"
#define COLLADA_TRANSPARENCY_MATERIAL_PARAMETER "transparency"
#define COLLADA_TRANSPARENT_MATERIAL_PARAMETER "transparent"
#define COLLADA_REFLECTIVE_MATERIAL_PARAMETER "reflective"
#define COLLADA_REFLECTIVITY_MATERIAL_PARAMETER "reflectivity"
#define COLLADA_SHININESS_MATERIAL_PARAMETER "shininess"
#define COLLADA_SPECULAR_MATERIAL_PARAMETER "specular"
#define COLLADA_INDEXOFREFRACTION_MATERIAL_PARAMETER "index_of_refraction"
#define COLLADA_OPAQUE_MODE_ATTRIBUTE "opaque"
#define COLLADA_OPAQUE_MODE_A_ONE "A_ONE"
#define COLLADA_OPAQUE_MODE_RGB_ONE "RGB_ONE"
#define COLLADA_OPAQUE_MODE_A_ZERO "A_ZERO"
#define COLLADA_OPAQUE_MODE_RGB_ZERO "RGB_ZERO"
#define COLLADA_LIGHT_AMBIENT_ELEMENT "ambient"
#define COLLADA_LIGHT_POINT_ELEMENT "point"
#define COLLADA_LIGHT_DIRECTIONAL_ELEMENT "directional"
#define COLLADA_LIGHT_SPOT_ELEMENT "spot"
#define COLLADA_COLOR_LIGHT_PARAMETER "color"
#define COLLADA_CONST_ATTENUATION_LIGHT_PARAMETER "constant_attenuation"
#define COLLADA_LIN_ATTENUATION_LIGHT_PARAMETER "linear_attenuation"
#define COLLADA_QUAD_ATTENUATION_LIGHT_PARAMETER "quadratic_attenuation"
#define COLLADA_FALLOFFEXPONENT_LIGHT_PARAMETER "falloff_exponent"
#define COLLADA_FALLOFFANGLE_LIGHT_PARAMETER "falloff_angle"
#define COLLADA_BINDSHAPEMX_SKIN_PARAMETER "bind_shape_matrix"
#define COLLADA_CONTRIBUTOR_ASSET_ELEMENT "contributor"
#define COLLADA_AUTHOR_ASSET_PARAMETER "author"
#define COLLADA_AUTHORINGTOOL_ASSET_PARAMETER "authoring_tool"
#define COLLADA_CREATED_ASSET_PARAMETER "created"
#define COLLADA_MODIFIED_ASSET_PARAMETER "modified"
#define COLLADA_REVISION_ASSET_PARAMETER "revision"
#define COLLADA_SOURCEDATA_ASSET_PARAMETER "source_data"
#define COLLADA_UNITS_ASSET_PARAMETER "unit"
#define COLLADA_UPAXIS_ASSET_PARAMETER "up_axis"
#define COLLADA_SYMBOL_PROPERTY "symbol"
// From Collada 1.3
#define COLLADA_DOCUMENT_STRUCTURE "COLLADA"
#define COLLADA_ASSET_STRUCTURE "asset"
#define COLLADA_REVISION_STRUCTURE "revision"
#define COLLADA_AUTHORING_TOOL_STRUCTURE "authoring_tool"
#define COLLADA_CREATED_STRUCTURE "created"
#define COLLADA_MODIFIED_STRUCTURE "modified"
#define COLLADA_AUTHOR_STRUCTURE "author"
#define COLLADA_TITLE_STRUCTURE "title"
#define COLLADA_SUBJECT_STRUCTURE "subject"
#define COLLADA_KEYWORDS_STRUCTURE "keywords"
#define COLLADA_COMMENTS_STRUCTURE "comments"
#define COLLADA_UNIT_STRUCTURE "unit"
#define COLLADA_SOURCE_DATA_STRUCTURE "source_data"
#define COLLADA_UP_AXIS_STRUCTURE "up_axis"
#define COLLADA_LIBRARY_STRUCTURE "library" // Deprecated 1.4
#define COLLADA_SCENE_STRUCTURE "scene"
#define COLLADA_NODE_STRUCTURE "node"
#define COLLADA_MATRIX_STRUCTURE "matrix"
#define COLLADA_TRANSFORM_STRUCTURE "transform"
#define COLLADA_TRANSLATE_STRUCTURE "translate"
#define COLLADA_TRANSLATION_STRUCTURE "translation" // For ColladaMax
#define COLLADA_TRANSLATE_ORIGIN "origin" //A fix for Poser(Bug 309548). Handle translate origin info exported from Poser.
#define COLLADA_TRANSLATE_LOCATION "location" //A fix for ? (Bug BARB-154). "location" is synonyn of "translate" ?
#define COLLADA_ROTATE_STRUCTURE "rotate"
#define COLLADA_SCALE_STRUCTURE "scale"
#define COLLADA_SKEW_STRUCTURE "skew"
#define COLLADA_ROTATE_X "rotateX"
#define COLLADA_ROTATE_Y "rotateY"
#define COLLADA_ROTATE_Z "rotateZ"
#define COLLADA_ROT_X "RotX" // For ColladaMax
#define COLLADA_ROT_Y "RotY"
#define COLLADA_ROT_Z "RotZ"
#define COLLADA_ROTATION_X "rotation_x" // For XSI
#define COLLADA_ROTATION_Y "rotation_y"
#define COLLADA_ROTATION_Z "rotation_z"
#define COLLADA_ROTATIONX "rotationX" // BARB-154
#define COLLADA_ROTATIONY "rotationY"
#define COLLADA_ROTATIONZ "rotationZ"
#define COLLADA_ROTATE_PIVOT "rotatePivot" // the next 6 subids are recognized by ColladaMaya
#define COLLADA_SCALE_PIVOT "scalePivot"
#define COLLADA_ROTATE_PIVOT_INVERSE "rotatePivotInverse"
#define COLLADA_SCALE_PIVOT_INVERSE "scalePivotInverse"
#define COLLADA_ROTATE_PIVOT_OFFSET "rotatePivotTranslation"
#define COLLADA_SCALE_PIVOT_OFFSET "scalePivotTranslation"
#define COLLADA_PRE_ROTATION_X "jointOrientX" // these 3 subids recognized by ColladaMaya
#define COLLADA_PRE_ROTATION_Y "jointOrientY"
#define COLLADA_PRE_ROTATION_Z "jointOrientZ"
#define COLLADA_POST_ROTATION_X "post-rotationX" // these 3 subids NOT recognized by ColladaMaya
#define COLLADA_POST_ROTATION_Y "post-rotationY"
#define COLLADA_POST_ROTATION_Z "post-rotationZ"
#define COLLADA_ROTATE_AXIS_X "rotateAxisX" // these 3 subids recognized by ColladaMaya
#define COLLADA_ROTATE_AXIS_Y "rotateAxisY"
#define COLLADA_ROTATE_AXIS_Z "rotateAxisZ"
#define COLLADA_LOOKAT_STRUCTURE "lookat"
#define COLLADA_PERSPECTIVE_STRUCTURE "perspective"
#define COLLADA_GEOMETRY_STRUCTURE "geometry"
#define COLLADA_MESH_STRUCTURE "mesh"
#define COLLADA_VERTICES_STRUCTURE "vertices"
#define COLLADA_POLYGONS_STRUCTURE "polygons"
#define COLLADA_POLYLIST_STRUCTURE "polylist"
#define COLLADA_TRIANGLES_STRUCTURE "triangles"
#define COLLADA_P_STRUCTURE "p"
#define COLLADA_ANIMATION_STRUCTURE "animation"
#define COLLADA_CONTROLLER_STRUCTURE "controller"
#define COLLADA_SKIN_STRUCTURE "skin"
#define COLLADA_COMBINER_STRUCTURE "combiner"
#define COLLADA_JOINTS_STRUCTURE "joints"
#define COLLADA_VALUE_STRUCTURE "v"
#define COLLADA_MATERIAL_STRUCTURE "material"
#define COLLADA_SHADER_STRUCTURE "shader"
#define COLLADA_PASS_STRUCTURE "pass"
#define COLLADA_PROGRAM_STRUCTURE "program"
#define COLLADA_TEXTURE_STRUCTURE "texture"
#define COLLADA_IMAGE_STRUCTURE "image"
#define COLLADA_INPUT_STRUCTURE "input"
#define COLLADA_TECHNIQUE_STRUCTURE "technique"
#define COLLADA_SOURCE_STRUCTURE "source"
#define COLLADA_ACCESSOR_STRUCTURE "accessor"
#define COLLADA_EXTRA_STRUCTURE "extra"
#define COLLADA_BOUNDINGBOX_STRUCTURE "boundingbox"
#define COLLADA_MIN_STRUCTURE "min"
#define COLLADA_MAX_STRUCTURE "max"
#define COLLADA_ARRAY_STRUCTURE "array"
#define COLLADA_FLOAT_ARRAY_STRUCTURE "float_array"
#define COLLADA_INT_ARRAY_STRUCTURE "int_array"
#define COLLADA_NAME_ARRAY_STRUCTURE "Name_array"
#define COLLADA_IDREF_ARRAY_STRUCTURE "IDREF_array"
#define COLLADA_BOOL_ARRAY_STRUCTURE "bool_array"
#define COLLADA_SAMPLER_STRUCTURE "sampler"
#define COLLADA_CHANNEL_STRUCTURE "channel"
#define COLLADA_CAMERA_STRUCTURE "camera"
#define COLLADA_LIGHT_STRUCTURE "light"
#define COLLADA_OPTICS_STRUCTURE "optics"
#define COLLADA_PROGRAM_STRUCTURE "program"
#define COLLADA_PARAMETER_STRUCTURE "param"
#define COLLADA_TYPE_PROPERTY "type"
#define COLLADA_ID_PROPERTY "id"
#define COLLADA_SUBID_PROPERTY "sid"
#define COLLADA_NAME_PROPERTY "name"
#define COLLADA_LAYER_PROPERTY "layer"
#define COLLADA_COUNT_PROPERTY "count"
#define COLLADA_STRIDE_PROPERTY "stride"
#define COLLADA_URL_PROPERTY "url"
#define COLLADA_SEMANTIC_PROPERTY "semantic"
#define COLLADA_SOURCE_PROPERTY "source"
#define COLLADA_TARGET_PROPERTY "target"
#define COLLADA_PROFILE_PROPERTY "profile"
#define COLLADA_MATERIAL_PROPERTY "material"
#define COLLADA_METER_PROPERTY "meter"
#define COLLADA_IDX_PROPERTY "idx"
#define COLLADA_SET_PROPERTY "set"
#define COLLADA_OFFSET_PROPERTY "offset"
#define COLLADA_FLOW_PROPERTY "flow"
#define COLLADA_FORMAT_PROPERTY "format"
#define COLLADA_HEIGHT_PROPERTY "height"
#define COLLADA_WIDTH_PROPERTY "width"
#define COLLADA_DEPTH_PROPERTY "depth"
#define COLLADA_REF_PROPERTY "ref"
#define COLLADA_GEOMETRY_LIBRARY_TYPE "GEOMETRY"
#define COLLADA_CONTROLLER_LIBRARY_TYPE "CONTROLLER"
#define COLLADA_ANIMATION_LIBRARY_TYPE "ANIMATION"
#define COLLADA_MATERIAL_LIBRARY_TYPE "MATERIAL"
#define COLLADA_TEXTURE_LIBRARY_TYPE "TEXTURE"
#define COLLADA_IMAGE_LIBRARY_TYPE "IMAGE"
#define COLLADA_LIGHT_LIBRARY_TYPE "LIGHT"
#define COLLADA_CAMERA_LIBRARY_TYPE "CAMERA"
#define COLLADA_LAMBERT_SHADER_TYPE "LAMBERT"
#define COLLADA_PHONG_SHADER_TYPE "PHONG"
#define COLLADA_CONSTANT_SHADER_TYPE "CONSTANT"
#define COLLADA_NAME_TYPE "name"
#define COLLADA_IDREF_TYPE "IDREF"
#define COLLADA_FLOAT_TYPE "float"
#define COLLADA_BOOL_TYPE "bool"
#define COLLADA_INT_TYPE "int"
#define COLLADA_FLOAT3_TYPE "float3"
#define COLLADA_FLOAT4_TYPE "float4"
#define COLLADA_FUNCTION_TYPE "function"
#define COLLADA_MATRIX_TYPE "float4x4"
#define COLLADA_STRING_TYPE "string"
#define COLLADA_JOINT_NODE_TYPE "JOINT"
#define COLLADA_NODE_NODE_TYPE "NODE"
#define COLLADA_TEXTURE_SEMANTIC "TEXTURE"
#define COLLADA_IMAGE_SEMANTIC "IMAGE"
#define COLLADA_INPUT_SEMANTIC "INPUT"
#define COLLADA_OUTPUT_SEMANTIC "OUTPUT"
#define COLLADA_IN_TANGENT_SEMANTIC "IN_TANGENT"
#define COLLADA_OUT_TANGENT_SEMANTIC "OUT_TANGENT"
#define COLLADA_INTERPOLATION_SEMANTIC "INTERPOLATION"
#define COLLADA_JOINT_SEMANTIC "JOINT"
#define COLLADA_BIND_POSITION_SEMANTIC "BIND_SHAPE_POSITION"
#define COLLADA_BIND_NORMAL_SEMANTIC "BIND_SHAPE_NORMAL"
#define COLLADA_JOINT_AND_WEIGHT_SEMANTIC "JOINTS_AND_WEIGHTS"
#define COLLADA_BIND_MATRIX_SEMANTIC "INV_BIND_MATRIX"
#define COLLADA_JOINT_PARAMETER "JOINT"
#define COLLADA_WEIGHT_PARAMETER "WEIGHT"
#define COLLADA_MORPH_TARGET_SEMANTIC "MORPH_TARGET"
#define COLLADA_MORPH_WEIGHT_SEMANTIC "MORPH_WEIGHT"
#define COLLADA_GENERIC_TECHNIQUE "COMMON"
#define COLLADA_TIME_TARGET "TIME"
#define COLLADA_VERTEX_INPUT "VERTEX"
#define COLLADA_POSITION_INPUT "POSITION"
#define COLLADA_NORMAL_INPUT "NORMAL"
#define COLLADA_COLOR_INPUT "COLOR"
#define COLLADA_MAPPING_INPUT "UV"
#define COLLADA_TEXCOORD_INPUT "TEXCOORD"
#define COLLADA_TEXTANGENT_INPUT "TEXTANGENT"
#define COLLADA_TEXBINORMAL_INPUT "TEXBINORMAL"
#define COLLADA_LIGHT_INTENSITY_PARAMETER_14 "intensity"
#define COLLADA_LIGHT_PENUMBRA_ANGLE_PARAMETER_14 "penumbra_angle"
#define COLLADA_LIGHT_DROPOFF_PARAMETER "dropoff"
#define COLLADA_CAMERA_YFOV_PARAMETER "YFOV"
#define COLLADA_CAMERA_ZNEAR_PARAMETER "ZNEAR"
#define COLLADA_CAMERA_ZFAR_PARAMETER "ZFAR"
#define COLLADA_CAMERA_ORTHO_BOTTOM_PARAMETER "BOTTOM"
#define COLLADA_CAMERA_ORTHO_TOP_PARAMETER "TOP"
#define COLLADA_CAMERA_ORTHO_LEFT_PARAMETER "LEFT"
#define COLLADA_CAMERA_ORTHO_RIGHT_PARAMETER "RIGHT"
#define COLLADA_TEXTURE_WRAPU_PARAMETER "wrapU"
#define COLLADA_TEXTURE_WRAPV_PARAMETER "wrapV"
#define COLLADA_TEXTURE_MIRRORU_PARAMETER "mirrorU"
#define COLLADA_TEXTURE_MIRRORV_PARAMETER "mirrorV"
#define COLLADA_TEXTURE_BLEND_MODE_PARAMETER "BLEND_MODE"
#define COLLADA_TEXTURE_BLEND_MODE_PARAMETER_14 "blend_mode"
#define COLLADA_TEXTURE_REPEATU_PARAMETER "repeatU"
#define COLLADA_TEXTURE_REPEATV_PARAMETER "repeatV"
#define COLLADA_CONSTANT_FUNCTION "CONSTANT"
#define COLLADA_LINEAR_FUNCTION "LINEAR"
#define COLLADA_QUADRATIC_FUNCTION "QUADRATIC"
#define COLLADA_INTERPOLATION_TYPE_LINEAR "LINEAR"
#define COLLADA_INTERPOLATION_TYPE_BEZIER "BEZIER"
#define COLLADA_INTERPOLATION_TYPE_CARDINAL "CARDINAL"
#define COLLADA_INTERPOLATION_TYPE_HERMITE "HERMITE"
#define COLLADA_INTERPOLATION_TYPE_BSPLINE "BSPLINE"
#define COLLADA_INTERPOLATION_TYPE_STEP "STEP"
#define COLLADA_X_UP "X_UP"
#define COLLADA_Y_UP "Y_UP"
#define COLLADA_Z_UP "Z_UP"
#define COLLADA_IN_FLOW "IN"
#define COLLADA_OUT_FLOW "OUT"
#define COLLADA_INOUT_FLOW "INOUT"
// Obsolete, but kept here for backward compatibility.
#define COLLADA_RGB_TYPE "ColorRGB" // use float3 instead
#define COLLADA_RGBA_TYPE "ColorRGBA" // use float4 instead
#define COLLADA_RGB_INPUT "COLORRGB" // beta MAX exporter has been known to generate them
#define COLLADA_RGBA_INPUT "COLORRGBA" // beta MAX exporter has been known to generate them
// Physics extension. Currently in prototype phase.
#define COLLADA_PHYSICS_LIBRARY_TYPE "PHYSICS"
#define COLLADA_SHAPE_STRUCTURE "shape"
#define COLLADA_RIGID_BODY_STRUCTURE "rigidbody"
#define COLLADA_DYNAMIC_STRUCTURE "dynamic"
#define COLLADA_MASS_STRUCTURE "mass"
#define COLLADA_PHYSICS_MATERIAL_STRUCTURE "physics_material"
#define COLLADA_STATIC_FRICTION_ATTRIBUTE "STATIC_FRICTION"
#define COLLADA_DYNAMIC_FRICTION_ATTRIBUTE "DYNAMIC_FRICTION"
#define COLLADA_ELASTICITY_ATTRIBUTE "ELASTICITY"
#define COLLADA_BOX_STRUCTURE "box"
#define COLLADA_SPHERE_STRUCTURE "sphere"
#define COLLADA_CAPSULE_STRUCTURE "capsule"
#define COLLADA_CYLINDER_STRUCTURE "cylinder"
#define COLLADA_ELLIPSOID_STRUCTURE "ellipsoid"
#define COLLADA_SIZE_STRUCTURE "size"
#define COLLADA_RADIUS_STRUCTURE "radius"
#define COLLADA_PHYSICS_ENVIRONMENT_STRUCTURE "physics_environment"
#define COLLADA_ENVIRONMENT_ID "Environment"
#define COLLADA_TIMESTEP_ATTRIBUTE "TIMESTEP"
#define COLLADA_GRAVITY_ATTRIBUTE "gravity"
#define COLLADA_INITIAL_VELOCITY_STRUCTURE "initial_velocity"
#define COLLADA_INITIAL_ANGULAR_VELOCITY_STRUCTURE "initial_angular_velocity"
#define COLLADA_CONVEX_MESH_STRUCTURE "convex_mesh"
#define COLLADA_INERTIA_STRUCTURE "inertia"
#define COLLADA_DENSITY_STRUCTURE "density"
#define COLLADA_CENTER_OF_MASS_STRUCTURE "center_of_mass"
#define COLLADA_DYNAMICS_STRUCTURE "dynamics"
#define COLLADA_RIGID_CONSTRAINT_STRUCTURE "rigid_constraint"
#define COLLADA_BODY_PROPERTY "body"
#define COLLADA_ATTACHMENT_STRUCTURE "attachment"
#define COLLADA_ROT_LIMIT_MIN_STRUCTURE "rot_limit_min"
#define COLLADA_ROT_LIMIT_MAX_STRUCTURE "rot_limit_max"
#define COLLADA_TRANS_LIMIT_MIN_STRUCTURE "trans_limit_min"
#define COLLADA_TRANS_LIMIT_MAX_STRUCTURE "trans_limit_max"
#define COLLADA_ENABLED_STRUCTURE "enabled"
#define COLLADA_INTERPENETRATE_STRUCTURE "interpenetrate"
#define COLLADA_SPRING_STRUCTURE "spring"
#define COLLADA_STIFFNESS_STRUCTURE "stiffness"
#define COLLADA_DAMPING_STRUCTURE "damping"
#define COLLADA_REST_LENGTH_STRUCTURE "rest_length"
#define COLLADA_P0_STRUCTURE "p0"
#define COLLADA_P1_STRUCTURE "p1"
#define COLLADA_TRUE_KEYWORD "TRUE"
#define COLLADA_FALSE_KEYWORD "FALSE"
#define COLLADA_LINES_STRUCTURE "lines"
#define COLLADA_LINESTRIP_STRUCTURE "linestrips"
#define COLLADA_TRIFANS_STRUCTURE "trifans"
#define COLLADA_TRISTRIPS_STRUCTURE "tristrips"
// Extensions
// Feeling Software ColladaMaya extensions
#define COLLADA_MAYA_PROFILE "MAYA"
#define COLLADA_MAYA_LAYER_ELEMENT "layer"
// Feeling Software ColladaMax extensions
#define COLLADA_MAX3D_PROFILE "MAX3D"
#define COLLADA_MAX3D_FRAMERATE_ELEMENT "frame_rate"
// Feeling Software FCollada extensions
#define COLLADA_FCOLLADA_PROFILE "FCOLLADA"
#define COLLADA_FCOLLADA_STARTTIME_ELEMENT "start_time"
#define COLLADA_FCOLLADA_ENDTIME_ELEMENT "end_time"
#define COLLADA_FCOLLADA_VISIBILITY_ELEMENT "visibility"
// XSI COLLADA extensions
#define COLLADA_XSI_PROFILE "XSI"
#define COLLADA_XSI_VISIBILITY_ELEMENT "SI_Visibility"
// FBX COLLADA extensions
#define COLLADA_FBX_PROFILE "FBX"
#define COLLADA_FBX_TARGET_ELEMENT "target"
// NVidia FXComposer extension -----------------------------------------------//
#define COLLADA_NVIDIA_FXCOMPOSER_PROFILE "NVIDIA_FXCOMPOSER"
#define COLLADA_NVIDIA_FXCOMPOSER_IMPORT_ELEMENT "import"
#define COLLADA_NVIDIA_FXCOMPOSER_URL_ATTRIBUTE "url"
#define COLLADA_NVIDIA_FXCOMPOSER_COMPILER_OPTIONS_ATTRIBUTE "compiler_options"
#define COLLADA_NVIDIA_FXCOMPOSER_PROFILE_ATTRIBUTE "profile"
#endif /* _FBXSDK_FILEIO_COLLADA_TOKENS_H_ */

View File

@ -0,0 +1,394 @@
/****************************************************************************************
Copyright (C) 2017 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxcolladautils.h
#ifndef _FBXSDK_FILEIO_COLLADA_UTILS_H_
#define _FBXSDK_FILEIO_COLLADA_UTILS_H_
#include <fbxsdk.h>
#include <fbxsdk/fileio/collada/fbxcolladatokens.h>
#include <fbxsdk/fileio/collada/fbxcolladaiostream.h>
#include <fbxsdk/scene/fbxscene.h>
#include <fbxsdk/utils/fbxrenamingstrategybase.h>
#include <fbxsdk/utils/fbxnamehandler.h>
#include <libxml/globals.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FBXSDK_DLL FbxRenamingStrategyCollada : public FbxRenamingStrategyBase
{
public:
FbxRenamingStrategyCollada();
virtual ~FbxRenamingStrategyCollada();
virtual void CleanUp();
virtual bool DecodeScene(FbxScene* pScene);
virtual bool EncodeScene(FbxScene* pScene);
virtual bool DecodeString(FbxNameHandler& pName);
virtual bool EncodeString(FbxNameHandler& pName, bool pIsPropertyName = false);
};
#ifndef INT_MAX
#define INT_MAX 0x7FFFFFFF
#endif
#ifndef CENTIMETERS_TO_INCHES
#define CENTIMETERS_TO_INCHES 2.54f
#endif
#ifndef RADIANS_TO_DEGREES
#define RADIANS_TO_DEGREES 57.295799f
#endif
enum DAE_Flow { kCOLLADAFlowIn, kCOLLADAFlowOut, kCOLLADAFlowInOut };
const int MATRIX_STRIDE = 16;
const int VECTOR_STRIDE = 3;
#define COLLADA_ID_PROPERTY_NAME "COLLADA_ID"
class XmlNodeDeletionPolicy
{
public:
static inline void DeleteIt(xmlNode ** ptr)
{
if (*ptr != NULL)
{
xmlFreeNode(*ptr);
*ptr = NULL;
}
}
};
typedef FbxAutoPtr<xmlNode, XmlNodeDeletionPolicy> XmlNodePtr;
typedef FbxMap< FbxString, xmlNode* > SourceElementMapType;
typedef FbxMap< FbxString, xmlNode* > SkinMapType;
// Some information connecting COLLADA layer string, such as "NORMAL" or "UV", to FBX layer element type.
struct ColladaLayerTraits
{
ColladaLayerTraits()
: mLayerType(FbxLayerElement::eUnknown), mLayerElementLength(0) {}
ColladaLayerTraits(FbxLayerElement::EType pType, int pLength)
: mLayerType(pType), mLayerElementLength(pLength) {}
// Type of FBX element layer
FbxLayerElement::EType mLayerType;
// Count of double of each element in FBX element layer
int mLayerElementLength;
/** Construct traits according to COLLADA layer string.
* \param pLabel COLLADA layer string.
* \return Return created traits.
*/
static const ColladaLayerTraits GetLayerTraits(const FbxString & pLabel);
};
/** Emit error message.
* \param pSdkManger The SDK manager used to access user notification object.
* \param pErrorMessage The message to be presented.
*/
void DAE_AddNotificationError(const FbxManager * pSdkManger, const FbxString & pErrorMessage);
/** Emit warning message.
* \param pSdkManger The SDK manager used to access user notification object.
* \param pWarningMessage The message to be presented.
*/
void DAE_AddNotificationWarning(const FbxManager * pSdkManger, const FbxString & pWarningMessage);
void DAE_ExportArray(xmlNode* parentXmlNode, const char* id, FbxArray<FbxVector4>& arr);
void DAE_ExportArray(xmlNode* parentXmlNode, const char* id, FbxArray<FbxVector2>& arr);
void DAE_ExportArray(xmlNode* parentXmlNode, const char* id, FbxArray<FbxColor>& arr);
void DAE_ExportArray(xmlNode* parentXmlNode, const char* id, FbxArray<double>& arr);
void DAE_ExportArray(xmlNode* parentXmlNode, const char* id, FbxStringList& arr);
// Syntax modification - for COLLADA 1.4
xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxStringList& accessorParams, FbxArray<double>& arr, bool isCommonProfile=true);
xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray<FbxVector4>& arr);
xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray<FbxVector2>& arr);
xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray<FbxColor>& arr);
xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray<FbxAMatrix>& arr);
xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray<FbxMatrix>& arr);
xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxStringList& arr, const char* type, bool isCommonProfile=true);
void DAE_ExportSourceArray(xmlNode* sourceNode, const char* id, FbxArray<FbxColor>& arr);
void DAE_ExportSourceArray14(xmlNode* sourceNode, const char* id, FbxArray<FbxColor>& arr);
xmlNode* DAE_ExportAccessor(xmlNode* parentXmlNode, const char* id, const char* arrayRef, int count, int stride, const char* name, const char* type);
xmlNode* DAE_ExportAccessor14(xmlNode* parentXmlNode, const char* id, const char* arrayRef, int count, int stride, const char* name, const char* type);
void DAE_AddXYZAccessor(xmlNode* parentXmlNode, const char* profile, const char* arrayName, const char* arrayRef, int count);
void DAE_AddSTAccessor(xmlNode* parentXmlNode, const char* profile, const char* arrayName, const char* arrayRef, int count);
void DAE_AddFlow(xmlNode* node, DAE_Flow flow);
void DAE_AddXYZAccessor14(xmlNode* parentXmlNode, const char* profile, const char* arrayName, const char* arrayRef, int count);
void DAE_AddSTAccessor14(xmlNode* parentXmlNode, const char* profile, const char* arrayName, const char* arrayRef, int count);
// AddParameter functions for COLLADA 1.3.
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, const FbxColor& color, DAE_Flow flow);
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, const FbxVector4& vector, DAE_Flow flow);
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, double value, DAE_Flow flow);
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, bool value, DAE_Flow flow);
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, const char* type, const char* value, DAE_Flow flow);
// Overload functions without DAE_Flow, for COLLADA 1.4.
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, const FbxDouble3& color);
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, const FbxColor& color);
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, const FbxVector4& vector);
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, double value);
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, bool value);
xmlNode* DAE_AddParameter(xmlNode* parentXmlNode, const char* name, const char* type, const char* value);
xmlNode* DAE_AddTechnique(xmlNode* parentXmlNode, const char* technique);
void DAE_AddInput(xmlNode* parentXmlNode, const char* semantic, const char* source, int idx = -1);
void DAE_AddInput14(xmlNode* parentXmlNode, const char* semantic, const char* source, int offset = -1, int set=-1);
FbxString matrixToString(const FbxAMatrix& mx);
typedef FbxArray<xmlNode*> CNodeList;
/** Find children elements whose type is included in a list of type.
* \param pParentElement The parent element.
* \param pTypes The list of types.
* \param pChildrenElements The found children elements.
*/
void findChildrenByType(xmlNode* pParentElement, const FbxSet<FbxString>& pTypes, CNodeList& pChildrenElements);
/** Find children elements of a specific type.
* \param pParentElement The parent element.
* \param pType The type.
* \param pChildrenElements The found children elements.
*/
void findChildrenByType(xmlNode* pParentElement, const char * pType, CNodeList& pChildrenElements);
xmlNode* getSourceAccessor(xmlNode* sourceNode);
xmlNode* getTechniqueNode(xmlNode* parent, const char * profile);
// Conversions
inline double inchesToCentimeters(double val) { return FbxFloor(val / CENTIMETERS_TO_INCHES * 100000) / 100000; }
inline double centimetersToInches(double val) { return FbxFloor(val * CENTIMETERS_TO_INCHES * 100000) / 100000; }
inline double degreesToRadians(double val) { return FbxFloor(val / RADIANS_TO_DEGREES * 100000) / 100000; }
inline double radiansToDegrees(double val) { return FbxFloor(val * RADIANS_TO_DEGREES * 100000) / 100000; }
/** Find a child element with a given attribute value.
* \param pParentElement The parent element.
* \param pAttributeName The name of the attribute.
* \param pAttributeValue The value of the attribute.
* \param pDefaultAttributeValue The default value of the attribute used when the attribute is not found explicitly.
* \return Return NULL if no child element has the given attribute value.
*/
xmlNode* DAE_FindChildElementByAttribute(xmlNode* pParentElement, const char * pAttributeName,
const char * pAttributeValue, const char * pDefaultAttributeValue = "");
/** Find a child element with a given tag.
* \param pParentElement The parent element.
* \param pTag The value of the tag.
* \param pFindFrom Find from the next child after pFindFrom if pFindFrom is not NULL.
* \return Return NULL if no child element has the given tag.
*/
xmlNode* DAE_FindChildElementByTag(xmlNode* pParentElement, const char * pTag, xmlNode* pFindFrom = NULL);
/** Get the content of a XML element.
* \param pElement The element whose content is returned.
* \param pData The returned data.
*/
template <typename TYPE>
void DAE_GetElementContent(xmlNode * pElement, TYPE & pData)
{
if (pElement != NULL)
{
xmlChar* lContent = xmlNodeGetContent(pElement);
if (lContent)
{
FromString(&pData, (const char *)lContent);
xmlFree(lContent);
}
}
}
/** Check whether this node is compatible to FBX transform structure.
* \param pNodeElement The specific node element.
* \return Return true if it is compatible.
*/
bool DAE_CheckCompatibility(xmlNode * pNodeElement);
/** Get the tag of the specific element.
* \param pElement The specific element.
* \param pTag Return the tag of the element.
*/
void DAE_GetElementTag(xmlNode * pElement, FbxString & pTag);
/** Get the value of an attribute of an element.
* \param pElement The specific XML element.
* \param pAttributeName The name of the specific attribute.
* \return The value of the attribute in the form of a string. If the attribute is not available, an empty string is returned.
*/
const FbxString DAE_GetElementAttributeValue(xmlNode * pElement, const char * pAttributeName);
/** Get the value of an attribute of an element.
* \param pElement The specific XML element.
* \param pAttributeName The name of the specific attribute.
* \param pData The returned data.
* \return Return \c true on success and \c false if no attribute has the given name.
*/
template <typename TYPE>
bool DAE_GetElementAttributeValue(xmlNode * pElement, const char * pAttributeName, TYPE & pData)
{
if (!pElement || !pAttributeName)
return false;
xmlChar* lPropertyValue = xmlGetProp(pElement, (const xmlChar *)pAttributeName);
if (lPropertyValue)
{
FromString(&pData, (const char *)lPropertyValue);
xmlFree(lPropertyValue);
return true;
}
return false;
}
// Special instantiation for string;
// Omit the whitespaces, just return the whole string
template <>
inline bool DAE_GetElementAttributeValue(xmlNode * pElement,
const char * pAttributeName,
FbxString & pData)
{
if (!pElement || !pAttributeName)
return false;
xmlChar* lPropertyValue =xmlGetProp(pElement, (const xmlChar *)pAttributeName);
if (lPropertyValue)
{
pData = (const char *)lPropertyValue;
xmlFree(lPropertyValue);
return true;
}
return false;
}
/** Compare the value of specific attribute of specific element with given value.
* \param pElement The specific element.
* \param pAttributeName The name of the specific attribute.
* \param pValue The value to compare with.
* \return Return true if values equal.
*/
bool DAE_CompareAttributeValue(xmlNode * pElement,
const char * pAttributeName,
const char * pValue);
/** Get the ID of another element from the url attribute of the given element.
* \param pElement The specific XML element in which the ID is looked for.
* \param pExternalRef The external reference part of the url (before the #)
* \return The ID of another element if success, or an empty string if no url attributes are found.
*/
const FbxString DAE_GetIDFromUrlAttribute(xmlNode * pElement, FbxString& pExternalRef);
/** Get the ID of another element from the source attribute of the given element.
* \param pElement The specific XML element in which the ID is looked for.
* \return The ID of another element if success, or an empty string if no source attributes are found.
*/
const FbxString DAE_GetIDFromSourceAttribute(xmlNode * pElement);
/** Get the ID of another element from the target attribute of the given element.
* Note that in target attribute, the URI identifier may or may not preceded with the pound sign.
* \param pElement The specific XML element in which the ID is looked for.
* \return The ID of another element if success, or an empty string if no target attributes are found.
*/
const FbxString DAE_GetIDFromTargetAttribute(xmlNode * pElement);
/** Set the name of the object with a given name. If the name is empty, use the ID.
* \param pObject The object whose name is to be set.
* \param pName The name string.
* \param pID The ID string.
*/
void DAE_SetName(FbxObject * pObject, const FbxString & pName, const FbxString & pID);
/** Get the COLLADA source element with a semantic meaning and a consumer element;
* The COLLADA input element declares the input connections to a data source that a consumer requires.
* A data source is a container of raw data that lacks semantic meaning so that the data can be reused within the
* document. To use the data, a consumer declares a connection to it with the desired semantic information.
* \param pConsumerElement A consumer element, like sampler element in animation system or joints element in controller system.
* \param pSemantic A semantic meaning, like "INPUT", "OUTPUT" or "INTERPOLATION" in animation system.
* \param pSourceElements The container of raw data.
* \return Return \c NULL is failed.
*/
xmlNode * DAE_GetSourceWithSemantic(xmlNode * pConsumerElement, const char * pSemantic,
const SourceElementMapType & pSourceElements);
/** Add a child element with specific content.
* \param pParentElement The parent element.
* \param pTag The tag string of the new child element.
* \param pContent The content of the child element.
* \return The created child element.
*/
template <typename T>
xmlNode * DAE_AddChildElement(xmlNode * pParentElement, const char * pTag,
const T & pContent)
{
const FbxString lRepr = ToString(pContent);
return xmlNewChild(pParentElement, NULL, (xmlChar *)pTag,
(xmlChar *)lRepr.Buffer());
}
// Create a child element with empty content.
inline xmlNode * DAE_AddChildElement(xmlNode * pParentElement, const char * pTag)
{
return DAE_AddChildElement(pParentElement, pTag, FbxString());
}
// Create a new element with empty content.
inline xmlNode * DAE_NewElement(const char * pTag)
{
return xmlNewNode(NULL, reinterpret_cast<xmlChar*>(const_cast<char *>(pTag)));
}
/** Add an attribute for a element.
* \param pElement The element where the attribute is added.
* \param pAttributeName The name of the attribute.
* \param pAttributeValue The value of the attribute.
* \return The created attribute.
*/
template <typename T>
xmlAttr * DAE_AddAttribute(xmlNode * pElement, const FbxString & pAttributeName,
const T & pAttributeValue)
{
const FbxString lRepr = ToString(pAttributeValue);
return xmlNewProp(pElement, (xmlChar *)pAttributeName.Buffer(),
(xmlChar *)lRepr.Buffer());
}
/** Import a COLLADA unit element into a FBX system unit.
* \param pUnitElement The COLLADA unit element.
* \return The created FBX system unit.
*/
const FbxSystemUnit DAE_ImportUnit(xmlNode * pUnitElement);
/** If the specific node has animation on its local translation, increase every key by the offset.
* \param pNode The specific node.
* \param pOffset The specific offset value.
*/
void IncreaseLclTranslationAnimation(FbxNode * pNode, FbxDouble3 & pOffset);
/** Search the elements with given tag, push the found results to the end of the given array.
* \param pBaseElement Search from this element.
* \param pTag The given tag.
* \param pResult The array to return the found results.
*/
void RecursiveSearchElement(xmlNode * pBaseElement, const char * pTag, FbxArray<xmlNode*> & pResult);
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_COLLADA_UTILS_H_ */

View File

@ -0,0 +1,557 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxreadercollada14.h
#ifndef _FBXSDK_FILEIO_COLLADA_READER_H_
#define _FBXSDK_FILEIO_COLLADA_READER_H_
#include <fbxsdk.h>
#include <fbxsdk/fileio/collada/fbxcolladautils.h>
#include <fbxsdk/fileio/collada/fbxcolladanamespace.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Class to read a Collada file and import it to a FBX scene.
*
* Some terms about COLLADA (from the spec of the COLLADA).
*
* Element: An XML document consists primarily of elements. An element is a block of information that is
* bounded by tags at the beginning and end of the block. Elements can be nested, producing a hierarchical
* data set.
*
* Tag: Each XML element begins with a start tag and ends with an end tag.
*
* Attribute: An XML element can have zero or more attributes. Attributes are given within the start tag and
* follow the tag name. Each attribute is a name-value pair. The value portion of an attribute is always
* surrounded by quotation marks (" "). Attributes provide semantic information about the element on which
* they are bound.
* For example:
* \code
* <tagName attribute="value">
* \endcode
*
* URI Addressing: Refers to the id attribute of an element. Used in url, source or target attributes.
* In a url, source or target attribute, the URI fragment identifier is preceded with the pound sign ("#").
*
* Markup and Content: The characters which make up an XML document are divided into markup and content.
* Markup and content may be distinguished by the application of simple syntactic rules.
* All strings which constitute markup either begin with the character "<" and end with a ">",
* or begin with the character "&" and end with a ";".
* Strings of characters which are not markup are content.
* \nosubgrouping
*/
class FbxReaderCollada : public FbxReader
{
public:
/**
* \name Constructors and Destructor
*/
//@{
/** Constructor.
* \param pManager FBX SDK object Manager.
* \param pID Internal ID.
* \param pStatus The FbxStatus object to hold error codes.
*/
FbxReaderCollada(FbxManager& pManager, int pID, FbxStatus& pStatus);
//! Destructor.
virtual ~FbxReaderCollada();
//@}
/**
* \name File Management
*/
//@{
/** Open file with the given name.
* \param pFileName the name of file.
* \return Return true if the specified file is opened.
*/
virtual bool FileOpen(char* pFileName);
/** Close file.
* \return Return true if file is closed successfully, false otherwise.
*/
virtual bool FileClose();
/** Check if current file is open.
* \return Return true if file is open, false otherwise.
*/
virtual bool IsFileOpen();
//@}
/**
* \name Read Functions
*/
//@{
/** Get Collada import options settings.
* \param pParseFileAsNeeded whether parse file as needed, the default value is true.
* \return true
*/
virtual bool GetReadOptions(bool pParseFileAsNeeded = true){ return true; }
/** Get axis system information from file
* \param pAxisSystem axis system in file
* \param pSystemUnits system unit in file
* \return if either pAxisSystem or pSystemUnits is \c NULL return \c false, otherwise return \c true.
*/
virtual bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
/** Returns the list of take infos from the file.
* \return NULL
*/
virtual FbxArray<FbxTakeInfo*>* GetTakeInfo();
/** Read from Collada file and import it to the FBX document, according to the given options settings.
* \param pDocument FBX Document to import.
* \return true on success, false otherwise.
*/
virtual bool Read(FbxDocument* pDocument);
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
/**
* \name Import Functions
*/
//@{
/** Import Collada XML nodes tree to FBX scene.
* \param pScene The FBX scene object.
* \param pXmlNode The XML Node to import, it should be the root of Collada nodes tree.
* \return true on success, false otherwise.
*/
bool ReadCollada(FbxScene &pScene, xmlNode* pXmlNode);
/** Import a Collada visual_scene element to the given FBX scene.
* \param pXmlNode The COLLADA visual_scene element.
* \param pScene The FBX scene to contain the imported data.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportVisualScene(xmlNode* pXmlNode, FbxScene * pScene);
/** Import a Collada visual_scene MAX3D extension to the given FBX scene.
* \param pXmlNode The COLLADA technique element with profile MAX3D.
* \param pScene The FBX scene to contain the imported data.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportVisualSceneMax3DExtension(xmlNode * pTechniqueElement, FbxScene * pScene);
/** Import a Collada visual_scene FCOLLADA extension to the given FBX scene.
* \param pXmlNode The COLLADA technique element with profile FCOLLADA.
* \param pScene The FBX scene to contain the imported data.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportVisualSceneFCOLLADAExtension(xmlNode * pTechniqueElement, FbxScene * pScene);
/** Import a Collada visual_scene MAYA extension to the given FBX scene.
* \param pXmlNode The COLLADA technique element with profile MAYA.
* \param pScene The FBX scene to contain the imported data.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportVisualSceneMayaExtension(xmlNode * pTechniqueElement, FbxScene * pScene);
/** Import Collada asset element.
* \param pXmlNode The XML Node, asset is read from pXmlNode and its children.
* \param pGlobalSettings The FBX global settings.
* \param pSceneInfo The FBX scene information object.
* \return Return true if asset is imported successfully.
* \remarks Imported asset has following contents:
* Axis System, system Unit, author, comments, title, subject, keywords, revision, etc.
*/
bool ImportAsset(xmlNode* pXmlNode, FbxGlobalSettings & pGlobalSettings, FbxDocumentInfo &pSceneInfo);
/** Import a COLLADA node element.
* If the COLLADA node element contains only one node attribute (node attribute means instance_geometry,
* instance_camera, instance_light and instance_controller), node attribute will be attached directly under the node;
* If not, one child node will be created for each node attribute except the first one.
* \param pXmlNode The COLLADA node element.
* \return The created node and return \c NULL if failed.
*/
FbxNode * ImportNode(xmlNode* pXmlNode);
/** Import a COLLADA node FCOLLADA extension to the given FBX node.
* \param pXmlNode The COLLADA technique element with profile FCOLLADA.
* \param pNode The FBX node to contain the imported data.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportNodeFCOLLADAExtension(xmlNode* pTechniqueElement, FbxNode * pNode);
/** Import a COLLADA node XSI extension to the given FBX node.
* \param pXmlNode The COLLADA technique element with profile XSI.
* \param pNode The FBX node to contain the imported data.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportNodeXSIExtension(xmlNode* pTechniqueElement, FbxNode * pNode);
/** Import a COLLADA node FBX extension to the given FBX node.
* \param pXmlNode The COLLADA technique element with profile FBX.
* \param pNode The FBX node to contain the imported data.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportNodeFBXExtension(xmlNode* pTechniqueElement, FbxNode * pNode);
/** Import a COLLADA geometry element.
* \param pGeometryID The COLLADA geometry ID.
* \param pMaterialSequence A ordered sequence of material symbols connecting to the geometry.
* \return The created geometry object and return \c NULL if failed.
* \remarks Except mesh, other types of geometry are not supported now.
*/
FbxGeometry * ImportGeometry(const FbxString & pGeometryID, const FbxDynamicArray<FbxString> & pMaterialSequence);
/** Import a COLLADA skin element.
* \param pSkinElement The COLLADA skin element.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportSkin(xmlNode* pSkinElement);
/** Import a COLLADA morph element or morphs recursively.
* \param pXmlNode The COLLADA morph element.
* \param pMaterialSequence A ordered sequence of material symbols connecting to the target geometry.
* \return Return the pointer to the target geometry.
*/
FbxGeometry * ImportMorph(xmlNode * pMorphElement, const FbxDynamicArray<FbxString> & pMaterialSequence);
/** Import a COLLADA controller element.
* \param pXmlNode The COLLADA controller ID.
* \param pMaterialSequence A ordered sequence of material symbols connecting to the target geometry.
* \return Return the pointer to the target geometry.
*/
FbxGeometry * ImportController(const FbxString & pControllerID, const FbxDynamicArray<FbxString> & pMaterialSequence);
/** Import a COLLADA camera element.
* \param pXmlNode The COLLADA camera element.
* \return The created camera object and return \c NULL if failed.
* \remarks Camera parameters will also be imported, such as FOV, aspect ratio, etc.
*/
FbxCamera * ImportCamera(xmlNode* pXmlNode);
/** Import a COLLADA light element.
* \param pXmlNode The COLLADA light element.
* \return The created light object and return \c NULL if failed.
* Following types of light are supported now: ambient light, directional light, point light, and spot light.
*/
FbxLight * ImportLight(xmlNode* pXmlNode);
/** Import a COLLADA material element.
* \param pXmlNode The COLLADA material element.
* \return The created material object and return \c NULL if failed.
*/
FbxSurfaceMaterial * ImportMaterial(xmlNode* pXmlNode);
/** Import a COLLADA effect element.
* \param pEffectElement The COLLADA effect element.
* \return The created material object and return \c NULL if failed.
*/
FbxSurfaceMaterial * ImportEffect(xmlNode* pEffectElement);
/** Import a COLLADA effect NVIDIA_FXCOMPOSER extension.
* \param pXmlNode The COLLADA technique element with profile
* NVIDIA_FXCOMPOSER.
* \return The created material object and return \c NULL if failed.
*/
FbxSurfaceMaterial * ImportEffectNVidiaExtension(xmlNode * pEffectElement);
/** Import a COLLADA texture element.
* \param pXmlNode The COLLADA texture element.
* \return The created texture object and return \c NULL if failed.
* \remarks Following types of texture are supported now: ambient, diffuse, emission, reflective, specular, transparent.
*/
FbxFileTexture * ImportTexture(xmlNode* pXmlNode);
/** Import a COLLADA image element.
* \param pXmlNode The COLLADA image element.
* \return The created texture object and return \c NULL if failed.
*/
FbxFileTexture * ImportImage(xmlNode* pXmlNode);
/** Import a COLLADA mesh element.
* If this mesh element contains polygons, polygon list or triangles elements, a FBX mesh will be created.
* If it contains lines or line strips elements, a FBX line will be created.
* \param pXmlNode The COLLADA mesh element.
* \param pMaterialSequence A ordered sequence of material symbols connecting to the geometry.
* \param pObjects List of all the created objects. If this mesh contains lines or line strips as well as
* the polymesh, the array will be filled with: [mesh, line, line strip]
* \return The created geometry object and return \c NULL if failed.
*/
FbxGeometry * ImportMesh(xmlNode* pXmlNode, const FbxDynamicArray<FbxString> & pMaterialSequence, FbxArray<FbxObject*>& pObjects);
/** Import a COLLADA vertices element.
* \param pVerticesElement The COLLADA vertices element.
* \param pGeometry The FBX geometry object to store the vertices.
* \return true on success, false otherwise.
* \remarks Besides vertex, the vertex colors and normals are also imported.
*/
bool ImportVertices(xmlNode* pVerticesElement, FbxGeometry * pGeometry);
/** Import polygons of Collada mesh node to FBX mesh node.
* \param pXmlNode Pointer to XML mesh Node.
* \param pMesh The FBX mesh object.
* \param pMaterialSequence A ordered sequence of material symbols connecting to the mesh.
* \return true on success, false otherwise.
* \remarks Vertex colors, normals, UVs, textures and materials which related to polygons, are also imported.
*/
bool ImportPolygons(xmlNode* pXmlNode, FbxMesh& pMesh, const FbxDynamicArray<FbxString> & pMaterialSequence);
/** Import the transformation of Collada node to FBX node.
* \param pXmlNode Pointer to XML Node.
* \param pNode The FBX node.
* \return true on success, false otherwise.
* \remarks Transformation will cover matrix, translation, rotation, scale, skew, perspective, etc.
*/
bool ImportTransforms(xmlNode* pXmlNode, FbxNode* pNode);
/** Import a COLLADA rotation element.
* \param pXmlNode The COLLADA rotation element.
* \param pRotationVector Vector4 value to return the rotation vector.
* \return Return the rotation axis index.
*/
int ImportRotationElement(xmlNode* pXmlNode, FbxVector4& pRotationVector);
/** Extrapolate rotation order by the given int list.
* \param pNode The node whose rotation order is updated.
* \param pRotationOrder The int list representing the rotation order.
*/
void SetRotationOrder(FbxNode * pNode, const FbxArray<int> & pRotationOrder);
/** Import Collada look at node, and computed camera position, interest, up vector, etc.
* \param pXmlNode Pointer to XML look at Node.
* \param lCameraPosition Vector4 value to return camera position.
* \param lInterestPosition Vector4 value to return camera interest position.
* \param lUpVector Vector4 value to return camera up vector.
* \param lCameraTransformMatrix XMatrix value to return camera transform matrix.
* \return true on success, false otherwise.
* \remarks Computed camera parameters are saved in lCameraPosition, lInterestPosition, lUpVector, lCameraTransformMatrix.
*/
bool ImportLookAt(xmlNode* pXmlNode, FbxVector4& lCameraPosition,
FbxVector4& lInterestPosition, FbxVector4& lUpVector,
FbxAMatrix& lCameraTransformMatrix);
//@}
/**
* \name Miscellaneous Functions
*/
//@{
/** Return false if we do not want to import a node with the given ID.
* \param lId The node ID.
* \return true for importable, false for in-importable.
* \remarks Do not import camera nodes with IDs (perspective, top, bottom,
* left, right, side, front or back), since they are global cameras already created in FBX.
*/
bool IsNodeExportable(FbxString lId);
/** Check if the Collada version is 1.4.*.
* \param pVersionString The string representing the COLLADA version, like "1.4.1".
* \return \c true if the Collada version is 1.4.* or \c false otherwise.
*/
bool CheckColladaVersion(const FbxString & pVersionString);
//@}
/**
* \name Error Management
*/
//@{
/** Add notification error info to notify users.
* \param pError String of error info.
*/
void AddNotificationError( FbxString pError );
/** Add notification warning info to notify users.
* \param pWarning String of warning info.
*/
void AddNotificationWarning( FbxString pWarning );
//@}
/** Import the whole scene from the root element of a COLLADA file.
* This is the main entry of COLLADA reader.
* \param pColladaNode The root element.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportScene(xmlNode * pColladaNode);
/** Preprocess the COLLADA scene.
* \param pColladaElement The root element of COLLADA scene.
*/
void Preprocess(xmlNode * pColladaElement);
/** Build up the cache map from COLLADA element id to their data, which contain COLLADA elements and FBX objects.
*/
void BuildUpLibraryMap();
/** Recursively build up the cache map from COLLADA element id to their data, which contain COLLADA elements and FBX objects.
* /param pElement The parent element which may contain target elements.
* /param pElementTag The tag of target elements.
*/
void BuildUpLibraryMap(xmlNode * pElement, const FbxString & pElementTag);
/** Retrieve the material map from the bind_material element under an instance_geometry or instance_controller.
* And connected the created materials to the node.
* \param pNode The node to which the materials connect.
* \param pElement The COLLADA instance_goemetry or instance_controller element.
* \param pMaterialSequence The ordered material symbols which is used to create geometries.
* \return Return \c true on success and \c false otherwise.
*/
bool ConnectMaterialsToNode(FbxNode * pNode, xmlNode * pElement, FbxDynamicArray<FbxString> & pMaterialSequence);
/** Import COLLADA transparent and transparency attributes in a COLLADA effect element.
* \param pElement A COLLADA Lambert, Phong, constant or Blinn element.
* \param pSurfaceMaterial A FBX surface material.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportTransparent(xmlNode * pElement, FbxSurfaceLambert * pSurfaceMaterial);
// Some traits with a typed element.
struct LibraryTypeTraits
{
FbxString library_tag;
FbxString element_tag;
};
/** Get a typed element from the library element with a given ID.
* \param pTypeTraits The traits of type.
* \param pID The ID of the element.
* \return The FBX object.
*/
FbxObject * GetLibrary(const LibraryTypeTraits & pTypeTraits, const FbxString & pID);
FbxObject * GetLibrary(const LibraryTypeTraits & pTypeTraits, xmlNode * pElement);
/** Import the transform animation of a given node.
* \param pNode The node whose transform to be animated.
* \pAnimationChannelID The ID of animation element.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportMatrixAnimation(FbxNode * pNode, const FbxString & pAnimationChannelID);
/** Import the animation of a given attribute.
* \param pProperty The property to be animated.
* \param pAnimationChannelID The ID of animation element.
* \param pChannelName The channel name if the property has multiple channels.
* \return Return \c true on success and \c false otherwise.
*/
bool ImportPropertyAnimation(FbxProperty & pProperty, const FbxString & pAnimationChannelID, const char * pChannelName = NULL);
/** Get the animation layer to which the specific animation curve belongs.
* \param pAnimationID The ID of the animation curve.
* \return The animation layer.
*/
FbxAnimLayer * GetAnimLayer(const FbxString & pAnimationID);
/** Import local unit conversion.
* \param pElement The specific element.
* \return Return the local unit conversion.
*/
double GetLocalUnitConversion(xmlNode * pElement);
/** Set the value of the property.
* \param pPropertyElement The corresponding element.
* \param pProperty The specific property.
*/
void SetProperty(xmlNode* pPropertyElement, FbxProperty & pProperty);
/** Create a property with given name and set the value.
* \param pObject The object as the parent of the property.
* \param pPropertyName The name of the property.
* \param pPropertyValueElement The element containing the value.
*/
void ImportPropertyValue(FbxObject * pObject, const char * pPropertyName,
xmlNode * pPropertyValueElement);
FbxFile* mFileObject;
FbxString mFileName;
// XML lib stuff
xmlDocPtr mXmlDoc;
FbxAnimLayer* mAnimLayer;
FbxScene* mScene;
// Save the global settings and document info in pre-reading
FbxGlobalSettings * mGlobalSettings;
FbxDocumentInfo * mDocumentInfo;
FbxArray<FbxTakeInfo*> mTakeInfo;
xmlNode * mColladaElement;
struct ColladaElementData
{
explicit ColladaElementData(xmlNode * pElement = NULL)
: mColladaElement(pElement), mFBXObject(NULL) {}
xmlNode * mColladaElement;
FbxObject * mFBXObject;
FbxArray<FbxObject*> mFBXObjects;
};
typedef FbxMap<FbxString, ColladaElementData> ColladaElementMapType;
ColladaElementMapType mColladaElements;
LibraryTypeTraits mEffectTypeTraits;
LibraryTypeTraits mMaterialTypeTraits;
LibraryTypeTraits mImageTypeTraits;
LibraryTypeTraits mGeometryTypeTraits;
LibraryTypeTraits mControllerTypeTraits;
LibraryTypeTraits mLightTypeTraits;
LibraryTypeTraits mCameraTypeTraits;
LibraryTypeTraits mNodeTypeTraits;
LibraryTypeTraits mAnimationTypeTraits;
typedef FbxMap<FbxString, FbxArray<xmlNode*> > AnimationMapType;
AnimationMapType mAnimationElements;
SourceElementMapType mSourceElements;
struct AnimationClipData
{
AnimationClipData(const FbxString & pID) : mID(pID), mAnimLayer(NULL) {}
AnimationClipData(const AnimationClipData& pOther){ *this = pOther; }
AnimationClipData& operator=(const AnimationClipData& pOther){ mID = pOther.mID; mAnimationElementIDs = pOther.mAnimationElementIDs; mAnimLayer = pOther.mAnimLayer; return *this; }
FbxString mID; // ID of animation clip
FbxSet<FbxString> mAnimationElementIDs; // IDs of animation belong to this animation clip
FbxAnimLayer * mAnimLayer; // The corresponding animation layer
};
FbxDynamicArray<AnimationClipData> mAnimationClipData;
// Map from skin ID to skin element.
SkinMapType mSkinElements;
// There are two distinct namespaces for node ID & SID mapping.
// One with ID and the other with SID.
typedef FbxMap<FbxString, FbxNode *> NodeMapType;
NodeMapType mIDNamespaceNodes;
NodeMapType mSIDNamespaceNodes;
// Record the nodes which are to connect to its target node.
// Save the ID of the target node if a node has its target
typedef FbxMap<FbxNode *, FbxString> TargetIDMapType;
TargetIDMapType mTargetIDs;
FbxColladaNamespace mNamespace;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_COLLADA_READER_H_ */

View File

@ -0,0 +1,570 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxwritercollada14.h
#ifndef _FBXSDK_FILEIO_COLLADA_WRITER_H_
#define _FBXSDK_FILEIO_COLLADA_WRITER_H_
#include <fbxsdk.h>
#include <fbxsdk/fileio/collada/fbxcolladautils.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** \brief Class to export FBX scene into a Collada file.
* \nosubgrouping
*/
class FbxWriterCollada : public FbxWriter
{
public:
/**
* \name Constructors and Destructor
*/
//@{
/** Constructor.
* \param pManager FBX SDK object Manager.
* \param pID Internal ID.
* \param pStatus The FbxStatus object to hold error codes.
*/
FbxWriterCollada(FbxManager& pManager, int pID, FbxStatus& pStatus);
//! Destructor.
virtual ~FbxWriterCollada();
//@}
/**
* \name File Management
*/
//@{
/** Create and open file with the given name.
* \param pFileName the name of file.
* \return Return true if the specified file is created and opened.
*/
virtual bool FileCreate(char* pFileName);
/** Close file.
* \return Return true if file is closed successfully, false otherwise.
*/
virtual bool FileClose();
/** Check if current file is open.
* \return Return true if file is open, false otherwise.
*/
virtual bool IsFileOpen();
//@}
/**
* \name Write Functions
*/
//@{
/** Get Collada export options settings.
*/
virtual void GetWriteOptions(){}
/** Export the FBX document to Collada file, according to the given options settings.
* \param pDocument FBX Document to export.
* \return true on success, false otherwise.
*/
virtual bool Write(FbxDocument* pDocument);
/** Process FBX scene before exporting FBX scene to Collada file.
* \param pScene the FBX scene to precess.
* \return Return true if the given scene is processed successfully.
* \remarks This function is processing name clash, special transformation conversion etc.
*/
virtual bool PreprocessScene(FbxScene &pScene);
/** Process FBX scene after exporting FBX scene to Collada file.
* \param pScene the FBX scene to precess.
* \return Return true if the given scene is processed successfully.
*/
virtual bool PostprocessScene(FbxScene &pScene);
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
/**
* \name Export Functions
*/
//@{
/** Export FBX scene info to Collada asset.
* \param pXmlNode the XML Node to export asset, asset nodes will be added as children to this XML node.
* \param pSceneInfo Pointer to the FBX scene information object.
* \return Return pointer to XML asset node.
* \remarks Asset here contains user-defined summary data, such as:
* contributor, author, authoring tool, created time, Axis System, etc.
*/
xmlNode* ExportAsset(xmlNode* pXmlNode, FbxDocumentInfo* pSceneInfo);
/** Export FBX scene.
* \param pScene Pointer to the FBX scene object.
* \return The pointer to XML scene element.
*/
xmlNode * ExportScene(FbxScene* pScene);
/** Export Libraries to the Collada document.
* \param pXmlNode Pointer to XML Node, it should be the asset node.
* \return Return true if all libraries are exported successfully.
* \remarks After the libraries are created, call this function to add libraries to the Collada document.
* Libraries are added as the siblings just after the given pXmlNode.
*/
bool ExportLibraries(xmlNode* pXmlNode);
/** Export the given FBX node and its hierarchy to Collada XML nodes.
* \param pXmlNode Pointer to XML Node, created XML nodes hierarchy will be added as children to this XML node.
* \param pNode Pointer to FBX node, it should be one node in FBX nodes tree.
* \return Return pointer to XML node.
* \remarks The returned XML node is corresponding to the given FBX node,
* the returned XML node will be added as child to the given pXmlNode,
* this method is called recursively.
*/
xmlNode* ExportNodeRecursive(xmlNode* pXmlNode, const FbxNode* pNode);
/** Export a Collada visual_scene MAX3D extension for the given FBX scene.
* \param pExtraElement The parent COLLADA extra element.
* \param pScene The FBX scene to be exported.
*/
void ExportVisualSceneMAX3DExtension(xmlNode * pExtraElement, FbxScene * pScene);
/** Export a Collada visual_scene FCOLLADA extension for the given FBX scene.
* \param pExtraElement The parent COLLADA extra element.
* \param pScene The FBX scene to be exported.
*/
void ExportVisualSceneFCOLLADAExtension(xmlNode * pExtraElement, FbxScene * pScene);
/** Export the given FBX node and its node attributes to Collada XML node.
* \param pXmlNode Pointer to XML Node, created XML node will be added as child to this XML node.
* \param pNode Pointer to FBX node, it should be one node in FBX nodes tree.
* \return Return pointer to the created XML node.
* \remarks The returned XML node is corresponding to the given FBX node,
* the returned XML node will be added as child to the given pXmlNode.
*/
xmlNode* ExportNode(xmlNode* pXmlNode, const FbxNode* pNode);
/** Export the given FBX node's default transformation.
* \param pXmlNode Pointer to XML Node.
* \param pNode Pointer to FBX node.
* \return Return true if transformation is exported successfully.
* \remarks FBX node transformation info is exported to properties of pXmlNode and its children,
* according to the Collada transformation structures.
*/
bool ExportTransform(xmlNode* pXmlNode, const FbxNode* pNode);
/** Export FBX node attributes, create different libraries according to different node attribute type.
* \param pXmlNode Pointer to XML Node.
* \param pNode Pointer to FBX node.
* \return Return true if FBX node attributes is exported successfully, false otherwise.
* \remarks According to different FBX node attribute type, different libraries will be created, such as:
* light, camera, geometry. See more details in CreateMeshLibrary(FbxNode* pNode), CreateCameraLibrary(FbxNode* pNode), CreateLightLibrary(FbxNode* pNode).
*/
bool ExportNodeAttribute(xmlNode* pXmlNode, const FbxNode* pNode);
/** Create geometry library for the given FBX node.
* \param pNode Pointer to FBX node, its node attribute type should be FbxNodeAttribute::eMesh, or FbxNodeAttribute::eNurbs, or FbxNodeAttribute::ePatch.
* \return Return pointer to XML mesh library node.
* \remarks The returned XML node will be added to the geometry library,
* the geometry library will be added to the Collada document by ExportLibraries(xmlNode* pXmlNode).
*/
xmlNode* CreateMeshLibrary(const FbxNode* pNode);
/** Create camera library for the given FBX node.
* \param pNode Pointer to FBX node, its node attribute type should be FbxNodeAttribute::eCamera.
* \return Return pointer to XML camera library node.
* \remarks The returned XML node will be added to the camera library,
* the camera library will be added to the Collada document by ExportLibraries(xmlNode* pXmlNode).
*/
xmlNode* CreateCameraLibrary(const FbxNode* pNode);
/** Create light library for the given FBX node.
* \param pNode Pointer to FBX node, its node attribute type should be FbxNodeAttribute::eLight.
* \return Return pointer to XML light library node.
* \remarks The returned XML node will be added to the light library,
* the light library will be added to the Collada document by ExportLibraries(xmlNode* pXmlNode).
*/
xmlNode* CreateLightLibrary(const FbxNode* pNode);
/** Export the given FBX mesh node to Collada XML node.
* \param pNode Pointer to FBX node, its node attribute type should be FbxNodeAttribute::eMesh.
* \return Return pointer to XML mesh node.
* \remarks Vertex, polygons of the mesh will be exported.
* Textures, materials, controllers, and shapes which linked to the mesh will also be exported.
*/
xmlNode* ExportMesh(const FbxNode* pNode);
/** Export the given shape's geometry to Collada XML node.
* \param pMeshShape, Pointer to FBX mesh, corresponding to shape.
* \param pShapeId, a string to identify shape from internal shape meshes list.
* \return Return pointer to XML shape geometry node.
* \remarks The geometry of shape will be exported, materials of shape will not be exported.
*/
xmlNode* ExportShapeGeometry(FbxMesh* pMeshShape, FbxString pShapeId);
/** Export the given mesh's vertex position to Collada XML node.
* \param pXmlNode Pointer to XML Node, created XML node will be added as child to this XML node.
* \param pMesh Pointer to FBX mesh object, position info of all the vertices of this mesh will be exported.
* \param pMeshName Name of the XML node to export, usually it's the name of FBX mesh node.
* \param pInGeometry True if vertices are inside an ordinary geometry, false if vertices are in a binded geometry.
* \param pExportControlPoints True if pMesh is an ordinary geometry, false if pMesh is a binded geometry.
* \return Return pointer to XML vertex position node, the returned XML node will be added as child to the given pXmlNode.
* \remarks In an ordinary geometry, pExportControlPoints should be true, export the position of the control points;
* in a binded geometry, pExportControlPoints should be false, export the position of the transformed control points.
*/
//Note why internally set pExportControlPoints to true?
xmlNode* ExportVertexPositions(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pMeshName, bool pInGeometry, bool pExportControlPoints);
/** Export all layer elements of the given mesh to Collada XML node.
* \param pXmlMesh Pointer to XML Node, created XML layer elements nodes will be added as child to this XML node.
* \param pMesh Pointer to FBX mesh object, all layer elements of this mesh node will be exported.
* \param pName String which used to construct the names of XML layer elements nodes.
* \return Return the modified pXmlMesh.
* \remarks Layer elements including Normals, UVs, Vertex Colors are covered,
* polygon groups and other undefined layer elements are NOT supported.
*/
xmlNode* ExportLayerElements(xmlNode* pXmlMesh, FbxMesh* pMesh, FbxString pName);
/** Export Normals of specified layer of the given mesh to Collada XML node.
* \param pXmlNode Pointer to XML Node, created XML Normals node will be added as child to this XML node.
* \param pMesh Pointer to FBX mesh object, normals layer element of this mesh node will be exported.
* \param pName String which used to construct the names of XML normals nodes.
* \param pExt Extension string which used to construct the names of XML normals nodes.
* \param pLayerIndex Specify an index of layers to export, normals of other layers will NOT be exported.
* \return Return pointer to XML Normals node.
* \remarks The returned XML node will be added as child to the given pXmlNode.
*/
xmlNode* ExportNormals(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName, FbxString pExt, int pLayerIndex);
/** Export UVs of specified layer of the given mesh to Collada XML node.
* \param pXmlNode Pointer to XML Node, created XML UVs node will be added as child to this XML node.
* \param pMesh Pointer to FBX mesh object, UVs layer element of this mesh node will be exported.
* \param pName String which used to construct the names of XML UVs nodes.
* \param pLayerIndex Specify an index of layers to export, UVs of other layers will NOT be exported.
* \return Return pointer to XML UVs node.
* \remarks The returned XML node will be added as child to the given pXmlNode.
*/
xmlNode* ExportUVs(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName, int pLayerIndex);
/** Export VertexColors of specified layer of the given mesh to Collada XML node.
* \param pXmlNode Pointer to XML Node, created XML VertexColors node will be added as child to this XML node.
* \param pMesh Pointer to FBX mesh object, VertexColors layer element of this mesh node will be exported.
* \param pName String which used to construct the names of XML VertexColors nodes.
* \param pLayerIndex Specify an index of layers to export, VertexColors of other layers will NOT be exported.
* \return Return pointer to XML VertexColors node.
* \remarks The returned XML node will be added as child to the given pXmlNode.
*/
xmlNode* ExportVertexColors(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName, int pLayerIndex);
/** Export the given mesh's vertex to Collada XML node.
* \param pXmlNode Pointer to XML Node.
* \param pMesh Pointer to FBX mesh object.
* \param pName Name of the XML node to export, usually it's the name of FBX mesh node.
* \return Return pointer to the created XML vertex node.
*/
xmlNode* ExportVertices(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName);
/** Export the given mesh's polygons to Collada XML node.
* \param pMeshElement Pointer to XML Node.
* \param pMesh Pointer to FBX mesh object.
* \param pMaterialName Specify the name of materials property.
* \param pMaterialIndexInNode Specify the material index in the FBXNode (will be ignored if there is only 1 material in the node)
* \param pName String which used to construct the names of created XML nodes.
* \param pShape true for shape node, false for general node, the default value is false;
* don't write out the materials if pShape is true.
* \return Return pointer to the created XML Polygons node.
*/
xmlNode* ExportPolygons(xmlNode* pMeshElement, FbxMesh* pMesh, FbxString pMaterialName, int pMaterialIndexInNode, FbxString pName, bool pShape = false);
/** Export all the materials used by the given mesh.
* \param pMesh FBX mesh to export.
* \param pNbMat materials count of pMesh.
* \return true on success, false otherwise.
*/
bool ExportMeshMaterials(FbxMesh *pMesh, int pNbMat);
/** Export the given material to the Material library.
* \param pMaterial Specify the surface material to export.
* \return Return pointer to the corresponding XML material node.
* \remarks If the given material is already in the materials library, return the XML node;
* otherwise, create and add XML material node to the Material library.
*/
xmlNode* ExportMaterial(FbxSurfaceMaterial *pMaterial);
/** Export the given material to the Effect library.
* \param pMaterial Specify the surface material to export.
* \param pEffectId Specify the effect ID to export.
* \return Return pointer to the corresponding XML effect node.
* \remarks Material is an instance of an effect.
* If the given material is already in the Effect library, return the XML node;
* otherwise, create and add XML effect node to the Effect library.
* Collada Effect support: Ambient Color, Diffuse Color, Emissive Color, Specular Color, Shiness, Reflective / Reflectivity,
* Opacity / Transparency.
*/
xmlNode* ExportEffect(FbxSurfaceMaterial *pMaterial, FbxString pEffectId);
/** Add the given texture as input to the given XML material node.
* \param pXmlMaterial Pointer to XML material node.
* \param pTexture FBX texture to export.
* \param pImageId A string to identify image from the image library.
* \param pLayerIndex Specify an index of layers to export.
* \param pLayerElementType Specify the layer element type.
* \return true on success, false otherwise.
*/
//Note why return true when failed and popped waring?
bool AddMaterialTextureInput(xmlNode *pXmlMaterial, FbxFileTexture *pTexture, FbxString pImageId, int pLayerIndex, int pLayerElementType);
/** Export the given texture to Collada XML node.
* \param pTexture FBX texture to export.
* \param pImageId A string to identify image from the image library.
* \param pLayerIndex Specify an index of layers to export.
* \return Return pointer to the created XML texture node.
*/
xmlNode* ExportTexture(FbxFileTexture *pTexture, FbxString pImageId, int pLayerIndex);
/** Export all the textures used by the given mesh.
* \param pMesh FBX mesh to export.
* \return true on success, false otherwise.
* \remarks The materials will also be Exported if needed.
*/
bool ExportMeshTextures(FbxMesh *pMesh);
/** Export the given FBX camera node to Collada XML node.
* \param pNode Pointer to FBX node, its node attribute type should be FbxNodeAttribute::eCamera.
* \return Return pointer to XML node.
* \remarks Camera parameters and properties will be exported.
*/
xmlNode* ExportCamera(const FbxNode* pNode);
/** Export the given FBX light node to Collada XML node.
* \param pNode Pointer to FBX node, its node attribute type should be FbxNodeAttribute::eLight.
* \return Return pointer to XML node.
* \remarks Light parameters and properties will be exported.
*/
xmlNode* ExportLight(const FbxNode* pNode);
/** Export the global ambient to Collada XML light node.
*/
void ExportSceneAmbient(xmlNode * pVisualSceneElement);
/** Export controllers of the given mesh to Collada XML node.
* \param pMesh FBX mesh to export, it should be a binded skin.
* \return true on success.
* \remarks A morph controller will be exported by ExportControllerShape().
*/
bool ExportController(FbxMesh *pMesh);
/** Export morph controllers of the given mesh to Collada XML node.
* \param pMesh FBX mesh to export, it should has more than one shape.
* \return true on success.
* \remarks Morph controller is also called shape deformer.
*/
bool ExportControllerShape(FbxMesh *pMesh);
/** .
* \param .
* \param .
* \return .
* \remarks .
*/
//Note : empty method now
xmlNode* ExportJointWeights(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pExt);
/** Update mesh library with the shapes found, and add shapes as nodes in the scene.
* \param pXmlNode Pointer to XML Node, created shape node will be added as child to this XML node.
* \return true on success, false otherwise.
* \remarks This method will create a geometry node in geometry library for every shape as needed,
* XML shape nodes will also be created and added to scene.
*/
bool UpdateMeshLibraryWithShapes(xmlNode* pXmlNode);
/** Export animations of the given node and its children, if they are animated.
* \param pNode FBX node to export, it should be animated.
* \return true on success, false otherwise.
* \remarks This method is called recursively, the animations of all the children of pXmlNode will also be exported.
*/
bool ExportAnimation(FbxNode* pNode);
/** Export all the animation curves of the given node to Collada XML node.
* \param pNode FBX node to export, it should be animated.
* \param pAnimationNode Pointer to XML Node, created sub-animation nodes will be added as children to this XML node.
* \return true on success.
*/
bool ExportAnimationCurves(FbxNode* pNode, xmlNode* pAnimationNode);
/** Export the texture into library_images.
* \param pTexture The texture whose file name to be exported.
* \return Return the ID of the create image element.
*/
const FbxString ExportImage(FbxFileTexture * pTexture);
/** Export the given animation curve (FCurve) to Collada XML node.
* \param pAnimationNode Pointer to XML Node, created sub-animation node will be added as child to this XML node.
* \param pCurve Animation Curve to export.
* \param pChannelName The name of animation channel.
* \param pSubChannelName The name of animation sub-channel.
* \param pExportShape Shape animation flag, default value is false; When it's true, Id nomenclature is a bit different.
* \param pExportIntensity Intensity flag, default value is false; When it's true, FCurve values are divided by 100.
* \param pExportLib Library flag, default value is false; When it's true, Id nomenclature is a bit different.
* \return true on success.
* \remarks When pExportShape or pExportIntensity is true, FCurve values are divided by 100.
*/
bool ExportCurve(xmlNode* pAnimationNode, FbxAnimCurve* pCurve,
const char* pChannelName, const char* pSubChannelName,
bool pExportShape=false, bool pExportIntensity=false, bool pExportLib=false);
/** Check whether the first three elements of the given vector are both zero.
* \param pV the FBX vector4 to check.
* \return Return true if one of the first three elements of pV is not zero, return false if all of the three elements are both zero.
* \remarks If the absolute value of element is less than a tolerance, the element will be considered as zero.
*/
bool NotZero(FbxVector4 pV);
/** Check whether the first three elements of the given vector are both equal to the given value.
* \param pV the FBX vector4 to check.
* \param pValue the value to check.
* \return Return true if one of the first three elements of pV is NOT equal to pValue, return false if all of the three elements are both equal to pValue.
*/
bool NotValue(FbxVector4 pV, double pValue);
/** Check whether the given value is zero.
* \param pD the value to check.
* \return Return true if pD is NOT zero, return false if pD is zero.
* \remarks If the absolute value of pD is less than a tolerance, pD is considered as zero.
*/
bool NotZero(double pD);
/** Check whether the given node's translation is animated.
* \param pNode the FBX node to check.
* \return Return true if one of Translation X/Y/Z is animated, return false if both of Translation X/Y/Z are not animated.
* \remarks If there is no key on one property, this property is not animated.
*/
bool IsTranslationAnimated(const FbxNode *pNode);
/** Check whether the given node's rotation is animated.
* \param pNode the FBX node to check.
* \return Return true if one of Rotation X/Y/Z is animated, return false if both of Rotation X/Y/Z are not animated.
* \remarks If there is no key on one property, this property is not animated.
*/
bool IsRotationAnimated(const FbxNode *pNode);
/** Check whether the given node's rotation of specified axis is animated.
* \param pNode the FBX node to check.
* \param pAxis Specify index of rotation axis, 0 for Rotation X, 1 for Rotation Y, 2 for Rotation Z.
* \return Return true if the rotation of specified axis is animated, return false if it is not animated.
* \remarks If there is no key on one property, this property is not animated.
*/
bool IsRotationAnimated(const FbxNode *pNode, int pAxis);
/** Check whether the given node's scale is animated.
* \param pNode the FBX node to check.
* \return Return true if one of Scale X/Y/Z is animated, return false if both of Scale X/Y/Z are not animated.
* \remarks If there is no key on one property, this property is not animated.
*/
bool IsScaleAnimated(const FbxNode *pNode);
/** Copy mesh parameters from pRefMesh to pNewMesh.
* \param lNewMesh New FBX mesh.
* \param lRefMesh Referenced FBX mesh.
* \remarks Vertices, polygons, layers will be copied.
*/
void CopyMesh(FbxMesh *lNewMesh, FbxMesh *lRefMesh);
/** Convert camera focal length animation curve to camera field of view animation curve.
* \param pFOVCurve A curve that represents camera field of view.
* \param pFLCurve A curve that represents camera focal length animation.
* \param pCamera FBX camera to convert.
*/
void ConvertFocalLengthCurveToFOV(FbxAnimCurve *pFOVCurve, FbxAnimCurve *pFLCurve, FbxCamera *pCamera);
/** Preprocess the given FBX node and its hierarchy.
* \param pNode Pointer to FBX node.
* \remarks To correctly export FBX scene to Collada, this method process FBX nodes,
* such as set pivot state for every FBX node, do special transformation conversion for FBX lights and cameras.
* This method is called recursively.
*/
void PreprocessNodeRecursive(FbxNode* pNode);
/** Export the value of the specific property as a child element of an element.
* \param pProperty The property whose value to be exported.
* \param pParentElement The parent element of the created element.
*/
void ExportPropertyValue(const FbxProperty & pProperty,
xmlNode * pParentElement);
//@}
/**
* \name Error Management
*/
//@{
/** Add notification error info to notify users.
* \param pError String of error info.
*/
void AddNotificationError( FbxString pError );
/** Add notification warning info to notify users.
* \param pWarning String of warning info.
*/
void AddNotificationWarning( FbxString pWarning );
//@}
FbxFile* mFileObject;
FbxString mFileName;
bool mStatus;
// XML lib stuff
//
xmlDocPtr mXmlDoc;
// Scene information
FbxScene* mScene;
// AnimStack/Layer holding the animation
FbxAnimStack* mAnimStack;
FbxAnimLayer* mAnimLayer;
// Libraries
// NB: CODE and PROGRAM libraries are unused, so they are not created.
xmlNode* mLibraryAnimation;
xmlNode* mLibraryCamera;
xmlNode* mLibraryController;
xmlNode* mLibraryGeometry;
xmlNode* mLibraryImage;
xmlNode* mLibraryLight;
xmlNode* mLibraryMaterial;
xmlNode* mLibraryEffect;
xmlNode* mLibraryTexture;
xmlNode* mLibraryVisualScene;
// Shape information
FbxStringList *mShapeMeshesList;
// export options
bool mTriangulate;
bool mSingleMatrix;
FbxTime mSamplingPeriod;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_COLLADA_WRITER_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,256 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxreaderfbx5.h
#ifndef _FBXSDK_FILEIO_FBX_READER_FBX5_H_
#define _FBXSDK_FILEIO_FBX_READER_FBX5_H_
#include <fbxsdk.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxAnimLayer;
class Fbx5ObjectTypeInfo;
FbxReader* CreateFBXReader(FbxManager& pManager,
FbxImporter& pImporter,
int pID,
FbxStatus& pStatus);
void GetInfoFBXReader(int* pCount,
const char* * pExtensions,
const char* * pDescriptions);
class FbxReaderFbx5 : public FbxReader
{
public:
FbxReaderFbx5(FbxManager& pManager, FbxImporter& pImporter, int pID, FbxStatus& pStatus);
virtual ~FbxReaderFbx5();
virtual bool FileOpen(char* pFileName, bool pIgnoredArg);
virtual bool FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags){ return FbxReader::FileOpen(pFileName, pFlags); }
virtual bool FileOpen(char* pFileName);
virtual bool FileOpen(FbxFile * pFile);
virtual bool FileOpen(FbxStream * pStream, void* pStreamData);
virtual bool FileClose();
virtual bool IsFileOpen();
virtual void SetEmbeddingExtractionFolder(const char* pExtractFolder);
typedef enum
{
eASCII,
eBINARY,
eENCRYPTED
} EImportMode;
EImportMode GetImportMode();
virtual void GetVersion(int& pMajor, int& pMinor, int& pRevision);
virtual bool GetReadOptions(bool pParseFileAsNeeded = true);
virtual bool Read(FbxDocument* pDocument);
virtual bool GetReadOptions(FbxIO* pFbx, bool pParseFileAsNeeded = true);
virtual bool Read(FbxScene& pScene, FbxIO* pFbx);
virtual FbxDocumentInfo* GetSceneInfo() { return mSceneInfo; }
virtual FbxArray<FbxTakeInfo*>* GetTakeInfo() { return &mTakeInfo; }
virtual bool SupportsStreams() const { return true; }
private:
void ReadOptionsInMainSection();
void ReadTakeOptions();
bool ReadOptionsInExtensionSection(int& pSectionIndex);
void ReadOptionsInGenericSection();
bool WriteOptionsInExtensionSection(bool pOverwriteLastExtensionSection=false);
bool WriteThumbnail(FbxThumbnail*);
FbxDocumentInfo* ReadSceneInfo();
FbxDocumentInfo* ReadSceneInfo(FbxString& pType);
void WriteSceneInfo(FbxDocumentInfo*);
void SetIsBeforeVersion6WithMainSection(bool pOpenMainSection);
bool ReadDefinitionSection(FbxScene& pScene, FbxArray<Fbx5ObjectTypeInfo*>& pObjectContent);
bool ReadObjectSection(FbxScene& pScene, FbxArray<Fbx5ObjectTypeInfo*>& pObjectContent);
bool ReadObject(FbxScene& pScene, FbxString& pObjectType, FbxString& pObjectSubType, FbxString& pObjectName, FbxString& pObjectUniqueId);
bool ReadNode();
//bool ReadGenericNode(FbxScene& pScene);
bool ReadAnimation(FbxScene& pScene);
bool ReadTakeAnimation(FbxScene& pScene, FbxTakeInfo* pTakeInfo);
FbxThumbnail* ReadThumbnail();
bool ReadNodeAnimation(FbxIO& pFileObject, FbxScene& pScene, FbxTakeInfo* pTakeInfo);
bool TimeShiftNodeAnimation(FbxScene& pScene, FbxTakeInfo* pTakeInfo);
bool ReadHierarchy(FbxNode& pRootNode);
bool ResolveHierarchy(FbxNode& pRootNode);
bool ResolveLinks(FbxNode& pRootNode, FbxNode& pCurrentNode);
bool ResolveTargets(FbxNode& pRootNode);
bool ResolveUpNodes(FbxNode& pRootNode);
bool ResolveCameraBackgrounds(FbxScene& pScene);
void RemoveDuplicateTextures(FbxScene& pScene);
void RemoveDuplicateMaterials(FbxScene& pScene);
void ReadPose(FbxScene& pScene);
bool ReadPose(FbxScene& pScene, FbxPose* pPose, bool pAsBindPose);
void ReadCameraSwitcher(FbxScene& pScene);
void ReorderCameraSwitcherIndices(FbxScene& pScene);
void ReadGobo(FbxScene& pScene);
void ReadGoboSection(FbxScene& pScene);
void ReadGobo(FbxGobo& pGobo);
void ReadCharacter(FbxScene& pScene);
void ReadCharacter(FbxCharacter& pCharacter,int& pInputType, int& pInputIndex);
void ReadCharacterLinkGroup(FbxCharacter& pCharacter, int pCharacterGroupId);
void ReadCharacterLink(FbxCharacter& pCharacter, int pCharacterNodeId);
void ReadCharacterLinkRotationSpace(FbxCharacterLink& pCharacterLink);
void ReadFilterSet(FbxCharacter& pCharacter);
void ReadControlSet(FbxControlSet& pControlSet);
void ReadControlSetLinkGroup(FbxControlSet& pControlSet, int pCharacterGroupId);
void ReadControlSetLink(FbxControlSet& pControlSet, int pCharacterNodeId);
void ReadEffector(FbxControlSet& pControlSet);
void ReadEffectorAux(FbxControlSet& pControlSet);
int ReadCharacterPose(FbxScene& pScene);
bool ReadCharacterPose(FbxCharacterPose& pCharacterPose);
void ReadGlobalLightSettings(FbxScene& pScene);
void ReadShadowPlane(FbxScene& pScene);
void ReadAmbientColor(FbxScene& pScene);
void ReadFogOption(FbxScene& pScene);
void ReadGlobalCameraAndTimeSettings(FbxScene& pScene); // for pre v6 files
void ReadGlobalTimeSettings(FbxScene& pScene);
void ReadGlobalCameraSettings(FbxScene& pScene);
bool ReadMedia(FbxScene& pScene, const char* pEmbeddedMediaDirectory = "");
FbxString ReadMediaClip(const char* pEmbeddedMediaDirectory);
bool ReadNode ( FbxNode& pNode );
bool ReadGenericNode ( FbxGenericNode& pNode );
bool ReadNodeChildrenName ( FbxNode& pNode );
bool ReadNodeShading ( FbxNode& pNode );
bool ReadNodeCullingType ( FbxNode& pNode );
bool ReadNodeLimits ( FbxNode& pNode );
bool ReadNodeTarget ( FbxNode& pNode );
bool ReadNodeAttribute ( FbxNode& pNode );
bool ReadNodePivots ( FbxNode& pNode );
bool ReadNodeDefaultAttributes ( FbxNode& pNode );
bool ReadNodeProperties ( FbxNode& pNode );
bool ReadGeometry ( FbxGeometry& pGeometry );
bool ReadGeometryMaterial ( FbxGeometry& pGeometry );
bool ReadGeometryTexture ( FbxGeometry& pGeometry );
bool ReadGeometryLinks ( FbxGeometry& pGeometry );
bool ReadGeometryShapes ( FbxGeometry& pGeometry );
bool ReadGeometryLayer ( FbxGeometry& pGeometry );
bool ReadGeometryTextureLayer ( FbxGeometry& pGeometry, int pLayerIndex );
bool ReadNull ( FbxNull& pNull );
bool ReadMarker ( FbxMarker& pMarker );
bool ReadCamera ( FbxCamera& pCamera );
bool ReadCameraSwitcher ( FbxCameraSwitcher& pCameraSwitcher );
bool ReadLight ( FbxLight& pLight );
bool ReadMesh ( FbxMesh& pMesh );
bool ReadMeshVertices ( FbxMesh& pMesh );
bool ReadMeshNormals ( FbxMesh& pMesh );
bool ReadMeshAssignation ( FbxMesh& pMesh );
bool ReadMeshPolygonIndex ( FbxMesh& pMesh );
bool ReadMeshPolyGroupIndex ( FbxMesh& pMesh );
bool ReadMeshMaterialsID ( FbxMesh& pMesh );
bool ReadMeshTexturesID ( FbxMesh& pMesh );
bool ReadMeshTextureType ( FbxMesh& pMesh );
bool ReadMeshTextureUV ( FbxMesh& pMesh );
bool ReadMeshTextureIndex ( FbxMesh& pMesh );
bool ReadMeshVertexColors ( FbxMesh& pMesh );
// Layer elements
bool ReadLayerElements (FbxGeometry& pGeometry);
bool ReadLayerElementsMaterial (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsMaterial);
bool ReadLayerElementsNormal (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsNormal);
bool ReadLayerElementsVertexColor (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsVertexColor);
bool ReadLayerElementsTexture (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsTexture);
bool ReadLayerElementsUV (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsUV);
bool ReadLayerElementsPolygonGroup (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsPolygonGroup);
bool ReadNurb ( FbxNurbs& pNurbs );
bool ReadPatch ( FbxPatch& pPatch );
int ReadPatchType ( FbxPatch& pPatch );
bool ReadTexture(FbxFileTexture& pTexture);
bool ReadSurfaceMaterial(FbxSurfacePhong& pMaterial);
bool ReadLink(FbxCluster& pLink);
bool ReadSkin(FbxSkin& pSkin);
bool ReadCluster(FbxCluster& pCluster);
bool ReadShape(FbxShape& pShape, FbxGeometry& pGeometry);
bool ReadVideo(FbxVideo& pVideo);
bool ReadConstraint(FbxConstraint& pPosition);
bool ReadUserProperties (FbxNode& pNode);
bool ReadProperties(FbxObject *pObject);
//
// 6.0 Format specific
//
bool ReadConnectionSection();
void ReadPoses(FbxScene& pScene);
FbxString ConvertCameraName(FbxString pCameraName);
bool GenerateParametricGeometryLayer(FbxGeometry& pGeometry);
void CorrectTextureLayers(FbxMesh& pMesh);
void TransferAnimation(void* pRootCurveNode, FbxProperty& pRootProperty, bool pValueOnly = false);
void ReadAnimation(FbxIO& pFileObject, void* pCurveNode);
void ReadAnimation(FbxIO& pFileObject, FbxObject* pObj);
void ReadTimeWarps(FbxIO& pFileObject, FbxMultiMap& pTimeWarpSet);
void DestroyTimeWarps(FbxMultiMap& pTimeWarpSet);
FbxNode* FindNode (char* pName);
int FindString(FbxString pString, FbxArray<FbxString*>& pStringArray);
FbxString FindFile(FbxString pFullFilePath, FbxString pRelativeFilePath = "");
bool ReadPassword(FbxString pPassword);
void ReadSceneGenericPersistenceSection(FbxScene& pScene);
private:
FbxReaderFbx5& operator=(FbxReaderFbx5 const&) { return *this; }
FbxIO* mFileObject;
FbxImporter& mImporter;
FbxCharPtrSet mNodeArrayName;
FbxCharPtrSet mTargetArrayName;
FbxCharPtrSet mUpNodeArrayName;
FbxCharPtrSet mCameraBackgroundArrayName;
FbxObjectStringMap mObjectMap;
FbxArray<FbxTakeInfo *> mTakeInfo;
FbxDocumentInfo * mSceneInfo;
FbxAnimLayer* mAnimLayer;
// Temporary storage
FbxArray<FbxTexture*> mTemporaryTextures;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_FBX_READER_FBX5_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,180 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxreaderfbx7.h
#ifndef _FBXSDK_FILEIO_FBX_READER_FBX7_H_
#define _FBXSDK_FILEIO_FBX_READER_FBX7_H_
#include <fbxsdk.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
struct FbxReaderFbx7_Impl;
/** \brief This class is the FBX v7 reader.
* The reader provide you the ability to read the global settings, objects and animation information from file.
*
*/
class FbxReaderFbx7 : public FbxReader
{
public:
/** \enum EImportMode File import mode.
*
*/
typedef enum
{
eASCII, /**< Plain text mode */
eBINARY, /**< Binary mode */
eENCRYPTED /**< Encrypted mode */
} EImportMode;
/** Constructor
* \param pManager the FbxManager Object
* \param pImporter the FbxImporter to import the SDK objects
* \param pID id for current reader
* \param pStatus the FbxStatus object to hold error codes
*/
FbxReaderFbx7(FbxManager& pManager, FbxImporter& pImporter, int pID, FbxStatus& pStatus);
/** Destructor
*
*/
virtual ~FbxReaderFbx7();
/** Open file with certain EFileOpenSpecialFlags
* \param pFileName name of the File to open
* \param pFlags the EFileOpenSpecialFlags to open with
* \return if the file is open successfully return true, otherwise return false
*/
virtual bool FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags);
/** Open file with default flag
* \param pFileName name of the File to open
* \return if the file is open successfully return \c true, otherwise return \c false
*/
virtual bool FileOpen(char* pFileName);
/** Open file with default flag
*/
virtual bool FileOpen(FbxFile* pFile);
/** Open file from stream
*/
virtual bool FileOpen(FbxStream * pStream, void* pStreamData);
/** Close the file stream
* \return if the file is closed successfully return \c true, otherwise return \c false
*/
virtual bool FileClose();
/** Check whether the file stream is open.
* \return if the file stream is open return \c true, otherwise return \c false.
*/
virtual bool IsFileOpen();
/** Get current Import mode
*
*/
EImportMode GetImportMode();
/** Get file version
* \param pMajor Major version
* \param pMinor Minor version
* \param pRevision Revision version
*/
virtual void GetVersion(int& pMajor, int& pMinor, int& pRevision);
/** Get axis system information from file
* \param pAxisSystem axis system in file
* \param pSystemUnits system unit in file
* \return if either pAxisSystem or pSystemUnits is \c NULL return \c false, otherwise return \c true.
*/
virtual bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
/** Get FBX file time mode read from GlobalSettings in FBX 6.n and FBX 7.n
* \param pTimeMode ref to a FbxTime::EMode enum
* \return \c true on success, \c false otherwise.
* \remarks This function must be called after FbxImporter::Initialize().
* Can be used for statistics (via GlobalSettings) before loading the whole scene from the file.
*/
virtual bool GetFrameRate(FbxTime::EMode &pTimeMode);
/** Get the statistics from file
* \param pStats statistics in file
* \return if fetching statistics is successfully return \c true, otherwise return \c false.
*/
virtual bool GetStatistics(FbxStatistics* pStats);
/** Get the file stream options
* \param pParseFileAsNeeded Whether to parse file as read options
* \return true on success, otherwise return false.
*/
virtual bool GetReadOptions(bool pParseFileAsNeeded = true);
/** Read file with stream options
* \param pDocument FbxDocument to store the file data
* \return if fetching statistics is successful return \c true, otherwise return \c false.
*/
virtual bool Read(FbxDocument *pDocument);
/** Reads extension plug-ins name, version and parameters, so that we can remember if a plug-in was used during export.
* This is especially useful for extension plug-ins that modify the scene and also to warn users during import if an
* extension plug-in was used that could be missing.
* \param pParams The parameters of the extension plug-in. The properties of the objects are used
* as the parameters of the extension plug-in.
*/
virtual void PluginReadParameters(FbxObject& pParams);
/** Get the file options
* \param pFbx file object to read options
* \param pParseFileAsNeeded Whether to parse file as read options
* \return true on success, otherwise return false.
*/
virtual bool GetReadOptions(FbxIO* pFbx, bool pParseFileAsNeeded = true);
/** Read file with stream options
* \param pDocument FbxDocument to store the file data
* \param pFbx file object to read from
* \return if reading the file is successful return \c true, otherwise return \c false.
*/
virtual bool Read(FbxDocument *pDocument, FbxIO* pFbx);
/** Returns the scene info from the file.
* \return The pointer to file scene info defined by this reader.
*/
virtual FbxDocumentInfo* GetSceneInfo();
/** Returns the pointer to the list of TakeInfo from the file.
* \return NULL
*/
virtual FbxArray<FbxTakeInfo*>* GetTakeInfo();
/** Pass a progress handler to the reader
* \param pProgress FbxProgress to store the progress information.
*/
virtual void SetProgressHandler(FbxProgress *pProgress);
virtual void SetEmbeddingExtractionFolder(const char* pExtractFolder);
virtual bool SupportsStreams() const { return true; }
private:
// Declared, not defined.
FbxReaderFbx7(const FbxReaderFbx7&);
FbxReaderFbx7& operator=(FbxReaderFbx7 const&);
private:
FbxReaderFbx7_Impl* mImpl;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_FBX_READER_FBX7_H_ */

View File

@ -0,0 +1,211 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxwriterfbx5.h
#ifndef _FBXSDK_FILEIO_FBX_WRITER_FBX5_H_
#define _FBXSDK_FILEIO_FBX_WRITER_FBX5_H_
#include <fbxsdk.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
//Writable versions for this file type.
//Sync the functions PreProcessScene and PostProcessScene with these elements of this list.
class FbxWriterFbx5 : public FbxWriter
{
public:
FbxWriterFbx5(FbxManager& pManager, FbxExporter& pExporter, int pID, FbxStatus& pStatus);
virtual ~FbxWriterFbx5();
virtual bool FileCreate(char* pFileName);
virtual bool FileCreate(FbxStream* pStream, void* pStreamData);
virtual bool FileClose();
virtual bool IsFileOpen();
typedef enum
{
eASCII,
eBINARY,
eENCRYPTED
} EExportMode;
void SetExportMode(EExportMode pMode);
virtual void GetWriteOptions();
virtual bool Write(FbxDocument* pDocument);
virtual bool Write(FbxDocument* pDocument, FbxIO* pFbx);
virtual bool PreprocessScene(FbxScene& pScene);
virtual bool PostprocessScene(FbxScene& pScene);
virtual bool SupportsStreams() const { return true; }
private:
bool WriteAnimation(FbxScene& pScene);
bool WriteAnimation(FbxNode& pRootNode, FbxAnimLayer* pAnimLayer);
void WriteTakeNode(KFCurveNode* pCurveNode, bool pRescaleShininess);
bool WriteTakeNode(FbxObject& pObj, FbxAnimLayer* pAnimLayer, const char* pBlockName, bool pRescaleShininess = false);
bool WriteThumbnail(FbxThumbnail* pThumbnail);
void WriteSceneInfo(FbxDocumentInfo*);
bool WriteExtensionSection(FbxScene& pScene, int pMediaCount);
bool WriteNode(FbxNode* pNode);
bool WriteCameraSwitcher(FbxScene& pScene);
void WriteGobo(FbxScene& pScene);
void WriteGoboSection(FbxScene& pScene);
void WriteGobo(FbxGobo& pGobo);
void WriteCharacter(FbxScene& pScene);
void WriteCharacter(FbxScene& pScene, int pCharacterIndex);
void WriteCharacterLinkGroup(FbxCharacter& pCharacter, int pCharacterGroupId, FbxScene& pScene, bool pBackwardCompatible);
void WriteCharacterLink(FbxCharacter& pCharacter, int pCharacterNodeId, FbxScene& pScene, bool pBackwardCompatible);
void WriteFilterSet(FbxCharacter& pCharacter);
void WriteControlSet(FbxControlSet& pControlSet, FbxScene& pScene, bool pBackwardCompatible);
void WriteControlSetLinkGroup(FbxControlSet& pControlSet, int pCharacterGroupId, FbxScene& pScene, bool pBackwardCompatible);
void WriteControlSetLink(FbxControlSet& pControlSet, int pCharacterNodeId, FbxScene& pScene);
void WriteEffector(FbxControlSet& pControlSet, int pEffectorNodeId, FbxScene& pScene);
void WriteEffectorAux(FbxControlSet& pControlSet, int pEffectorNodeId, FbxScene& pScene);
int WriteCharacterPose(FbxScene& pScene);
void WriteCharacterPose(FbxCharacterPose& pCharacterPose);
void WritePose(FbxScene& pScene);
void WritePose(FbxPose& pPose);
void WriteConstraint(FbxScene& pScene);
void WriteGlobalLightSettings(FbxScene& pScene);
void WriteShadowPlane(FbxScene& pScene);
void WriteShadowPlaneSection(FbxScene& pScene);
void WriteAmbientColor(FbxScene& pScene);
void WriteFogOption(FbxScene& pScene);
void WriteGlobalCameraAndTimeSettings(FbxScene& pScene);
bool WriteMedia(FbxScene& pScene, bool pMediaEmbedded, int& pMediaCount);
bool WriteMediaClip(FbxString& pFileName, bool pEmbeddedMedia);
void WriteDefaultMedia();
bool WriteNode (FbxNode& pNode);
bool WriteNodeBegin (FbxNode& pNode);
bool WriteNodeParameters (FbxNode& pNode);
bool WriteNodeVersion (FbxNode& pNode);
bool WriteNodeShading (FbxNode& pNode);
bool WriteNodeAnimationSettings (FbxNode& pNode);
bool WriteNodeCullingType (FbxNode& pNode);
bool WriteNodeLimits (FbxNode& pNode);
bool WriteNodeProperties (FbxNode& pNode);
bool WriteNodeTarget (FbxNode& pNode);
bool WriteNodeAnimatedProperties(FbxNode& pNode);
bool WriteNodeAttribute (FbxNode& pNode);
bool WriteNodeDefaultAttributes (FbxNode& pNode);
bool WriteNodeChildrenList (FbxNode& pNode);
bool WriteNodeEnd (FbxNode& pNode);
bool WriteNull ( FbxNull* pNull );
bool WriteMarker ( FbxNode& pNode );
bool WriteCamera ( FbxCamera& pCamera, bool pIsProducerCamera = false );
bool WriteCameraSwitcher ( FbxCameraSwitcher& pCameraSwitcher );
bool WriteLight ( FbxLight& pLight );
bool WriteGeometry ( FbxGeometry& pGeometry );
bool WriteGeometryLayer ( FbxGeometry& pGeometry );
bool WriteGeometryTextureLayer ( FbxGeometry& pGeometry, int pIndex );
bool WriteMesh ( FbxMesh& pMesh );
bool WriteMeshVertices ( FbxMesh& pMesh );
bool WriteMeshNormals ( FbxMesh& pMesh );
bool WriteMeshMaterial ( FbxMesh& pMesh );
bool WriteMeshTexture ( FbxMesh& pMesh );
bool WriteMeshGeometryUVInfo ( FbxMesh& pMesh );
bool WriteMeshPolyVertexIndex ( FbxMesh& pMesh );
bool WriteMeshPolyGroupIndex ( FbxMesh& pMesh );
bool WriteMeshVertexColors ( FbxMesh& pMesh );
bool WriteNurb ( FbxNurbs& pNurbs );
bool WritePatch ( FbxPatch& pPatch );
bool WritePatchType ( FbxPatch& pPatch, int pType );
bool WriteSkeleton ( FbxSkeleton& pSkeleton );
bool WriteSkeletonRoot ( FbxSkeleton& pSkeleton );
bool WriteSkeletonLimb ( FbxSkeleton& pSkeleton );
bool WriteSkeletonLimbNode ( FbxSkeleton& pSkeleton );
bool WriteSkeletonEffector ( FbxSkeleton& pSkeleton );
bool WriteOpticalReference ( FbxOpticalReference& pOpticalReference );
bool WriteTexture(FbxFileTexture& pTexture);
bool WriteSurfaceMaterial(FbxSurfaceMaterial& pMaterial);
bool WriteLink(FbxCluster& pCluster);
bool WriteShape(FbxShape& pShape, FbxString pShapeName, FbxGeometry& pGeometry);
bool WriteProperties(FbxObject* pObject);
int FindString(FbxString pString, FbxArray<FbxString*>& pStringArray);
void FindShapeValidIndices(FbxArray<FbxVector4>& pGeometryControlPoints, FbxArray<FbxVector4>& pShapeControlPoints, FbxArray<int>& lValidIndices);
void ConvertShapeNamesToV5Format(FbxNode& pNode);
void RevertShapeNamesToV6Format (FbxNode& pNode);
void WritePassword();
void FindAnimatedChannels(FbxScene& pScene);
void ClearAnimatedChannels();
void WriteSceneGenericPersistenceSection(FbxScene& pScene);
void ForceKFCurveNodesOnTRS(FbxNode* pNode);
void SetPivotStateRecursive(FbxNode* pNode);
private:
FbxWriterFbx5& operator=(const FbxWriterFbx5&) { return *this; }
FbxIO* mFileObject;
FbxExporter& mExporter;
EExportMode mExportMode;
FbxMultiMap mTextureAnimatedChannels;
FbxMultiMap mMaterialAnimatedChannels;
struct TextureAnimatedChannels
{
bool mTranslation;
bool mRotation;
bool mScaling;
bool mAlpha;
};
struct SurfaceMaterialAnimatedChannels
{
bool mAmbient;
bool mDiffuse;
bool mSpecular;
bool mEmissive;
bool mOpacity;
bool mShininess;
bool mReflectivity;
};
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_FBX_WRITER_FBX5_H_ */

View File

@ -0,0 +1,311 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxwriterfbx6.h
#ifndef _FBXSDK_FILEIO_FBX_WRITER_FBX6_H_
#define _FBXSDK_FILEIO_FBX_WRITER_FBX6_H_
#include <fbxsdk.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class Fbx6TypeDefinition;
class Fbx6TypeWriteReferences;
class Fbx6TypeObjectHierarchy;
typedef FbxArray<FbxTakeInfo*> TakeInfoArray;
class FbxWriterFbx6 : public FbxWriter
{
public:
FbxWriterFbx6(FbxManager& pManager, FbxExporter& pExporter, int pID, FbxStatus& pStatus);
virtual ~FbxWriterFbx6();
virtual bool FileCreate(char* pFileName);
virtual bool FileCreate(FbxStream* pStream, void* pStreamData);
virtual bool FileClose();
virtual bool IsFileOpen();
typedef enum {eASCII, eBINARY, eENCRYPTED} EExportMode;
void SetExportMode(EExportMode pMode);
virtual void GetWriteOptions();
virtual bool Write(FbxDocument* pDocument);
virtual bool PreprocessScene(FbxScene& pScene);
virtual bool PostprocessScene(FbxScene& pScene);
virtual void PluginWriteParameters(FbxObject& pParams);
virtual bool Write(FbxDocument* pDocument, FbxIO* pFbx);
virtual void SetProgressHandler(FbxProgress *pProgress);
virtual bool SupportsStreams() const { return true; }
private:
/*************************** new writer ***************************/
void ConvertShapePropertyToOldStyle(FbxScene& pScene);
void ConvertShapePropertyToNewStyle(FbxScene& pScene);
void BuildObjectDefinition(FbxDocument* pDocument, Fbx6TypeDefinition& pDefinitions);
void SetObjectWriteSupport(const Fbx6TypeDefinition& pDefinitions);
bool WriteDescriptionSection(FbxDocument* pDocument);
bool WriteReferenceSection(FbxDocument* pDocument, Fbx6TypeWriteReferences& pReferences);
void WriteObjectDefinition(FbxDocument* pDocument, Fbx6TypeDefinition& pDefinitions);
void WriteObjectProperties(FbxDocument* pDocument, Fbx6TypeDefinition& pDefinitions);
void FlattenDocument(FbxDocument* pDocument, Fbx6TypeObjectHierarchy& pDocHierarchy, bool pFirstCall=true);
void UnFlattenDocument(FbxDocument* pDocument, Fbx6TypeObjectHierarchy& pDocHierarchy);
bool WriteObjectHeaderAndReferenceIfAny(FbxObject& pObj, const char* pObjectType) const;
FbxObject* GetObjectIndirection(FbxObject* pObject);
void WriteObjectConnections(FbxDocument* pDocument);
void WriteTakesAndAnimation(FbxDocument* pDocument);
void WriteConstraints(FbxScene& pScene);
void WriteConstraint(FbxConstraint& pConstraint, FbxScene& pScene);
void WriteGeometryWeightedMap(FbxGeometryWeightedMap& pGeometryWeightedMap);
void WriteNodeAttributes(const FbxDocument& pDocument);
void WriteAllGeometries(FbxScene& pScene);
void WriteAllGeometryWeightedMaps(FbxScene& pScene);
int WriteCharacterPose(FbxScene& pScene);
void WriteCharacterPose(FbxCharacterPose& pCharacterPose);
void WriteCharacterLinkGroup(FbxCharacter& pCharacter, int pCharacterGroupId, FbxScene& pScene);
void WriteCharacterLink(FbxCharacter& pCharacter, int pCharacterNodeId, FbxScene& pScene);
void WriteCharacterLinkRotationSpace(FbxCharacterLink& pCharacterLink);
void WriteControlSetPlug(FbxScene& pScene);
/*************************** new writer ***************************/
bool WriteNodes(FbxScene& pScene, bool pIncludeRoot);
bool WriteNodes(const FbxDocument& pDocument);
/*************************** kept functions ***************************/
bool WriteObjectProperties(FbxObject* pObject);
bool WriteObjectPropertiesAndFlags(FbxObject* pObject);
bool WriteContainers(FbxScene& pScene);
bool WriteNode(FbxNode& pNode);
bool WriteNodeBegin(FbxNode& pNode);
bool WriteNodeEnd(FbxNode& pNode);
bool WriteNodeParameters(FbxNode& pNode);
bool WriteNodeVersion(FbxNode& pNode);
bool WriteNodeAnimationSettings(FbxNode& pNode);
bool WriteNodeShading(FbxNode& pNode);
bool WriteNodeCullingType(FbxNode& pNode);
bool WriteNodeAttribute(FbxNodeAttribute* pNodeAttribute);
bool WriteNodeProperties(FbxNode& pNode);
bool WriteNodeType(FbxNode& pNode);
bool WriteNull(FbxNull* pNull);
bool WriteMarker(FbxNode& pNode);
bool WriteSkeleton(FbxSkeleton& pSkeleton);
bool WriteSkeletonRoot(FbxSkeleton& pSkeleton);
bool WriteSkeletonLimb(FbxSkeleton& pSkeleton);
bool WriteSkeletonLimbNode(FbxSkeleton& pSkeleton);
bool WriteSkeletonEffector(FbxSkeleton& pSkeleton);
bool WriteGenericNodes(FbxScene& pScene);
bool WriteGeometry(FbxGeometry& pGeometry);
bool WriteMesh(FbxMesh& pMesh);
bool WriteMeshSmoothness(FbxMesh& pMesh);
bool WriteMeshVertices(FbxMesh& pMesh);
bool WriteMeshPolyVertexIndex(FbxMesh& pMesh);
bool WriteMeshEdges(FbxMesh& pMesh);
bool WriteNurb(FbxNurbs& pNurbs);
bool WriteNurbsSurface(FbxNurbsSurface& pNurbs);
bool WriteNurbsCurve(FbxNurbsCurve& pNurbsCurve);
bool WriteTrimNurbsSurface(FbxTrimNurbsSurface& pNurbs);
bool WriteBoundary(FbxBoundary& pBoundary);
bool WriteSubdiv(FbxSubDiv& pSubdiv);
bool WritePatch(FbxPatch& pPatch);
bool WritePatchType(FbxPatch& pPatch, int pType);
bool WriteDeformers(FbxScene& pScene);
bool WriteSkin(FbxSkin& pSkin);
bool WriteVertexCacheDeformer(FbxVertexCacheDeformer& pDeformer);
bool WriteCluster(FbxCluster& pCluster);
bool WriteShape(FbxShape& pShape, FbxString pShapeName, FbxGeometry& pGeometry);
void FindShapeValidIndices(FbxArray<FbxVector4>& pGeometryControlPoints, FbxArray<FbxVector4>& pShapeControlPoints, FbxArray<int>& lValidIndices);
bool WriteFbxLayerElementNormals(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementBinormals(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementTangents(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementMaterials(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementTextures(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementTexturesChannel(FbxLayerContainer& pLayerContainer, FbxLayerElement::EType pTextureType, FbxMultiMap& pLayerIndexSet);
bool WriteFbxLayerElementUVsChannel(FbxLayerContainer& pLayerContainer, FbxLayerElement::EType pTextureType, FbxMultiMap& pLayerIndexSet);
bool WriteFbxLayerElementPolygonGroups(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementVertexColors(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementUVs(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementSmoothing(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementUserData(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementVisibility(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementVertexCrease(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementEdgeCrease(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteFbxLayerElementHole(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
bool WriteLayers(FbxLayerContainer& pLayerContainer, FbxMultiMap&);
int MapLayeredTextureIndexToConnectionIndex(FbxNode* pNode, void* pLET, int pIndex);
bool WriteMaterials(FbxDocument* pDocument);
bool WriteSurfaceMaterial(FbxSurfaceMaterial& pMaterial);
bool WritePose(FbxScene& pScene);
// Write Connections
bool WriteFieldConnection(FbxDocument* pDocument, FbxObject* pSrcObject, FbxDocument* pDstDocument);
bool WriteFieldConnection(FbxDocument* pDocument, FbxObject* pSrc,FbxObject* pDst);
bool WriteFieldConnection(FbxDocument* pDocument, FbxObject* pSrc,FbxProperty& pDst);
bool WriteFieldConnection(FbxDocument* pDocument, FbxProperty& pSrc,FbxObject* pDst);
bool WriteFieldConnection(FbxDocument* pDocument, FbxProperty& pSrc,FbxProperty& pDst);
void WriteObjectConnections(FbxDocument* pDocument, FbxObject* pObject, bool pRecursive);
bool WriteCamera(FbxCamera& pCamera);
bool WriteCameraStereo(FbxCameraStereo& pCameraStereo);
bool WriteLight(FbxLight& pLight);
bool WriteCameraSwitcher(FbxScene& pScene);
bool WriteCameraSwitcher(FbxCameraSwitcher& pCameraSwitcher);
bool WriteTextures(FbxDocument* pDocument);
bool WriteTexture(FbxFileTexture& pTexture);
bool WriteTimeWarps(FbxDocument* pDocument, FbxAnimStack* pAnimStack);
bool WriteThumbnails(FbxDocument* pDocument);
bool WriteThumbnail(FbxThumbnail& pThumbnail);
bool WriteCaches(FbxDocument* pDocument);
bool WriteCache(FbxCache& pCache);
bool WriteBindingTables(FbxDocument* pDocument);
bool WriteBindingTable(FbxBindingTable& pTable);
bool WriteBindingOperators(FbxDocument* pDocument);
bool WriteBindingOperator(FbxBindingOperator& pOperator);
bool WriteImplementations(FbxDocument* pDocument);
bool WriteImplementation(FbxImplementation& pImplementation);
bool WriteCollections(FbxDocument* pDocument);
bool WriteCollection(FbxCollection& pImplementation);
bool WriteDocuments(FbxDocument* pDocument);
bool WriteDocument(FbxDocument& pSubDocument);
bool WriteLayeredTextures(FbxDocument* pDocument);
bool WriteLayeredTexture(FbxLayeredTexture& pTexture);
void WriteGobo(FbxScene& pScene);
void WriteGoboSection(FbxScene& pScene);
void WriteGobo(FbxGobo& pGobo);
bool WriteVideos(FbxDocument* pDocument);
bool WriteVideo(FbxVideo& pVideo, FbxString& pFileName, bool pEmbeddedMedia);
bool WriteAnimation(FbxDocument* pDocument);
bool WriteAnimation(FbxDocument* pDocument, FbxAnimLayer* pAnimLayer);
bool WriteFCurves(FbxObject& pObject, FbxAnimLayer* pAnimLayer, const char* pBlockName, bool pKeepBlockOpen=false, bool pRescaleShininess=false);
void WritePose(FbxPose& pPose);
bool WriteSelectionNode(FbxScene& pScene);
void WriteSelectionNode(FbxSelectionNode& pSelectionNode);
bool WriteSelectionSet(FbxScene& pScene);
void WriteSelectionSet(FbxSelectionSet& pSelectionSet);
bool WriteThumbnail(FbxThumbnail* pThumbnail);
void WriteSceneInfo(FbxDocumentInfo*);
void WriteGlobalSettings(FbxGlobalSettings& pGlobalSettings);
bool WriteExtensionSection(FbxScene& pScene, int pMediaCount);
int FindString(FbxString pString, FbxArray<FbxString*>& pStringArray);
/****************** Function that write in the v5 section******************/
void WriteGlobalLightSettings(FbxScene& pScene);
void WriteShadowPlane(FbxScene& pScene);
void WriteShadowPlaneSection(FbxScene& pScene);
void WriteAmbientColor(FbxScene& pScene);
void WriteFogOption(FbxScene& pScene);
void WriteGlobalCameraSettings(FbxScene& pScene);
void WriteGlobalTimeSettings(FbxScene& pScene);
/****************** Function that write in the v5 section******************/
void WritePassword();
void WriteLayeredAnimation(FbxScene& pScene);
private:
void WritePropertyTemplate(FbxClassId pClassId, FbxDocument* pDocument, bool& pVisitedNodeClass);
void WriteProperty(FbxProperty& pProperty, bool lSetNodeAttributeFlag);
void ConnectTimeWarp(FbxAnimCurveNode* pCurveNode, KFCurveNode* pFCurveNode);
FbxWriterFbx6& operator=(const FbxWriterFbx6&);
FbxScene* mScene;
FbxIO* mFileObject;
FbxExporter& mExporter;
Fbx6TypeObjectHierarchy* mDocumentHierarchy;
Fbx6TypeWriteReferences* mDocumentReferences;
bool mWriteNonDefaultPropertiesOnly;
bool mWriteEnhancedProperties;
EExportMode mExportMode;
FbxMultiMap mTextureAnimatedChannels;
FbxMultiMap mMaterialAnimatedChannels;
FbxMultiMap mTimeWarpsCurveNodes;
struct TextureAnimatedChannels
{
bool mTranslation;
bool mRotation;
bool mScaling;
bool mAlpha;
};
struct SurfaceMaterialAnimatedChannels
{
bool mAmbient;
bool mDiffuse;
bool mSpecular;
bool mEmissive;
bool mOpacity;
bool mShininess;
bool mReflectivity;
};
FbxNode* mCurrentNode;
struct ModifiedPropertyInfo { FbxObject* mObj; FbxString mPropName; };
FbxArray<ModifiedPropertyInfo*> mModifiedProperties;
void ReplaceUnsupportedProperties(FbxScene* pScene, bool pPreprocessPass, int pFormatV);
void StoreUnsupportedProperty(FbxObject* pObject, FbxProperty& pProperty);
bool IsLeafRoll(const FbxString& pNameWithoutNameSpacePrefix);
FbxProgress* mProgress;
bool mProgressPause;
};
bool IsNameUnique(FbxScene& pScene, FbxObject* pObject);
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_FBX_WRITER_FBX6_H_ */

View File

@ -0,0 +1,72 @@
/****************************************************************************************
Copyright (C) 2017 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxwriterfbx7.h
#ifndef _FBXSDK_FILEIO_FBX_WRITER_FBX7_H_
#define _FBXSDK_FILEIO_FBX_WRITER_FBX7_H_
#include <fbxsdk.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
struct FbxWriterFbx7_Impl;
class FbxWriterFbx7 : public FbxWriter
{
public:
typedef enum
{
eASCII,
eBINARY,
eENCRYPTED
} EExportMode;
FbxWriterFbx7(FbxManager& pManager, FbxExporter& pExporter, int pID, FbxStatus& pStatus);
FbxWriterFbx7(FbxManager& pManager, FbxExporter& pExporter, EExportMode pMode, int pID, FbxStatus& pStatus);
virtual ~FbxWriterFbx7();
virtual bool FileCreate(char* pFileName);
virtual bool FileCreate(FbxStream* pStream, void* pStreamData);
virtual bool FileClose();
virtual bool IsFileOpen();
virtual void GetWriteOptions();
virtual bool Write(FbxDocument* pDocument);
virtual bool PreprocessScene(FbxScene &pScene);
virtual bool PostprocessScene(FbxScene &pScene);
virtual bool Write(FbxDocument* pDocument, FbxIO* pFbx);
virtual void PluginWriteParameters(FbxObject& pParams);
virtual void SetProgressHandler(FbxProgress *pProgress);
void SetExportMode(EExportMode pMode);
virtual bool SupportsStreams() const { return true; }
private:
// Declared, not defined.
FbxWriterFbx7(const FbxWriterFbx7&);
FbxWriterFbx7& operator=(const FbxWriterFbx7&);
struct ModifiedPropertyInfo{ FbxObject* mObj; FbxString mPropName; };
FbxArray<ModifiedPropertyInfo*> mModifiedProperties;
void StoreUnsupportedProperty(FbxObject* pObject, FbxProperty& pProperty);
void MakeNonSavableAndRemember(FbxObject* pObj);
FbxArray<FbxObject*> mSwitchedToNonSavablesObjects;
FbxArray<FbxAnimLayer*> mAnimLayerInternallyAdded;
private:
FbxWriterFbx7_Impl* mImpl;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_FBX_WRITER_FBX7_H_ */

View File

@ -0,0 +1,64 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxbase64coder.h
#ifndef _FBXSDK_FILEIO_BASE64CODER_H_
#define _FBXSDK_FILEIO_BASE64CODER_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** This class decodes Base64 encoded data. */
class FBXSDK_DLL FbxBase64Decoder
{
public:
/** Decodes the input buffer.
* \param pInBuffer the input buffer containing Base64 data.
* \param pInSize the size of the input data in bytes (must be a multiple of 4)
* \param pOutBuffer the destination buffer.
* \param pOutSize the capacity of the output buffer in bytes.
* \return the number of bytes put in the output buffer, or -1 if the output buffer is too small, or contains invalid characters */
int Decode(const void* pInBuffer, int pInSize, void* pOutBuffer, int pOutSize);
/** Decodes the input buffer.
* \param pInBuffer the input buffer containing Base64 data; its length is computed using strlen().
* \param pOutBuffer the destination buffer.
* \param pOutSize the capacity of the output buffer in bytes.
* \return the number of bytes put in the output buffer. */
int Decode(const char* pInBuffer, void* pOutBuffer, int pOutSize);
};
/** This class encodes data in the Base64 format. */
class FBXSDK_DLL FbxBase64Encoder
{
public:
/** Encodes the input buffer.
* \param pInBuffer the input buffer containing data.
* \param pInSize the size of the input data in bytes.
* \param pOutBuffer the destination buffer, receives data encoded in Base64.
* \param pOutSize the capacity of the output buffer in bytes, which should be at least 33% larger than the input buffer size, or 4 bytes whichever is more.
* \return the number of bytes put in the output buffer, or -1 if we ran out of room. */
int Encode(const void* pInBuffer, int pInSize, void* pOutBuffer, int pOutSize);
/** Encodes the input buffer.
* \param pInBuffer the input buffer containing data.
* \param pInSize the size of the input data in bytes.
* \param pOutBuffer the destination buffer; data is set, not appended.
* \return the number of bytes put in the output buffer. */
int Encode(const void* pInBuffer, int pInSize, FbxString& pOutBuffer);
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_BASE64CODER_H_ */

View File

@ -0,0 +1,304 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxexporter.h
#ifndef _FBXSDK_FILEIO_EXPORTER_H_
#define _FBXSDK_FILEIO_EXPORTER_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxevent.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fileio/fbxiobase.h>
#include <fbxsdk/fileio/fbxiosettings.h>
#include <fbxsdk/fileio/fbxprogress.h>
#include <fbxsdk/utils/fbxrenamingstrategy.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxIO;
class FbxIOFileHeaderInfo;
class FbxThread;
class FbxWriter;
struct FbxExportThreadArg;
/** Class to export SDK objects into an FBX file.
* Normally this class is used as is. But for very special needs
* a user can override Initialize() for special purpose.
*
* An exporter will select the appropriate writer to a particular file.
* Ex: When an exporter must export an FBX 7 file,
* the exporter will ask for all registered writers if an FBX 7 file writer is available,
* then if a writer is found, the exporter will create
* the specialized FBX 7 writer and write the file.
* This way, an exporter can "write" many different type of files like FBX 5/6/7, 3DS, Obj, Dxf, Collada, etc.
* \see FbxWriter
*
* Typical workflow for using the FbxExporter class:
* -# create a SDKManager
* -# create an IOSettings object
* -# create an empty scene
* -# create an exporter
* -# initialize it with a file name
* -# set numerous options to control how the exporter will behave.\n
* ex: set IOSettings values to export Materials or Textures.
* -# call FbxExporter::Export() with the entity to export.
*
* \code
* // ex:
* // create a SdkManager
* FbxManager* lSdkManager = FbxManager::Create();
*
* // create an IOSettings object
* FbxIOSettings* ios = FbxIOSettings::Create(lSdkManager, IOSROOT);
*
* // set some IOSettings options
* ios->SetBoolProp(EXP_FBX_MATERIAL, true);
* ios->SetBoolProp(EXP_FBX_TEXTURE, true);
*
* // create an empty scene
* FbxScene* lScene = FbxScene::Create(lSdkManager, "");
*
* // create an exporter.
* FbxExporter* lExporter = FbxExporter::Create(lSdkManager, "");
*
* // initialize the exporter by providing a filename and the IOSettings to use
* lExporter->Initialize("C:\\myfile.fbx", -1, ios);
*
* // export the scene.
* lExporter->Export(lScene);
*
* // destroy the exporter
* lExporter->Destroy();
* \endcode
*
* \remarks According to the file suffix, a specialized writer will be created internally.\n
* Ex: for .fbx files a FBX Writer, for .3ds files, a 3ds writer, etc.\n
* Supported files formats: FBX 5/6/7 Binary & ASCII, Collada, DXF, OBJ, 3DS
* \nosubgrouping
*/
class FBXSDK_DLL FbxExporter : public FbxIOBase
{
FBXSDK_OBJECT_DECLARE(FbxExporter, FbxIOBase);
public:
/**
* \name Export Functions
*/
//@{
/** Initialize object.
* \param pFileName Name of file to access.
* \param pFileFormat file format identifier User does not need to specify it by default.
if not specified, plugin will detect the file format according to file suffix automatically.
* \param pIOSettings client IOSettings, if not specified, a default IOSettings will be created
* \return \c true on success, \c false otherwise.
* \remarks To identify the error that occurred, inspect the status object accessed
* using the GetStatus() function.
*/
bool Initialize(const char* pFileName, int pFileFormat = -1, FbxIOSettings* pIOSettings = NULL) override;
/** Initialize object.
* \param pStream stream to access.
* \param pStreamData user-defined stream data.
* \param pFileFormat file format identifier User does not need to specify it by default.
if not specified, plugin will request the file format from the stream.
* \param pIOSettings client IOSettings, if not specified, a default IOSettings will be created
* \return \c true on success, \c false otherwise.
* \remarks To identify the error that occurred, inspect the status object accessed
* using the GetStatus() function.
*/
virtual bool Initialize(FbxStream* pStream, void* pStreamData=NULL, int pFileFormat = -1, FbxIOSettings * pIOSettings = NULL);
/** Setup file export options settings.
* \return \c true on success, \c false otherwise.
*/
bool GetExportOptions();
/** Access to a IOSettings object.
* \return The pointer to IOSettings or \c NULL \c if the object has not been allocated.
*/
FbxIOSettings* GetIOSettings();
/** Set the IOSettings pointer
* \param pIOSettings Pointer on a FbxIOSettings object.
*/
void SetIOSettings(FbxIOSettings* pIOSettings);
/** Export the document to the currently created file.
* \param pDocument Document to export.
* \param pNonBlocking If true, the export process will be executed in a new thread, allowing it to be non-blocking.
To determine if the export finished, refer to the function IsExporting().
* \return \c true on success, \c false otherwise.
* \remarks To identify the error that occurred, inspect the status object accessed
* using the GetStatus() function.
*/
bool Export(FbxDocument* pDocument, bool pNonBlocking=false);
#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
/** Check if the exporter is currently exporting.
* \param pExportResult This parameter, after the export finished, will contain the result of the export success or failure.
* \return Return true if the exporter is currently exporting.
* \remarks This function will always return false if Export() was called with pNonBlocking set to false.
* This function should be used only in the context of pNonBlocking set to true.
* It is very important to periodically check if the export finished using this function,
* since it will also free up the thread's allocations when its done.
*/
bool IsExporting(bool& pExportResult);
#endif /* !FBXSDK_ENV_WINSTORE && ! FBXSDK_ENV_EMSCRIPTEN */
/** Get the progress status in non-blocking mode.
* \param pStatus Optional current status string.
* \return Percentage of the finished workload.
*/
float GetProgress(FbxString* pStatus=NULL);
/** Register a callback function for progress reporting in single thread mode.
* \param pCallback Pointer of the callback function.
* \param pArgs Pointer to the arguments passed to the callback function.
*/
void SetProgressCallback(FbxProgressCallback pCallback, void* pArgs=NULL);
//@}
/**
* \name File Format
*/
//@{
/** Get the format of the exported file.
* \return File format identifier.
*/
int GetFileFormat();
/** Return \c true if the file format is a recognized FBX format.
*/
bool IsFBX();
/** Get the list of writable versions for the current file format.
* \return \c NULL or a null terminated array of strings.
* \remarks the strings returned match the writers registered for the current format.
* The array items can be retrieved with the following code:
* \code
* char const* const* lWV = lExporter->GetCurrentWritableVersions();
* if (lWV)
* {
* int i = 0;
* while (lWV[i] != NULL)
* {
* printf("fmt = %s\n", lWV[i]);
* i++;
* }
* }
* \endcode
*
*/
char const* const* GetCurrentWritableVersions();
/** Set file version for a given file format.
* \param pVersion String description of the file format.
* \param pRenamingMode Renaming mode.
* \return \c true if mode is set correctly
*/
bool SetFileExportVersion(FbxString pVersion, FbxSceneRenamer::ERenamingMode pRenamingMode=FbxSceneRenamer::eNone);
/** Set the resampling rate (only used when exporting to FBX 5.3 and lower)
* \param pResamplingRate resampling rate
*/
inline void SetResamplingRate(double pResamplingRate){ mResamplingRate = pResamplingRate; }
/** Set the default rendering resolution.
* \param pCamName name of the camera.
* \param pResolutionMode resolution mode.
* \param pW width.
* \param pH height.
* \remark These values are ignored when exporting to FBX 7.x and higher. With FBX version 6.x and lower,
* the HeaderInfo is still accessible for legacy reasons and any other custom writers. For FBX filles,
* these values are used by the FBX QuickTime plug-in (obsolete now) to help it get the window size
* without loading the whole file. The information contained in the FbxIOFileHeaderInfo is a duplicate
* of AspectRatioMode, AspectWidth and AspectHeight properties defined in the FbxCamera class.
* Retrieveing the FileHeaderInfo starting from FBX 7.x will always return the uninitialized structure.
*/
void SetDefaultRenderResolution(FbxString pCamName, FbxString pResolutionMode, double pW, double pH);
/** Get the complete file header information.
* \return valid pointer to the complete header information
*/
FbxIOFileHeaderInfo* GetFileHeaderInfo();
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
bool GetExportOptions(FbxIO* pFbxObject);
bool Export(FbxDocument* pDocument, FbxIO* pFbxObject);
protected:
void Construct(const FbxObject* pFrom) override;
void Destruct(bool pRecursive) override;
virtual void SetOrCreateIOSettings(FbxIOSettings* pIOSettings, bool pAllowNULL);
void Reset();
bool FileCreate();
void FileClose();
private:
bool ExportProcess(FbxDocument* pDocument);
int mFileFormat;
FbxWriter* mWriter;
#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
FbxThread* mExportThread;
FbxExportThreadArg* mExportThreadArg;
bool mExportThreadResult;
bool mIsThreadExporting;
#endif /* !FBXSDK_ENV_WINSTORE && !FBXSDK_ENV_EMSCRIPTEN */
FbxProgress mProgress;
FbxStream* mStream;
void* mStreamData;
FbxString mStrFileVersion;
double mResamplingRate;
FbxSceneRenamer::ERenamingMode mRenamingMode;
FbxIOFileHeaderInfo* mHeaderInfo;
FbxIOSettings* mIOSettings;
bool mClientIOSettings;
friend void ExportThread(void*);
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
//! Event that is emitted to plugins before a file is exported to the FBX format.
class FBXSDK_DLL FbxEventPreExport : public FbxEvent<FbxEventPreExport>
{
FBXSDK_EVENT_DECLARE(FbxEventPreExport);
public:
FbxEventPreExport(FbxDocument* pDocument) : mDocument(pDocument) {};
//! The document to be exported
FbxDocument* mDocument;
};
//! Event that is emitted to plugins after a file is exported to the FBX format.
class FBXSDK_DLL FbxEventPostExport : public FbxEvent<FbxEventPostExport>
{
FBXSDK_EVENT_DECLARE(FbxEventPostExport);
public:
FbxEventPostExport(FbxDocument* pDocument) : mDocument(pDocument) {};
//! The document to be exported
FbxDocument* mDocument;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_EXPORTER_H_ */

View File

@ -0,0 +1,133 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxexternaldocreflistener.h
#ifndef _FBXSDK_FILEIO_EXTERNAL_DOCREF_LISTENER_H_
#define _FBXSDK_FILEIO_EXTERNAL_DOCREF_LISTENER_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxlistener.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** Contains data about an external document.
* The document is a FbxDocument object.
*/
struct FBXSDK_DLL FbxExternalDocumentInfo
{
FbxString mDocumentName; //!< Bare name of external document in document hierarchy.
FbxString mClassName; //!< Class name of the document (FbxDocument, FbxLibrary...).
FbxString mParentFullName; //!< Full name of the parent document in document hierarchy.
FbxString mFilePathUrl; //!< File path of the external document.
};
/** Event that is emitted on loading document when a referenced document
* is encountered while loading external references.
*/
class FBXSDK_DLL FbxEventReferencedDocument : public FbxEvent<FbxEventReferencedDocument>, public FbxExternalDocumentInfo
{
FBXSDK_EVENT_DECLARE(FbxEventReferencedDocument);
public:
FbxEventReferencedDocument() {}
};
class FbxExternalDocRefListenerData;
/** Typical handler for the referenced document events.
*
* Register it like so:
* FbxExternalDocRefListener lRefDocListener( sdkManager, fileName );
* FbxEventHandler * lHandler = lRefDocListener.Bind(scene,
* &FbxExternalDocRefListener::HandleEvent);
*
* And later unregister it like so:
* lRefDocListener.Unbind(lHandler);
*/
class FBXSDK_DLL FbxExternalDocRefListener : public FbxListener
{
public:
/** Constructor.
* \param pManager
* \param pDocFilePath
* \remarks Keep a reference to the SDK and the path of the document
* to be able to resolve relative paths.
*/
FbxExternalDocRefListener( FbxManager & pManager, const FbxString & pDocFilePath );
virtual ~FbxExternalDocRefListener();
/** Set the document file path used to resolve documents.
* \param pDocFilePath
* \remarks Allows re-using the same instance for multiple document loadings.
*/
virtual void SetDocumentFilePath( const FbxString & pDocFilePath );
/** Verify that all documents that were previously loaded in a previous
* load session are still valid.
* \return \c true if all documents are still valid, \c false otherwise.
*/
virtual bool AreAllExternalDocumentsStillValid() const;
//
/** Verify that all documents that were referred to didn't change.
* \return \c true if all documents didn't change, \c false otherwise.
* \remarks This function should be called if at posteriori check is desired.
*/
virtual bool WereAllExternalDocumentsValid() const;
/** Unload all documents that were loaded through this event handler.
*/
virtual void UnloadExternalDocuments();
// External document reference event handler.
//
// Operation: calls FindDocument() to find the specified external document
// and if not found calls LoadDocument() either directly,
// if it has not parent, or via ConnectToParentLibrary().
// If its parent cannot be found, it's added to the dangling
// document list (and it is not loaded until it's parent is found).
// After, it tries to resolve dangling documents by calling
// TryConnectingDanglingLibraries().
/** External document reference event handler.
* \param pEvent
* \remarks Operation: calls FindDocument() to find the specified external document
* and if not found calls LoadDocument() either directly,
* if it has not parent, or via ConnectToParentLibrary().
* If its parent cannot be found, it's added to the dangling
* document list (and it is not loaded until it's parent is found).
* After, it tries to resolve dangling documents by calling
* TryConnectingDanglingLibraries().
*/
virtual void HandleEvent(const FbxEventReferencedDocument * pEvent);
protected:
/**
* Turn a relative path to an absolute path using the file path of the original document being loaded.
* If the path is already is absolute, it is returned as is.
*/
virtual FbxString MakeFilenameAbsolute(const FbxString & pFilename) const;
//! Locate a document by its document path.
virtual FbxDocument * FindDocument( const FbxString & pPathToDoc );
//! Load a library, potentially under another library.
virtual FbxDocument * LoadDocument(FbxObject * pParent, const FbxString & pClassName, const FbxString & pFilename);
//! Try to connect a library to its parent given its document path.
virtual bool ConnectToParentLibrary(const FbxExternalDocumentInfo &);
//! Try to reconnect dangling libraries that didn't find their parent.
virtual void TryConnectingDanglingLibraries();
private:
FbxExternalDocRefListenerData * mData;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_EXTERNAL_DOCREF_LISTENER_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,168 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxglobalcamerasettings.h
#ifndef _FBXSDK_FILEIO_GLOBAL_CAMERA_SETTINGS_H_
#define _FBXSDK_FILEIO_GLOBAL_CAMERA_SETTINGS_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxStatus;
class FbxManager;
class FbxScene;
class FbxCamera;
class FbxCameraSwitcher;
#define FBXSDK_CAMERA_PERSPECTIVE "Producer Perspective"
#define FBXSDK_CAMERA_TOP "Producer Top"
#define FBXSDK_CAMERA_FRONT "Producer Front"
#define FBXSDK_CAMERA_BACK "Producer Back"
#define FBXSDK_CAMERA_RIGHT "Producer Right"
#define FBXSDK_CAMERA_LEFT "Producer Left"
#define FBXSDK_CAMERA_BOTTOM "Producer Bottom"
#define FBXSDK_CAMERA_SWITCHER "Camera Switcher"
/** This class contains the global camera settings.
* \nosubgrouping
* \remarks This class exists for FBX version 6.x and earlier. The new FBX v7.x file format
* that is now the default no longer uses it. The relevant data (a subset of this class) has
* been moved to the FbxGlobalSettings object and should be used instead.
*/
class FBXSDK_DLL FbxGlobalCameraSettings
{
FBXSDK_FRIEND_NEW();
public:
/** \name Default Camera Settings */
//@{
/** \enum EViewingMode Viewing modes. */
enum EViewingMode
{
eStandard, //<! Standard view mode.
eXRay, //<! X ray view mode.
eModelsOnly //<! Model only view mode.
};
/** Sets the default camera.
* \param pCameraName Name of the default camera.
* \param pStatus The FbxStatus object to hold error codes.
* \return \c True if camera name is valid, returns \c false if it is not valid.
* \remark A valid camera name must be either one of the defined tokens (FBXSDK_CAMERA_PERSPECTIVE, FBXSDK_CAMERA_TOP, FBXSDK_CAMERA_BOTTOM, FBXSDK_CAMERA_FRONT, FBXSDK_CAMERA_BACK,
* FBXSDK_CAMERA_RIGHT, FBXSDK_CAMERA_LEFT and FBXSDK_CAMERA_SWITCHER) or the name of a camera that is inserted in the node tree under the scene's root node. */
bool SetDefaultCamera(const char* pCameraName, FbxStatus* pStatus=NULL);
/** Returns the default camera name.
* \return The default camera name, or returns an empty string if no camera name has been specified. */
const char* GetDefaultCamera() const;
//! Restores the default settings.
void RestoreDefaultSettings();
/** Sets the default viewing mode.
* \param pViewingMode Viewing mode to set(eStandard, eXRay or eModelsOnly). */
void SetDefaultViewingMode(EViewingMode pViewingMode);
/** Returns the default viewing mode.
* \return The currently set Viewing mode. */
EViewingMode GetDefaultViewingMode() const;
//@}
/** \name Producer Cameras
* Producer cameras are global cameras in MotionBuilder you use to view the scene.
* You cannot animate Producer cameras but you can specify their default positions. */
//@{
/** Creates the default Producer cameras. */
void CreateProducerCameras();
/** Destroys the default Producer cameras. */
void DestroyProducerCameras();
/** Checks if the camera is a Producer camera.
* \param pCamera The camera to check.
* \return \c True if it is a producer camera, returns \c false if it is not a producer camera. */
bool IsProducerCamera(FbxCamera* pCamera) const;
/** Returns a reference to the Producer perspective camera.
* \return The reference to the internal Perspective camera. */
FbxCamera* GetCameraProducerPerspective() const;
/** Returns a reference to the Producer front camera.
* \return The reference to the internal Front camera. */
FbxCamera* GetCameraProducerFront() const;
/** Returns a reference to the Producer back camera.
* \return The reference to the internal Back camera. */
FbxCamera* GetCameraProducerBack() const;
/** Returns a reference to the Producer left camera.
* \return The reference to the internal Left camera. */
FbxCamera* GetCameraProducerLeft() const;
/** Returns a reference to the Producer right camera.
* \return The reference to the internal Right camera. */
FbxCamera* GetCameraProducerRight() const;
/** Returns a reference to the Producer top camera.
* \return The reference to the internal Top camera. */
FbxCamera* GetCameraProducerTop() const;
/** Returns a reference to the Producer bottom camera.
* \return The reference to the internal Bottom camera. */
FbxCamera* GetCameraProducerBottom() const;
/** Returns the Camera Switcher.
* \return A pointer to the Camera Switcher.
* \remark This node has a \c FbxNodeAttribute::eCameraSwitcher node attribute type. This node is not saved when there is no camera in the scene. Nodes inserted below are never saved.
* Camera indices start at 1. Out of range indices are clamped between 1 and the number of cameras in the scene. The index of a camera refers to its order of appearance when searching
* the node tree depth first. If a camera is added or removed after camera indices have been set, the camera indices must be updated. It is easier to set camera indices once every camera
* have been set. Camera index keys must be set using constant interpolation to ensure that camera switches occur exactly at key time. */
FbxCameraSwitcher* GetCameraSwitcher() const;
/** Sets the Camera Switcher.
* \param pSwitcher The Camera Switcher to be set. */
void SetCameraSwitcher(FbxCameraSwitcher* pSwitcher);
//@}
/** Assignment operator.
* \param pGlobalCameraSettings FbxGlobalCameraSettings object assigned to this one. */
const FbxGlobalCameraSettings& operator=(const FbxGlobalCameraSettings& pGlobalCameraSettings);
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
bool CopyProducerCamera(const char* pCameraName, const FbxCamera* pCamera, bool pIncludeConnections = false) const;
private:
FbxGlobalCameraSettings(FbxManager& pManager, FbxScene& pScene);
~FbxGlobalCameraSettings();
FbxScene* mScene;
FbxString mDefaultCamera;
EViewingMode mDefaultViewingMode;
FbxCamera* mCameraPerspective;
FbxCamera* mCameraFront;
FbxCamera* mCameraBack;
FbxCamera* mCameraLeft;
FbxCamera* mCameraRight;
FbxCamera* mCameraTop;
FbxCamera* mCameraBottom;
FbxCameraSwitcher* mCameraSwitcher;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_GLOBAL_CAMERA_SETTINGS_H_ */

View File

@ -0,0 +1,229 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxgloballightsettings.h
#ifndef _FBXSDK_FILEIO_GLOBAL_LIGHT_SETTINGS_H_
#define _FBXSDK_FILEIO_GLOBAL_LIGHT_SETTINGS_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxpropertytypes.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxGlobalLightSettingsProperties;
/** This class contains functions for accessing global light settings.
* \nosubgrouping
* \remarks This class exists for FBX version 6.x and earlier. The new FBX v7.x file format that is
* now the default no longer uses it. The relevant data (a subset of this class) has been moved to
* the FbxGlobalSettings object and should be used instead.
*/
class FBXSDK_DLL FbxGlobalLightSettings
{
public:
FBXSDK_FRIEND_NEW();
/**
* \name Ambient Color
*/
//@{
/** Sets the ambient color.
* \param pAmbientColor The ambient color to set.
* \remarks The ambient color only use RGB channels.
*/
void SetAmbientColor(FbxColor pAmbientColor);
/** Returns the ambient color.
* \return The ambient color.
*/
FbxColor GetAmbientColor() const;
//@}
/**
* \name Fog Option
*/
//@{
/** Activates or disables the fog.
* \param pEnable Set to \c true to activate the fog option or set to \c false to disable the fog option.
*/
void SetFogEnable(bool pEnable);
/** Returns the fog option's current state.
* \return \c True if fog is activated, returns \c false if fog is disabled.
*/
bool GetFogEnable() const;
/** Sets the fog color.
* \param pColor The fog color to be set.
* \remarks The fog color only uses RGB channels.
*/
void SetFogColor(FbxColor pColor);
/** Returns the fog color.
* \return The fog color.
* \remarks The fog color only uses RGB channels.
*/
FbxColor GetFogColor() const;
/** \enum EFogMode Fog types.
*/
enum EFogMode
{
eLinear, //! Linear fog mode.
eExponential, //! Exponential fog mode.
eExponentialSquareRoot //! Exponential square root fog mode.
};
/** Sets the fog mode.
* \param pMode The fog type to be set.
*/
void SetFogMode(EFogMode pMode);
/** Returns the fog mode.
* \return The currently set fog mode.
*/
EFogMode GetFogMode() const;
/** Sets the fog density.
* \param pDensity The fog density to be set. It can be any double value, however it can
* happen that other sections of FBX SDK may clamp values to reasonable values.
* \remarks This function is only used when the fog mode is set to exponential or square root exponential.
*/
void SetFogDensity(double pDensity);
/** Returns the fog density.
* \return The currently set fog density.
* \remarks This function is only used when the fog mode is set to exponential or square root exponential.
*/
double GetFogDensity() const;
/** Sets the distance from the view where the fog begins.
* \param pStart Distance where the fog begins.
* \remarks This function is only used when the fog mode is set to linear. The new value is clamped to fit inside the interval [0, FogEnd()].
*/
void SetFogStart(double pStart);
/** Returns the distance from the view where the fog begins.
* \return The distance from the view where the fog begins.
* \remarks This function is only used when the fog mode is set to linear.
*/
double GetFogStart() const;
/** Sets the distance from the view where the fog ends.
* \param pEnd Distance where the fog ends.
* \remarks This function is only used when the fog mode is set to linear. The new value is adjusted to fit within the interval [FogStart(), inf).
*/
void SetFogEnd(double pEnd);
/** Returns the distance from the view where the fog ends.
* \return The distance from the view where the fog ends.
* \remarks This function is only used when the fog mode is set to linear.
*/
double GetFogEnd() const;
//@}
/**
* \name Shadow Planes
* The functions in this section are supported only by FiLMBOX version 2.7 and earlier.
* FiLMBOX 3.0 supports shadow planes within a specific shader, which is not supported by the FBX SDK.
*/
//@{
/** Struct used to define the shadow plane.
*/
struct FBXSDK_DLL ShadowPlane
{
//! Default constructor.
ShadowPlane();
//! Activate flag.
bool mEnable;
//! Origin point.
FbxVector4 mOrigin;
//! Normal vector.
FbxVector4 mNormal;
};
/** Activates or disables the display of shadow planes.
* \param pShadowEnable Set to \c true to display shadow planes in the scene.
*/
void SetShadowEnable(bool pShadowEnable);
/** Returns the current state of the shadow enable flag.
* \return \c True if shadow planes are set to be displayed in the scene.
*/
bool GetShadowEnable() const;
/** Sets the shadow intensity that is applied to all shadow planes.
* \param pShadowIntensity Intensity applied to all the shadow planes.
* \remarks Ranges from 0 to 300.
*/
void SetShadowIntensity(double pShadowIntensity);
/** Returns the shadow intensity applied to all shadow planes.
* \return The intensity applied to all shadow planes in the scene.
* \remarks Ranges from 0 to 300.
*/
double GetShadowIntensity() const;
/** Returns the number of shadow planes.
* \return Number of shadow planes.
*/
int GetShadowPlaneCount() const;
/** Returns a shadow plane at the specified index.
* \param pIndex Shadow plane index.
* \param pStatus The FbxStatus object to hold error codes.
* \return Pointer the shadow plane, or \c NULL if the index is out of range.
*/
ShadowPlane* GetShadowPlane(int pIndex, FbxStatus* pStatus=NULL);
/** Adds a shadow plane.
* \param pShadowPlane The shadow plane to be added.
*/
void AddShadowPlane(ShadowPlane pShadowPlane);
//! Removes all shadow planes.
void RemoveAllShadowPlanes();
//@}
//! Restores default settings.
void RestoreDefaultSettings();
/** Assignment operator.
* \param pGlobalLightSettings FbxGlobalLightSettings object assigned to this one.
*/
const FbxGlobalLightSettings& operator=(const FbxGlobalLightSettings& pGlobalLightSettings);
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
FbxGlobalLightSettings();
~FbxGlobalLightSettings();
FbxGlobalLightSettingsProperties* mPH;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_GLOBAL_LIGHT_SETTINGS_H_ */

View File

@ -0,0 +1,315 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxglobalsettings.h
#ifndef _FBXSDK_FILEIO_GLOBAL_SETTINGS_H_
#define _FBXSDK_FILEIO_GLOBAL_SETTINGS_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxobject.h>
#include <fbxsdk/core/base/fbxstatus.h>
#include <fbxsdk/scene/fbxaxissystem.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** \brief This class contains functions for accessing global settings.
* \nosubgrouping
*/
class FBXSDK_DLL FbxGlobalSettings : public FbxObject
{
FBXSDK_OBJECT_DECLARE(FbxGlobalSettings, FbxObject);
public:
/**
* \name Axis system
*/
//@{
/** Sets the scene's coordinate system.
* \param pAxisSystem The coordinate system to set.
*/
void SetAxisSystem(const FbxAxisSystem& pAxisSystem);
/** Returns the scene's current coordinate system.
* \return The scene's current coordinate system.
*/
FbxAxisSystem GetAxisSystem();
//@}
/** Sets the coordinate system's original Up Axis when the scene is created.
* \param pAxisSystem The coordinate system whose Up Axis is copied.
*/
void SetOriginalUpAxis(const FbxAxisSystem& pAxisSystem);
/** Returns the coordinate system's original Up Axis.
* \return The coordinate system's original Up Axis when the scene is created. 0 is X, 1 is Y, 2 is Z axis.
*/
int GetOriginalUpAxis() const;
//@}
/**
* \name System Units
*/
//@{
/** Sets the unit of measurement used by the system.
* \param pOther The system unit to set.
*/
void SetSystemUnit(const FbxSystemUnit& pOther);
/** Returns the unit of measurement used by the system.
* \return The unit of measurement used by the system.
*/
FbxSystemUnit GetSystemUnit() const;
/** Sets the original unit of measurement used by the system.
* \param pOther The original system unit to set.
*/
void SetOriginalSystemUnit(const FbxSystemUnit& pOther);
/** Returns the original unit of measurement used by the system.
* \return The original unit of measurement used by the system.
*/
FbxSystemUnit GetOriginalSystemUnit() const;
//@}
/**
* \name Light Settings
*/
//@{
/** Sets the ambient color.
* \param pAmbientColor The ambient color to set.
* \remarks The ambient color only uses the RGB channels.
*/
void SetAmbientColor(FbxColor pAmbientColor);
/** Returns the ambient color.
* \return The ambient color.
*/
FbxColor GetAmbientColor() const;
//@}
/**
* \name Camera Settings
*/
//@{
/** Sets the default camera.
* \param pCameraName Name of the default camera.
* \return \c true if camera name is valid, returns \c false if the camera does not have a valid name.
* \remarks A valid camera name can be either one of the defined tokens (FBXSDK_CAMERA_PERSPECTIVE,
* FBXSDK_CAMERA_TOP, FBXSDK_CAMERA_FRONT, FBXSDK_CAMERA_BACK, FBXSDK_CAMERA_RIGHT, FBXSDK_CAMERA_LEFT and FBXSDK_CAMERA_BOTTOM) or the name
* of a camera inserted in the node tree under the scene's root node.
*/
bool SetDefaultCamera(const char* pCameraName);
/** Returns the default camera name.
* \return The default camera name, or an empty string if no camera name has been set.
*/
FbxString GetDefaultCamera() const;
//@}
/**
* \name Time Settings
*/
//@{
/** Sets the time mode.
* \param pTimeMode One of the defined modes in class FbxTime.
*/
void SetTimeMode(FbxTime::EMode pTimeMode);
/** Returns the time mode.
* \return The currently set TimeMode.
*/
FbxTime::EMode GetTimeMode() const;
/** Sets the time protocol.
* \param pTimeProtocol One of the defined protocols in FbxTime class.
*/
void SetTimeProtocol(FbxTime::EProtocol pTimeProtocol);
/** Returns the time protocol.
* \return The currently set time protocol (default FbxTime::eFrameCount).
*/
FbxTime::EProtocol GetTimeProtocol() const;
/** \enum ESnapOnFrameMode Snap on frame mode.
*/
enum ESnapOnFrameMode
{
eNoSnap, //! No snap.
eSnapOnFrame, //! Snap on frame.
ePlayOnFrame, //! Play on frame.
eSnapAndPlayOnFrame //! Snap and play on frame.
};
/** Sets the snap on frame mode.
* \param pSnapOnFrameMode One of the following values: eNoSnap, eSnapOnFrame, ePlayOnFrame, or eSnapAndPlayOnFrame.
*/
void SetSnapOnFrameMode(ESnapOnFrameMode pSnapOnFrameMode);
/** Returns the snap on frame mode.
* \return The currently set snap on frame mode (default eNoSnap).
*/
ESnapOnFrameMode GetSnapOnFrameMode() const;
/** Sets the default time span of the time line.
* \param pTimeSpan The default time span of the time line.
*/
void SetTimelineDefaultTimeSpan(const FbxTimeSpan& pTimeSpan);
/** Returns the default time span of the time line.
* \param pTimeSpan The default time span of the time line.
*/
void GetTimelineDefaultTimeSpan(FbxTimeSpan& pTimeSpan) const;
/** Set custom frame rate.
* This is meaningless if the time mode is not FbxTime::eCustom.
*/
void SetCustomFrameRate(double pCustomFrameRate);
/** Return frame rate if the time mode is FbxTime::eCustom.
* If the time mode is not FbxTime::eCustom, return -1.
*/
double GetCustomFrameRate() const;
//@}
/**
* \name Time Markers
*/
//@{
struct FBXSDK_DLL TimeMarker
{
//! Default constructor.
TimeMarker();
/** Copy constructor.
* \param pTimeMarker Another time marker copied to this time marker.
*/
TimeMarker(const TimeMarker& pTimeMarker);
/** Assignment operator.
* \param pTimeMarker Another time marker assigned to this time marker.
*/
TimeMarker& operator=(const TimeMarker& pTimeMarker);
//! Marker name.
FbxString mName;
//! Marker time.
FbxTime mTime;
//! Loop flag.
bool mLoop;
};
/** Returns the number of time markers.
* \return The number of time markers.
*/
int GetTimeMarkerCount() const;
/** Returns the time marker at the given index.
* \param pIndex The time marker index.
* \param pStatus The FbxStatus object to hold error codes.
* \return A copy of the time marker at the given index, or an empty one if an error occurred.
*/
TimeMarker GetTimeMarker(int pIndex, FbxStatus* pStatus=NULL) const;
/** Adds a time marker.
* \param pTimeMarker The new time marker to be added.
* \param pStatus The FbxStatus object to hold error codes.
*/
void AddTimeMarker(const TimeMarker& pTimeMarker, FbxStatus* pStatus=NULL);
/** Replaces the time marker at the specified index with the new one.
* \param pIndex The time marker index.
* \param pTimeMarker The new time marker.
* \param pStatus The FbxStatus object to hold error codes.
*/
void ReplaceTimeMarker(int pIndex, const TimeMarker& pTimeMarker, FbxStatus* pStatus=NULL);
//! Removes all time markers and sets the current time marker index to -1.
void RemoveAllTimeMarkers();
/** Sets the index of the current time marker.
* \param pIndex The current time marker index.
* \param pStatus The FbxStatus object to hold error codes.
* \return \c true if successful, or returns \c false if the index is not valid.
*/
bool SetCurrentTimeMarker(int pIndex, FbxStatus* pStatus=NULL);
/** Returns the current time marker index.
* \return The current time marker index, or -1 if no current time marker has been set.
*/
int GetCurrentTimeMarker() const;
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxObject& Copy(const FbxObject& pObject) override;
protected:
FbxPropertyT<FbxInt> UpAxis;
FbxPropertyT<FbxInt> UpAxisSign;
FbxPropertyT<FbxInt> FrontAxis;
FbxPropertyT<FbxInt> FrontAxisSign;
FbxPropertyT<FbxInt> CoordAxis;
FbxPropertyT<FbxInt> CoordAxisSign;
FbxPropertyT<FbxInt> OriginalUpAxis;
FbxPropertyT<FbxInt> OriginalUpAxisSign;
FbxPropertyT<FbxDouble> UnitScaleFactor;
FbxPropertyT<FbxDouble> OriginalUnitScaleFactor;
FbxPropertyT<FbxDouble3> AmbientColor;
FbxPropertyT<FbxString> DefaultCamera;
FbxPropertyT<FbxEnum> TimeMode;
FbxPropertyT<FbxEnum> TimeProtocol;
FbxPropertyT<FbxEnum> SnapOnFrameMode;
FbxPropertyT<FbxTime> TimeSpanStart;
FbxPropertyT<FbxTime> TimeSpanStop;
FbxPropertyT<FbxDouble> CustomFrameRate;
protected:
void Construct(const FbxObject* pFrom) override;
void ConstructProperties(bool pForceSet) override;
private:
void AxisSystemToProperties();
void PropertiesToAxisSystem();
void Init();
FbxAxisSystem mAxisSystem;
int mNbTimeMarkers;
friend class FbxWriterFbx6;
FbxProperty mTimeMarkers;
FbxPropertyT<FbxInt> mCurrentTimeMarker;
void AddSetTimeMarker(int pIndex, const TimeMarker& pTimeMarker, FbxStatus* pStatus, bool pAdd);
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
inline EFbxType FbxTypeOf(const FbxTime::EMode&){ return eFbxEnum; }
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_GLOBAL_SETTINGS_H_ */

View File

@ -0,0 +1,48 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxgobo.h
#ifndef _FBXSDK_FILEIO_GOBO_H_
#define _FBXSDK_FILEIO_GOBO_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/base/fbxstring.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/**
* \brief A gobo is a filter placed over a spot light to project light patterns through fog on a surface.
* You can also use an image file as a gobo, which cause the light to project an image, much like a projector.
*/
class FbxGobo
{
public:
FbxGobo(char* pName) :
mName(pName)
{
}
//! Gobo name.
FbxString mName;
//! path and file name of the image file.
FbxString mFileName;
//! Flag that if shows the light projected on the ground.
bool mDrawGroundProjection;
//! Flag that lets you create a volumetric lighting effect by making the light stream visible.
bool mVolumetricLightProjection;
//! Flag that front facing light occurs when the camera view is looking down or up the light stream of a Spot light, which makes the light stream look three-dimensional.
bool mFrontVolumetricLightProjection;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_GOBO_H_ */

View File

@ -0,0 +1,393 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbximporter.h
#ifndef _FBXSDK_FILEIO_IMPORTER_H_
#define _FBXSDK_FILEIO_IMPORTER_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxsystemunit.h>
#include <fbxsdk/core/base/fbxtime.h>
#include <fbxsdk/fileio/fbxiobase.h>
#include <fbxsdk/fileio/fbxprogress.h>
#include <fbxsdk/fileio/fbxiosettings.h>
#include <fbxsdk/fileio/fbxstatistics.h>
#include <fbxsdk/scene/fbxaxissystem.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
class FbxIO;
class FbxIOFileHeaderInfo;
class FbxDocumentInfo;
class FbxTakeInfo;
class FbxReader;
class FbxThread;
struct FbxImportThreadArg;
/** Class to import an FBX file into SDK objects.
* Normally this class is used as is. But for very special needs
* a user can override Initialize() for special purpose.
*
* An importer will select the appropriate reader to a particular file.
* Ex: When an importer must import an FBX 7 file,
* the importer will ask for all registered readers if an FBX 7 file reader is available,
* then if a reader is found, the importer will create
* the specialized FBX 7 reader and read the file.
* This way, an importer can "read" many different type of files like FBX 5/6/7, 3DS, Obj, Dxf, Collada, etc.
* \see FbxReader
*
* Typical workflow for using the FbxImporter class:
* -# create a SDKManager
* -# create an IOSettings object
* -# create an empty scene
* -# create an importer
* -# initialize the importer with a file name and IOSettings
* -# set numerous states, take information, defining how the importer will behave
* -# call FbxImporter::Import() with an empty scene
* \code
* ex:
* // create a SdkManager
* FbxManager *lSdkManager = FbxManager::Create();
*
* // create an IOSettings object
* FbxIOSettings * ios = FbxIOSettings::Create(lSdkManager, IOSROOT );
*
* // set some IOSettings options
* ios->SetBoolProp(IMP_FBX_MATERIAL, true);
* ios->SetBoolProp(IMP_FBX_TEXTURE, true);
*
* // create an empty scene
* FbxScene* lScene = FbxScene::Create(lSdkManager,"");
*
* // Create an importer.
* FbxImporter* lImporter = FbxImporter::Create(lSdkManager, "");
*
* // Initialize the importer by providing a filename and the IOSettings to use
* lImporter->Initialize("C:\\myfile.fbx", -1, ios);
*
* // Import the scene.
* lImporter->Import(lScene);
*
* // Destroy the importer.
* lImporter->Destroy();
* \endcode
*
* \remarks According to the file suffix, a specialized reader will be created internally.
* Ex: for .fbx files a FBX Reader, for .3ds files, a 3ds reader, etc.
* Supported files formats: FBX 5/6/7 Binary & ASCII, Collada, DXF, OBJ, 3DS
* \nosubgrouping
*/
class FBXSDK_DLL FbxImporter : public FbxIOBase
{
FBXSDK_OBJECT_DECLARE(FbxImporter, FbxIOBase);
public:
/**
* \name Import Functions
*/
//@{
/** Initialize object.
* \param pFileName Name of file to access.
* \param pFileFormat file format identifier User does not need to specify it by default.
if not specified, plugin will detect the file format according to file suffix automatically.
* \param pIOSettings client IOSettings, if not specified, a default IOSettings will be created
* \return \c true on success, \c false otherwise.
* \remarks To identify the error that occurred, inspect the status object accessed
* using the GetStatus() function.
* \remarks You do not need to give the pFileFormat if the suffix of pFileName is recognized
*/
bool Initialize(const char* pFileName, int pFileFormat=-1, FbxIOSettings * pIOSettings=NULL) override;
/** Initialize object.
* \param pStream stream to access.
* \param pStreamData user-defined stream data.
* \param pFileFormat file format identifier User does not need to specify it by default.
if not specified, plugin will request the file format from the stream automatically.
* \param pIOSettings client IOSettings, if not specified, a default IOSettings will be created
* \return \c true on success, \c false otherwise.
* \remarks To identify the error that occurred, inspect the status object accessed
* using the GetStatus() function.
* \remarks You do not need to give the pFileFormat if the suffix of pFileName is recognized
*/
virtual bool Initialize(FbxStream* pStream, void* pStreamData=NULL, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
/** Get the FBX version number of the FBX file.
* FBX version numbers start at 5.0.0.
* \param pMajor Version major number.
* \param pMinor Version minor number.
* \param pRevision Version revision number.
* \remarks This function must be called after FbxImporter::Initialize().
*/
void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
/** Get the default rendering resolution if present in the file header.
* \param pCamName Returned name of the camera.
* \param pResolutionMode Returned resolution mode.
* \param pW Returned width.
* \param pH Returned height.
* \return \c true if the default rendering settings are defined in the file, otherwise
* returns \c false with empty parameters.
*/
bool GetDefaultRenderResolution(FbxString& pCamName, FbxString& pResolutionMode, double& pW, double& pH);
/** Get the complete file header information.
* \return valid pointer to the complete header information
*/
FbxIOFileHeaderInfo* GetFileHeaderInfo();
/** \enum EStreamOptionsGeneration Stream options identifiers.
* - \e eParseFile Parse the file
* - \e eDoNotParseFile Do not parse the file.
*/
enum EStreamOptionsGeneration
{
eParseFile, // Parse the file
eDoNotParseFile // Do not parse the file (fast)
};
/** Read the currently opened file header to retrieve information related to takes.
* \param pStreamOptionsGeneration Stream options identifier.
* \return \c true on success, \c false otherwise.
* \remarks Caller gets ownership of the returned structure.
*/
bool GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eParseFile);
/** Read the currently opened file header to retrieve information related to takes.
* \param pFbxObject Target FBX file.
* \return \c true on success, \c false otherwise.
* \remarks Caller gets ownership of the returned structure.
*/
bool GetImportOptions(FbxIO* pFbxObject);
/** Import the currently opened file into a scene.
* \param pDocument Document to fill with file content.
* \param pNonBlocking If true, the import process will be executed in a new thread, allowing it to be non-blocking.
To determine if the import finished, refer to the function IsImporting().
* \return \c true on success, \c false otherwise.
* \remarks To identify the error that occurred, inspect the status object accessed
* using the GetStatus() function.
* If the imported file is password protected and the password is not
* set or wrong, the FbxStatus object access with GetStatus() will be set with
* FbxStatus::ePasswordError.
*/
bool Import(FbxDocument* pDocument, bool pNonBlocking=false);
#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
/** Check if the importer is currently importing.
* \param pImportResult This parameter, after the import finished, will contain the result of the import success or failure.
* \return Return true if the importer is currently importing.
* \remarks This function will always return false if Import() was called with pNonBlocking set to false.
* This function should be used only in the context of pNonBlocking set to true.
* It is very important to periodically check if the import finished using this function,
* since it will also free up the thread's allocations when its done.
*/
bool IsImporting(bool& pImportResult);
#endif /* !FBXSDK_ENV_WINSTORE && !defined(FBXSDK_ENV_EMSCRIPTEN) */
/** Get the progress status in non-blocking mode.
* \param pStatus Optional current status string.
* \return Percentage of the finished workload
*/
float GetProgress(FbxString* pStatus=NULL);
/** Register a callback function for progress reporting in single thread mode.
* \param pCallback Pointer of the callback function.
* \param pArgs pointer to the arguments passed to the callback function.
*/
void SetProgressCallback(FbxProgressCallback pCallback, void* pArgs=NULL);
/** Explicitly set the embedding extraction folder. If this is never called, the FBX SDK will determine the best folder to extract embedded files.
* \param pExtractFolder The file path name where the embedded files should be extracted.
*/
void SetEmbeddingExtractionFolder(const char* pExtractFolder);
/** Retrieve the current folder destination where the embedded files will be extracted. This might not be initialized until file I/O is performed.
*/
const char* GetEmbeddingExtractionFolder();
/** Access to a IOSettings object.
* \return The pointer to IOSettings or \c NULL \c if the object has not been allocated.
*/
FbxIOSettings* GetIOSettings();
/** Set the IOSettings pointer
* \param pIOSettings Point to a FbxIOSettings object.
*/
void SetIOSettings(FbxIOSettings* pIOSettings);
/** Set the password.
* All subsequently imported files are opened with the given password.
* \param pPassword Password string.
*/
void SetPassword(char* pPassword);
/**
* \name Animation Stack Description Access
* \see FbxAnimStack
*/
//@{
/** Get the number of available animation stacks in the file.
* \return Number of animation stacks.
* \remarks This function must be called after FbxImporter::Initialize().
*/
int GetAnimStackCount();
/** Get the take information about an available take.
* Use the returned reference to a FbxTakeInfo object to set whether the indexed take is imported.
* \param pIndex Index of the requested take.
* \return Take information or \c NULL if function failed.
* \remarks This function must be called after FbxImporter::Initialize().
*/
FbxTakeInfo* GetTakeInfo(int pIndex);
/** Return the active animation stack name.
* \return Active animation stack name if there is one, otherwise returns an empty string.
* \remarks This function must be called after FbxImporter::Initialize().
*/
FbxString GetActiveAnimStackName();
//@}
/**
* \name Scene Description Access
*/
//@{
/** Get the scene info.
* \return Pointer to the scene info or \c NULL if no scene information
* is available in the file.
*/
FbxDocumentInfo* GetSceneInfo();
//@}
/**
* \name File Format
*/
//@{
/** Returns the index of the reader (FbxReader) associated with the file format.
This index is considered the identifier of the file format.
The array of registered readers can't be retrieved.
\return Index of the registered FbxReader associated with the file format.
If no reader found return -1.
\remarks According to the number of readers registered this value can change
for the same reader between SDK Manager instantiations.
*/
int GetFileFormat ();
/** \return \c true if the file format is a recognized FBX format.
*/
bool IsFBX();
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FbxFile* GetFile();
FbxStream* GetStream();
void* GetStreamData();
void ParseForGlobalSettings(bool pState);
void ParseForStatistics(bool pState);
bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
bool GetStatistics(FbxStatistics* pStatistics);
bool GetFrameRate(FbxTime::EMode &pTimeMode);
protected:
void Construct(const FbxObject* pFrom) override;
void Destruct(bool pRecursive) override;
virtual void SetOrCreateIOSettings(FbxIOSettings* pIOSettings, bool pAllowNULL);
void Reset();
bool FileOpen(FbxFile* pFile = NULL);
bool FileOpen(FbxStream* pStream, void* pStreamData);
void FileClose();
void GetImportOptionsInfo();
bool IsNativeExtension ();
//These two internal functions are only used to read old character pose data
public:
bool Initialize(FbxFile* pFile, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
bool Import(FbxDocument* pDocument, FbxIO* pFbxObject);
private:
bool ImportProcess(FbxDocument* pDocument);
int mFileFormat;
FbxReader* mReader;
FbxString mExtractFolder;
bool mParseForGlobalSettings;
FbxAxisSystem mAxisSystem;
FbxSystemUnit mSystemUnits;
FbxTime::EMode mFrameRate;
bool mParseForStatistics;
FbxStatistics mStatistics;
#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
FbxThread* mImportThread;
FbxImportThreadArg* mImportThreadArg;
bool mImportThreadResult;
bool mIsThreadImporting;
#endif /* !FBXSDK_ENV_WINSTORE && !defined(FBXSDK_ENV_EMSCRIPTEN) */
FbxProgress mProgress;
FbxFile* mFile;
FbxStream* mStream;
void* mStreamData;
bool mImportOptionsDone;
FbxArray<FbxTakeInfo*> mTakeInfo;
FbxDocumentInfo* mSceneInfo;
FbxString mActiveAnimStackName;
int mMajorVersion;
int mMinorVersion;
int mRevisionVersion;
FbxIOFileHeaderInfo* mHeaderInfo;
FbxIOSettings* mIOSettings;
bool mClientIOSettings;
//For Initialize and Import
friend class FbxReaderFbx5;
friend class FbxReaderFbx6;
friend struct FbxReaderFbx7_Impl;
friend void ImportThread(void*);
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
//! Event that is emitted to plugins before a FBX file has been imported.
class FBXSDK_DLL FbxEventPreImport : public FbxEvent<FbxEventPreImport>
{
FBXSDK_EVENT_DECLARE(FbxEventPreImport);
public:
inline FbxEventPreImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
//! The document the FBX file is to be imported into.
FbxDocument* mDocument;
};
//! Event that is emitted to plugins after a FBX file has been imported.
class FBXSDK_DLL FbxEventPostImport : public FbxEvent<FbxEventPostImport>
{
FBXSDK_EVENT_DECLARE(FbxEventPostImport);
public:
inline FbxEventPostImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
//! The imported document
FbxDocument* mDocument;
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_IMPORTER_H_ */

View File

@ -0,0 +1,67 @@
/****************************************************************************************
Copyright (C) 2015 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxiobase.h
#ifndef _FBXSDK_FILEIO_IO_BASE_H_
#define _FBXSDK_FILEIO_IO_BASE_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/core/fbxobject.h>
#include <fbxsdk/core/base/fbxstatus.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
#define FBXSDK_IO_END_NODE_STR "_End"
/** \brief Base class for FBX file importer and exporter.
* \nosubgrouping
*/
class FBXSDK_DLL FbxIOBase : public FbxObject
{
FBXSDK_OBJECT_DECLARE(FbxIOBase, FbxObject);
public:
/** Initializes the object.
* \param pFileName The name of the file to access.
* \param pFileFormat Unused in this class implementation.
* \param pIOSettings Unused in this class implementation.
* \return \c True if successful, returns \c False otherwise.
* \remarks To identify the error, inspect \e mStatus.
*/
virtual bool Initialize(const char *pFileName, int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
/** Returns the file name.
* \return The file name or an empty string if no filename has been set.
*/
virtual FbxString GetFileName();
//! Get the status object containing the success or failure state.
FbxStatus& GetStatus() { return mStatus; }
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
void Construct(const FbxObject* pFrom) override;
int DetectReaderFileFormat(const char *pFileName);
int DetectWriterFileFormat(const char *pFileName);
FbxStatus mStatus;
FbxString mFilename;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_FILEIO_IO_BASE_H_ */

Some files were not shown because too many files have changed in this diff Show More