diff --git a/.gitignore b/.gitignore index 64ab3301..ed0f9026 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,6 @@ data/ obj/ bak/ -# Generated files -Unreal/Shaders.h -UmodelTool/Version.h - # Ignore makefiles for tools Tools/**/makefile-* @@ -26,3 +22,4 @@ umodel.pdb Tools/**/*.exe Tools/**/*.pdb Docs/ObjectVersion.h +*.log diff --git a/BuildTools/bash.exe b/BuildTools/bash.exe new file mode 100644 index 00000000..cee8a2bf Binary files /dev/null and b/BuildTools/bash.exe differ diff --git a/BuildTools/cat.exe b/BuildTools/cat.exe new file mode 100644 index 00000000..04da19bd Binary files /dev/null and b/BuildTools/cat.exe differ diff --git a/BuildTools/cp.exe b/BuildTools/cp.exe new file mode 100644 index 00000000..3ee8426f Binary files /dev/null and b/BuildTools/cp.exe differ diff --git a/BuildTools/diff.exe b/BuildTools/diff.exe new file mode 100644 index 00000000..40e91432 Binary files /dev/null and b/BuildTools/diff.exe differ diff --git a/BuildTools/find.exe b/BuildTools/find.exe new file mode 100644 index 00000000..94e6ab1f Binary files /dev/null and b/BuildTools/find.exe differ diff --git a/BuildTools/jom.exe b/BuildTools/jom.exe new file mode 100644 index 00000000..2506b4ed Binary files /dev/null and b/BuildTools/jom.exe differ diff --git a/BuildTools/less.exe b/BuildTools/less.exe new file mode 100644 index 00000000..4ba02ee2 Binary files /dev/null and b/BuildTools/less.exe differ diff --git a/BuildTools/ls.exe b/BuildTools/ls.exe new file mode 100644 index 00000000..2f358308 Binary files /dev/null and b/BuildTools/ls.exe differ diff --git a/BuildTools/mkdir.exe b/BuildTools/mkdir.exe new file mode 100644 index 00000000..b472731b Binary files /dev/null and b/BuildTools/mkdir.exe differ diff --git a/BuildTools/msys-1.0.dll b/BuildTools/msys-1.0.dll new file mode 100644 index 00000000..f2e50358 Binary files /dev/null and b/BuildTools/msys-1.0.dll differ diff --git a/BuildTools/msys-crypt-0.dll b/BuildTools/msys-crypt-0.dll new file mode 100644 index 00000000..5c6f3cb8 Binary files /dev/null and b/BuildTools/msys-crypt-0.dll differ diff --git a/BuildTools/msys-iconv-2.dll b/BuildTools/msys-iconv-2.dll new file mode 100644 index 00000000..622c181f Binary files /dev/null and b/BuildTools/msys-iconv-2.dll differ diff --git a/BuildTools/msys-intl-8.dll b/BuildTools/msys-intl-8.dll new file mode 100644 index 00000000..892acba7 Binary files /dev/null and b/BuildTools/msys-intl-8.dll differ diff --git a/BuildTools/msys-perl5_8.dll b/BuildTools/msys-perl5_8.dll new file mode 100644 index 00000000..b43f91ad Binary files /dev/null and b/BuildTools/msys-perl5_8.dll differ diff --git a/BuildTools/msys-regex-1.dll b/BuildTools/msys-regex-1.dll new file mode 100644 index 00000000..379c6b39 Binary files /dev/null and b/BuildTools/msys-regex-1.dll differ diff --git a/BuildTools/msys-termcap-0.dll b/BuildTools/msys-termcap-0.dll new file mode 100644 index 00000000..8f5ac266 Binary files /dev/null and b/BuildTools/msys-termcap-0.dll differ diff --git a/BuildTools/perl.exe b/BuildTools/perl.exe new file mode 100644 index 00000000..b1e1c73f Binary files /dev/null and b/BuildTools/perl.exe differ diff --git a/BuildTools/rm.exe b/BuildTools/rm.exe new file mode 100644 index 00000000..9f6de62a Binary files /dev/null and b/BuildTools/rm.exe differ diff --git a/BuildTools/rmdir.exe b/BuildTools/rmdir.exe new file mode 100644 index 00000000..4f80153b Binary files /dev/null and b/BuildTools/rmdir.exe differ diff --git a/BuildTools/sh.exe b/BuildTools/sh.exe new file mode 100644 index 00000000..cee8a2bf Binary files /dev/null and b/BuildTools/sh.exe differ diff --git a/BuildTools/sleep.exe b/BuildTools/sleep.exe new file mode 100644 index 00000000..dfecc2d8 Binary files /dev/null and b/BuildTools/sleep.exe differ diff --git a/BuildTools/sort.exe b/BuildTools/sort.exe new file mode 100644 index 00000000..c92bb0dd Binary files /dev/null and b/BuildTools/sort.exe differ diff --git a/BuildTools/tee.exe b/BuildTools/tee.exe new file mode 100644 index 00000000..ba553ff4 Binary files /dev/null and b/BuildTools/tee.exe differ diff --git a/BuildTools/vc32tools b/BuildTools/vc32tools new file mode 100644 index 00000000..56902390 --- /dev/null +++ b/BuildTools/vc32tools @@ -0,0 +1,320 @@ +#!/bin/bash + +# Color constants +norm="\\033[0m" +hgl="\\033[1" +force_nmake="" + +# Usage: CheckVC +function CheckVC() +{ + if [ "$workpath" ]; then + return # already found + fi + # compare supplied version with required + if [ "$vc_ver" ]; then + if [ "$vc_ver" -gt 2000 ]; then + # this is year-based version + [ "$vc_ver" -gt "$3" ] && return + else + [ "$vc_ver" -gt "$2" ] && return + fi + fi + # verify presence + if [ -f "$1/bin/nmake.exe" ]; then + if [ "$amd64" ] && ! [ -f "$1/bin/amd64/nmake.exe" ]; then + return + fi + workpath="$1" + found_vc=$2 + platform="32 bit" + if [ "$amd64" ]; then + platform="64 bit" + fi + echo "Using Visual C++ $2 ($3) [$platform] found at \"$1\" ..." + fi +} + + +function CheckSDK() +{ + if [ "$sdkpath" ]; then + return # already found + fi + # verify presence + if [ -d "$1" ] && [ -f "$1/bin/rc.exe" ]; then +# sdkpath="/cygdrive/${1//:/}" # d:/path -> /cygdrive/d/path - CygWin +# sdkpath="/${1//:/}" # d:/path -> /d/path - MSys + sdkpath="$1" # no path replacement + echo "Found Win32 SDK at \"$1\" ..." + fi +} + + +function AddPath() +{ + # Unix has multiple items separated with ":" which is used as drive separator on Windows systems +# local p="/cygdrive/${1//:/}" # d:/path -> /cygdrive/d/path - CygWin + local p="/${1//:/}" # d:/path -> /d/path - MSys + PATH="$PATH:$p" +} + + +function PrepareVC() +{ + if [ "$workpath" ]; then + return # action already performed + fi + + # find "Program Files" dir + # note: on 64-bit systems "PROGRAMFILES" will contain path to (x86) dir + if [ "$PROGRAMFILES" ]; then + progs="${PROGRAMFILES//\\//}" # get from environment with slash replacement + else + progs="c:/program files" + fi + + # ---------- Find Visual Studio ---------- + + CheckVC "$progs/microsoft visual studio/vc98" 6 0 # 6.0 + CheckVC "$progs/microsoft visual studio .net/vc7" 7 0 # 7.0 + CheckVC "$progs/microsoft visual studio .net 2003/vc7" 7 0 # 7.1 + CheckVC "$progs/microsoft visual studio 8/vc" 8 2005 # 8.0 (2005) + CheckVC "$progs/microsoft visual studio 9.0/vc" 9 2008 # 9.0 (2008) + CheckVC "$progs/microsoft visual studio 10.0/vc" 10 2010 # 10.0 (2010) + CheckVC "$progs/microsoft visual studio 11.0/vc" 11 2012 # 11.0 (2012) + CheckVC "$progs/microsoft visual studio 12.0/vc" 12 2013 # 12.0 (2013) + CheckVC "$progs/microsoft visual studio 14.0/vc" 14 2015 # 14.0 (2015) + + if [ ! "$workpath" ]; then + echo -e "${hgl};31mERROR: Visual C++ is not found.${norm}" + exit 1 + fi + + # compute path to additional dlls + case $found_vc in + 6) ide="$workpath/../common/msdev98/bin" + ;; + *) ide="$workpath/../common7/IDE" + ;; + esac + + # setup environment variables + if [ "$amd64" ]; then + AddPath "$workpath/bin/amd64" + else + AddPath "$workpath/bin" + AddPath "$ide" + fi + INCLUDE="$workpath/INCLUDE;$workpath/MFC/INCLUDE;$workpath/PlatformSDK/Include;$workpath/PlatformSDK/Include/prerelease" + if [ -z "$amd64" ]; then + LIB="$workpath/LIB;$workpath/PlatformSDK/LIB" + else + LIB="$workpath/LIB/amd64;$workpath/PlatformSDK/LIB/x64" + fi + + # ---------- Find Platform SDK ---------- + + CheckSDK "C:/Program Files/Microsoft SDKs/Windows/v6.0A" # NOTE: not in "Program Files (x86)" + CheckSDK "$progs/Microsoft SDKs/Windows/v7.0A" + CheckSDK "$progs/Microsoft SDKs/Windows/v7.1" + if [ "$sdkpath" ]; then + INCLUDE="$INCLUDE;$sdkpath/Include" + if [ -z "$amd64" ]; then + LIB="$LIB;$sdkpath/Lib" + else + LIB="$LIB;$sdkpath/Lib/x64" + fi + AddPath "$sdkpath/bin" # VC9+ has no RC.exe in its bin directory, using it from the SDK + fi + + if [ -z "$sdkpath" ] || [ $found_vc -ge 14 ]; then + # VS starting with 2015 version doesn't have CRT, it uses UCRT from Windows Kits/10 + win10sdk="$progs/Windows Kits/10" + if [ -d "$win10sdk" ]; then + olddir="$PWD" + cd "$win10sdk/Include" + win10sdk_ver="0.0.0.0" + for d in *; do + if [[ $d > $win10sdk_ver ]]; then + win10sdk_ver=$d + fi + done + cd "$olddir" + INCLUDE="$INCLUDE;$win10sdk/Include/$win10sdk_ver/ucrt;$win10sdk/Include/$win10sdk_ver/um;$win10sdk/Include/$win10sdk_ver/shared" + if [ -z "$amd64" ]; then + lib_subdir=x86 + else + lib_subdir=x64 + fi + LIB="$LIB;$win10sdk/Lib/$win10sdk_ver/ucrt/$lib_subdir;$win10sdk/Lib/$win10sdk_ver/um/$lib_subdir" + # include SDK bin directory (required for rc.exe) + AddPath "$win10sdk/bin/$lib_subdir" + else + echo "ERROR: $win10sdk not found" + exit 1 + fi + fi + +# echo " -- PATH: $workpath : $sdkpath" +# echo " -- INC: $INCLUDE" +# echo " -- LIB: $LIB" + export INCLUDE LIB +} + + +function Make() +{ + local line + local makefile=$1 + local mkfile + if [ -f $makefile ]; then + mkfile=$makefile + elif [ -f $makefile.mak ]; then + mkfile=$makefile.mak + else + echo -e "${hgl};31mERROR: makefile \"$makefile\" is not found$norm" + exit 1 + fi + shift + PrepareVC + # choose jom when available + # "jom" is nmake replacement with multicore support + # http://qt-project.org/wiki/jom + # Also verify this CL option: http://msdn.microsoft.com/en-us/library/bb385193(v=vs.120).aspx + # (requires passing multiple .cpp files to CL in signle command line) + #?? jom is not compatible with VS2013 - has problems with simultaneous access from multiple CL.exe to single pdb file + if [ -f "${0%/*}/jom.exe" ] && [ -z "$force_nmake" ]; then + make=jom + else + make=nmake + fi + echo "CALLING $make $mkfile $*" + #?? is CFG used somewhere ? + export TIMEFORMAT="Build time: %1R sec" + #!! check: perhaps "CFG=" option is not needed; when needed, could add parameter + #!! for this script, which will select a confuguration name + time vcfilt $make -nologo -s -f $mkfile CFG="$makefile - Win32 Release" $* + exit ${PIPESTATUS[0]} +} + + +function Compile() +{ + #?? logging + local filename="" + local cppopt="" + local linkopt="" + PrepareVC + # get CPP options + while [ $# -gt 0 ]; do + case "$1" in + *.c|*.cpp) + # another filename specified + filename="$filename $1" + ;; + "/debug"|"--debug") + cppopt="$cppopt -Zi" + linkopt="-debug" + ;; + "/link") + # get linker options + shift # skip "/link" + linkopt="$linkopt $*" + break + ;; + *) + cppopt="$cppopt $1" + ;; + esac + shift + done + if [ -z "$filename" ]; then + echo "ERROR: filename is not specified" + exit 1 + fi +# echo "CPP: <$cppopt> LNK: <$linkopt>" +# linker option "-merge:.rdata=.data" will merge sections, but produce warnings + vcfilt cl -nologo -O1 -MD $cppopt $filename -link -filealign:512 $linkopt + exit ${PIPESTATUS[0]} +} + + +function Link() +{ + PrepareVC + link $* +} + +function Usage() +{ +cat<] [--make ] [--check] [--help] +Options: + --version=ver force VC++ version to use (version option should go first) + --64 use 64-bit compiler + --compile compile c/cpp source file(s) + extra options: + --debug create pdb file + /link pass options to linker + --link link source files + --make build specified makefile + --check verify availability of VC++ + --help display compiler help pages + --nmake force NMAKE build, ignore JOM presence +EOF +} + + +# NOTE: this will tryt to parse command even when called via "source ", i.e. included +while [ "1" ]; do + + case "$1" in + --version=*) # specify preferred compiler version + vc_ver=${1:10} + shift + continue # process other switches + ;; + --64) + amd64=1 + shift + continue + ;; + --nmake) + force_nmake=1 + shift + continue + ;; + --compile) + shift + Compile $* + ;; + --link) + shift + Link $* + exit + ;; + --make) + shift + Make $* + ;; + --check) + PrepareVC + exit + ;; + --help) + PrepareVC + cl -? + exit + ;; + "") # no commands + Usage + exit 0 + ;; + *) + echo "invalid vc32tools command: $1" + exit 1 + ;; + esac + +done diff --git a/BuildTools/vcfilt b/BuildTools/vcfilt new file mode 100644 index 00000000..57c5a6d7 --- /dev/null +++ b/BuildTools/vcfilt @@ -0,0 +1,80 @@ +#!/usr/bin/perl -w + +# Changes: +# 20.09.2014 +# - removed 'nice' call - probably not needed anymore (previously used to give priority to this +# filter process over compiler, so there was no lags in output) +# 31.01.2012 +# - do not use colorizing when not attached to terminal (redirected to a file) +# 14.10.2011 +# - fixed strange bug with Win7 + new CygWin - pipe were not created when arguments are quoted + +sub color { + my ($line, $color) = @_; + return "\033[1;${color}m".$line."\033[0m"; +} + +$log = 0; +if (exists $ENV{"logfile"}) { + $log = 1; + open (LOG, ">>".$ENV{"logfile"}) or $log = 0; +} + +#setpriority(PRIO_PROCESS, $PID, -20); -- unimplemented + +# wisely combine command line, adding quotes when needed +# other (smaller) variants: +# $cmdline = "\"".join("\" \"", @ARGV)."\""; +# - this could raise to error "Can't pipe to ..." because executable name is quoted +# $cmdline = join(" ", @ARGV); +# - combine without quotes, will not process spaces at all +$cmdline = $ARGV[0]; +shift @ARGV; +foreach $arg (@ARGV) +{ + if ($arg =~ /\s/) { + $cmdline .= " \"$arg\""; + } else { + $cmdline .= " $arg"; + } +} +die "Usage: vcfilt \n" if !defined($cmdline); + + +# set priority of executed tool lower, then this filter' priority +#!!$cmdline = "nice -n 5 $cmdline"; + +# create process with piped output +#-- open(IN, "-|", "2>&1 $cmdline") or die "Can't pipe to @ARGV[0]\n"; +open(IN, "$cmdline 2>&1|") or die "Can't pipe to $ARGV[0]\n"; +$isConsole = (-t STDOUT); + +while ($line = ) +{ + if (!$isConsole) { + print($line); + print(LOG $line) if $log; + next; + } + my $line2 = $line; + if ($line =~ /Microsoft|Copyright/) { + $line2 = color ($line, 30); + } elsif ($line =~ /: fatal/) { + $line2 = color ($line, 35); + } elsif ($line =~ /: error/) { + $line2 = color ($line, 31); + } elsif ($line =~ /: warning/) { + $line2 = color ($line, 33); + } elsif ($line =~ /: attention/) { #!! temporary + $line2 = color ($line, 34); + } + print($line2); + print(LOG $line) if $log; +} +close(IN); +$ret = $?; + +close(LOG) if $log; + +# return code => out; note: code 256 could be converted to 0 (8 bit value!) so convert it to 0 or 1 +exit($ret != 0); diff --git a/Exporters/ExportFbx.cpp b/Exporters/ExportFbx.cpp new file mode 100644 index 00000000..05574c1e --- /dev/null +++ b/Exporters/ExportFbx.cpp @@ -0,0 +1,692 @@ +#include "Core.h" +#include "UnCore.h" + +#include "UnObject.h" +#include "UnMaterial.h" + +#include "SkeletalMesh.h" +#include "StaticMesh.h" + +#include "Exporters.h" + +#include "UnMathTools.h" + +#include "ExportFbx.h" + +#ifdef IOS_REF +#undef IOS_REF +#define IOS_REF (*(SdkManager->GetIOSettings())) +#endif + +const char* FBXVersions[] = +{ + FBX_2010_00_COMPATIBLE, + FBX_2011_00_COMPATIBLE, + FBX_2012_00_COMPATIBLE, + FBX_2013_00_COMPATIBLE, + FBX_2014_00_COMPATIBLE, + FBX_2016_00_COMPATIBLE, + FBX_2018_00_COMPATIBLE, +}; + +FFbxExportOption::FFbxExportOption() +{ + FbxExportCompatibility = EFbxExportCompatibility::FBX_2013; + bForceFrontXAxis = false; + LevelOfDetail = true; + Collision = true; + VertexColor = true; + WeldedVertices = true; // By default we want to weld verts, but provide option to not weld + MapSkeletalMotionToRoot = false; +} + +void FFbxExporter::CreateDocument() +{ + Scene = FbxScene::Create(SdkManager, ""); + + // create scene info + FbxDocumentInfo* SceneInfo = FbxDocumentInfo::Create(SdkManager, "SceneInfo"); + SceneInfo->mTitle = "Unreal FBX Exporter"; + SceneInfo->mSubject = "Export FBX meshes from Unreal"; + SceneInfo->mAuthor = "NEXT Studio"; + Scene->SetSceneInfo(SceneInfo); + + //FbxScene->GetGlobalSettings().SetOriginalUpAxis(KFbxAxisSystem::Max); + FbxAxisSystem::EFrontVector FrontVector = (FbxAxisSystem::EFrontVector) - FbxAxisSystem::eParityOdd; + if (ExportOptions->bForceFrontXAxis) + FrontVector = FbxAxisSystem::eParityEven; + + const FbxAxisSystem UnrealZUp(FbxAxisSystem::eZAxis, FrontVector, FbxAxisSystem::eRightHanded); + Scene->GetGlobalSettings().SetAxisSystem(UnrealZUp); + Scene->GetGlobalSettings().SetOriginalUpAxis(UnrealZUp); + // Maya use cm by default + Scene->GetGlobalSettings().SetSystemUnit(FbxSystemUnit::cm); + //FbxScene->GetGlobalSettings().SetOriginalSystemUnit( KFbxSystemUnit::m ); + + // setup anim stack + AnimStack = FbxAnimStack::Create(Scene, "Unreal Take"); + //KFbxSet(AnimStack->LocalStart, KTIME_ONE_SECOND); + AnimStack->Description.Set("Animation Take for Unreal."); + + // this take contains one base layer. In fact having at least one layer is mandatory. + AnimLayer = FbxAnimLayer::Create(Scene, "Base Layer"); + AnimStack->AddMember(AnimLayer); +} + +void FFbxExporter::CloseDocument() +{ + //FbxSkeletonRoots.Reset(); + FbxMaterials.Reset(); + FbxMeshes.Reset(); + //FbxNodeNameToIndexMap.Reset(); + if (Scene) + { + Scene->Destroy(); + Scene = NULL; + } +} + +void FFbxExporter::WriteToFile(const char* Filename) +{ + int32 Major, Minor, Revision; + bool Status = true; + + int32 FileFormat = -1; + bool bEmbedMedia = false; + + // Create an exporter. + FbxExporter* Exporter = FbxExporter::Create(SdkManager, ""); + + // set file format + // Write in fall back format if pEmbedMedia is true + FileFormat = SdkManager->GetIOPluginRegistry()->GetNativeWriterFormat(); + + // Set the export states. By default, the export states are always set to + // true except for the option eEXPORT_TEXTURE_AS_EMBEDDED. The code below + // shows how to change these states. + + IOS_REF.SetBoolProp(EXP_FBX_MATERIAL, true); + IOS_REF.SetBoolProp(EXP_FBX_TEXTURE, true); + IOS_REF.SetBoolProp(EXP_FBX_EMBEDDED, bEmbedMedia); + IOS_REF.SetBoolProp(EXP_FBX_SHAPE, true); + IOS_REF.SetBoolProp(EXP_FBX_GOBO, true); + IOS_REF.SetBoolProp(EXP_FBX_ANIMATION, true); + IOS_REF.SetBoolProp(EXP_FBX_GLOBAL_SETTINGS, true); + + //Get the compatibility from the editor settings + const EFbxExportCompatibility FbxExportCompatibility = ExportOptions->FbxExportCompatibility; + const char* CompatibilitySetting = CompatibilitySetting = FBXVersions[FbxExportCompatibility]; + + // We export using FBX 2013 format because many users are still on that version and FBX 2014 files has compatibility issues with + // normals when importing to an earlier version of the plugin + if (!Exporter->SetFileExportVersion(CompatibilitySetting, FbxSceneRenamer::eNone)) + { + appPrintf("Call to KFbxExporter::SetFileExportVersion(FBX_2013_00_COMPATIBLE) to export 2013 fbx file format failed.\n"); + } + + // Initialize the exporter by providing a filename. + if (!Exporter->Initialize(Filename, FileFormat, SdkManager->GetIOSettings())) + { + appPrintf("Call to KFbxExporter::Initialize() failed.\n"); + appPrintf("Error returned: %s\n\n"), Exporter->GetStatus().GetErrorString(); + return; + } + + FbxManager::GetFileFormatVersion(Major, Minor, Revision); + appPrintf("FBX version number for this version of the FBX SDK is %d.%d.%d\n\n", Major, Minor, Revision); + + // Export the scene. + Status = Exporter->Export(Scene); + + // Destroy the exporter. + Exporter->Destroy(); + + CloseDocument(); +} + +void FFbxExporter::ExportStaticMesh(const CStaticMesh* StaticMesh) +{ + FString MeshName = StaticMesh->OriginalMesh->Name; + FbxNode* MeshNode = FbxNode::Create(Scene, *MeshName); + Scene->GetRootNode()->AddChild(MeshNode); + + ExportOptions->LevelOfDetail = GExportLods; + if (ExportOptions->LevelOfDetail && StaticMesh->Lods.Num() > 1) + { + char LodGroup_MeshName[128]; + appSprintf(LodGroup_MeshName, 128, "%s_LodGroup", *MeshName); + FbxLODGroup *FbxLodGroupAttribute = FbxLODGroup::Create(Scene, LodGroup_MeshName); + MeshNode->AddNodeAttribute(FbxLodGroupAttribute); + FbxLodGroupAttribute->ThresholdsUsedAsPercentage = true; + //Export an Fbx Mesh Node for every LOD and child them to the fbx node (LOD Group) + for (int CurrentLodIndex = 0; CurrentLodIndex < StaticMesh->Lods.Num(); ++CurrentLodIndex) + { + char NodeName[512]; + appSprintf(ARRAY_ARG(NodeName), "%s_LOD%d", *MeshName, CurrentLodIndex); + FString FbxLODNodeName = NodeName; + FbxNode* FbxActorLOD = FbxNode::Create(Scene, *FbxLODNodeName); + MeshNode->AddChild(FbxActorLOD); + if (CurrentLodIndex + 1 < StaticMesh->Lods.Num()) + { + //Convert the screen size to a threshold, it is just to be sure that we set some threshold, there is no way to convert this precisely + double LodScreenSize = (double)(10.0f * (CurrentLodIndex + 1)); + FbxLodGroupAttribute->AddThreshold(LodScreenSize); + } + ExportStaticMeshToFbx(StaticMesh, CurrentLodIndex, *MeshName, FbxActorLOD, -1); + } + } + else + { + ExportStaticMeshToFbx(StaticMesh, 0, *MeshName, MeshNode, -1); + } +} + +FFbxExporter::FFbxExporter() +{ + ExportOptions = new FFbxExportOption(); + + // Create the SdkManager + SdkManager = FbxManager::Create(); + + // create an IOSettings object + FbxIOSettings * ios = FbxIOSettings::Create(SdkManager, IOSROOT); + SdkManager->SetIOSettings(ios); + + Scene = nullptr; + AnimStack = nullptr; + AnimLayer = nullptr; + DefaultCamera = nullptr; +} + + +FFbxExporter::~FFbxExporter() +{ + if (SdkManager) + { + SdkManager->Destroy(); + SdkManager = nullptr; + } + if (ExportOptions) + { + delete ExportOptions; + ExportOptions = nullptr; + } +} + +void DetermineVertsToWeld(TArray& VertRemap, TArray& UniqueVerts, const CStaticMeshLod& RenderMesh) +{ + const int32 VertexCount = RenderMesh.NumVerts; + + // Maps unreal verts to reduced list of verts + VertRemap.Empty(VertexCount); + VertRemap.AddUninitialized(VertexCount); + + // List of Unreal Verts to keep + UniqueVerts.Empty(VertexCount); + + // Combine matching verts using hashed search to maintain good performance + TMap HashedVerts; + for (int32 a = 0; a < VertexCount; a++) + { + const CVecT& Position = RenderMesh.Verts[a].Position; + FVector PositionA; + PositionA.Set(Position[0], Position[1], Position[2]); + const int32* FoundIndex = HashedVerts.Find(PositionA); + if (!FoundIndex) + { + int32 NewIndex = UniqueVerts.Add(a); + VertRemap[a] = NewIndex; + HashedVerts.Add(PositionA, NewIndex); + } + else + { + VertRemap[a] = *FoundIndex; + } + } +} +void DetermineUVsToWeld(TArray& VertRemap, TArray& UniqueVerts, const CStaticMeshLod& RenderMesh, int32 TexCoordSourceIndex) +{ + const int32 VertexCount = RenderMesh.NumVerts; + + // Maps unreal verts to reduced list of verts + VertRemap.Empty(VertexCount); + VertRemap.AddUninitialized(VertexCount); + + // List of Unreal Verts to keep + UniqueVerts.Empty(VertexCount); + + // Combine matching verts using hashed search to maintain good performance + TMap HashedVerts; + for (int32 Vertex = 0; Vertex < VertexCount; Vertex++) + { + const CMeshUVFloat& MeshUV = RenderMesh.GetVertexUV(Vertex, TexCoordSourceIndex); + const FVector2D& PositionA = *(FVector2D*)&MeshUV; + + const int32* FoundIndex = HashedVerts.Find(PositionA); + if (!FoundIndex) + { + int32 NewIndex = UniqueVerts.Add(Vertex); + VertRemap[Vertex] = NewIndex; + HashedVerts.Add(PositionA, NewIndex); + } + else + { + VertRemap[Vertex] = *FoundIndex; + } + } +} + +FbxNode* FFbxExporter::ExportStaticMeshToFbx(const CStaticMesh* StaticMesh, int32 ExportLOD, const char* MeshName, FbxNode* FbxActor, int32 LightmapUVChannel /*= -1*/) +{ + FbxMesh* Mesh = nullptr; + if ((ExportLOD == 0 || ExportLOD == -1) && LightmapUVChannel == -1) + { + auto MeshPtr = FbxMeshes.Find(StaticMesh); + if (MeshPtr) + Mesh = *MeshPtr; + } + + if (!Mesh) + { + Mesh = FbxMesh::Create(Scene, MeshName); + + const CStaticMeshLod& RenderMesh = StaticMesh->Lods[ExportLOD]; + + // Verify the integrity of the static mesh. + if (RenderMesh.NumVerts == 0) + { + return nullptr; + } + + if (RenderMesh.Sections.Num() == 0) + { + return nullptr; + } + + // Remaps an Unreal vert to final reduced vertex list + TArray VertRemap; + TArray UniqueVerts; + + if (ExportOptions->WeldedVertices) + { + // Weld verts + DetermineVertsToWeld(VertRemap, UniqueVerts, RenderMesh); + } + else + { + // Do not weld verts + VertRemap.AddUninitialized(RenderMesh.NumVerts); + for (int32 i = 0; i < VertRemap.Num(); i++) + { + VertRemap[i] = i; + } + CopyArray(UniqueVerts, VertRemap); + } + + // Create and fill in the vertex position data source. + // The position vertices are duplicated, for some reason, retrieve only the first half vertices. + const int32 VertexCount = VertRemap.Num(); + const int32 PolygonsCount = RenderMesh.Sections.Num(); + + Mesh->InitControlPoints(UniqueVerts.Num()); + + FbxVector4* ControlPoints = Mesh->GetControlPoints(); + for (int32 PosIndex = 0; PosIndex < UniqueVerts.Num(); ++PosIndex) + { + int32 UnrealPosIndex = UniqueVerts[PosIndex]; + CVecT& Position = RenderMesh.Verts[UnrealPosIndex].Position; + ControlPoints[PosIndex] = FbxVector4(Position[0], -Position[1], Position[2]); + } + + // Set the normals on Layer 0. + FbxLayer* Layer = Mesh->GetLayer(0); + if (Layer == nullptr) + { + Mesh->CreateLayer(); + Layer = Mesh->GetLayer(0); + } + + // Build list of Indices re-used multiple times to lookup Normals, UVs, other per face vertex information + TArray Indices; + for (int32 PolygonsIndex = 0; PolygonsIndex < PolygonsCount; ++PolygonsIndex) + { + auto RawIndices = RenderMesh.Indices.GetAccessor(); + const CMeshSection& Polygons = RenderMesh.Sections[PolygonsIndex]; + const uint32 TriangleCount = Polygons.NumFaces; + for (uint32 TriangleIndex = 0; TriangleIndex < TriangleCount; ++TriangleIndex) + { + for (uint32 PointIndex = 0; PointIndex < 3; PointIndex++) + { + uint32 UnrealVertIndex = RawIndices(Polygons.FirstIndex + ((TriangleIndex * 3) + PointIndex)); + Indices.Add(UnrealVertIndex); + } + } + } + + // Create and fill in the per-face-vertex normal data source. + // We extract the Z-tangent and the X/Y-tangents which are also stored in the render mesh. + FbxLayerElementNormal* LayerElementNormal = FbxLayerElementNormal::Create(Mesh, ""); + FbxLayerElementTangent* LayerElementTangent = FbxLayerElementTangent::Create(Mesh, ""); + FbxLayerElementBinormal* LayerElementBinormal = FbxLayerElementBinormal::Create(Mesh, ""); + + // Set 3 NTBs per triangle instead of storing on positional control points + LayerElementNormal->SetMappingMode(FbxLayerElement::eByPolygonVertex); + LayerElementTangent->SetMappingMode(FbxLayerElement::eByPolygonVertex); + LayerElementBinormal->SetMappingMode(FbxLayerElement::eByPolygonVertex); + + // Set the NTBs values for every polygon vertex. + LayerElementNormal->SetReferenceMode(FbxLayerElement::eDirect); + LayerElementTangent->SetReferenceMode(FbxLayerElement::eDirect); + LayerElementBinormal->SetReferenceMode(FbxLayerElement::eDirect); + + TArray FbxNormals; + TArray FbxTangents; + TArray FbxBinormals; + + FbxNormals.AddUninitialized(VertexCount); + FbxTangents.AddUninitialized(VertexCount); + FbxBinormals.AddUninitialized(VertexCount); + + for (int32 NTBIndex = 0; NTBIndex < VertexCount; ++NTBIndex) + { + CVecT Normal, Tangent, Binormal; + RenderMesh.Verts[NTBIndex].DecodeTangents(Normal, Tangent, Binormal); + + FbxVector4& FbxNormal = FbxNormals[NTBIndex]; + FbxNormal = FbxVector4(Normal[0], -Normal[1], Normal[2]); + FbxNormal.Normalize(); + + FbxVector4& FbxTangent = FbxTangents[NTBIndex]; + FbxTangent = FbxVector4(Tangent[0], -Tangent[1], Tangent[2]); + FbxTangent.Normalize(); + + FbxVector4& FbxBinormal = FbxBinormals[NTBIndex]; + FbxBinormal = FbxVector4(Binormal[0], -Binormal[1], Binormal[2]); + FbxBinormal.Normalize(); + } + + // Add one normal per each face index (3 per triangle) + for (int32 FbxVertIndex = 0; FbxVertIndex < Indices.Num(); FbxVertIndex++) + { + uint32 UnrealVertIndex = Indices[FbxVertIndex]; + LayerElementNormal->GetDirectArray().Add(FbxNormals[UnrealVertIndex]); + LayerElementTangent->GetDirectArray().Add(FbxTangents[UnrealVertIndex]); + LayerElementBinormal->GetDirectArray().Add(FbxBinormals[UnrealVertIndex]); + } + + Layer->SetNormals(LayerElementNormal); + Layer->SetTangents(LayerElementTangent); + Layer->SetBinormals(LayerElementBinormal); + + FbxNormals.Empty(); + FbxTangents.Empty(); + FbxBinormals.Empty(); + + // Create and fill in the per-face-vertex texture coordinate data source(s). + // Create UV for Diffuse channel. + int32 TexCoordSourceCount = (LightmapUVChannel == -1) ? RenderMesh.NumTexCoords : LightmapUVChannel + 1; + int32 TexCoordSourceIndex = (LightmapUVChannel == -1) ? 0 : LightmapUVChannel; + for (; TexCoordSourceIndex < TexCoordSourceCount; ++TexCoordSourceIndex) + { + FbxLayer* UVsLayer = (LightmapUVChannel == -1) ? Mesh->GetLayer(TexCoordSourceIndex) : Mesh->GetLayer(0); + if (UVsLayer == NULL) + { + Mesh->CreateLayer(); + UVsLayer = (LightmapUVChannel == -1) ? Mesh->GetLayer(TexCoordSourceIndex) : Mesh->GetLayer(0); + } + assert(UVsLayer); + + char UVChannelName[128]; + appSprintf(UVChannelName, 128, "UVmap_%d", TexCoordSourceIndex); + if ((LightmapUVChannel >= 0) || ((LightmapUVChannel == -1) && (TexCoordSourceIndex == 1/*StaticMesh->LightMapCoordinateIndex*/))) + { + appSprintf(UVChannelName, 128, "%s", "LightMapUV"); + } + + FbxLayerElementUV* UVDiffuseLayer = FbxLayerElementUV::Create(Mesh, UVChannelName); + + // Note: when eINDEX_TO_DIRECT is used, IndexArray must be 3xTriangle count, DirectArray can be smaller + UVDiffuseLayer->SetMappingMode(FbxLayerElement::eByPolygonVertex); + UVDiffuseLayer->SetReferenceMode(FbxLayerElement::eIndexToDirect); + + TArray UvsRemap; + TArray UniqueUVs; + if (ExportOptions->WeldedVertices) + { + // Weld UVs + DetermineUVsToWeld(UvsRemap, UniqueUVs, RenderMesh, TexCoordSourceIndex); + } + else + { + // Do not weld UVs + CopyArray(UvsRemap, VertRemap); + CopyArray(UniqueUVs, UvsRemap); + } + + // Create the texture coordinate data source. + for (int32 FbxVertIndex = 0; FbxVertIndex < UniqueUVs.Num(); FbxVertIndex++) + { + int32 UnrealVertIndex = UniqueUVs[FbxVertIndex]; + const FVector2D& TexCoord = *(FVector2D*)&RenderMesh.GetVertexUV(UnrealVertIndex, TexCoordSourceIndex); + UVDiffuseLayer->GetDirectArray().Add(FbxVector2(TexCoord.X, -TexCoord.Y + 1.0)); + } + + // For each face index, point to a texture uv + UVDiffuseLayer->GetIndexArray().SetCount(Indices.Num()); + for (int32 FbxVertIndex = 0; FbxVertIndex < Indices.Num(); FbxVertIndex++) + { + uint32 UnrealVertIndex = Indices[FbxVertIndex]; + int32 NewVertIndex = UvsRemap[UnrealVertIndex]; + UVDiffuseLayer->GetIndexArray().SetAt(FbxVertIndex, NewVertIndex); + } + + UVsLayer->SetUVs(UVDiffuseLayer, FbxLayerElement::eTextureDiffuse); + } + + FbxLayerElementMaterial* MatLayer = FbxLayerElementMaterial::Create(Mesh, ""); + MatLayer->SetMappingMode(FbxLayerElement::eByPolygon); + MatLayer->SetReferenceMode(FbxLayerElement::eIndexToDirect); + Layer->SetMaterials(MatLayer); + + // Keep track of the number of tri's we export + uint32 AccountedTriangles = 0; + for (int32 PolygonsIndex = 0; PolygonsIndex < PolygonsCount; ++PolygonsIndex) + { + const CMeshSection& Polygons = RenderMesh.Sections[PolygonsIndex]; + auto RawIndices = RenderMesh.Indices.GetAccessor(); + UUnrealMaterial* Material = Polygons.Material; + + FbxSurfaceMaterial* FbxMaterial = Material ? this->ExportMaterial(Material) : NULL; + if (!FbxMaterial) + { + FbxMaterial = CreateDefaultMaterial(PolygonsIndex); + } + int32 MatIndex = FbxActor->AddMaterial(FbxMaterial); + + // Determine the actual material index + int32 ActualMatIndex = MatIndex; + + // Static meshes contain one triangle list per element. + // [GLAFORTE] Could it occasionally contain triangle strips? How do I know? + uint32 TriangleCount = Polygons.NumFaces; + + // Copy over the index buffer into the FBX polygons set. + for (uint32 TriangleIndex = 0; TriangleIndex < TriangleCount; ++TriangleIndex) + { + Mesh->BeginPolygon(ActualMatIndex); + for (uint32 PointIndex = 0; PointIndex < 3; PointIndex++) + { + uint32 OriginalUnrealVertIndex = RawIndices(Polygons.FirstIndex + ((TriangleIndex * 3) + PointIndex)); + int32 RemappedVertIndex = VertRemap[OriginalUnrealVertIndex]; + Mesh->AddPolygon(RemappedVertIndex); + } + Mesh->EndPolygon(); + } + + AccountedTriangles += TriangleCount; + } + + if ((ExportLOD == 0 || ExportLOD == -1) && LightmapUVChannel == -1) + { + FbxMeshes.Add(StaticMesh, Mesh); + } +#if WITH_PHYSX + if ((ExportLOD == 0 || ExportLOD == -1) && ExportOptions->Collision) + { + ExportCollisionMesh(StaticMesh, MeshName, FbxActor); + } +#endif + } + else + { + //Materials in fbx are store in the node and not in the mesh, so even if the mesh was already export + //we have to find and assign the mesh material. + const CStaticMeshLod& RenderMesh = StaticMesh->Lods[ExportLOD]; + const int32 PolygonsCount = RenderMesh.Sections.Num(); + uint32 AccountedTriangles = 0; + for (int32 PolygonsIndex = 0; PolygonsIndex < PolygonsCount; ++PolygonsIndex) + { + const CMeshSection& Polygons = RenderMesh.Sections[PolygonsIndex]; + auto RawIndices = RenderMesh.Indices.GetAccessor(); + UUnrealMaterial* Material = Polygons.Material; + + FbxSurfaceMaterial* FbxMaterial = Material ? this->ExportMaterial(Material) : NULL; + if (!FbxMaterial) + { + FbxMaterial = CreateDefaultMaterial(PolygonsIndex); + } + FbxActor->AddMaterial(FbxMaterial); + } + } + + //Set the original meshes in case it was already existing + FbxActor->SetNodeAttribute(Mesh); + + return FbxActor; +} + +FbxSurfaceMaterial* FFbxExporter::CreateDefaultMaterial(int Index) +{ + char DefaultMaterialName[128]; + appSprintf(DefaultMaterialName, 128, "DefaultMaterial%d", Index); + FbxSurfaceMaterial* FbxMaterial = Scene->GetMaterial(DefaultMaterialName); + + if (!FbxMaterial) + { + FbxMaterial = FbxSurfaceLambert::Create(Scene, DefaultMaterialName); + ((FbxSurfaceLambert*)FbxMaterial)->Diffuse.Set(FbxDouble3(0.72, 0.72, 0.72)); + } + + return FbxMaterial; +} + +FbxSurfaceMaterial* FFbxExporter::ExportMaterial(UUnrealMaterial* Material) +{ + if (Scene == nullptr || Material == nullptr) return nullptr; + + // Verify that this material has not already been exported: + if (FbxMaterials.Find(Material)) + { + return *FbxMaterials.Find(Material); + } + + CMaterialParams Params; + Material->GetParams(Params); + if (Params.IsNull() || Params.Diffuse == Material) return nullptr; // empty/unknown material, or material itself is a texture + + // Create the Fbx material + FbxSurfaceMaterial* FbxMaterial = nullptr; + + // Set the shading model + //if (Material->GetShadingModel() == MSM_DefaultLit) + { + FbxMaterial = FbxSurfacePhong::Create(Scene, Material->Name); + //((FbxSurfacePhong*)FbxMaterial)->Specular.Set(Material->Specular)); + //((FbxSurfacePhong*)FbxMaterial)->Shininess.Set(Material->SpecularPower.Constant); + } + //else // if (Material->ShadingModel == MSM_Unlit) + //{ + // FbxMaterial = FbxSurfaceLambert::Create(Scene, Material->Name); + //} + + //((FbxSurfaceLambert*)FbxMaterial)->TransparencyFactor.Set(Material->Opacity.Constant); + + // Fill in the profile_COMMON effect with the material information. + //Fill the texture or constant + if (!FillFbxTextureProperty(FbxSurfaceMaterial::sDiffuse, Params.Diffuse, FbxMaterial)) + { + //((FbxSurfaceLambert*)FbxMaterial)->Diffuse.Set(SetMaterialComponent(Material->BaseColor, true)); + } + if (!FillFbxTextureProperty(FbxSurfaceMaterial::sEmissive, Params.Emissive, FbxMaterial)) + { + //((FbxSurfaceLambert*)FbxMaterial)->Emissive.Set(FbxDouble3(Params.EmissiveColor.R, Params.EmissiveColor.G, Params.EmissiveColor.B)); + } + + //Always set the ambient to zero since we dont have ambient in unreal we want to avoid default value in DCCs + ((FbxSurfaceLambert*)FbxMaterial)->Ambient.Set(FbxDouble3(0.0, 0.0, 0.0)); + + //Set the Normal map only if there is a texture sampler + FillFbxTextureProperty(FbxSurfaceMaterial::sNormalMap, Params.Normal, FbxMaterial); + FillFbxTextureProperty(FbxSurfaceMaterial::sSpecular, Params.Specular, FbxMaterial); + FillFbxTextureProperty(FbxSurfaceMaterial::sShininess, Params.SpecPower, FbxMaterial); + FillFbxTextureProperty(FbxSurfaceMaterial::sReflection, Params.Cube, FbxMaterial); + + //UMaterial3* Material3 = Material->IsA("Material3") ? static_cast(Material) : nullptr; + //if (Material3 != nullptr && Material3->BlendMode == BLEND_Translucent) + //{ + // if (!FillFbxTextureProperty(FbxSurfaceMaterial::sTransparentColor, Params.Opacity, FbxMaterial)) + // { + // //FbxDouble3 OpacityValue((FbxDouble)(Material->Opacity.Constant), (FbxDouble)(Material->Opacity.Constant), (FbxDouble)(Material->Opacity.Constant)); + // //((FbxSurfaceLambert*)FbxMaterial)->TransparentColor.Set(OpacityValue); + // } + // if (!FillFbxTextureProperty(FbxSurfaceMaterial::sTransparencyFactor, Params.Opacity, FbxMaterial)) + // { + // ((FbxSurfaceLambert*)FbxMaterial)->TransparencyFactor.Set(Material3->OpacityMaskClipValue); + // } + //} + + FbxMaterials.Add(Material, FbxMaterial); + + return FbxMaterial; +} + +bool FFbxExporter::FillFbxTextureProperty(const char *PropertyName, const UUnrealMaterial* Texture, FbxSurfaceMaterial* FbxMaterial) +{ + if (Scene == NULL) + { + return false; + } + + FbxProperty FbxColorProperty = FbxMaterial->FindProperty(PropertyName); + if (FbxColorProperty.IsValid()) + { + if (Texture) + { + const char* TextureSourceFullPath = GetExportTextureName(Texture); + //Create a fbx property + FbxFileTexture* lTexture = FbxFileTexture::Create(Scene, "EnvSamplerTex"); + lTexture->SetFileName(TextureSourceFullPath); + lTexture->SetTextureUse(FbxTexture::eStandard); + lTexture->SetMappingType(FbxTexture::eUV); + lTexture->ConnectDstProperty(FbxColorProperty); + return true; + } + } + return false; +} + +void ExportFbxStaticMesh(const CStaticMesh *Mesh) +{ + UObject *OriginalMesh = Mesh->OriginalMesh; + if (!Mesh->Lods.Num()) + { + appNotify("Mesh %s has 0 lods", OriginalMesh->Name); + return; + } + + FFbxExporter* FbxExporter = FFbxExporter::GetInstance(); + FbxExporter->CreateDocument(); + FbxExporter->ExportStaticMesh(Mesh); + const char* Filename = GetExportFileName(OriginalMesh, "%s.fbx", OriginalMesh->Name); + FbxExporter->WriteToFile(Filename); +} diff --git a/Exporters/ExportFbx.h b/Exporters/ExportFbx.h new file mode 100644 index 00000000..668cf034 --- /dev/null +++ b/Exporters/ExportFbx.h @@ -0,0 +1,141 @@ +#pragma once + +#define __PLACEMENT_NEW_INLINE +#include + +enum EFbxExportCompatibility +{ + FBX_2010, + FBX_2011, + FBX_2012, + FBX_2013, + FBX_2014, + FBX_2016, + FBX_2018, +}; + +class FFbxExportOption +{ +public: + FFbxExportOption(); +public: + /** This will set the fbx sdk compatibility when exporting to fbx file. The default value is 2013 */ + EFbxExportCompatibility FbxExportCompatibility; + + /** If enabled, export with X axis as the front axis instead of default -Y */ + uint32 bForceFrontXAxis : 1; + + /** If enable, export vertex color */ + uint32 VertexColor : 1; + + /** If enabled, export the level of detail */ + uint32 LevelOfDetail : 1; + + /** If enabled, export collision */ + uint32 Collision : 1; + + /** If enable, export welded vertices*/ + uint32 WeldedVertices : 1; + + /** If enable, Map skeletal actor motion to the root bone of the skeleton. */ + uint32 MapSkeletalMotionToRoot : 1; +}; +/** +* FBX basic data conversion class. +*/ +class FFbxDataConverter +{ +public: + static void SetJointPostConversionMatrix(FbxAMatrix ConversionMatrix) { JointPostConversionMatrix = ConversionMatrix; } + static const FbxAMatrix &GetJointPostConversionMatrix() { return JointPostConversionMatrix; } + + static FVector ConvertPos(FbxVector4 Vector); + static FVector ConvertDir(FbxVector4 Vector); + static FRotator ConvertEuler(FbxDouble3 Euler); + static FVector ConvertScale(FbxDouble3 Vector); + static FVector ConvertScale(FbxVector4 Vector); + static FRotator ConvertRotation(FbxQuaternion Quaternion); + static FVector ConvertRotationToFVect(FbxQuaternion Quaternion, bool bInvertRot); + static FQuat ConvertRotToQuat(FbxQuaternion Quaternion); + static float ConvertDist(FbxDouble Distance); + static FTransform ConvertTransform(FbxAMatrix Matrix); + static FMatrix ConvertMatrix(FbxAMatrix Matrix); + + /* + * Convert fbx linear space color to sRGB FColor + */ + static FColor ConvertColor(FbxDouble3 Color); + + static FbxVector4 ConvertToFbxPos(FVector Vector); + static FbxVector4 ConvertToFbxRot(FVector Vector); + static FbxVector4 ConvertToFbxScale(FVector Vector); + + /* + * Convert sRGB FColor to fbx linear space color + */ + static FbxDouble3 ConvertToFbxColor(FColor Color); + static FbxString ConvertToFbxString(FName Name); + static FbxString ConvertToFbxString(const FString& String); + +private: + static FbxAMatrix JointPostConversionMatrix; +}; + +class FFbxExporter +{ +public: + static FFbxExporter* GetInstance() + { + static FFbxExporter fbxExporter; + return &fbxExporter; + } +public: + /** + * Creates and readies an empty document for export. + */ + void CreateDocument(); + + /** + * Closes the FBX document, releasing its memory. + */ + void CloseDocument(); + + /** + * Writes the FBX document to disk and releases it by calling the CloseDocument() function. + */ + void WriteToFile(const char* Filename); + + void ExportStaticMesh(const CStaticMesh* StaticMesh); + +private: + FFbxExporter(); + ~FFbxExporter(); + + /** + * Exports a static mesh + * @param StaticMesh The static mesh to export + * @param MeshName The name of the mesh for the FBX file + * @param FbxActor The fbx node representing the mesh + * @param ExportLOD The LOD of the mesh to export + * @param LightmapUVChannel Optional UV channel to export + */ + FbxNode* ExportStaticMeshToFbx(const CStaticMesh* StaticMesh, int32 ExportLOD, const char* MeshName, FbxNode* FbxActor, int32 LightmapUVChannel = -1); + FbxSurfaceMaterial* CreateDefaultMaterial(int Index); + FbxSurfaceMaterial* ExportMaterial(UUnrealMaterial* Material); + bool FillFbxTextureProperty(const char *PropertyName, const UUnrealMaterial* Texture, FbxSurfaceMaterial* FbxMaterial); + +private: + FbxManager* SdkManager; + FbxScene* Scene; + FbxAnimStack* AnimStack; + FbxAnimLayer* AnimLayer; + FbxCamera* DefaultCamera; + + FFbxDataConverter Converter; + + FFbxExportOption* ExportOptions; + +private: + TMap FbxMeshes; + TMap FbxMaterials; +}; \ No newline at end of file diff --git a/Exporters/ExportPsk.cpp b/Exporters/ExportPsk.cpp index 8de597c1..7c36f370 100644 --- a/Exporters/ExportPsk.cpp +++ b/Exporters/ExportPsk.cpp @@ -28,20 +28,20 @@ static void ExportScript(const CSkeletalMesh *Mesh, FArchive &Ar) // mesh info Ar.Printf( - "class %s extends Actor;\n\n" - "#exec MESH MODELIMPORT MESH=%s MODELFILE=%s.psk\n" - "#exec MESH ORIGIN MESH=%s X=%g Y=%g Z=%g YAW=%d PITCH=%d ROLL=%d\n" - "// rotator: P=%d Y=%d R=%d\n", - MeshName, - MeshName, MeshName, - MeshName, VECTOR_ARG(Mesh->MeshOrigin), - Mesh->RotOrigin.Yaw >> 8, Mesh->RotOrigin.Pitch >> 8, Mesh->RotOrigin.Roll >> 8, - Mesh->RotOrigin.Pitch, Mesh->RotOrigin.Yaw, Mesh->RotOrigin.Roll + "class %s extends Actor;\n\n" + "#exec MESH MODELIMPORT MESH=%s MODELFILE=%s.psk\n" + "#exec MESH ORIGIN MESH=%s X=%g Y=%g Z=%g YAW=%d PITCH=%d ROLL=%d\n" + "// rotator: P=%d Y=%d R=%d\n", + MeshName, + MeshName, MeshName, + MeshName, VECTOR_ARG(Mesh->MeshOrigin), + Mesh->RotOrigin.Yaw >> 8, Mesh->RotOrigin.Pitch >> 8, Mesh->RotOrigin.Roll >> 8, + Mesh->RotOrigin.Pitch, Mesh->RotOrigin.Yaw, Mesh->RotOrigin.Roll ); // mesh scale Ar.Printf( - "#exec MESH SCALE MESH=%s X=%g Y=%g Z=%g\n\n", - MeshName, VECTOR_ARG(Mesh->MeshScale) + "#exec MESH SCALE MESH=%s X=%g Y=%g Z=%g\n\n", + MeshName, VECTOR_ARG(Mesh->MeshScale) ); // sockets for (int i = 0; i < Mesh->Sockets.Num(); i++) @@ -51,12 +51,12 @@ static void ExportScript(const CSkeletalMesh *Mesh, FArchive &Ar) FRotator R; AxisToRotator(T.axis, R); Ar.Printf( - "#exec MESH ATTACHNAME MESH=%s BONE=\"%s\" TAG=\"%s\" YAW=%d PITCH=%d ROLL=%d X=%g Y=%g Z=%g\n" - "// rotator: P=%d Y=%d R=%d\n", - MeshName, *S.Bone, *S.Name, - R.Yaw >> 8, R.Pitch >> 8, R.Roll >> 8, - VECTOR_ARG(T.origin), - R.Pitch, R.Yaw, R.Roll + "#exec MESH ATTACHNAME MESH=%s BONE=\"%s\" TAG=\"%s\" YAW=%d PITCH=%d ROLL=%d X=%g Y=%g Z=%g\n" + "// rotator: P=%d Y=%d R=%d\n", + MeshName, *S.Bone, *S.Name, + R.Yaw >> 8, R.Pitch >> 8, R.Roll >> 8, + VECTOR_ARG(T.origin), + R.Pitch, R.Yaw, R.Roll ); } } @@ -68,11 +68,11 @@ static void ExportScript(const CSkeletalMesh *Mesh, FArchive &Ar) static void ExportCommonMeshData ( - FArchive &Ar, - const CMeshSection *Sections, int NumSections, - const CMeshVertex *Verts, int NumVerts, int VertexSize, - const CIndexBuffer &Indices, - CVertexShare &Share + FArchive &Ar, + const CMeshSection *Sections, int NumSections, + const CMeshVertex *Verts, int NumVerts, int VertexSize, + const CIndexBuffer &Indices, + CVertexShare &Share ) { guard(ExportCommonMeshData); @@ -214,10 +214,10 @@ static void ExportCommonMeshData static void ExportExtraUV ( - FArchive &Ar, - const CMeshUVFloat* const ExtraUV[], - int NumVerts, - int NumTexCoords + FArchive &Ar, + const CMeshUVFloat* const ExtraUV[], + int NumVerts, + int NumTexCoords ) { guard(ExportExtraUV); @@ -279,11 +279,11 @@ static void ExportSkeletalMeshLod(const CSkeletalMesh &Mesh, const CSkelMeshLod ExportCommonMeshData ( - Ar, - &Lod.Sections[0], Lod.Sections.Num(), - Lod.Verts, Lod.NumVerts, sizeof(CSkelMeshVertex), - Lod.Indices, - Share + Ar, + &Lod.Sections[0], Lod.Sections.Num(), + Lod.Verts, Lod.NumVerts, sizeof(CSkelMeshVertex), + Lod.Indices, + Share ); int numBones = Mesh.RefSkeleton.Num(); @@ -354,11 +354,11 @@ static void ExportSkeletalMeshLod(const CSkeletalMesh &Mesh, const CSkelMeshLod ExportExtraUV(Ar, Lod.ExtraUV, Lod.NumVerts, Lod.NumTexCoords); -/* if (!GExportPskx) // nothing more to write - return; + /* if (!GExportPskx) // nothing more to write + return; - // pskx extension -*/ + // pskx extension + */ unguard; } @@ -591,11 +591,11 @@ static void ExportStaticMeshLod(const CStaticMeshLod &Lod, FArchive &Ar) ExportCommonMeshData ( - Ar, - &Lod.Sections[0], Lod.Sections.Num(), - Lod.Verts, Lod.NumVerts, sizeof(CStaticMeshVertex), - Lod.Indices, - Share + Ar, + &Lod.Sections[0], Lod.Sections.Num(), + Lod.Verts, Lod.NumVerts, sizeof(CStaticMeshVertex), + Lod.Indices, + Share ); BoneHdr.DataCount = 0; // dummy ... @@ -645,4 +645,6 @@ void ExportStaticMesh(const CStaticMesh *Mesh) unguardf("%d", Lod); } + + ExportFbxStaticMesh(Mesh); } diff --git a/Exporters/ExportTexture.cpp b/Exporters/ExportTexture.cpp index 53e701b0..47c77fbd 100644 --- a/Exporters/ExportTexture.cpp +++ b/Exporters/ExportTexture.cpp @@ -90,15 +90,17 @@ void WriteTGA(FArchive &Ar, int width, int height, byte *pic) byte a = *src++; if (column < width - 1 && // not on screen edge; NOTE: when i == size-1, col==width-1 - b == src[0] && g == src[1] && r == src[2] && a == src[3] && // next pixel will be the same - !(rle && flag && *flag == 254)) // flag overflow + b == src[0] && g == src[1] && r == src[2] && a == src[3] && // next pixel will be the same + !(rle && flag && *flag == 254)) // flag overflow { if (!rle || !flag) { // starting new RLE sequence flag = dst++; *flag = 128 - 1; // will be incremented below - *dst++ = b; *dst++ = g; *dst++ = r; // store RGB + *dst++ = b; + *dst++ = g; + *dst++ = r; // store RGB if (colorBytes == 4) *dst++ = a; // store alpha } (*flag)++; // enqueue one more texel @@ -123,7 +125,9 @@ void WriteTGA(FArchive &Ar, int width, int height, byte *pic) flag = dst++; *flag = 255; } - *dst++ = b; *dst++ = g; *dst++ = r; // store RGB + *dst++ = b; + *dst++ = g; + *dst++ = r; // store RGB if (colorBytes == 4) *dst++ = a; // store alpha (*flag)++; if (*flag == 127) flag = NULL; // check for overflow @@ -353,3 +357,36 @@ void ExportTexture(const UUnrealMaterial *Tex) unguard; } + +const char* GetExportTextureName(const UUnrealMaterial *Tex) +{ + // for UTexture3 (UE3+), can check SourceArt for PNG data and save it if available + if (Tex->IsA("Texture3")) + { + // Note: there are several SourceArt texture formats available. We're detecting PNG + // by checking for magic value, however it is possible to analyze bPNGCompressed and + // ETextureSourceFormat enum to determine exact format. + const UTexture3* Tex3 = static_cast(Tex); + const FByteBulkData& Bulk = Tex3->SourceArt; + if (Bulk.BulkData && memcmp(Bulk.BulkData, "\x89PNG", 4) == 0) + { + return GetExportFileName(Tex, "%s.png", Tex->Name); + } + } + + CTextureData TexData; + if (Tex->GetTextureData(TexData)) + { + if (GExportDDS && TexData.IsDXT()) + { + return GetExportFileName(Tex, "%s.dds", Tex->Name); + } + } + // For HDR textures use Radiance format + if (PixelFormatInfo[TexData.Format].Float) + { + return GetExportFileName(Tex, "%s.hdr", Tex->Name); + } + return GetExportFileName(Tex, "%s.tga", Tex->Name); +} + diff --git a/Exporters/Exporters.h b/Exporters/Exporters.h index 2141efcb..cba70ef3 100644 --- a/Exporters/Exporters.h +++ b/Exporters/Exporters.h @@ -60,6 +60,8 @@ class CStaticMesh; void ExportPsk(const CSkeletalMesh *Mesh); void ExportPsa(const CAnimSet *Anim); void ExportStaticMesh(const CStaticMesh *Mesh); +// FBX +void ExportFbxStaticMesh(const CStaticMesh *Mesh); // MD5Mesh void ExportMd5Mesh(const CSkeletalMesh *Mesh); void ExportMd5Anim(const CAnimSet *Anim); @@ -67,6 +69,7 @@ void ExportMd5Anim(const CAnimSet *Anim); void Export3D (const UVertMesh *Mesh); // TGA void ExportTexture(const UUnrealMaterial *Tex); +const char* GetExportTextureName(const UUnrealMaterial *Tex); // UUnrealMaterial void ExportMaterial(const UUnrealMaterial *Mat); // sound diff --git a/SDL2.dll b/SDL2.dll index 09706efc..6cf858ca 100644 Binary files a/SDL2.dll and b/SDL2.dll differ diff --git a/UmodelTool/Version.h b/UmodelTool/Version.h new file mode 100644 index 00000000..4ba0bd6f --- /dev/null +++ b/UmodelTool/Version.h @@ -0,0 +1 @@ +#define GIT_REVISION 732 diff --git a/Unreal/Shaders.h b/Unreal/Shaders.h new file mode 100644 index 00000000..bb130919 --- /dev/null +++ b/Unreal/Shaders.h @@ -0,0 +1,133 @@ +// Automatically generated file +// Do not modify + + +// BloomBlend.ush +static const char BloomBlend_ush[] = "BloomBlend.ush\x00" +"\n\n\n\n\n\n\nuniform sampler2D BlurTex;\nuniform sampler2D OrigTex;\n" +"uniform sampler2D DepthTex;\n\nvoid VertexShaderMain()\n{\n" +"gl_TexCoord[0]=gl_MultiTexCoord0;\ngl_Position=ftransform();\n}\n\n" +"#define BLOOM_SCALE 4.0\n\nvoid PixelShaderMain()\n{\n" +"vec2 TexCoord=gl_TexCoord[0].st;\nvec4 Blur=texture2D(BlurTex,TexCoord);\n" +"vec3 Orig=texture2D(OrigTex,TexCoord).rgb;\nvec4 c;\n\n\n\n\n\n" +"c=vec4(Orig+Blur.rgb*Blur.a*BLOOM_SCALE,1.0);\n\n\n\ngl_FragColor=c;\n\n\n" +"float f=texture2D(DepthTex,TexCoord).r;\ngl_FragDepth=f;\n\n#ifdef SHOW_DEPTH\n" +"f=2.0 /(1000.0-f*1000.0);\ngl_FragColor=vec4(f,f,f,1.0);\n#endif\n}\n"; + + +// BloomGather.ush +static const char BloomGather_ush[] = "BloomGather.ush\x00" +"\n\n\n\nuniform sampler2D tex;\n\nvoid VertexShaderMain()\n{\n" +"gl_TexCoord[0]=gl_MultiTexCoord0;\ngl_Position=ftransform();\n}\n\n\n" +"void PixelShaderMain()\n{\nvec3 c;\nvec2 TexCoord=gl_TexCoord[0].st;\n" +"c=texture2D(tex,TexCoord).rgb;\nfloat m=max(c.r,c.g);\nm=max(m,c.b);\n#if 0\n" +"if(m <=1.0)m=0.0;\nc*=0.5;\n#else\nm=max(m-1.0,0.0);\n#endif\n" +"gl_FragColor=vec4(c,m);\n}\n"; + + +// BloomPass.ush +static const char BloomPass_ush[] = "BloomPass.ush\x00" +"\n\n\n\nuniform sampler2D Tex;\nuniform vec2 Step;\n\nvoid VertexShaderMain()\n" +"{\ngl_TexCoord[0]=gl_MultiTexCoord0;\ngl_Position=ftransform();\n}\n\n\n\n\n\n" +"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#define W0 6.0\n#define W1 10.8\n" +"#define W2 6.4\n#define W3 2.2\n\n#define OF1 1.47\n#define OF2 3.35\n" +"#define OF3 5.32\n\n\n#define W_SUM W0+2.0*(W1+W2+W3)\n\n" +"void PixelShaderMain()\n{\nvec4 c;\nvec2 TexCoord=gl_TexCoord[0].st;\n" +"c=texture2D(Tex,TexCoord)*W0;\nc+=texture2D(Tex,TexCoord-Step*OF1)*W1;\n" +"c+=texture2D(Tex,TexCoord+Step*OF1)*W1;\n" +"c+=texture2D(Tex,TexCoord-Step*OF2)*W2;\n" +"c+=texture2D(Tex,TexCoord+Step*OF2)*W2;\n" +"c+=texture2D(Tex,TexCoord-Step*OF3)*W3;\n" +"c+=texture2D(Tex,TexCoord+Step*OF3)*W3;\nc*=1.0 /(W_SUM);\n\ngl_FragColor=c;\n" +"}\n"; + + +// Generic.ush +static const char Generic_ush[] = "Generic.ush\x00" +"\n\n\n\n#define SPECULAR\n\n#ifndef TEXTURING\n#define TEXTURING 1\n#endif\n\n" +"#define PIXEL_LIGHT_DIR\n#define PIXEL_HALF_VEC\n\n\n" +"varying vec4 diffuse,ambient,specular;\nvarying vec3 normal;\n\n" +"#ifndef PIXEL_LIGHT_DIR\nvarying vec3 lightDir;\n#endif\n" +"varying vec3 position;\n#ifndef PIXEL_HALF_VEC\nvarying vec3 halfVector;\n" +"#endif\n\n\n#if TEXTURING\nuniform sampler2D tex;\n#endif\n\n" +"uniform bool useLighting;\nuniform vec3 eyeLocation;\n\n\n" +"void VertexShaderMain()\n{\n\nnormal=normalize(gl_NormalMatrix*gl_Normal);\n" +"position=(gl_ModelViewMatrix*gl_Vertex).xyz;\n\n#ifndef PIXEL_LIGHT_DIR\n" +"lightDir=gl_LightSource[0].position.xyz-position;\n#endif\n" +"#ifndef PIXEL_HALF_VEC\nhalfVector=gl_LightSource[0].halfVector.xyz;\n#endif\n" +"\nif(useLighting)\n{\n\ndiffuse=gl_Color*gl_LightSource[0].diffuse;\n" +"ambient=gl_Color*(gl_LightSource[0].ambient+gl_LightModel.ambient);\n" +"specular=gl_FrontMaterial.specular*gl_LightSource[0].specular;\n}\nelse\n{\n" +"diffuse=vec4(0.0);\nambient=gl_Color;\nspecular=vec4(0.0);\n}\n" +"gl_TexCoord[0]=gl_MultiTexCoord0;\ngl_Position=ftransform();\n}\n\n\n" +"void PixelShaderMain()\n{\n#ifdef PIXEL_LIGHT_DIR\n" +"vec3 lightDir=gl_LightSource[0].position.xyz-position;\n#endif\n" +"vec3 nLightDir=normalize(lightDir);\nvec3 n=normalize(normal);\n" +"float NdotL=max(dot(n,nLightDir),0.0);\n\nvec4 color=ambient+diffuse*NdotL;\n\n" +"#if TEXTURING\nvec4 texColor=texture2D(tex,gl_TexCoord[0].st);\n" +"color.rgb*=texColor.rgb;\ncolor.a=texColor.a;\n#endif\n\n#ifdef SPECULAR\n\n\n" +"\nfloat specularScale=0.5;\n#ifdef PIXEL_HALF_VEC\n" +"vec3 eyeDir=normalize(eyeLocation-position);\n" +"vec3 halfVector=nLightDir+eyeDir;\n#endif\nvec3 halfV=normalize(halfVector);\n" +"float NdotHV=max(dot(n,halfV),0.0);\n" +"color.rgb+=pow(NdotHV,gl_FrontMaterial.shininess)*specular.rgb*specularScale;\n" +"#endif\n\n#ifdef NORMALMAP\ngl_FragColor=vec4(n,1.0);\n#else\n" +"gl_FragColor=color;\n#endif\n}\n"; + + +// Normal.ush +static const char Normal_ush[] = "Normal.ush\x00" +"\n\n\n\n\n\n\n\n\n#define SPECULAR\n\n#ifndef DIFFUSE\n#define DIFFUSE 0\n" +"#endif\n\n#ifndef CUBE\n#define CUBE 0\n#endif\n\n#ifdef SHOW_BUMP\n" +"#undef EMISSIVE\n#endif\n\n#ifndef EMISSIVE\n#define EMISSIVE 0\n#endif\n\n\n" +"#undef CUBE\n#define CUBE 1\n\n#if defined(CUBE)|| defined(WORLDNORMAL)\n" +"#define NEEDS_TANGENT_TO_WORLD\n#endif\n\n\n" +"varying vec4 diffuse,ambient,specular;\n" +"varying vec3 tangentLightDir,tangentEye;\n#ifdef NEEDS_TANGENT_TO_WORLD\n" +"varying mat3 tangentToWorld;\n#endif\nvarying vec3 tmp;\n\n\n" +"attribute vec4 normal;\nattribute vec3 tangent;\n\n\n\n\n" +"uniform sampler2D diffTex;\nuniform sampler2D normTex;\n" +"uniform sampler2D specTex;\nuniform sampler2D spPowTex;\n" +"uniform sampler2D opacTex;\nuniform sampler2D emisTex;\n" +"uniform samplerCube cubeTex;\nuniform sampler2D maskTex;\n\n\n" +"void VertexShaderMain()\n{\n\n\ndiffuse=gl_Color*gl_LightSource[0].diffuse;\n" +"ambient=gl_Color*(gl_LightSource[0].ambient+gl_LightModel.ambient);\n" +"specular=gl_FrontMaterial.specular*gl_LightSource[0].specular;\n\n\n" +"gl_TexCoord[0]=gl_MultiTexCoord0;\ngl_Position=ftransform();\n\n\n\n" +"vec3 n=normalize(normal.xyz);\nvec3 t=normalize(tangent);\n" +"vec3 b=cross(n,t)*normal.w;\n" +"mat3 tbn=transpose(mat3(gl_ModelViewMatrix)*mat3(t,b,n));\n\n\n\n" +"vec3 eyeVertexPos=(gl_ModelViewMatrix*gl_Vertex).xyz;\n" +"vec3 eyeLightPos=gl_LightSource[0].position.xyz;\n" +"tangentLightDir=normalize(tbn*(eyeLightPos-eyeVertexPos));\n" +"tangentEye=normalize(tbn*-eyeVertexPos);\n\n#ifdef NEEDS_TANGENT_TO_WORLD\n\n" +"tangentToWorld=mat3(t,b,n);\n#endif\n}\n\n\n#if DIFFUSE\n" +"vec4 GetMaterialDiffuseColor(vec2 TexCoord)\n{\n" +"return texture2D(diffTex,TexCoord);\n}\n#endif\n\n" +"vec3 GetMaterialNormal(vec2 TexCoord)\n{\n#if 0\nreturn vec3(0.0,0.0,1.0);\n" +"#else\nreturn %s;\n#endif\n}\n\nvec3 GetMaterialSpecularColor(vec2 TexCoord)\n" +"{\n#ifndef SHOW_BUMP\nreturn %s;\n#else\nreturn vec3(1.0);\n#endif\n}\n\n" +"float GetMaterialSpecularPower(vec2 TexCoord)\n{\nreturn %s;\n}\n\n" +"float GetMaterialOpacity(vec2 TexCoord)\n{\nreturn %s;\n}\n\n#if EMISSIVE\n" +"vec3 GetMaterialEmissive(vec2 TexCoord)\n{\nreturn %s;\n}\n#endif\n\n" +"vec3 GetMaterialCubemap(vec3 TexCoord)\n{\nreturn %s;\n}\n\n" +"float GetCubemapMask(vec2 TexCoord)\n{\nreturn %s;\n}\n\n\n" +"void PixelShaderMain()\n{\nvec2 TexCoord=gl_TexCoord[0].st;\n\n" +"vec3 normal=GetMaterialNormal(TexCoord);\n%s\nnormal=normalize(normal);\n" +"vec3 nLightDir=normalize(tangentLightDir);\nvec3 nEye=normalize(tangentEye);\n" +"\nfloat NdotL=max(dot(normal,nLightDir),0.0);\n" +"vec4 color=ambient+diffuse*NdotL;\n\n#if DIFFUSE\n" +"vec4 diffuse=GetMaterialDiffuseColor(TexCoord);\ncolor*=diffuse;\n#endif\n\n" +"#ifdef SHOW_BUMP\ncolor=vec4(0.1,0.1,0.1,1.0);\n#endif\n\n#ifdef SPECULAR\n\n\n" +"\nvec3 halfVector=nLightDir+nEye;\nvec3 halfV=normalize(halfVector);\n" +"float NdotHV=max(dot(normal,halfV),0.0);\n" +"color.rgb+=pow(NdotHV,GetMaterialSpecularPower(TexCoord))*GetMaterialSpecularColor(TexCoord);\n" +"#endif\n\n#if CUBE && !DIFFUSE\ncolor=vec4(0.0,0.0,0.0,1.0);\n#endif\n\n" +"#if CUBE\nvec3 reflectVec=tangentToWorld*reflect(nEye,normal);\n" +"vec3 reflectColor=GetMaterialCubemap(-reflectVec);\n" +"color.rgb+=reflectColor*GetCubemapMask(TexCoord);\n#endif\n\n#if EMISSIVE\n" +"color.rgb+=GetMaterialEmissive(TexCoord);\n#endif\n\n" +"color.a=GetMaterialOpacity(TexCoord);\n\n\n\n\n\n#ifdef NORMALMAP\n" +"color.rgb=pow(dot(normal,nEye),3.5)*vec3(1.0);\n#endif\n#ifdef WORLDNORMAL\n" +"color.rgb=tangentToWorld*normal*0.5+0.5;\n#endif\n\ngl_FragColor=color;\n}\n"; + diff --git a/Unreal/StaticMesh.h b/Unreal/StaticMesh.h index 66f90a4a..52490bea 100644 --- a/Unreal/StaticMesh.h +++ b/Unreal/StaticMesh.h @@ -18,7 +18,7 @@ struct CStaticMeshLod : public CBaseMeshLod CStaticMeshVertex *Verts; CStaticMeshLod() - : Verts(NULL) + : Verts(NULL) {} ~CStaticMeshLod() @@ -40,6 +40,18 @@ struct CStaticMeshLod : public CBaseMeshLod HasTangents = true; } + const CMeshUVFloat& GetVertexUV(int32 VertexIndex, int32 UVIndex) const + { + if (UVIndex == 0) + { + return Verts[VertexIndex].UV; + } + else + { + return ExtraUV[UVIndex - 1][VertexIndex]; + } + } + void AllocateVerts(int Count) { guard(CStaticMeshLod::AllocateVerts); @@ -53,10 +65,10 @@ struct CStaticMeshLod : public CBaseMeshLod #if DECLARE_VIEWER_PROPS DECLARE_STRUCT(CStaticMeshLod) BEGIN_PROP_TABLE - PROP_ARRAY(Sections, CMeshSection) - PROP_INT(NumVerts) - VPROP_ARRAY_COUNT(Indices.Indices16, IndexCount) - PROP_INT(NumTexCoords) + PROP_ARRAY(Sections, CMeshSection) + PROP_INT(NumVerts) + VPROP_ARRAY_COUNT(Indices.Indices16, IndexCount) + PROP_INT(NumTexCoords) END_PROP_TABLE #endif // DECLARE_VIEWER_PROPS }; @@ -71,7 +83,7 @@ class CStaticMesh TArray Lods; CStaticMesh(UObject *Original) - : OriginalMesh(Original) + : OriginalMesh(Original) {} void FinalizeMesh() @@ -97,8 +109,8 @@ class CStaticMesh #if DECLARE_VIEWER_PROPS DECLARE_STRUCT(CStaticMesh) BEGIN_PROP_TABLE - PROP_ARRAY(Lods, CStaticMeshLod) - VPROP_ARRAY_COUNT(Lods, LodCount) + PROP_ARRAY(Lods, CStaticMeshLod) + VPROP_ARRAY_COUNT(Lods, LodCount) END_PROP_TABLE private: CStaticMesh() // for InternalConstructor() diff --git a/Unreal/UnCore.h b/Unreal/UnCore.h index 969c4381..3c864884 100644 --- a/Unreal/UnCore.h +++ b/Unreal/UnCore.h @@ -172,10 +172,10 @@ class FName const char *Str; FName() - : Index(0) - , Str("None") + : Index(0) + , Str("None") #if UNREAL3 || UNREAL4 - , ExtraIndex(0) + , ExtraIndex(0) #endif {} @@ -258,138 +258,138 @@ enum EGame GAME_UNKNOWN = 0, // should be 0 GAME_UE1 = 0x0100000, - GAME_Undying, + GAME_Undying, GAME_UE2 = 0x0200000, - GAME_UT2, - GAME_Pariah, - GAME_SplinterCell, - GAME_SplinterCellConv, - GAME_Lineage2, - GAME_Exteel, - GAME_Ragnarok2, - GAME_RepCommando, - GAME_Loco, - GAME_BattleTerr, - GAME_UC1, // note: not UE2X - GAME_XIII, - GAME_Vanguard, - GAME_AA2, - GAME_EOS, + GAME_UT2, + GAME_Pariah, + GAME_SplinterCell, + GAME_SplinterCellConv, + GAME_Lineage2, + GAME_Exteel, + GAME_Ragnarok2, + GAME_RepCommando, + GAME_Loco, + GAME_BattleTerr, + GAME_UC1, // note: not UE2X + GAME_XIII, + GAME_Vanguard, + GAME_AA2, + GAME_EOS, GAME_VENGEANCE = 0x0210000, // variant of UE2 - GAME_Tribes3, - GAME_Swat4, // not autodetected, overlaps with Tribes3 - GAME_Bioshock, + GAME_Tribes3, + GAME_Swat4, // not autodetected, overlaps with Tribes3 + GAME_Bioshock, GAME_LEAD = 0x0220000, GAME_UE2X = 0x0400000, - GAME_UC2, + GAME_UC2, GAME_UE3 = 0x0800000, - GAME_EndWar, - GAME_MassEffect, - GAME_MassEffect2, - GAME_MassEffect3, - GAME_R6Vegas2, - GAME_MirrorEdge, - GAME_TLR, - GAME_Huxley, - GAME_Turok, - GAME_Fury, - GAME_XMen, - GAME_MagnaCarta, - GAME_ArmyOf2, - GAME_CrimeCraft, - GAME_50Cent, - GAME_AVA, - GAME_Frontlines, - GAME_Batman, - GAME_Batman2, - GAME_Batman3, - GAME_Batman4, - GAME_Borderlands, - GAME_AA3, - GAME_DarkVoid, - GAME_Legendary, - GAME_Tera, - GAME_BladeNSoul, - GAME_APB, - GAME_AlphaProtocol, - GAME_Transformers, - GAME_MortalOnline, - GAME_Enslaved, - GAME_MOHA, - GAME_MOH2010, - GAME_Berkanix, - GAME_DOH, - GAME_DCUniverse, - GAME_Bulletstorm, - GAME_Undertow, - GAME_Singularity, - GAME_Tron, - GAME_Hunted, - GAME_DND, - GAME_ShadowsDamned, - GAME_Argonauts, - GAME_SpecialForce2, - GAME_GunLegend, - GAME_TaoYuan, - GAME_Tribes4, - GAME_Dishonored, - GAME_Hawken, - GAME_Fable, - GAME_DmC, - GAME_PLA, - GAME_AliensCM, - GAME_GoWJ, - GAME_Bioshock3, - GAME_RememberMe, - GAME_MarvelHeroes, - GAME_LostPlanet3, - GAME_XcomB, - GAME_Xcom2, - GAME_Thief4, - GAME_Murdered, - GAME_SOV, - GAME_VEC, - GAME_Dust514, - GAME_Guilty, - GAME_Alice, - GAME_DunDef, - GAME_Gigantic, - GAME_MetroConflict, - GAME_Smite, - GAME_DevilsThird, + GAME_EndWar, + GAME_MassEffect, + GAME_MassEffect2, + GAME_MassEffect3, + GAME_R6Vegas2, + GAME_MirrorEdge, + GAME_TLR, + GAME_Huxley, + GAME_Turok, + GAME_Fury, + GAME_XMen, + GAME_MagnaCarta, + GAME_ArmyOf2, + GAME_CrimeCraft, + GAME_50Cent, + GAME_AVA, + GAME_Frontlines, + GAME_Batman, + GAME_Batman2, + GAME_Batman3, + GAME_Batman4, + GAME_Borderlands, + GAME_AA3, + GAME_DarkVoid, + GAME_Legendary, + GAME_Tera, + GAME_BladeNSoul, + GAME_APB, + GAME_AlphaProtocol, + GAME_Transformers, + GAME_MortalOnline, + GAME_Enslaved, + GAME_MOHA, + GAME_MOH2010, + GAME_Berkanix, + GAME_DOH, + GAME_DCUniverse, + GAME_Bulletstorm, + GAME_Undertow, + GAME_Singularity, + GAME_Tron, + GAME_Hunted, + GAME_DND, + GAME_ShadowsDamned, + GAME_Argonauts, + GAME_SpecialForce2, + GAME_GunLegend, + GAME_TaoYuan, + GAME_Tribes4, + GAME_Dishonored, + GAME_Hawken, + GAME_Fable, + GAME_DmC, + GAME_PLA, + GAME_AliensCM, + GAME_GoWJ, + GAME_Bioshock3, + GAME_RememberMe, + GAME_MarvelHeroes, + GAME_LostPlanet3, + GAME_XcomB, + GAME_Xcom2, + GAME_Thief4, + GAME_Murdered, + GAME_SOV, + GAME_VEC, + GAME_Dust514, + GAME_Guilty, + GAME_Alice, + GAME_DunDef, + GAME_Gigantic, + GAME_MetroConflict, + GAME_Smite, + GAME_DevilsThird, GAME_RocketLeague, GAME_MIDWAY3 = 0x0810000, // variant of UE3 - GAME_A51, - GAME_Wheelman, - GAME_MK, - GAME_Strangle, - GAME_TNA, + GAME_A51, + GAME_Wheelman, + GAME_MK, + GAME_Strangle, + GAME_TNA, GAME_UE4_BASE = 0x1000000, - // bytes: 01.00.0N.NX : 01=UE4, 00=masked by GAME_ENGINE, NN=UE4 subversion, X=game (4 bits, 0=base engine) - // Add custom UE4 game engines here + // bytes: 01.00.0N.NX : 01=UE4, 00=masked by GAME_ENGINE, NN=UE4 subversion, X=game (4 bits, 0=base engine) + // Add custom UE4 game engines here // 4.5 GAME_Ark = GAME_UE4(5)+1, - // 4.8 - GAME_HIT = GAME_UE4(8)+1, - // 4.11 - GAME_Gears4 = GAME_UE4(11)+1, - // 4.13 - GAME_Lawbreakers = GAME_UE4(13)+1, + // 4.8 + GAME_HIT = GAME_UE4(8)+1, + // 4.11 + GAME_Gears4 = GAME_UE4(11)+1, + // 4.13 + GAME_Lawbreakers = GAME_UE4(13)+1, GAME_StateOfDecay2 = GAME_UE4(13)+2, - // 4.14 - GAME_Friday13 = GAME_UE4(14)+1, - GAME_Tekken7 = GAME_UE4(14)+2, + // 4.14 + GAME_Friday13 = GAME_UE4(14)+1, + GAME_Tekken7 = GAME_UE4(14)+2, // 4.17 GAME_Dauntless = GAME_UE4(17)+1, - // 4.19 - GAME_Paragon = GAME_UE4(19)+1, + // 4.19 + GAME_Paragon = GAME_UE4(19)+1, GAME_ENGINE = 0xFFF0000 // mask for game engine }; @@ -431,14 +431,14 @@ class FArchive int Platform; // EPlatform FArchive() - : ArPos(0) - , ArStopper(0) - , ArVer(100000) //?? something large - , ArLicenseeVer(0) + : ArPos(0) + , ArStopper(0) + , ArVer(100000) //?? something large + , ArLicenseeVer(0) , IsLoading(true) - , ReverseBytes(false) - , Game(GAME_UNKNOWN) - , Platform(PLATFORM_PC) + , ReverseBytes(false) + , Game(GAME_UNKNOWN) + , Platform(PLATFORM_PC) {} virtual ~FArchive() @@ -791,8 +791,8 @@ class FReaderWrapper : public FArchive int ArPosOffset; FReaderWrapper(FArchive *File, int Offset = 0) - : Reader(File) - , ArPosOffset(Offset) + : Reader(File) + , ArPosOffset(Offset) {} virtual ~FReaderWrapper() { @@ -846,8 +846,8 @@ class FMemReader : public FArchive DECLARE_ARCHIVE(FMemReader, FArchive); public: FMemReader(const void *data, int size) - : DataPtr((const byte*)data) - , DataSize(size) + : DataPtr((const byte*)data) + , DataSize(size) { IsLoading = true; ArStopper = size; @@ -938,12 +938,16 @@ struct FVector void Set(float _X, float _Y, float _Z) { - X = _X; Y = _Y; Z = _Z; + X = _X; + Y = _Y; + Z = _Z; } void Scale(float value) { - X *= value; Y *= value; Z *= value; + X *= value; + Y *= value; + Z *= value; } friend FArchive& operator<<(FArchive &Ar, FVector &V) @@ -991,7 +995,9 @@ struct FRotator void Set(int _Yaw, int _Pitch, int _Roll) { - Pitch = _Pitch; Yaw = _Yaw; Roll = _Roll; + Pitch = _Pitch; + Yaw = _Yaw; + Roll = _Roll; } friend FArchive& operator<<(FArchive &Ar, FRotator &R) @@ -1017,7 +1023,10 @@ struct FQuat void Set(float _X, float _Y, float _Z, float _W) { - X = _X; Y = _Y; Z = _Z; W = _W; + X = _X; + Y = _Y; + Z = _Z; + W = _W; } friend FArchive& operator<<(FArchive &Ar, FQuat &F) @@ -1119,7 +1128,7 @@ struct FColor FColor() {} FColor(byte r, byte g, byte b, byte a = 255) - : R(r), G(g), B(b), A(a) + : R(r), G(g), B(b), A(a) {} friend FArchive& operator<<(FArchive &Ar, FColor &C) { @@ -1135,7 +1144,10 @@ struct FLinearColor void Set(float _R, float _G, float _B, float _A) { - R = _R; G = _G; B = _B; A = _A; + R = _R; + G = _G; + B = _B; + A = _A; } friend FArchive& operator<<(FArchive &Ar, FLinearColor &C) @@ -1179,8 +1191,8 @@ struct FPackedNormal FPackedNormal &operator=(const FVector &V) { Data = int((V.X + 1) * 127.5f) - + (int((V.Y + 1) * 127.5f) << 8) - + (int((V.Z + 1) * 127.5f) << 16); + + (int((V.Y + 1) * 127.5f) << 8) + + (int((V.Z + 1) * 127.5f) << 16); return *this; } @@ -1252,6 +1264,11 @@ struct FVector2D } }; +FORCEINLINE bool operator==(const FVector2D &V1, const FVector2D &V2) +{ + return V1.X == V2.X && V1.Y == V2.Y; +} + struct FTransform { FQuat Rotation; @@ -1372,9 +1389,9 @@ class FArray public: FORCEINLINE FArray() - : DataCount(0) - , MaxCount(0) - , DataPtr(NULL) + : DataCount(0) + , MaxCount(0) + , DataPtr(NULL) {} ~FArray(); @@ -1458,7 +1475,7 @@ class TArray : public FArray friend class FString; // for rvalue public: TArray() - : FArray() + : FArray() {} ~TArray() { @@ -1720,13 +1737,13 @@ class TArray : public FArray // Note: there is no reading optimization performed here (in umodel). FORCEINLINE void BulkSerialize(FArchive& Ar) { - #if DO_GUARD_MAX +#if DO_GUARD_MAX guardfunc; - #endif +#endif SerializeBulkArray(Ar, *this, SerializeArray); - #if DO_GUARD_MAX +#if DO_GUARD_MAX unguard; - #endif +#endif } #endif // UNREAL3 @@ -1761,7 +1778,7 @@ class TArray : public FArray protected: // disable array copying TArray(const TArray& Other) - : FArray() + : FArray() {} TArray& operator=(const TArray& Other) { @@ -1911,7 +1928,8 @@ inline void CopyArray(TArray &Dst, const TArray &Src) do // Count is > 0 here - checked above, so "do ... while" is more suitable (and more compact) { *pDst++ = *pSrc++; - } while (--Count); + } + while (--Count); } } @@ -1933,7 +1951,6 @@ struct TMapPair } }; - template class TMap : public TArray > { @@ -1942,6 +1959,33 @@ class TMap : public TArray > { return Ar << (TArray >&)Map; } + + FORCEINLINE TV& Add(const TK& Key, const TV& Value) + { + TMapPair Pair; + Pair.Key = Key; + Pair.Value = Value; + int Index = TArray >::Add(Pair); + TMapPair& PairAdded = GetData()[Index]; + return PairAdded.Value; + } + + FORCEINLINE TV* Find(const TK& Key) + { + for (int i = 0; i < this->Num(); ++i) + { + TMapPair& Pair = GetData()[i]; + if (Pair.Key == Key) + { + return &Pair.Value; + } + } + return nullptr; + } + FORCEINLINE const TV* Find(const TK& Key) const + { + return const_cast(this)->Find(Key); + } }; template @@ -1996,7 +2040,7 @@ class FString // rvalue functions FString(FString&& Other) - : Data(MoveTemp(Other.Data)) + : Data(MoveTemp(Other.Data)) {} FString& operator=(FString&& Other) { @@ -2254,8 +2298,8 @@ struct FByteBulkData //?? separate FUntypedBulkData // FArchive *AttachedAr; FByteBulkData() - : BulkData(NULL) - , BulkDataOffsetInFile(0) + : BulkData(NULL) + , BulkDataOffsetInFile(0) {} virtual ~FByteBulkData() @@ -2390,46 +2434,46 @@ enum VER_UE4_0 = 342, VER_UE4_1 = 352, VER_UE4_2 = 363, - VER_UE4_LOAD_FOR_EDITOR_GAME = 365, - VER_UE4_FTEXT_HISTORY = 368, // used for UStaticMesh versioning - VER_UE4_STORE_BONE_EXPORT_NAMES = 370, + VER_UE4_LOAD_FOR_EDITOR_GAME = 365, + VER_UE4_FTEXT_HISTORY = 368, // used for UStaticMesh versioning + VER_UE4_STORE_BONE_EXPORT_NAMES = 370, VER_UE4_3 = 382, - VER_UE4_ADD_STRING_ASSET_REFERENCES_MAP = 384, + VER_UE4_ADD_STRING_ASSET_REFERENCES_MAP = 384, VER_UE4_4 = 385, - VER_UE4_SKELETON_ADD_SMARTNAMES = 388, - VER_UE4_SOUND_COMPRESSION_TYPE_ADDED = 392, - VER_UE4_RENAME_CROUCHMOVESCHARACTERDOWN = 394, // used for UStaticMesh versioning - VER_UE4_DEPRECATE_UMG_STYLE_ASSETS = 397, // used for UStaticMesh versioning + VER_UE4_SKELETON_ADD_SMARTNAMES = 388, + VER_UE4_SOUND_COMPRESSION_TYPE_ADDED = 392, + VER_UE4_RENAME_CROUCHMOVESCHARACTERDOWN = 394, // used for UStaticMesh versioning + VER_UE4_DEPRECATE_UMG_STYLE_ASSETS = 397, // used for UStaticMesh versioning VER_UE4_5 = 401, VER_UE4_6 = 413, - VER_UE4_RENAME_WIDGET_VISIBILITY = 416, // used for UStaticMesh versioning - VER_UE4_ANIMATION_ADD_TRACKCURVES = 417, + VER_UE4_RENAME_WIDGET_VISIBILITY = 416, // used for UStaticMesh versioning + VER_UE4_ANIMATION_ADD_TRACKCURVES = 417, VER_UE4_7 = 434, - VER_UE4_STRUCT_GUID_IN_PROPERTY_TAG = 441, - VER_UE4_PACKAGE_SUMMARY_HAS_COMPATIBLE_ENGINE_VERSION = 444, + VER_UE4_STRUCT_GUID_IN_PROPERTY_TAG = 441, + VER_UE4_PACKAGE_SUMMARY_HAS_COMPATIBLE_ENGINE_VERSION = 444, VER_UE4_8 = 451, - VER_UE4_SERIALIZE_TEXT_IN_PACKAGES = 459, + VER_UE4_SERIALIZE_TEXT_IN_PACKAGES = 459, VER_UE4_9 = 482, VER_UE4_10 = VER_UE4_9, // exactly the same file version for 4.9 and 4.10 - VER_UE4_COOKED_ASSETS_IN_EDITOR_SUPPORT = 485, - VER_UE4_SOUND_CONCURRENCY_PACKAGE = 489, // used for UStaticMesh versioning + VER_UE4_COOKED_ASSETS_IN_EDITOR_SUPPORT = 485, + VER_UE4_SOUND_CONCURRENCY_PACKAGE = 489, // used for UStaticMesh versioning VER_UE4_11 = 498, - VER_UE4_INNER_ARRAY_TAG_INFO = 500, - VER_UE4_PROPERTY_GUID_IN_PROPERTY_TAG = 503, - VER_UE4_NAME_HASHES_SERIALIZED = 504, + VER_UE4_INNER_ARRAY_TAG_INFO = 500, + VER_UE4_PROPERTY_GUID_IN_PROPERTY_TAG = 503, + VER_UE4_NAME_HASHES_SERIALIZED = 504, VER_UE4_12 = 504, VER_UE4_13 = 505, - VER_UE4_PRELOAD_DEPENDENCIES_IN_COOKED_EXPORTS = 507, - VER_UE4_TemplateIndex_IN_COOKED_EXPORTS = 508, + VER_UE4_PRELOAD_DEPENDENCIES_IN_COOKED_EXPORTS = 507, + VER_UE4_TemplateIndex_IN_COOKED_EXPORTS = 508, VER_UE4_14 = 508, - VER_UE4_PROPERTY_TAG_SET_MAP_SUPPORT = 509, - VER_UE4_ADDED_SEARCHABLE_NAMES = 510, + VER_UE4_PROPERTY_TAG_SET_MAP_SUPPORT = 509, + VER_UE4_ADDED_SEARCHABLE_NAMES = 510, VER_UE4_15 = 510, - VER_UE4_64BIT_EXPORTMAP_SERIALSIZES = 511, + VER_UE4_64BIT_EXPORTMAP_SERIALSIZES = 511, VER_UE4_16 = 513, VER_UE4_17 = 513, VER_UE4_18 = 514, - VER_UE4_ADDED_PACKAGE_SUMMARY_LOCALIZATION_ID = 516, + VER_UE4_ADDED_PACKAGE_SUMMARY_LOCALIZATION_ID = 516, VER_UE4_19 = 516, // look for NEW_ENGINE_VERSION over the code to find places where version constants should be inserted. // LATEST_SUPPORTED_UE4_VERSION should be updated too. diff --git a/build.sh b/build.sh index 0b69ea39..40e0abc4 100755 --- a/build.sh +++ b/build.sh @@ -33,8 +33,8 @@ last_revision=${last_revision##* } # cut "#define ..." #------------------------------------------------------------- -PLATFORM="vc-win32" -#PLATFORM="vc-win64" +#PLATFORM="vc-win32" +PLATFORM="vc-win64" #PLATFORM="mingw32" - not implemented yet # force PLATFORM=linux under Linux OS diff --git a/common.project b/common.project index e93a7e12..e953729e 100644 --- a/common.project +++ b/common.project @@ -11,7 +11,7 @@ OPTIMIZE = size PDB = 2 # keep enabled, executable is almost the same, except embedded link to pdb file !if !defined($OLDCRT) # allow overriding of OLDCRT in parent project -OLDCRT = 1 # OLDCRT=0 is required for VS2015+ (TODO: try to fix that) +OLDCRT = 0 # OLDCRT=0 is required for VS2015+ (TODO: try to fix that) !endif #?? TODO: UE3_LIBS seems combines all libraries used in UModel, but which aren't for UE3 exactly. Should I rename the constant? diff --git a/libfbxsdk.dll b/libfbxsdk.dll new file mode 100644 index 00000000..d4e6a015 Binary files /dev/null and b/libfbxsdk.dll differ diff --git a/libs/fbx/include/fbxsdk.h b/libs/fbx/include/fbxsdk.h new file mode 100644 index 00000000..7998fe89 --- /dev/null +++ b/libs/fbx/include/fbxsdk.h @@ -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 + *

+ * \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). + *

+ * The FBX SDK Reference is organized into the following sections: + *

  • Class List: an alphabetical list of FBX SDK classes + *
  • Class Hierarchy: a textual representation of the FBX SDK class structure + *
  • Graphical Class Hierarchy: a graphical representation of the FBX SDK class structure + *
  • File List: an alphabetical list of all documented header files
+ *

+ * \section otherdocumentation Other Documentation + * Apart from this reference guide, an FBX SDK Programming Guide and many FBX + * SDK examples are also provided. + *

+ * \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 + +#ifndef FBXSDK_NAMESPACE_USING + #define FBXSDK_NAMESPACE_USING 1 +#endif + +//--------------------------------------------------------------------------------------- +//Core Base Includes +#include +#include +#include +#include +#include +#include +#include +#ifndef FBXSDK_ENV_WINSTORE + #include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//Core Math Includes +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//Core Sync Includes +#ifndef FBXSDK_ENV_WINSTORE + #include + #include + #include + #include +#endif /* !FBXSDK_ENV_WINSTORE */ + +//--------------------------------------------------------------------------------------- +//Core Includes +#include +#include +#include +#ifndef FBXSDK_ENV_WINSTORE + #include + #include +#endif /* !FBXSDK_ENV_WINSTORE */ +#include +#include +#include +#ifndef FBXSDK_ENV_WINSTORE + #include + #include +#endif /* !FBXSDK_ENV_WINSTORE */ +#include +#include +#include +#include +#include +#include +#include +#ifndef FBXSDK_ENV_WINSTORE + #include + #include +#endif /* !FBXSDK_ENV_WINSTORE */ +#include + +//--------------------------------------------------------------------------------------- +//File I/O Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//Scene Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//Scene Animation Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//Scene Constraint Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//Scene Geometry Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//Scene Shading Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//Utilities Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +#if defined(FBXSDK_NAMESPACE) && (FBXSDK_NAMESPACE_USING == 1) + using namespace FBXSDK_NAMESPACE; +#endif + +#pragma pack(pop) + +#endif /* _FBXSDK_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/arch/fbxalloc.h b/libs/fbx/include/fbxsdk/core/arch/fbxalloc.h new file mode 100644 index 00000000..ee3ff28a --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/arch/fbxalloc.h @@ -0,0 +1,419 @@ +/**************************************************************************************** + + 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 + +#if defined(_DEBUG) && defined(FBXSDK_ENV_WIN) + #include +#endif + +#if defined(FBXSDK_ENV_MAC) + #include +#else + #include +#endif + +#include + +#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 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 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 void FbxDelete(T* p); +template void FbxDelete(const T* p); +template 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 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 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 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(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 FbxAutoFreePtr : public FbxAutoPtr > +{ +public: + //! Construct from a pointer. + explicit FbxAutoFreePtr(Type* pPtr=0) : FbxAutoPtr >(pPtr){} +}; + +//! Scoped pointer for FbxNew allocations, which call FbxDelete() to deallocate. +template class FbxAutoDeletePtr : public FbxAutoPtr > +{ +public: + //! Construct from a pointer. + explicit FbxAutoDeletePtr(Type* pPtr=0) : FbxAutoPtr >(pPtr){} +}; + +//! Scoped pointer for FbxObject derived classes, which call Destroy() to deallocate. +template class FbxAutoDestroyPtr : public FbxAutoPtr > +{ +public: + //! Construct from a pointer. + explicit FbxAutoDestroyPtr(Type* pPtr=0) : FbxAutoPtr >(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 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 FbxSharedFreePtr : public FbxSharedPtr > +{ +public: + //! Construct from a pointer. + explicit FbxSharedFreePtr(Type* pPtr=0) : FbxSharedPtr >(pPtr){} +}; + +//! Scoped pointer for FbxNew allocations, which call FbxDelete() to deallocate. +template class FbxSharedDeletePtr : public FbxSharedPtr > +{ +public: + //! Construct from a pointer. + explicit FbxSharedDeletePtr(Type* pPtr=0) : FbxSharedPtr >(pPtr){} +}; + +//! Scoped pointer for FbxObject derived classes, which call Destroy() to deallocate. +template class FbxSharedDestroyPtr : public FbxSharedPtr > +{ +public: + //! Construct from a pointer. + explicit FbxSharedDestroyPtr(Type* pPtr=0) : FbxSharedPtr >(pPtr){} +}; + + + +#include + +#endif /* _FBXSDK_CORE_ARCH_ALLOC_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/arch/fbxarch.h b/libs/fbx/include/fbxsdk/core/arch/fbxarch.h new file mode 100644 index 00000000..b5246e17 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/arch/fbxarch.h @@ -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_ */ diff --git a/libs/fbx/include/fbxsdk/core/arch/fbxdebug.h b/libs/fbx/include/fbxsdk/core/arch/fbxdebug.h new file mode 100644 index 00000000..9e348b7d --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/arch/fbxdebug.h @@ -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 + +#include + +/** 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 struct FbxStaticAssertType; + template<> struct FbxStaticAssertType {enum{value=1};}; + template<> struct FbxStaticAssertType {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 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::value) + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +#include + +#endif /* _FBXSDK_CORE_ARCH_DEBUG_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/arch/fbxnew.h b/libs/fbx/include/fbxsdk/core/arch/fbxnew.h new file mode 100644 index 00000000..22a16183 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/arch/fbxnew.h @@ -0,0 +1,510 @@ +/**************************************************************************************** + + 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 + +#include + +#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 + +//Type traits for primitive types +template struct FbxSimpleType { enum {value = 0}; }; +template struct FbxSimpleType { enum {value = 1}; }; +template struct FbxSimpleType { enum {value = FbxSimpleType::value}; }; +template struct FbxSimpleType { enum {value = FbxSimpleType::value}; }; + +#define FBXSDK_DEFINE_SIMPLE_TYPE(T) template<> struct FbxSimpleType{ 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::value) + +template T* FbxNew() +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(); +} + +template T* FbxNew(T1& p1) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1); +} + +template T* FbxNew(const T1& p1) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1); +} + +template T* FbxNew(T1& p1, T2& p2) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2); +} + +template T* FbxNew(T1& p1, const T2& p2) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2); +} + +template T* FbxNew(const T1& p1, T2& p2) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2); +} + +template T* FbxNew(const T1& p1, const T2& p2) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2); +} + +template T* FbxNew(T1& p1, T2& p2, T3& p3) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2, p3); +} + +template T* FbxNew(T1& p1, T2& p2, const T3& p3) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2, p3); +} + +template T* FbxNew(T1& p1, const T2& p2, T3& p3) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2, p3); +} + +template T* FbxNew(T1& p1, const T2& p2, const T3& p3) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2, p3); +} + +template T* FbxNew(const T1& p1, T2& p2, T3& p3) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2, p3); +} + +template T* FbxNew(const T1& p1, T2& p2, const T3& p3) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2, p3); +} + +template T* FbxNew(const T1& p1, const T2& p2, T3& p3) +{ + T* p = (T*)FbxMalloc(sizeof(T)); + return new(p)T(p1, p2, p3); +} + +template 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 void FbxDelete(T* p) +{ + if( p ) + { + ((T*)p)->~T(); + FbxFree(p); + } +} + +template void FbxDelete(const T* p) +{ + if( p ) + { + ((T*)p)->~T(); + FbxFree(const_cast(p)); + } +} + +template T* FbxNewArray(const int n) +{ + if( FBXSDK_IS_SIMPLE_TYPE(T) ) + { + return (T*)FbxMalloc(sizeof(T)*n); + } + else + { + void* pTmp = FbxMalloc(sizeof(T) * n + 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 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\ + friend T* FBXSDK_NAMESPACE::FbxNew();\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, T3& p3);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, const T3& p3);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, T3& p3);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, const T3& p3);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, const T3& p3);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3);\ + \ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, T3& p3, T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, T3& p3, const T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, const T3& p3, T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, const T3& p3, const T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, T3& p3, T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, T3& p3, const T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, const T3& p3, T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, const T2& p2, const T3& p3, const T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, const T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, const T3& p3, T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, const T3& p3, const T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, const T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, T4& p4);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4);\ + \ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(T1& p1, T2& p2, T3& p3, T4& p4, T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, T4& p4, T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, T4& p4, T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, const T3& p3, T4& p4, T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, const T4& p4, T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, T2& p2, T3& p3, T4& p4, const T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, T4& p4, T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, const T4& p4, T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, T3& p3, T4& p4, const T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, T4& p4, const T5& p5);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5);\ + \ + template\ + friend T* FBXSDK_NAMESPACE::FbxNew(const T1& p1, const T2& p2, const T3& p3, const T4& p4, const T5& p5, const T6& p6);\ + template\ + 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\ + 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\ + 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\ + friend void FBXSDK_NAMESPACE::FbxDelete(T* p);\ + template\ + friend void FBXSDK_NAMESPACE::FbxDelete(const T* p);\ + template\ + friend T* FBXSDK_NAMESPACE::FbxNewArray(const int n);\ + template\ + friend void FBXSDK_NAMESPACE::FbxDeleteArray(T* p); + +#ifdef FBXSDK_COMPILER_MSC + #pragma warning(pop) +#endif + +#include + +#endif /* _FBXSDK_CORE_ARCH_NEW_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/arch/fbxstdcompliant.h b/libs/fbx/include/fbxsdk/core/arch/fbxstdcompliant.h new file mode 100644 index 00000000..059dc4a2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/arch/fbxstdcompliant.h @@ -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 + +#include + +#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 + +#endif /* _FBXSDK_CORE_ARCH_STDCOMPLIANT_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/arch/fbxtypes.h b/libs/fbx/include/fbxsdk/core/arch/fbxtypes.h new file mode 100644 index 00000000..9f620bbb --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/arch/fbxtypes.h @@ -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 + +//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 + +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 const FbxChar FbxMin(const FbxChar){ return FBXSDK_CHAR_MIN; } +inline const FbxUChar FbxMin(const FbxUChar){ return FBXSDK_UCHAR_MIN; } +inline const FbxShort FbxMin(const FbxShort){ return FBXSDK_SHORT_MIN; } +inline const FbxUShort FbxMin(const FbxUShort){ return FBXSDK_USHORT_MIN; } +inline const FbxInt FbxMin(const FbxInt){ return FBXSDK_INT_MIN; } +inline const FbxUInt FbxMin(const FbxUInt){ return FBXSDK_UINT_MIN; } +inline const FbxLongLong FbxMin(const FbxLongLong){ return FBXSDK_LONGLONG_MIN; } +inline const FbxULongLong FbxMin(const FbxULongLong){ return FBXSDK_ULONGLONG_MIN; } +inline const FbxFloat FbxMin(const FbxFloat){ return FBXSDK_FLOAT_MIN; } +inline const FbxDouble FbxMin(const FbxDouble){ return FBXSDK_DOUBLE_MIN; } + +inline const FbxChar FbxMax(const FbxChar){ return FBXSDK_CHAR_MAX; } +inline const FbxUChar FbxMax(const FbxUChar){ return FBXSDK_UCHAR_MAX; } +inline const FbxShort FbxMax(const FbxShort){ return FBXSDK_SHORT_MAX; } +inline const FbxUShort FbxMax(const FbxUShort){ return FBXSDK_USHORT_MAX; } +inline const FbxInt FbxMax(const FbxInt){ return FBXSDK_INT_MAX; } +inline const FbxUInt FbxMax(const FbxUInt){ return FBXSDK_UINT_MAX; } +inline const FbxLongLong FbxMax(const FbxLongLong){ return FBXSDK_LONGLONG_MAX; } +inline const FbxULongLong FbxMax(const FbxULongLong){ return FBXSDK_ULONGLONG_MAX; } +inline const FbxFloat FbxMax(const FbxFloat){ return FBXSDK_FLOAT_MAX; } +inline const FbxDouble FbxMax(const FbxDouble){ return FBXSDK_DOUBLE_MAX; } + +#ifndef FBXSDK_SYSTEM_IS_LP64 + inline const FbxLong FbxMin(const FbxLong){ return FBXSDK_LONG_MIN; } + inline const FbxULong FbxMin(const FbxULong){ return FBXSDK_ULONG_MIN; } + inline const FbxLong FbxMax(const FbxLong){ return FBXSDK_LONG_MAX; } + inline const FbxULong FbxMax(const FbxULong){ return FBXSDK_ULONG_MAX; } +#endif + +template inline const T FbxMin(const T){}; +template inline const T FbxMax(const T){}; + +template inline T FbxMin(const T x, const T y){ return (x < y) ? x : y; } +template inline T FbxMax(const T x, const T y){ return (x > y) ? x : y; } + +//------------------------------------------------------------------------------------- +//Vector Template Types +template 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& operator=(const T& pValue){ mData[0] = pValue; mData[1] = pValue; return *this; } + inline FbxVectorTemplate2& operator=(const FbxVectorTemplate2& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; return *this; } + inline bool operator==(const FbxVectorTemplate2& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1])); } + inline bool operator!=(const FbxVectorTemplate2& pVector) const { return !operator==( pVector ); } + inline T* Buffer(){ return mData; } + inline const T* Buffer() const { return mData; } + T mData[2]; +}; + +template 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& () const { return *((FbxVectorTemplate2*)this); } + inline FbxVectorTemplate3& operator=(T const &pValue){ mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; return *this; } + inline FbxVectorTemplate3& operator=(const FbxVectorTemplate2& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; return *this; } + inline FbxVectorTemplate3& operator=(const FbxVectorTemplate3& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; mData[2] = pVector.mData[2]; return *this; } + inline bool operator==(const FbxVectorTemplate3& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1]) && (mData[2] == pVector.mData[2])); } + inline bool operator!=(const FbxVectorTemplate3& pVector) const { return !operator==(pVector); } + inline T* Buffer(){ return mData; } + inline const T* Buffer() const { return mData; } + T mData[3]; +}; + +template 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& () const { return *((FbxVectorTemplate3*)this); } + inline FbxVectorTemplate4& operator=(const T& pValue){ mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; mData[3] = pValue; return *this; } + inline FbxVectorTemplate4& operator=(const FbxVectorTemplate3& pValue){ mData[0] = pValue[0]; mData[1] = pValue[1]; mData[2] = pValue[2]; return *this; } + inline FbxVectorTemplate4& operator=(const FbxVectorTemplate4& 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& 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& pVector) const { return !operator==( pVector ); } + inline T* Buffer(){ return mData; } + inline const T* Buffer() const { return mData; } + T mData[4]; +}; + +typedef FbxVectorTemplate2 FbxDouble2; +typedef FbxVectorTemplate3 FbxDouble3; +typedef FbxVectorTemplate4 FbxDouble4; +typedef FbxVectorTemplate4 FbxDouble4x4; + +#include + +#endif /* _FBXSDK_CORE_ARCH_TYPES_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxarray.h b/libs/fbx/include/fbxsdk/core/base/fbxarray.h new file mode 100644 index 00000000..942a7ef6 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxarray.h @@ -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 + +#include + +/** 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 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& 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& 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& 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& operator=(const FbxArray& 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& 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, 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 inline void FbxArrayFree(FbxArray& 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 inline void FbxArrayDelete(FbxArray& 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 inline void FbxArrayDestroy(FbxArray& 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>, which is not supported. +template FBXSDK_INCOMPATIBLE_WITH_ARRAY_TEMPLATE(FbxArray); + +#include + +#endif /* _FBXSDK_CORE_BASE_ARRAY_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxbitset.h b/libs/fbx/include/fbxsdk/core/base/fbxbitset.h new file mode 100644 index 00000000..798b1bbb --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxbitset.h @@ -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 + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_BASE_BITSET_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxcharptrset.h b/libs/fbx/include/fbxsdk/core/base/fbxcharptrset.h new file mode 100644 index 00000000..6c6d1406 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxcharptrset.h @@ -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 + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_BASE_CHARPTRSET_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxcontainerallocators.h b/libs/fbx/include/fbxsdk/core/base/fbxcontainerallocators.h new file mode 100644 index 00000000..16098783 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxcontainerallocators.h @@ -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 + +#include + +/** 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(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(mData) + pSize; + } + + ~MemoryBlock() + { + FbxFree(mData); + } + + void* GetChunk(const size_t pSize) + { + if( reinterpret_cast(mFreeData) + pSize < mEnd ) + { + void* lChunk = mFreeData; + mFreeData = reinterpret_cast(mFreeData) + pSize; + return lChunk; + } + return NULL; + } + + MemoryBlock* mNextBlock; + void* mData; + void* mFreeData; + void* mEnd; + }; + + size_t mRecordSize; + size_t mRecordPoolSize; + MemoryBlock* mData; +}; + +#include + +#endif /* _FBXSDK_CORE_BASE_CONTAINER_ALLOCATORS_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxdynamicarray.h b/libs/fbx/include/fbxsdk/core/base/fbxdynamicarray.h new file mode 100644 index 00000000..edaa45f3 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxdynamicarray.h @@ -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 + +#include + +#include + +/** Template class for dynamic array holding objects. + * \nosubgrouping + * \see FbxStaticArray + */ +template 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 + +#endif /* _FBXSDK_CORE_BASE_DYNAMICARRAY_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxfile.h b/libs/fbx/include/fbxsdk/core/base/fbxfile.h new file mode 100644 index 00000000..6a808345 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxfile.h @@ -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 + +#include + +#include + +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 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 + +#endif /* _FBXSDK_CORE_BASE_FILE_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxfolder.h b/libs/fbx/include/fbxsdk/core/base/fbxfolder.h new file mode 100644 index 00000000..b9af90f9 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxfolder.h @@ -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 + +#ifndef FBXSDK_ENV_WINSTORE + +#include + +#include + +/** 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 + +#endif /* !FBXSDK_ENV_WINSTORE */ + +#endif /* _FBXSDK_CORE_BASE_FOLDER_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxhashmap.h b/libs/fbx/include/fbxsdk/core/base/fbxhashmap.h new file mode 100644 index 00000000..1cefa6f7 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxhashmap.h @@ -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 + +#include +#include + +#include + +template class FbxNoOpDestruct { public: static inline void DoIt(T&) {} }; +template class FbxPtrDestruct { public: static inline void DoIt(T& v) { FbxDelete(v); v = NULL; } }; + +//True if equal, false otherwise +template 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, class Comparator = FbxDefaultComparator > +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 mBuckets; + HashFunctorType mHashFunctor; + + friend class Iterator; +}; + +#include + +#endif /* _FBXSDK_CORE_BASE_HASHMAP_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxintrusivelist.h b/libs/fbx/include/fbxsdk/core/base/fbxintrusivelist.h new file mode 100644 index 00000000..e001cf7a --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxintrusivelist.h @@ -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 + +#include + +/***************************************************************************************************************************** +** 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& GetListNode(int index = 0){ return this->mNode[index]; }\ + private: FbxListNode mNode[NodeCount]; + +template class FbxListNode +{ + typedef FbxListNode 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 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 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 + +#endif /* _FBXSDK_CORE_BASE_INTRUSIVE_LIST_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxmap.h b/libs/fbx/include/fbxsdk/core/base/fbxmap.h new file mode 100644 index 00000000..2cb07a07 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxmap.h @@ -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 + +#include +#include + +#include + +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 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 Allocator=FbxBaseAllocator> class FbxMap +{ +protected: + //! This class defines the key-value pairs used by the map. + class KeyValuePair : private FbxPair + { + /***************************************************************************************************************************** + ** 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(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 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 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 FBXSDK_DLL FbxSimpleMap +{ +public: + typedef typename FbxMap::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 mMap; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** This class template declare a simple FbxObject map. +* \nosubgrouping */ +template class FBXSDK_DLL FbxObjectMap : public FbxSimpleMap +{ +public: + //! Constructor + inline FbxObjectMap(){} + + /** Get the object contained in an element. + * \param pIterator The given element. + * \return The object. + */ + inline FbxObject* Get(typename FbxSimpleMap::Iterator pIterator) + { + return pIterator ? pIterator->GetValue() : 0; + } +}; + +/** A class that maps strings to objects with a basic string comparator. +* \nosubgrouping */ +class FBXSDK_DLL FbxObjectStringMap : public FbxObjectMap +{ +public: + //! Constructor + inline FbxObjectStringMap(){} +}; + +//! Call FbxFree on each element of the map, and then clear it. +template inline void FbxMapFree(FbxMap& pMap) +{ + for( typename FbxMap::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 inline void FbxMapDelete(FbxMap& pMap) +{ + for( typename FbxMap::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 inline void FbxMapDestroy(FbxMap& pMap) +{ + for( typename FbxMap::Iterator i = pMap.Begin(); i != pMap.End(); ++i ) + { + i->GetValue()->Destroy(); + } + pMap.Clear(); +} + +template class FbxSimpleMap; +template class FbxObjectMap; + +#include + +#endif /* _FBXSDK_CORE_BASE_MAP_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxmemorypool.h b/libs/fbx/include/fbxsdk/core/base/fbxmemorypool.h new file mode 100644 index 00000000..46656831 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxmemorypool.h @@ -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 + +#include + +#include + +/** \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 + +#endif /* _FBXSDK_CORE_BASE_MEMORY_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxmultimap.h b/libs/fbx/include/fbxsdk/core/base/fbxmultimap.h new file mode 100644 index 00000000..a5901ed0 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxmultimap.h @@ -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 + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_BASE_MULTIMAP_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxpair.h b/libs/fbx/include/fbxsdk/core/base/fbxpair.h new file mode 100644 index 00000000..b1cebfb1 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxpair.h @@ -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 + +#include + +/** This class template holds a pair of objects. +* \nosubgrouping */ +template 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& operator=(const FbxPair& pOther) + { + mFirst = pOther.mFirst; + mSecond = pOther.mSecond; + return *this; + } + + /** Comparison operator. + * \param pOther The pair to be compared. */ + inline bool operator==(const FbxPair& pOther) + { + return mFirst == pOther.mFirst && mSecond == pOther.mSecond; + } + + /** Inverse comparison operator. + * \param pOther The pair to be compared. */ + inline bool operator!=(const FbxPair& pOther) + { + return !operator==(pOther); + } + + First mFirst; //!< The first object in the pair. + Second mSecond; //!< The second object in the pair. +}; + +#include + +#endif /* _FBXSDK_CORE_BASE_PAIR_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxredblacktree.h b/libs/fbx/include/fbxsdk/core/base/fbxredblacktree.h new file mode 100644 index 00000000..40ea509d --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxredblacktree.h @@ -0,0 +1,1398 @@ +/**************************************************************************************** + + 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 fbxredblacktree.h +#ifndef _FBXSDK_CORE_BASE_REDBLACKTREE_H_ +#define _FBXSDK_CORE_BASE_REDBLACKTREE_H_ + +#include + +#include +#include + +#include + +/***************************************************************************************************************************** +** 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 class FbxRedBlackConstIterator; + +template class FbxRedBlackIterator +{ +public: + FbxRedBlackIterator() : mRecord(0) {} + FbxRedBlackIterator(RecordType* pRecord) : mRecord(pRecord) {} + FbxRedBlackIterator(const FbxRedBlackIterator& pV) : mRecord(pV.mRecord) {} + + FbxRedBlackIterator& operator++() + { + FBX_ASSERT( mRecord != NULL ); + mRecord = mRecord->Successor(); + return *this; + } + + const FbxRedBlackIterator operator++(int) + { + FbxRedBlackIterator t(*this); + operator++(); + return t; + } + + FbxRedBlackIterator& operator+=(int pCount) + { + FBX_ASSERT( mRecord != NULL ); + for( int i = 0; i < pCount; ++i ) + { + if( !mRecord ) break; + mRecord = mRecord->Successor(); + } + return *this; + } + + FbxRedBlackIterator& operator--() + { + FBX_ASSERT( mRecord ); + mRecord = mRecord->Predecessor(); + return *this; + } + + const FbxRedBlackIterator operator--(int) + { + FbxRedBlackIterator t(*this); + operator--(); + return t; + } + + FbxRedBlackIterator& operator-=(int pCount) + { + FBX_ASSERT( mRecord != NULL ); + for( int i = 0; i < pCount; ++i ) + { + if( !mRecord ) break; + mRecord = mRecord->Predecessor(); + } + return *this; + } + + const RecordType& operator*() const + { + FBX_ASSERT( mRecord ); + + return *mRecord; + } + + RecordType& operator*() + { + FBX_ASSERT( mRecord ); + + return *mRecord; + } + + const RecordType* operator->() const + { + FBX_ASSERT( mRecord ); + + return mRecord; + } + + RecordType* operator->() + { + FBX_ASSERT( mRecord ); + + return mRecord; + } + + inline bool operator==(const FbxRedBlackIterator& pOther) const + { + return mRecord == pOther.mRecord; + } + + inline bool operator !=(const FbxRedBlackIterator& pOther) const + { + return mRecord != pOther.mRecord; + } + +protected: + RecordType* mRecord; + + friend class FbxRedBlackConstIterator; +}; + +template class FbxRedBlackConstIterator +{ +public: + FbxRedBlackConstIterator() : mRecord(0) {} + FbxRedBlackConstIterator(const RecordType* pRecord) : mRecord(pRecord) {} + FbxRedBlackConstIterator(const FbxRedBlackIterator& pV) : mRecord(pV.mRecord) {} + FbxRedBlackConstIterator(const FbxRedBlackConstIterator& pV) : mRecord(pV.mRecord) {} + + FbxRedBlackConstIterator & operator++() + { + FBX_ASSERT( mRecord != NULL ); + mRecord = mRecord->Successor(); + return *this; + } + + const FbxRedBlackConstIterator operator++(int) + { + FbxRedBlackConstIterator t(*this); + operator++(); + return t; + } + + FbxRedBlackConstIterator& operator+=(int pCount) + { + FBX_ASSERT( mRecord != NULL ); + for( int i = 0; i < pCount; ++i ) + { + if( !mRecord ) break; + mRecord = mRecord->Successor(); + } + return *this; + } + + FbxRedBlackConstIterator & operator--() + { + FBX_ASSERT( mRecord ); + mRecord = mRecord->Predecessor(); + return *this; + } + + const FbxRedBlackConstIterator operator--(int) + { + FbxRedBlackConstIterator t(*this); + operator--(); + return t; + } + + FbxRedBlackConstIterator& operator-=(int pCount) + { + FBX_ASSERT( mRecord != NULL ); + for( int i = 0; i < pCount; ++i ) + { + if( !mRecord ) break; + mRecord = mRecord->Predecessor(); + } + return *this; + } + + const RecordType& operator*() const + { + FBX_ASSERT( mRecord ); + + return *mRecord; + } + + const RecordType& operator*() + { + FBX_ASSERT( mRecord ); + + return *mRecord; + } + + const RecordType* operator->() const + { + FBX_ASSERT( mRecord ); + + return mRecord; + } + + const RecordType* operator->() + { + FBX_ASSERT( mRecord ); + + return mRecord; + } + + inline bool operator==(const FbxRedBlackConstIterator& pOther) const + { + return mRecord == pOther.mRecord; + } + + inline bool operator !=(const FbxRedBlackConstIterator& pOther) const + { + return mRecord != pOther.mRecord; + } + +protected: + const RecordType* mRecord; + + friend class FbxRedBlackIterator; +}; + +//! Implements an efficient ordered data storage. +template class FbxRedBlackTree +{ +public: + typedef Type DataType; + typedef typename Type::KeyType KeyType; + typedef typename Type::ConstKeyType ConstKeyType; + typedef typename Type::ValueType ValueType; + typedef typename Type::ConstValueType ConstValueType; + typedef Allocator AllocatorType; + + /** + This class represents a node in the tree. It contains the key, + the value, and internal tree management data. + */ + class RecordType + { + public: + inline ConstKeyType& GetKey() const { return mData.GetKey(); } + inline ConstValueType& GetValue() const { return mData.GetValue(); } + inline ValueType& GetValue() { return mData.GetValue(); } + + inline const RecordType* Minimum() const + { + const RecordType* lParent = 0; + const RecordType* lNode = this; + while (lNode != 0) + { + lParent = lNode; + lNode = lNode->mLeftChild; + } + + return lParent; + } + + inline RecordType* Minimum() + { + RecordType* lParent = 0; + RecordType* lNode = this; + while (lNode != 0) + { + lParent = lNode; + lNode = lNode->mLeftChild; + } + + return lParent; + } + + inline const RecordType* Maximum() const + { + const RecordType* lParent = 0; + const RecordType* lNode = this; + while (lNode != 0) + { + lParent = lNode; + lNode = lNode->mRightChild; + } + + return lParent; + } + + inline RecordType* Maximum() + { + RecordType* lParent = 0; + RecordType* lNode = this; + while (lNode != 0) + { + lParent = lNode; + lNode = lNode->mRightChild; + } + + return lParent; + } + + inline const RecordType* Predecessor() const + { + if (mLeftChild) + { + return mLeftChild->Maximum(); + } + else + { + const RecordType* lParent = mParent; + const RecordType* lNode = this; + + while (lParent && lParent->mLefttChild == lNode) + { + lNode = lParent; + lParent = lParent->mParent; + } + + return lParent; + } + } + + inline RecordType* Predecessor() + { + if (mLeftChild) + { + return mLeftChild->Maximum(); + } + else + { + RecordType* lParent = mParent; + RecordType* lNode = this; + + while (lParent && lParent->mLeftChild == lNode) + { + lNode = lParent; + lParent = lParent->mParent; + } + + return lParent; + } + } + + inline const RecordType* Successor() const + { + if (mRightChild) + { + return mRightChild->Minimum(); + } + else + { + const RecordType* lParent = mParent; + const RecordType* lNode = this; + + while (lParent && lParent->mRightChild == lNode) + { + lNode = lParent; + lParent = lParent->mParent; + } + + return lParent; + } + } + + inline RecordType* Successor() + { + if (mRightChild) + { + return mRightChild->Minimum(); + } + else + { + RecordType* lParent = mParent; + RecordType* lNode = this; + + while (lParent && lParent->mRightChild == lNode) + { + lNode = lParent; + lParent = lParent->mParent; + } + + return lParent; + } + } + + inline const int GetBlackDepth() { return mBlackDepth; } + + private: + enum ETreeType {eRed, eBlack}; + + inline RecordType(const DataType& pData) + : mData(pData) + , mParent(0) + , mLeftChild(0) + , mRightChild(0) + , mColor(eRed) + , mBlackDepth(0) + { + } + + inline RecordType(const RecordType& pRecordType) + : mData(pRecordType.mData) + , mParent(0) + , mLeftChild(0) + , mRightChild(0) + , mColor(pRecordType.mColor) + , mBlackDepth(pRecordType.mBlackDepth) + { + } + + DataType mData; + + friend class FbxRedBlackTree; + + RecordType* mParent; + RecordType* mLeftChild; + RecordType* mRightChild; + unsigned int mColor:2; + unsigned int mBlackDepth:30; + }; + +public: + typedef FbxRedBlackConstIterator ConstIteratorType; + typedef FbxRedBlackIterator IteratorType; + + inline FbxRedBlackTree() : mRoot(0), mSize(0), mAllocator(sizeof(RecordType)) {} + inline FbxRedBlackTree(const FbxRedBlackTree& pTree) : mRoot(0), mSize(0), mAllocator(sizeof(RecordType)) { operator=(pTree); } + inline ~FbxRedBlackTree() { Clear(); } + + /** Deep copy pTree in this. + * \param pTree The tree to copy in this tree. */ + inline FbxRedBlackTree& operator=(const FbxRedBlackTree& pTree) + { + if( this != &pTree ) + { + Clear(); + + mAllocator = pTree.mAllocator; + + if( pTree.mRoot ) + { + void* lBuffer = mAllocator.AllocateRecords(); + mRoot = new(lBuffer) RecordType(*(pTree.mRoot)); //in-place new won't allocate memory, so it is safe + mRoot->mLeftChild = DuplicateSubTree(pTree.mRoot->mLeftChild); + mRoot->mRightChild = DuplicateSubTree(pTree.mRoot->mRightChild); + + if (mRoot->mLeftChild) + { + mRoot->mLeftChild->mParent = mRoot; + } + + if (mRoot->mRightChild) + { + mRoot->mRightChild->mParent = mRoot; + } + } + else + { + FBX_ASSERT( pTree.mSize == 0 ); + FBX_ASSERT( mRoot == 0 ); + } + + mSize = pTree.mSize; + } + + return *this; + } + + inline bool operator==(const FbxRedBlackTree& pTree) const + { + // Check a few quick shortcuts + if( this == &pTree ) + return true; + + if( GetSize() != pTree.GetSize() ) + return false; + + // Iterator through all nodes; if we reach the end of both iterators at the same + // time then we have two iterators that match. + ConstIteratorType End; + ConstIteratorType Iter1(Minimum()); + ConstIteratorType Iter2(pTree.Minimum()); + + while( (Iter1 != End) && (Iter2 != End) && + (Iter1->GetKey() == Iter2->GetKey()) && + (Iter1->GetValue() == Iter2->GetValue()) ) + { + ++Iter1; + ++Iter2; + } + + return Iter1 == End && Iter2 == End; + } + + /** Ask Allocator to reserve space to hold pRecordCount elements. + * \param pRecordCount + */ + inline void Reserve(unsigned int pRecordCount) + { + mAllocator.Reserve(pRecordCount); + } + + /** Get the number of elements in the tree. Takes O(1) time. + * \return The number of elements in the tree. + */ + inline int GetSize() const { return mSize; } + + inline bool Empty() const { return mSize == 0; } + + /** Insert a new element in the tree. Takes O(log n) time. + * \param pData The element to insert. + * \return If pData.GetKey() is already present in the tree, returns the + * existing record and false; else returns the new record and true. + */ + inline FbxPair Insert(const DataType& pData) + { + Compare lCompareKeys; + bool lResult = false; + RecordType* lParent = 0; + RecordType* lNode = mRoot; + while (lNode != 0) + { + const KeyType& lNodeKey = lNode->GetKey(); + const KeyType& lDataKey = pData.GetKey(); + + if (lCompareKeys(lNodeKey, lDataKey) < 0) + { + lParent = lNode; + lNode = lNode->mRightChild; + } + else if (lCompareKeys(lNodeKey, lDataKey) > 0) + { + lParent = lNode; + lNode = lNode->mLeftChild; + } + else + { + break; + } + } + + if (lNode == 0) + { + void* lBuffer = mAllocator.AllocateRecords(); + lNode = new(lBuffer) RecordType(pData); //in-place new won't allocate memory, so it is safe + mSize++; + + FBX_ASSERT(lNode == lBuffer); + + if (lParent) + { + if (lCompareKeys(lParent->GetKey(), pData.GetKey()) < 0) + { + FBX_ASSERT(lParent->mRightChild == 0); + lParent->mRightChild = lNode; + lNode->mParent = lParent; + } + else + { + FBX_ASSERT(lParent->mLeftChild == 0); + lParent->mLeftChild = lNode; + lNode->mParent = lParent; + } + } + else + { + mRoot = lNode; + } + + // Fix red black tree property + FixNodesAfterInsertion(lNode); + + lResult = true; + } + + return FbxPair(lNode, lResult); + } + + /** Remove an element identified by a key from the tree. Takes O(log n) time. + * \param pKey The key identifying the element to remove. + */ + inline bool Remove(const KeyType& pKey) + { + Compare lCompareKeys; + bool lResult = false; + RecordType* lNode = mRoot; + while (lNode != 0) + { + if (lCompareKeys(lNode->GetKey(), pKey) < 0) + { + lNode = lNode->mRightChild; + } + else if (lCompareKeys(lNode->GetKey(), pKey) > 0) + { + lNode = lNode->mLeftChild; + } + else + { + break; + } + } + + if (lNode) + { + RemoveNode(lNode); + mSize--; + lNode->~RecordType(); + mAllocator.FreeMemory(lNode); + + lResult = true; + } + + return lResult; + } + + /** Remove all elements from the tree. Takes O(n) time. Recursive. + */ + inline void Clear() + { + if (mRoot) + { + ClearSubTree(mRoot->mLeftChild); + ClearSubTree(mRoot->mRightChild); + mRoot->~RecordType(); + mAllocator.FreeMemory(mRoot); + mRoot = 0; + mSize = 0; + } + } + + /** Find the smallest element in the tree. + * Takes O(log n) time. + */ + inline const RecordType* Minimum() const + { + if (0 != mRoot) + { + return mRoot->Minimum(); + } + else + { + return 0; + } + } + + /** Find the smallest element in the tree. + * Takes O(log n) time. + */ + inline RecordType* Minimum() + { + if (0 != mRoot) + { + return mRoot->Minimum(); + } + else + { + return 0; + } + } + + /** Find the largest element in the tree. + * Takes O(log n) time. + */ + inline const RecordType* Maximum() const + { + if (0 != mRoot) + { + return mRoot->Maximum(); + } + else + { + return 0; + } + } + + /** Find the largest element in the tree. + * Takes O(log n) time. + */ + inline RecordType* Maximum() + { + if (0 != mRoot) + { + return mRoot->Maximum(); + } + else + { + return 0; + } + } + + /** Find the key-value pair with key pKey. + * Takes O(log n) time. + * \param pKey The key to look for. + */ + inline const RecordType* Find(const KeyType& pKey) const + { + Compare lCompareKeys; + const RecordType* lNode = mRoot; + while (lNode != 0) + { + if (lCompareKeys(lNode->GetKey(), pKey) < 0) + { + lNode = lNode->mRightChild; + } + else if (lCompareKeys(lNode->GetKey(), pKey) > 0) + { + lNode = lNode->mLeftChild; + } + else + { + break; + } + } + + return lNode; + } + + /** Find the key-value pair with key pKey. + * Takes O(log n) time. + * \param pKey The key to look for. + */ + inline RecordType* Find(const KeyType& pKey) + { + Compare lCompareKeys; + RecordType* lNode = mRoot; + while (lNode != 0) + { + if (lCompareKeys(lNode->GetKey(), pKey) < 0) + { + lNode = lNode->mRightChild; + } + else if (lCompareKeys(lNode->GetKey(), pKey) > 0) + { + lNode = lNode->mLeftChild; + } + else + { + break; + } + } + + return lNode; + } + + /** Find the key-value pair with the smallest key greater than pKey. + * Takes O(log n) time. + * \param pKey The key to look for. + */ + inline const RecordType* UpperBound(const KeyType& pKey) const + { + Compare lCompareKeys; + const RecordType* lNode = mRoot; + const RecordType* lCandidate = 0; + while (lNode != 0) + { + if (lCompareKeys(lNode->GetKey(), pKey) <= 0) + { + lNode = lNode->mRightChild; + } + else if (lCompareKeys(lNode->GetKey(), pKey) > 0) + { + lCandidate = lNode; + lNode = lNode->mLeftChild; + } + } + + return lCandidate; + } + + /** Find the key-value pair with the smallest key greater than pKey. + * Takes O(log n) time. + * \param pKey The key to look for. + */ + inline RecordType* UpperBound(const KeyType& pKey) + { + Compare lCompareKeys; + RecordType* lNode = mRoot; + RecordType* lCandidate = 0; + while (lNode != 0) + { + if (lCompareKeys(lNode->GetKey(), pKey) <= 0) + { + lNode = lNode->mRightChild; + } + else if (lCompareKeys(lNode->GetKey(), pKey) > 0) + { + lCandidate = lNode; + lNode = lNode->mLeftChild; + } + } + + return lCandidate; + } + +protected: + RecordType* mRoot; + int mSize; + + AllocatorType mAllocator; + + inline RecordType* DuplicateSubTree(const RecordType* pNode) + { + RecordType* lNewSubTree = 0; + + if (pNode) + { + void* lBuffer = mAllocator.AllocateRecords(); + lNewSubTree = new(lBuffer) RecordType(*pNode); //in-place new won't allocate memory, so it is safe + lNewSubTree->mLeftChild = DuplicateSubTree(pNode->mLeftChild); + lNewSubTree->mRightChild = DuplicateSubTree(pNode->mRightChild); + + if (lNewSubTree->mLeftChild) + { + lNewSubTree->mLeftChild->mParent = lNewSubTree; + } + + if (lNewSubTree->mRightChild) + { + lNewSubTree->mRightChild->mParent = lNewSubTree; + } + } + + return lNewSubTree; + } + + inline void FixNodesAfterInsertion(RecordType* pNode) + { + RecordType* lNode = pNode; + bool lDone = false; + + while (!lDone) + { + lDone = true; + + if (lNode->mParent == 0) + { + lNode->mColor = RecordType::eBlack; + } + else if (lNode->mParent->mColor == RecordType::eRed) + { + RecordType* lUncle = 0; + if (lNode->mParent == lNode->mParent->mParent->mLeftChild) + { + lUncle = lNode->mParent->mParent->mRightChild; + } + else if (lNode->mParent == lNode->mParent->mParent->mRightChild) + { + lUncle = lNode->mParent->mParent->mLeftChild; + } + + // since lNode->mParent is red, lNode->mParent->mParent exists + + if (lUncle && lUncle->mColor == RecordType::eRed) + { + lNode->mParent->mColor = RecordType::eBlack; + lUncle->mColor = RecordType::eBlack; + lNode->mParent->mParent->mColor = RecordType::eRed; + lNode = lNode->mParent->mParent; + + lDone = false; + } + else + { + if ((lNode == lNode->mParent->mRightChild) && + (lNode->mParent == lNode->mParent->mParent->mLeftChild)) + { + LeftRotate(lNode->mParent); + lNode = lNode->mLeftChild; + } + else if ((lNode == lNode->mParent->mLeftChild) && + (lNode->mParent == lNode->mParent->mParent->mRightChild)) + { + RightRotate(lNode->mParent); + lNode = lNode->mRightChild; + } + + lNode->mParent->mColor = RecordType::eBlack; + lNode->mParent->mParent->mColor = RecordType::eRed; + if ((lNode == lNode->mParent->mLeftChild) && + (lNode->mParent == lNode->mParent->mParent->mLeftChild)) + { + RightRotate(lNode->mParent->mParent); + } + else + { + LeftRotate(lNode->mParent->mParent); + } + } + } + } + + mRoot->mColor = RecordType::eBlack; + } + + inline void LeftRotate(RecordType* pNode) + { + FBX_ASSERT_RETURN(pNode); + + RecordType* lNode = pNode->mRightChild; + FBX_ASSERT_RETURN(lNode); + + #ifdef _DEBUG + RecordType* A = pNode->mLeftChild; + RecordType* B = lNode->mLeftChild; + RecordType* C = lNode->mRightChild; + RecordType* Z = pNode->mParent; + #endif + + pNode->mRightChild = lNode->mLeftChild; + if (pNode->mRightChild) + { + pNode->mRightChild->mParent = pNode; + } + + lNode->mParent = pNode->mParent; + if (pNode->mParent == 0) + { + FBX_ASSERT(mRoot == pNode); + mRoot = lNode; + } + else if (pNode == pNode->mParent->mLeftChild) + { + pNode->mParent->mLeftChild = lNode; + } + else + { + pNode->mParent->mRightChild = lNode; + } + pNode->mParent = lNode; + lNode->mLeftChild = pNode; + + FBX_ASSERT(pNode->mLeftChild == A); + FBX_ASSERT(pNode->mRightChild == B); + FBX_ASSERT(pNode->mParent == lNode); + + FBX_ASSERT(lNode->mLeftChild == pNode); + FBX_ASSERT(lNode->mRightChild == C); + FBX_ASSERT(lNode->mParent == Z); + + FBX_ASSERT(A == 0 || A->mParent == pNode); + FBX_ASSERT(B == 0 || B->mParent == pNode); + FBX_ASSERT(C == 0 || C->mParent == lNode); + FBX_ASSERT(Z == 0 || Z->mLeftChild == lNode || Z->mRightChild == lNode); + } + + inline void RightRotate(RecordType* pNode) + { + RecordType* lNode = pNode->mLeftChild; + + #ifdef _DEBUG + RecordType* A = lNode->mLeftChild; + RecordType* B = lNode->mRightChild; + RecordType* C = pNode->mRightChild; + RecordType* Z = pNode->mParent; + #endif + + pNode->mLeftChild = lNode->mRightChild; + if (pNode->mLeftChild) + { + pNode->mLeftChild->mParent = pNode; + } + + lNode->mParent = pNode->mParent; + if (pNode->mParent == 0) + { + FBX_ASSERT(mRoot == pNode); + mRoot = lNode; + } + else if (pNode == pNode->mParent->mRightChild) + { + pNode->mParent->mRightChild = lNode; + } + else + { + pNode->mParent->mLeftChild = lNode; + } + pNode->mParent = lNode; + lNode->mRightChild = pNode; + + FBX_ASSERT(lNode->mLeftChild == A); + FBX_ASSERT(lNode->mRightChild == pNode); + FBX_ASSERT(lNode->mParent == Z); + + FBX_ASSERT(pNode->mLeftChild == B); + FBX_ASSERT(pNode->mRightChild == C); + FBX_ASSERT(pNode->mParent == lNode); + + FBX_ASSERT(A == 0 || A->mParent == lNode); + FBX_ASSERT(B == 0 || B->mParent == pNode); + FBX_ASSERT(C == 0 || C->mParent == pNode); + FBX_ASSERT(Z == 0 || Z->mLeftChild == lNode || Z->mRightChild == lNode); + } + + inline void RemoveNode(RecordType* pNode) + { + if (pNode->mLeftChild == 0) + { + if (pNode->mRightChild == 0) + { + if (pNode->mParent) + { + if (pNode->mParent->mLeftChild == pNode) + { + pNode->mParent->mLeftChild = 0; + } + else if (pNode->mParent->mRightChild == pNode) + { + pNode->mParent->mRightChild = 0; + } + else + { + FBX_ASSERT_NOW("Node not found in FbxRedBlackTree"); + } + } + else + { + FBX_ASSERT(mRoot == pNode); + mRoot = 0; + } + + if (pNode->mColor == RecordType::eBlack) + { + FixNodesAfterRemoval(pNode->mParent, 0); + } + } + else + { + if (pNode->mParent) + { + if (pNode->mParent->mLeftChild == pNode) + { + pNode->mParent->mLeftChild = pNode->mRightChild; + pNode->mRightChild->mParent = pNode->mParent; + } + else if (pNode->mParent->mRightChild == pNode) + { + pNode->mParent->mRightChild = pNode->mRightChild; + pNode->mRightChild->mParent = pNode->mParent; + } + else + { + FBX_ASSERT_NOW("Node not found in FbxRedBlackTree"); + } + } + else + { + FBX_ASSERT(mRoot == pNode); + mRoot = pNode->mRightChild; + pNode->mRightChild->mParent = 0; + } + + if (pNode->mColor == RecordType::eBlack) + { + FixNodesAfterRemoval(pNode->mRightChild->mParent, pNode->mRightChild); + } + } + } + else + { + if (pNode->mRightChild == 0) + { + if (pNode->mParent) + { + if (pNode->mParent->mLeftChild == pNode) + { + pNode->mParent->mLeftChild = pNode->mLeftChild; + pNode->mLeftChild->mParent = pNode->mParent; + } + else if (pNode->mParent->mRightChild == pNode) + { + pNode->mParent->mRightChild = pNode->mLeftChild; + pNode->mLeftChild->mParent = pNode->mParent; + } + else + { + FBX_ASSERT_NOW("Node not found in FbxRedBlackTree"); + } + } + else + { + FBX_ASSERT(mRoot == pNode); + mRoot = pNode->mLeftChild; + pNode->mLeftChild->mParent = 0; + } + + if (pNode->mColor == RecordType::eBlack) + { + FixNodesAfterRemoval(pNode->mLeftChild->mParent, pNode->mLeftChild); + } + } + else + { + RecordType* lMinRightNode = pNode->mRightChild->Minimum(); + RemoveNode(lMinRightNode); + + lMinRightNode->mColor = pNode->mColor; + ReplaceNode(pNode, lMinRightNode); + } + } + + pNode->mParent = 0; + pNode->mLeftChild = 0; + pNode->mRightChild = 0; + } + + inline void ReplaceNode(RecordType* pNodeToReplace, RecordType* pReplacement) + { + pReplacement->mParent = pNodeToReplace->mParent; + if (pNodeToReplace->mParent) + { + if (pNodeToReplace->mParent->mLeftChild == pNodeToReplace) + { + pNodeToReplace->mParent->mLeftChild = pReplacement; + } + else if (pNodeToReplace->mParent->mRightChild == pNodeToReplace) + { + pNodeToReplace->mParent->mRightChild = pReplacement; + } + } + else + { + FBX_ASSERT(mRoot == pNodeToReplace); + mRoot = pReplacement; + } + + pReplacement->mLeftChild = pNodeToReplace->mLeftChild; + if (pReplacement->mLeftChild) + { + pReplacement->mLeftChild->mParent = pReplacement; + } + + pReplacement->mRightChild = pNodeToReplace->mRightChild; + if (pReplacement->mRightChild) + { + pReplacement->mRightChild->mParent = pReplacement; + } + } + + inline RecordType* Sibling(const RecordType* pParent, const RecordType* pNode) const + { + if (pParent) + { + if (pParent->mLeftChild == pNode) + { + return pParent->mRightChild; + } + else if (pParent->mRightChild == pNode) + { + return pParent->mLeftChild; + } + } + + return 0; + } + + inline bool IsBlack(const RecordType* pNode) + { + return ((pNode == 0) || (pNode->mColor == RecordType::eBlack)); + } + + inline void FixNodesAfterRemoval(RecordType* pParent, RecordType* pNode) + { + RecordType* lParent = pParent; + RecordType* lNode = pNode; + bool lDone = false; + + while (!lDone) + { + lDone = true; + + if (!IsBlack(lNode)) + { + lNode->mColor = RecordType::eBlack; + } + else if (lParent != NULL) + { + RecordType* lSibling = Sibling(lParent, lNode); + + if (!IsBlack(lSibling)) + { + lParent->mColor = RecordType::eRed; + lSibling->mColor = RecordType::eBlack; + if (lNode == lParent->mLeftChild) + { + LeftRotate(lParent); + } + else + { + RightRotate(lParent); + } + + // update sibling: it may have change after rotation + // parent was not affected by this rotation + lSibling = Sibling(lParent, lNode); + } + + /* check this for null sibling */ + if (lSibling && + IsBlack(lParent) && + IsBlack(lSibling) && + IsBlack(lSibling->mLeftChild) && + IsBlack(lSibling->mRightChild)) + { + lSibling->mColor = RecordType::eRed; + lNode = lParent; + lParent = lParent->mParent; + lDone = false; + } + else + { + if (!IsBlack(lParent) && + IsBlack(lSibling) && + ((lSibling == 0) || IsBlack(lSibling->mLeftChild)) && + ((lSibling == 0) || IsBlack(lSibling->mRightChild))) + { + if (lSibling) + { + lSibling->mColor = RecordType::eRed; + } + lParent->mColor = RecordType::eBlack; + } + else if( lSibling != 0 ) + { + if ((lNode == lParent->mLeftChild) && + IsBlack(lSibling) && + !IsBlack(lSibling->mLeftChild) && + IsBlack(lSibling->mRightChild)) + { + lSibling->mColor = RecordType::eRed; + lSibling->mLeftChild->mColor = RecordType::eBlack; + RightRotate(lSibling); + } + else if ((lNode == lParent->mRightChild) && + IsBlack(lSibling) && + IsBlack(lSibling->mLeftChild) && + !IsBlack(lSibling->mRightChild)) + { + lSibling->mColor = RecordType::eRed; + lSibling->mRightChild->mColor = RecordType::eBlack; + LeftRotate(lSibling); + } + + // update sibling: it may have change after rotation + lSibling = Sibling(lParent, lNode); + FBX_ASSERT(lSibling != 0 && lParent != 0); // lSibling is now + // the former red + // child of the + // former sibling + + if( lSibling != 0 && lParent != 0 ) + { + lSibling->mColor = lParent->mColor; + lParent->mColor = RecordType::eBlack; + if (lNode == lParent->mLeftChild) + { + if (lSibling->mRightChild) + { + lSibling->mRightChild->mColor = RecordType::eBlack; + } + LeftRotate(lParent); + } + else + { + if (lSibling->mLeftChild) + { + lSibling->mLeftChild->mColor = RecordType::eBlack; + } + RightRotate(lParent); + } + } + } + } + } + } + + if (mRoot) + { + mRoot->mColor = RecordType::eBlack; + } + } + + inline void ClearSubTree(RecordType* pNode) + { + if (pNode) + { + ClearSubTree(pNode->mLeftChild); + ClearSubTree(pNode->mRightChild); + pNode->~RecordType(); + mAllocator.FreeMemory(pNode); + } + } + + inline int GetSubTreeSize(RecordType* pNode) const + { + if (pNode) + { + return GetSubTreeSize(pNode->mLeftChild) + GetSubTreeSize(pNode->mRightChild) + 1; + } + else + { + return 0; + } + } + +#if 0 + inline void IsSane() + { + FBX_ASSERT((mRoot == 0) || (mRoot->mColor == RecordType::eBlack)); + FBX_ASSERT(((mRoot == 0) && (mSize == 0)) || (mRoot != 0) && (mSize != 0)); + IsSubTreeSane(mRoot); + + ComputeBlackDepth(mRoot, 0); + + RecordType* lNode = mRoot; + unsigned int lLeafBlackDepth = 0; + while (lNode) + { + if (lNode->mLeftChild == 0) + { + lLeafBlackDepth = lNode->mBlackDepth + ((lNode->mColor == RecordType::eBlack) ? 1 : 0); + } + + lNode = lNode->mLeftChild; + } + + CheckLeavesBlackDepth(mRoot, lLeafBlackDepth); + } + + inline void IsSubTreeSane(const RecordType* pNode) const + { + Compare lCompareKeys; + + if (pNode) + { + FBX_ASSERT(pNode != pNode->mParent); + FBX_ASSERT(pNode != pNode->mLeftChild); + FBX_ASSERT(pNode != pNode->mRightChild); + + // Check for two consecutive red nodes + FBX_ASSERT((pNode->mColor == RecordType::eBlack) || + (pNode->mLeftChild == NULL) || + (pNode->mLeftChild->mColor == RecordType::eBlack)); + + FBX_ASSERT((pNode->mColor == RecordType::eBlack) || + (pNode->mRightChild == NULL) || + (pNode->mRightChild->mColor == RecordType::eBlack)); + + // Check key ordering + FBX_ASSERT((pNode->mLeftChild == 0 || + lCompareKeys(pNode->GetKey(), pNode->mLeftChild->GetKey()) > 0)); + + FBX_ASSERT((pNode->mRightChild == 0 || + lCompareKeys(pNode->GetKey(), pNode->mRightChild->GetKey()) < 0)); + + IsSubTreeSane(pNode->mLeftChild); + IsSubTreeSane(pNode->mRightChild); + } + } + + inline void ComputeBlackDepth(RecordType* pNode, unsigned int pDepth) + { + if( pNode ) + { + pNode->mBlackDepth = pDepth; + if( pNode->mColor == RecordType::eBlack ) + { + pDepth++; + } + ComputeBlackDepth(pNode->mLeftChild, pDepth); + ComputeBlackDepth(pNode->mRightChild, pDepth); + } + } + + inline void CheckLeavesBlackDepth(RecordType* pNode, unsigned int pBlackDepth) + { + if( pNode ) + { + if( pNode->mLeftChild == 0 || pNode->mRightChild == 0 ) + { + FBX_ASSERT((pNode->mBlackDepth + ((pNode->mColor == RecordType::eBlack) ? 1 : 0)) == pBlackDepth); + } + CheckLeavesBlackDepth(pNode->mLeftChild, pBlackDepth); + CheckLeavesBlackDepth(pNode->mRightChild, pBlackDepth); + } + } +#endif +}; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +#include + +#endif /*_FBXSDK_CORE_BASE_REDBLACKTREE_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxset.h b/libs/fbx/include/fbxsdk/core/base/fbxset.h new file mode 100644 index 00000000..b1231a2b --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxset.h @@ -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 + +#include +#include + +#include + +/** 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 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 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 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& pOther) const + { + return (this == &pOther) || (mTree == pOther.mTree); + } + + //! Inequality operator. + inline bool operator != (const FbxSet& 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 + +#endif /* _FBXSDK_CORE_BASE_SET_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxstatus.h b/libs/fbx/include/fbxsdk/core/base/fbxstatus.h new file mode 100644 index 00000000..3e67a684 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxstatus.h @@ -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 + +#include + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_BASE_STATUS_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxstring.h b/libs/fbx/include/fbxsdk/core/base/fbxstring.h new file mode 100644 index 00000000..a604e67b --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxstring.h @@ -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 + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_BASE_STRING_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxstringlist.h b/libs/fbx/include/fbxsdk/core/base/fbxstringlist.h new file mode 100644 index 00000000..8a34cf2e --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxstringlist.h @@ -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 + +#include +#include + +#include + +//! 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 FbxStringListT +{ +protected: + FbxArray 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 (pIndexmString.Buffer(); else return NULL; } + + //! Set string at given index. + virtual bool SetStringAt(int pIndex, const char* pString) + { + if (pIndexmString = 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; CountmReference==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; lCountmString==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; lCountmString; + if (lCount +{ +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 + +#endif /* _FBXSDK_CORE_BASE_STRING_LIST_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxtime.h b/libs/fbx/include/fbxsdk/core/base/fbxtime.h new file mode 100644 index 00000000..1deb3bf1 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxtime.h @@ -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 + +#include +#include + +#include + +#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: + *

  • 1 means hours only + *
  • 2 means hours and minutes + *
  • 3 means hours, minutes and seconds + *
  • 4 means hours, minutes, seconds and frames + *
  • 5 means hours, minutes, seconds, frames and field + *
  • 6 means hours, minutes, seconds, frames, field and residual value
+ * \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 + +#endif /* _FBXSDK_CORE_BASE_TIME_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxtimecode.h b/libs/fbx/include/fbxsdk/core/base/fbxtimecode.h new file mode 100644 index 00000000..6e025e16 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxtimecode.h @@ -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 + +#include + +#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 + +#endif /* _FBXSDK_CORE_BASE_TIMECODE_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/base/fbxutils.h b/libs/fbx/include/fbxsdk/core/base/fbxutils.h new file mode 100644 index 00000000..eb17d287 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/base/fbxutils.h @@ -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 + +#include +#include + +#include + +#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(); + } + return *mStatusPtr; + } + +private: + FbxStatusGlobal(){ mStatusPtr = NULL; } + ~FbxStatusGlobal(){ FbxDelete(mStatusPtr); } + static FbxStatusGlobal sgFbxStatusGlobal; + static FbxStatus* mStatusPtr; +}; + + +#include + +#endif /* _FBXSDK_CORE_BASE_UTILITIES_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxclassid.h b/libs/fbx/include/fbxsdk/core/fbxclassid.h new file mode 100644 index 00000000..a98eed17 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxclassid.h @@ -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 + +#include + +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 + +#endif /* _FBXSDK_CORE_CLASSID_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxconnectionpoint.h b/libs/fbx/include/fbxsdk/core/fbxconnectionpoint.h new file mode 100644 index 00000000..21057b67 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxconnectionpoint.h @@ -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 + +#include + +#include + +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 mSrcList; + FbxArray 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 mSubConnectList; + FbxArray 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 + +#endif /* _FBXSDK_CORE_CONNECTION_POINT_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxdatatypes.h b/libs/fbx/include/fbxsdk/core/fbxdatatypes.h new file mode 100644 index 00000000..1b2552c3 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxdatatypes.h @@ -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 + +#include +#include + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_DATA_TYPES_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxemitter.h b/libs/fbx/include/fbxsdk/core/fbxemitter.h new file mode 100644 index 00000000..32f61701 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxemitter.h @@ -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 + +#include +#include + +#include + +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 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 EventHandlerList; + struct EventData { EventHandlerList mEventHandlerList; }; + EventData* mData; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_CORE_EMITTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxevent.h b/libs/fbx/include/fbxsdk/core/fbxevent.h new file mode 100644 index 00000000..b2695a31 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxevent.h @@ -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 + +#include + +#include + +/** 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; \ + +// +// 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(*((const FBXType *)0))).GetName() + ">"; \ + \ + return lEventName.Buffer(); \ + } \ + friend class FbxEvent< Class >; + + + +//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 >\ +{\ + 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 >; + + +//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 \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 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 int FbxEvent::smTypeId = 0; + +#include + +#endif /* _FBXSDK_CORE_EVENT_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxeventhandler.h b/libs/fbx/include/fbxsdk/core/fbxeventhandler.h new file mode 100644 index 00000000..5cf45216 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxeventhandler.h @@ -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 + +#include +#include + +#include + +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 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(&pEvent)); } + virtual FbxListener* GetListener(){ return mListener; } + +private: + ListenerType* mListener; + CallbackFnc mFunction; +}; + +template 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(&pEvent)); } + virtual FbxListener* GetListener(){ return mListener; } + +private: + ListenerType* mListener; + CallbackFnc mFunction; +}; + +template 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(&pEvent), mListener); } + virtual FbxListener* GetListener(){ return mListener; } + +private: + FbxListener* mListener; + CallbackFnc mFunction; +}; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +#include + +#endif /* _FBXSDK_CORE_EVENT_HANDLER_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxlistener.h b/libs/fbx/include/fbxsdk/core/fbxlistener.h new file mode 100644 index 00000000..85b13c90 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxlistener.h @@ -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 + +#include +#include +#include + +#include + +/**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 FbxEventHandler* Bind(FbxEmitter& pEmitter, void (ListenerType::*pFunc)(const EventType*)) + { + FbxMemberFuncEventHandler* eventHandler = + FbxNew< FbxMemberFuncEventHandler >(static_cast(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 FbxEventHandler* Bind(FbxEmitter& pEmitter, void (ListenerType::*pFunc)(const EventType*)const) + { + FbxConstMemberFuncEventHandler* eventHandler = + FbxNew< FbxConstMemberFuncEventHandler >(static_cast(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 FbxEventHandler* Bind(FbxEmitter& pEmitter, void (*pFunc)(const EventType*,FbxListener*)) + { + FbxFuncEventHandler* eventHandler = + FbxNew< FbxFuncEventHandler >(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 EventHandlerList; + EventHandlerList mEventHandler; +}; + +#include + +#endif /* _FBXSDK_CORE_LISTENER_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxloadingstrategy.h b/libs/fbx/include/fbxsdk/core/fbxloadingstrategy.h new file mode 100644 index 00000000..393defc6 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxloadingstrategy.h @@ -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 + +#ifndef FBXSDK_ENV_WINSTORE + +#include +#include + +#include + +/** + * 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 + +#endif /* !FBXSDK_ENV_WINSTORE */ + +#endif /* _FBXSDK_CORE_LOADING_STRATEGY_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxmanager.h b/libs/fbx/include/fbxsdk/core/fbxmanager.h new file mode 100644 index 00000000..9e4a5f1e --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxmanager.h @@ -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 + +#include + +#include + +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 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 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 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 inline void UnregisterFbxClass(const T* pFBX_TYPE_Class) + { + 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 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& pArray); + + /** Unregister a list of objects with the manager. + * \internal + * \param pArray The list of object to be unregistered. + */ + void UnregisterObjects(const FbxArray& 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 mObjects; + FbxArray mDocuments; + + FbxIOSettings* mIOSettings; + FbxIOPluginRegistry* mRegistry; + FbxUserNotification* mUserNotification; + FbxMessageEmitter* mMessageEmitter; + FbxArray mLocalizationManagerArray; + FbxArray mSceneReferenceArray; + FbxAnimEvaluator* mDefaultAnimationEvaluator; + + FbxArray mDestroyingObjects; + FbxArray 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 + +#endif /* _FBXSDK_CORE_MANAGER_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxmodule.h b/libs/fbx/include/fbxsdk/core/fbxmodule.h new file mode 100644 index 00000000..cdac5bb7 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxmodule.h @@ -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 + +#ifndef FBXSDK_ENV_WINSTORE + +#include + +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 + +#endif /* !FBXSDK_ENV_WINSTORE */ + +#endif /* _FBXSDK_CORE_MODULE_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxobject.h b/libs/fbx/include/fbxsdk/core/fbxobject.h new file mode 100644 index 00000000..2a6bad22 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxobject.h @@ -0,0 +1,1557 @@ +/**************************************************************************************** + + 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 fbxobject.h +#ifndef _FBXSDK_CORE_OBJECT_H_ +#define _FBXSDK_CORE_OBJECT_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +class FbxManager; +class FbxDocument; +class FbxImplementation; +class FbxImplementationFilter; +class FbxLibrary; +class FbxMessage; +class FbxPeripheral; +class FbxUserDataRecord; +class FbxConnectEvent; + +//! \internal Macro used to declare ClassId mechanics. +#define FBXSDK_CLASS_DECLARE(Class, Parent)\ +private:\ + Class(const Class&);\ + Class& operator=(const Class&);\ +protected:\ + virtual ~Class(){};\ +public:\ + static FbxClassId ClassId;\ + virtual FbxClassId GetClassId() const { return ClassId; }\ + friend class FBXSDK_NAMESPACE::FbxManager;\ + typedef Parent ParentClass;\ + static Class* Create(FbxManager* pManager, const char* pName);\ + +//! \internal Macro used to declare the FbxObject class. +#define FBXSDK_FBXOBJECT_DECLARE(Class, Parent)\ + FBXSDK_CLASS_DECLARE(Class, Parent)\ + FBXSDK_FRIEND_NEW()\ + static Class* Create(FbxObject* pContainer, const char* pName);\ +protected:\ + static Class* Allocate(FbxManager* pManager, const char* pName, const Class* pFrom);\ + +//! Macro used to declare a new class derived from FbxObject. +#define FBXSDK_OBJECT_DECLARE(Class, Parent)\ + FBXSDK_FBXOBJECT_DECLARE(Class, Parent)\ +protected:\ + Class(FbxManager& pManager, const char* pName) : Parent(pManager, pName){};\ +private: /* end of object declaration, put back private */\ + +//! Macro used to declare a new abstract class derived from FbxObject. +#define FBXSDK_ABSTRACT_OBJECT_DECLARE(Class, Parent)\ + FBXSDK_CLASS_DECLARE(Class, Parent)\ +protected:\ + static FbxObjectCreateProc Allocate;\ + Class(FbxManager& pManager, const char* pName) : Parent(pManager, pName){};\ +private: /* end of object declaration, put back private */\ + +//! Macro used to implement a new class derived from FbxObject. +#define FBXSDK_OBJECT_IMPLEMENT(Class)\ + FbxClassId Class::ClassId;\ + Class* Class::Create(FbxManager* pManager, const char* pName)\ + {\ + return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName);\ + }\ + Class* Class::Create(FbxObject* pContainer, const char* pName)\ + {\ + FBX_ASSERT_RETURN_VALUE(pContainer && pContainer->GetFbxManager(), NULL);\ + return (Class*)pContainer->GetFbxManager()->CreateNewObjectFromClassId(Class::ClassId, pName, pContainer);\ + }\ + Class* Class::Allocate(FbxManager* pManager, const char* pName, const Class* pFrom)\ + {\ + Class* lNewObject = FbxNew(*pManager, pName);\ + lNewObject->Construct(pFrom);\ + lNewObject->SetObjectFlags(FbxObject::eInitialized, true);\ + return lNewObject;\ + }\ + +//! Macro used to implement a new abstract class derived from FbxObject. +#define FBXSDK_ABSTRACT_OBJECT_IMPLEMENT(Class)\ + FbxClassId Class::ClassId;\ + FbxObjectCreateProc Class::Allocate = 0;\ + Class* Class::Create(FbxManager* pManager, const char* pName)\ + {\ + return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName);\ + }\ + +/** The base class of most FBX objects. Provides the benefits of connectivity, identity, run-time typing, + * properties, naming, copying, cloning, selection, and automated file IO. Most of + * the FBX SDK API deals with FbxObject pointers when it comes to manipulate objects in its simplest form. + * + * The ClassID mechanism replaces the dynamic_cast mechanism for efficient run-time type information. + * + * The FbxObject provides methods for managing the connections between objects. + * Using connections, objects can be related to each other to form hierarchies or structures. All of + * the FBX scene's object relations are expressed as connections between objects. Those connections can + * be altered as needed to reflect most kind of setups encountered in this world. For example, + * connections can be used to express parenting between transform nodes. Connections are not strict in + * the sense that we allow any type of objects to connect to any other type of objects. The meaning of + * the connection is purely semantic. As of yet, we do not provide the functionality to validate if + * the connections made by the users are allowed or not. + * + * FbxObject provide a property (FbxProperty) mechanism to describe characteristics of + * objects in a scene. Properties may be either static or dynamic. Static properties are defined in the class direction + * and can be accessed directly by their name on the object exposing them without + * the need for a search in the property list of the object. Dynamic properties can be added during run-time, + * while the program is running. Objects can have an unlimited amount of properties. + * Properties can be listed at run-time, allowing for a flexible support of custom data + * on objects, since they might be considered by the FBX file readers/writers depending on the flags set. + * + * Here is an example of a new empty minimal class template for FBX objects: + * \code + * //Declaration + * class MyClass : public FbxObject + * { + * FBXSDK_OBJECT_DECLARE(MyClass, FbxObject); //Be careful! The second parameter to this macro must be the parent class name! + * + * public: + * //Declare methods and properties here... + * }; + * \endcode + * \code + * //Implementation + * FBXSDK_OBJECT_IMPLEMENT(MyClass); + * \endcode + * Before the new class can be used, it needs to be registered to the manager with the following method: + * \code + * MyFbxManager->RegisterFbxClass("MyClassName", FBX_TYPE(MyClass), FBX_TYPE(FbxObject)); //Be careful! The 3rd parameter must be the parent class! If the parent class change, it must be updated here too! + * \endcode + * Then to create or delete instances of your new class, the following methods must be used: + * \code + * //Creating a new instance + * MyClass* MyObject = MyClass::Create(MyFbxManager, "Object Name"); + * + * //Deleting this instance + * MyObject->Destroy(); + * MyObject = NULL; + * \endcode + * \see FbxProperty + */ +class FBXSDK_DLL FbxObject : public FbxEmitter +{ + FBXSDK_FBXOBJECT_DECLARE(FbxObject, FbxEmitter); + +public: + //! \name General Object Management + //@{ + /** Templated test if this class is a hierarchical children of the specified class type. + * \return \c 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. */ + template inline bool Is() const { return GetClassId().Is(T::ClassId); } + + /** Retrieve the FbxManager this object belongs to. + * \return A pointer to the manager that this object belongs to. */ + FbxManager* GetFbxManager() const; + + /** Returns a const pointer to the document that contains this object. + * \return A const pointer to the document that contains this object or \c NULL if the object does not belong to any document. */ + FbxDocument* GetDocument() const; + + /** Returns a const pointer to the root document that contains this object. + * \return A const pointer to the root document that contains this object or \c NULL if the object does not belong to any document. + * \remarks It returns this pointer if this object is a document object and does not belong to any document. That means this object is the root document. */ + FbxDocument* GetRootDocument() const; + + /** Returns a const pointer to the scene that contains this object. + * \return A pointer to the scene that contains this object or \c NULL if the object does not belong to any scene. */ + FbxScene* GetScene() const; + + /** Unregister and delete this object from memory. This will also breaks all connections as well as removing all the instance of all the properties of this object with the object's class. + * \param pRecursive If true, all children (source) objects will also be unregistered and deleted. */ + void Destroy(bool pRecursive=false); + + /** Reset all the properties of this object to their default values. */ + void ResetProperties(); + //@} + + //! \name Object Flags Management + //@{ + //! Flags available to control objects. + enum EObjectFlag + { + eNone = 0, //!< No flags. + eInitialized = 1 << 0, //!< Automatically set when FbxObject::Construct() is completed. + eSystem = 1 << 1, //!< When set, object is deleted upon FbxManager destroy only. Use carefully! + eSavable = 1 << 2, //!< If set, object is stored in FBX file upon export. All objects are savable by default. + eSelected = 1 << 3, //!< Used by the selection mechanic to specify a selected object. + eHidden = 1 << 4, //!< Used for interface representation; if set, the object should not be visible. + eContentLoaded = 1 << 5, //!< Used by load-on-demand mechanic to specify if an object has its content loaded. + eDontLocalize = 1 << 6, //!< Used by asset builder; Do not localize this object + eCopyCalledByClone = 1 << 16 //!< Used internally. If set, modify the Copy behavior of the object + }; + + /** Set the state of object flags. + * \param pFlags Bit flags which value is going to be changed. + * \param pValue If \c true, bit flags will be set, otherwise bits will be un-set. */ + void SetObjectFlags(EObjectFlag pFlags, bool pValue); + + /** Get the state of object flags. + * \param pFlags Bit flags to query. + * \return \c true if the specified bit flags are all set. */ + bool GetObjectFlags(EObjectFlag pFlags) const; + + /** Override all object flags at once. + * \param pFlags The bit flags to set all the object flags to. + * \remark This function will override all flags; unspecified bit flags will be un-set. */ + void SetAllObjectFlags(FbxUInt pFlags); + + /** Get all object flags at once. + * \return All bit flags at once. */ + FbxUInt GetAllObjectFlags() const; + //@} + + //! \name Copying, Cloning and Referencing + //@{ + /** Copy an object content into this object. + * \param pObject The source object to copy data from. + * \return Returns the destination object being modified by the source. + * \remark This function replace the assignment operator (operator=). It will copy all property values and the name. Connections are NOT copied. */ + virtual FbxObject& Copy(const FbxObject& pObject); + + //! Types of clones that can be created for FbxObject. + enum ECloneType + { + eDeepClone, //!< A deep copy of the object. Changes to either the original or clone properties do not propagate to each other. + eReferenceClone //!< Changes to original object properties propagate to clone. Changes to clone properties do not propagate to original. + }; + + /** Creates a clone of this object. + * By default, the connections are NOT cloned. If the desired effect is to clone the connections as well, you must clone using the FbxCloneManager + * (refer to this class documentation for further details). + * + * \param pCloneType The type of clone to be created. By default, the clone type is eDeepClone. + * \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 pSet See remark section. + * \return The new clone, or NULL (if the specified clone type is not supported). + * \remark When doing either a "deep" or "reference" clone type, the clone will always get its properties values set from + * the source object properties values. + * \remark Since this is a virtual function, some classes might do additional tasks. + * \remark The \e pSet argument is not used in the default implementation of this method. Specialized implementations should + * cast this pointer to FbxCloneManager::CloneSet to have access to the cloned objects so far. Typically, this + * pointer is set by the clone manager. + */ + virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; + + /** Checks if this object is a reference clone of another object. + * \return \c True if this object is a clone of another object, \c false otherwise */ + bool IsAReferenceTo() const; + + /** If this object is a reference clone, returns the original object (from which the clone originates). + * \return The original object, or NULL (if this object is not a reference clone). */ + FbxObject* GetReferenceTo() const; + + /** Checks if any objects are reference cloned from this object. + * \return \c True if there are objects reference cloned from this object, \c false otherwise. */ + bool IsReferencedBy() const; + + /** Returns the number of objects that are reference clones of this object. + * \return The number of objects that are reference clones of this object. */ + int GetReferencedByCount() const; + + /** Returns a reference clone of this object at the specified index. + * \param pIndex The specified index, valid values are [0, GetReferencedByCount()) + * \return The reference clone, or NULL (if pIndex is out of range). */ + FbxObject* GetReferencedBy(int pIndex) const; + //@} + + /** + * \name Object Name Management + */ + //@{ + /** Sets the name of this object. + * \param pName The object name as a \c NULL terminated string. + */ + void SetName(const char* pName); + + /** Returns the full name of this object. + * \return The full name as a \c NULL terminated string. + */ + const char* GetName() const; + + /** Returns the name of the object without the namespace qualifier. + * \return The object name without the namespace qualifier. + */ + FbxString GetNameWithoutNameSpacePrefix() const; + + /** Returns the name of the object with the namespace qualifier. + * \return The object name with the namespace qualifier. + */ + FbxString GetNameWithNameSpacePrefix() const; + + /** Sets the initial name of the object. + * \param pName The object's initial name as a \c NULL terminated string. + */ + void SetInitialName(const char* pName); + + /** Returns the initial name of the object. + * \return The object's initial name as a \c NULL terminated string. + */ + const char* GetInitialName() const; + + /** Returns the namespace of the object. + * \return The object's namespace as a \c NULL terminated string. + */ + FbxString GetNameSpaceOnly(); + + /** Sets the namespace of the object. + * \param pNameSpace The object's namespace as a \c NULL terminated string. + */ + void SetNameSpace(FbxString pNameSpace); + + /** Returns an array of all the namespaces for this object + * \param identifier The identifier of the namespaces. + * \return The array of all namespaces. + */ + FbxArray GetNameSpaceArray(char identifier); + + /** Returns only the name (no namespace or prefix) of the object. + * \return The name only as a \c NULL terminated string. + */ + FbxString GetNameOnly() const; + + /** Returns the namespace qualifier. + * \return The namespace qualifier. + */ + FbxString GetNameSpacePrefix() const; + + /** Removes the prefix of pName + * \param pName Whose prefix is removed. + * \return A temporary string without prefix. + */ + static FbxString RemovePrefix(char* pName); + + /** Strips the prefix of pName + * \param lName Whose prefix is stripped. + * \return lName stripped of its prefix. + */ + static FbxString StripPrefix(FbxString& lName); + + /** Strips the prefix of pName + * \param pName Whose prefix is stripped. + * \return A temporary string stripped of its prefix. + */ + static FbxString StripPrefix(const char* pName); + + //!Returns the unique ID of this object. + const FbxUInt64& GetUniqueID() const; + //@} + + /** + * \name Selection management + */ + //@{ + /** Returns if this object is currently in a selected state. + * \return \c True if this object is selected, \c false otherwise. + */ + virtual bool GetSelected(); + + /** Sets whether this object is currently selected. + * \param pSelected The selection flag. + */ + virtual void SetSelected(bool pSelected); + //@} + + /** + * \name User data + */ + //@{ + /** Sets the data pointer for an user data record whose ID is pUserID. + * \param pUserID The ID of the user data record. + * \param pUserData The data pointer of the user data record. + * \remarks An user data record is composed of an ID and a data pointer. + * If the user data record identified by pUserID does not exist, a new user data record is created and its data pointer is set as pUserData. + */ + void SetUserDataPtr(const FbxUInt64& pUserID, void* pUserData); + + /** Returns the data pointer of an user data record whose ID is pUserID. + * \param pUserID The ID of the user data record. + * \return The data pointer of the user data record, \c NULL if the user data record is not found. + */ + void* GetUserDataPtr(const FbxUInt64& pUserID) const; + + /** Sets the data pointer for the user data record whose ID is the object ID. + * \param pUserData The data pointer of the user data record. + * \remarks An user data record is composed of an ID and a data pointer. + * If the user data record identified by pUserID does not exist, a new user data record is created and its data pointer is set as pUserData. + */ + inline void SetUserDataPtr(void* pUserData){ SetUserDataPtr(GetUniqueID(), pUserData); } + + /** Returns the data pointer of the user data record whose ID is the object ID. + * \return The data pointer of the user data record, \c NULL if the user data record is not found. + */ + inline void* GetUserDataPtr() const { return GetUserDataPtr(GetUniqueID()); } + //@} + + /** + * \name General Object Connection and Relationship Management + */ + //@{ + /** Connects this object to a source object. + * \param pObject The source object to which this object connects. + * \param pType The connection type between this object and the source object. + * \return \c True on success, \c false otherwise. + */ + inline bool ConnectSrcObject(FbxObject* pObject, FbxConnection::EType pType=FbxConnection::eNone) { return RootProperty.ConnectSrcObject(pObject,pType); } + + /** Judges whether this object connects with the source object. + * \param pObject The source object. + * \return \c True if this object connects with the source object, \c false otherwise. + */ + inline bool IsConnectedSrcObject(const FbxObject* pObject) const { return RootProperty.IsConnectedSrcObject(pObject); } + + /** Disconnects this object from a source object. + * \param pObject The source object from which this object will be disconnected. + * \return \c True on success, \c false otherwise. + */ + inline bool DisconnectSrcObject(FbxObject* pObject){ return RootProperty.DisconnectSrcObject(pObject); } + + /** Disconnects this object from all source objects. + * \return \c True if it disconnects all source objects successfully, \c false otherwise. + */ + inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(); } + + /** Disconnects this object from all source objects that satisfy a given criteria. + * \param pCriteria The given criteria. + * \return \c True if it disconnects all the source objects successfully, \c false otherwise. + */ + inline bool DisconnectAllSrcObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllSrcObject(pCriteria); } + + /** Returns the number of source objects with which this object connects. + * \return The number of source objects with which this object connects. + */ + inline int GetSrcObjectCount() const { return RootProperty.GetSrcObjectCount(); } + + /** Returns the number of source objects that satisfy the given criteria with which this object connects. + * \param pCriteria The given criteria. + * \return The number of source objects that satisfy the given criteria with which this object connects. + */ + inline int GetSrcObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetSrcObjectCount(pCriteria); } + + /** Returns the source object with which this object connects at the specified index. + * \param pIndex The specified index whose default value is 0. + * \return The source object at the specified index, NULL if not found. + */ + inline FbxObject* GetSrcObject(int pIndex=0) const { return RootProperty.GetSrcObject(pIndex); } + + /** Returns the source object that satisfies the criteria at the specified index with which this object connects. + * \param pCriteria The given criteria. + * \param pIndex The specified index whose default value is 0. + * \return The source object that satisfies the given criteria at the specified index, NULL if not found. + */ + inline FbxObject* GetSrcObject(const FbxCriteria& pCriteria, int pIndex=0) const { return RootProperty.GetSrcObject(pCriteria,pIndex); } + + /** Searches the source object with the specified name, starting at the specified index. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. + */ + inline FbxObject* FindSrcObject(const char* pName, int pStartIndex=0) const { return RootProperty.FindSrcObject(pName,pStartIndex); } + + /** Searches the source object with the specified name which satisfies the given criteria, starting at the specified index. + * \param pCriteria The given criteria. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. + */ + inline FbxObject* FindSrcObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return RootProperty.FindSrcObject(pCriteria,pName,pStartIndex); } + + /** Disconnects this object from all source objects of the specified class type. + * \return \c true if it disconnects all source objects successfully, \c false otherwise. */ + template inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(FbxCriteria::ObjectType(T::ClassId)); } + + /** Disconnects this object from all source objects that are of the specified class type and that satisfy the given criteria. + * \param pCriteria The given criteria. + * \return \c true if it disconnects all source objects successfully, \c false otherwise. */ + template inline bool DisconnectAllSrcObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } + + /** Returns the number of source objects of a specific class type with which this object connects. + * \return The number of source objects of the specified class type with which this object connects. */ + template inline int GetSrcObjectCount() const { return RootProperty.GetSrcObjectCount(FbxCriteria::ObjectType(T::ClassId)); } + + /** Returns the number of source objects with which this object connects that are the specified class type and that satisfy the given criteria. + * \param pCriteria The given criteria. + * \return The number of source objects that are the specified class type and that satisfy the given criteria. */ + template inline int GetSrcObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetSrcObjectCount(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } + + /** Returns the source object of the specified class type at the specified index. + * \param pIndex The specified index whose default value is 0. + * \return The source object of a specified class type at the specified index, NULL if not found. */ + template inline T* GetSrcObject(int pIndex=0) const { return (T*)RootProperty.GetSrcObject(FbxCriteria::ObjectType(T::ClassId), pIndex); } + + /** Returns the source object that is the specified class type and that satisfies the given criteria at the specified index. + * \param pCriteria The given criteria. + * \param pIndex The specified index whose default value is 0. + * \return The source object that is of the specified class type and that satisfies the given criteria at the specified index, NULL if not found. */ + template inline T* GetSrcObject(const FbxCriteria& pCriteria, int pIndex=0) const { return (T*)RootProperty.GetSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pIndex); } + + /** Searches the source object with the specified name that is the specified class type, starting at the specified index. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. */ + template inline T* FindSrcObject(const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindSrcObject(FbxCriteria::ObjectType(T::ClassId), pName, pStartIndex); } + + /** Searches the source object with the specified name that is the specified class type and that satisfies the given criteria, starting at the specified index. + * \param pCriteria The given criteria. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. */ + template inline T* FindSrcObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pName, pStartIndex); } + + /** Connects this object to one destination object. + * \param pObject The destination object with which this object connects. + * \param pType The connection type between this object and the destination object. + * \return \c True on success, \c false otherwise. + */ + inline bool ConnectDstObject(FbxObject* pObject, FbxConnection::EType pType=FbxConnection::eNone) { return RootProperty.ConnectDstObject(pObject,pType); } + + /** Judges whether this object connects with the destination object. + * \param pObject The destination object. + * \return \c True if this object connects with the destination object, \c false otherwise. + */ + inline bool IsConnectedDstObject(const FbxObject* pObject) const { return RootProperty.IsConnectedDstObject(pObject); } + + /** Disconnects this object from the destination object. + * \param pObject The destination object from which this object disconnects. + * \return \c True on success, \c false otherwise. + */ + inline bool DisconnectDstObject(FbxObject* pObject) { return RootProperty.DisconnectDstObject(pObject); } + + /** Disconnects this object from all destination objects. + * \return \c True if it disconnects all destination objects successfully, \c false otherwise. + */ + inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(); } + + /** Disconnects this object from all destination objects that satisfy given criteria. + * \param pCriteria The given criteria. + * \return \c True if it disconnects all destination objects successfully, \c false otherwise. + */ + inline bool DisconnectAllDstObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllDstObject(pCriteria); } + + /** Returns the number of destination objects with which this object connects. + * \return The number of destination objects with which this object connects. + */ + inline int GetDstObjectCount() const { return RootProperty.GetDstObjectCount(); } + + /** Returns the number of destination objects with which this object connects that satisfy the given criteria. + * \param pCriteria The given criteria. + * \return The number of destination objects with which this object connects that satisfy the given criteria. + */ + inline int GetDstObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetDstObjectCount(pCriteria); } + + /** Returns the destination object at the specified index with which this object connects. + * \param pIndex The specified index whose default value is 0. + * \return The destination object at the specified index, NULL if not found. + */ + inline FbxObject* GetDstObject(int pIndex=0) const { return RootProperty.GetDstObject(pIndex); } + + /** Returns the destination object with which this object connects that satisfies the given criteria at the specified index. + * \param pCriteria The given criteria. + * \param pIndex The specified index whose default value is 0. + * \return The destination object that satisfies the given criteria at the specified index, NULL if not found. + */ + inline FbxObject* GetDstObject(const FbxCriteria& pCriteria, int pIndex=0) const { return RootProperty.GetDstObject(pCriteria,pIndex); } + + /** Searches the destination object with the specified name, starting at the specified index. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The destination object with the name, NULL if not found. + */ + inline FbxObject* FindDstObject(const char* pName, int pStartIndex=0) const { return RootProperty.FindDstObject(pName,pStartIndex); } + + /** Searches the destination object with the specified name which satisfies the given criteria, starting at the specified index. + * \param pCriteria The given criteria. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The destination object with the name, NULL if not found. + */ + inline FbxObject* FindDstObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return RootProperty.FindDstObject(pCriteria,pName,pStartIndex); } + + /** Disconnects this object from all destination objects of the specified class type. + * \return \c true if it disconnects all destination objects of the specified class type successfully, \c false otherwise. */ + template inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(FbxCriteria::ObjectType(T::ClassId)); } + + /** Disconnects this object from all destination objects that are the specified class type and that satisfy the given criteria. + * \param pCriteria The given criteria. + * \return \c true if it disconnects all destination objects successfully, \c false otherwise. */ + template inline bool DisconnectAllDstObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } + + /** Returns the number of destination objects of the specified class type with which this object connects. + * \return The number of destination objects of the specified class type with which this object connects. */ + template inline int GetDstObjectCount() const { return RootProperty.GetDstObjectCount(FbxCriteria::ObjectType(T::ClassId)); } + + /** Returns the number of destination objects with which this object connects that are the specified class type and that satisfy the given criteria. + * \param pCriteria The given criteria. + * \return The number of destination objects that are the specified class type and that satisfy the given criteria. */ + template inline int GetDstObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetDstObjectCount(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } + + /** Returns the destination object with which this object connects that is the specified class type at the specified index. + * \param pIndex The specified index whose default value is 0. + * \return The destination object of the specified class type at the specified index, NULL if not found. */ + template inline T* GetDstObject(int pIndex=0) const { return (T*)RootProperty.GetDstObject(FbxCriteria::ObjectType(T::ClassId), pIndex); } + + /** Returns the destination object with which this object connects that is the specified class type and that satisfies the given criteria at the specified index. + * \param pCriteria The given criteria. + * \param pIndex The specified index whose default value is 0. + * \return The destination object that is the specified class type and that satisfies the given criteria at the specified index, NULL if not found. */ + template inline T* GetDstObject(const FbxCriteria& pCriteria, int pIndex=0) const { return (T*)RootProperty.GetDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pIndex); } + + /** Searches the destination object with the specified name which is of the specified class type, starting at the specified index. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. */ + template inline T* FindDstObject(const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindDstObject(FbxCriteria::ObjectType(T::ClassId), pName, pStartIndex); } + + /** Searches the destination object with the specified name that is the specified class type and that satisfies the given criteria, starting at the specified index. + * \param pCriteria The given criteria. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. */ + template inline T* FindDstObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pName, pStartIndex); } + //@} + + /** + * \name Property Management + */ + //@{ + /** Returns the first property of this object. + * \return The first property of this object. + */ + inline FbxProperty GetFirstProperty() const + { + return RootProperty.GetFirstDescendent(); + } + + /** Returns the next property of this object that follows the specified property. + * \param pProperty The specified property. + * \return The next property of this object that follows pProperty. + */ + inline FbxProperty GetNextProperty(const FbxProperty& pProperty) const + { + return RootProperty.GetNextDescendent(pProperty); + } + + /** Searches a property by name. + * \param pName The property name. + * \param pCaseSensitive Whether the name is case-sensitive. + * \return A valid FbxProperty if found, else an invalid FbxProperty. See FbxProperty::IsValid() + */ + inline FbxProperty FindProperty(const char* pName, bool pCaseSensitive = true) const + { + return RootProperty.Find(pName, pCaseSensitive ); + } + + /** Searches a property by name and data type. + * \param pName The property name. + * \param pDataType The data type of the property. + * \param pCaseSensitive Whether the name is case-sensitive. + * \return A valid FbxProperty if the property is found, else an invalid FbxProperty. See FbxProperty::IsValid() + */ + inline FbxProperty FindProperty(const char* pName, const FbxDataType& pDataType, bool pCaseSensitive = true) const + { + return RootProperty.Find(pName, pDataType, pCaseSensitive ); + } + + /** Searches a property by full name. + * \param pName The full name of the property as a \c NULL terminated string. + * \param pCaseSensitive whether or not the name is case-sensitive. + * \return A valid FbxProperty if the property is found, else + * an invalid FbxProperty. See FbxProperty::IsValid() + */ + inline FbxProperty FindPropertyHierarchical(const char* pName, bool pCaseSensitive = true) const + { + return RootProperty.FindHierarchical(pName, pCaseSensitive ); + } + + /** Searches a property by full name and data type. + * \param pName The full name of the property as a \c NULL terminated string. + * \param pDataType The data type of the property. + * \param pCaseSensitive whether or not the name is case-sensitive. + * \return A valid FbxProperty if the property is found, else + * an invalid FbxProperty. See FbxProperty::IsValid() + */ + inline FbxProperty FindPropertyHierarchical(const char* pName, const FbxDataType& pDataType, bool pCaseSensitive = true) const + { + return RootProperty.FindHierarchical(pName, pDataType, pCaseSensitive ); + } + + /** Returns the class root property. + * \return The class root property if it exists, else an invalid FbxProperty. See FbxProperty::IsValid(). + * \remarks Class FbxObject and its sub-classes all have a class root property. This class root property contains basic information about the class type, such as the class name. + */ + FbxProperty GetClassRootProperty(); + + /** Connects this object to a source property. + * \param pProperty The source property with which this object connects. + * \return \c True on success, \c false otherwise. + */ + inline bool ConnectSrcProperty(const FbxProperty& pProperty) { return RootProperty.ConnectSrcProperty(pProperty); } + + /** Determines whether this object connects with the specified source property. + * \param pProperty The specified source property. + * \return \c True if this object connects with the specified source property, \c false otherwise. + */ + inline bool IsConnectedSrcProperty(const FbxProperty& pProperty) { return RootProperty.IsConnectedSrcProperty(pProperty); } + + /** Disconnects this object from the specified source property. + * \param pProperty The specified source property. + * \return \c True on success, \c false otherwise. + */ + inline bool DisconnectSrcProperty(const FbxProperty& pProperty) { return RootProperty.DisconnectSrcProperty(pProperty); } + + /** Returns the number of source properties with which this object connects. + * \return The number of source properties with which this object connects. + */ + inline int GetSrcPropertyCount() const { return RootProperty.GetSrcPropertyCount(); } + + /** Returns the source property at the specified index with which this object connects. + * \param pIndex The specified index. + * \return The source property at the specified index. + */ + inline FbxProperty GetSrcProperty(int pIndex=0) const { return RootProperty.GetSrcProperty(pIndex); } + + /** Searches a source property with which this object connects that has a specific name, starting at the specified index. + * \param pName The specified property name. + * \param pStartIndex The start index. + * \return The source property with the specified name. + */ + inline FbxProperty FindSrcProperty(const char* pName,int pStartIndex=0) const { return RootProperty.FindSrcProperty(pName,pStartIndex); } + + /** Connects this object to a destination property. + * \param pProperty The destination property with which this object connects. + * \return \c True on success, \c false otherwise. + */ + inline bool ConnectDstProperty(const FbxProperty& pProperty) { return RootProperty.ConnectDstProperty(pProperty); } + + /** Determines if this object connects with the specified destination property. + * \param pProperty The specified destination property. + * \return \c True if this object connects with the specified destination property, \c false otherwise. + */ + inline bool IsConnectedDstProperty(const FbxProperty& pProperty) { return RootProperty.IsConnectedDstProperty(pProperty); } + + /** Disconnects this object from the specified destination property. + * \param pProperty The specified destination property. + * \return \c True on success, \c false otherwise. + */ + inline bool DisconnectDstProperty(const FbxProperty& pProperty) { return RootProperty.DisconnectDstProperty(pProperty); } + + /** Returns the number of destination properties with which this object connects. + * \return The number of destination properties with which this object connects. + */ + inline int GetDstPropertyCount() const { return RootProperty.GetDstPropertyCount(); } + + /** Returns the destination property at the specified index with which this object connects. + * \param pIndex The specified index. + * \return The destination property at the specified index. + */ + inline FbxProperty GetDstProperty(int pIndex=0) const { return RootProperty.GetDstProperty(pIndex); } + + /** Searches a destination property with which this object connects that has a specific name, starting at the specified index. + * \param pName The specified property name. + * \param pStartIndex The start index. + * \return The destination property with the specified name. + */ + inline FbxProperty FindDstProperty(const char* pName, int pStartIndex=0) const { return RootProperty.FindDstProperty(pName,pStartIndex); } + //@} + + /** + * \name Off-Loading Management + * \remarks You can modify the unloaded state flag using the SetObjectFlags() + * method. The ContentIsUnloaded() method below (implemented in this class) + * is simply a synonym of GetObjectFlags(eCONTENT_UNLOADED_FLAG) + */ + //@{ + /** Unloads this object's content using the offload peripheral that is currently set in the document + * then flushes it from memory. + * \return 2 if the object's content is already unloaded or 1 if + * this object's content has been successfully unloaded to the current + * peripheral. + * + * \remarks If the content is locked more than once, or the peripheral cannot handle + * this object's unloading, or if an error occurs, this method returns 0 and does not flush the content. + */ + int ContentUnload(); + + /** Loads this object's content using the offload peripheral that is currently set in the document. + * \return 1 if this object's content has been successfully loaded from the current + * peripheral, 2 if the content is already loaded, and 0 if an error occurs or + * the object's content is locked. + * \remarks On a successful Load attempt, the object content is locked. + */ + int ContentLoad(); + + /** Judges if this object's content is loaded. + * \return \c True if this object's content is loaded, \c false otherwise. + * \remarks An object that has not been filled yet must be considered + * unloaded. + */ + bool ContentIsLoaded() const; + + /** Decreases the content lock count of an object. If the content lock count of an object + * is greater than 0, the content of the object is considered locked. + */ + void ContentDecrementLockCount(); + + /** Increases the content lock count of an object. If the content lock count of an object + * is greater than 0, the content of the object is considered locked. + */ + void ContentIncrementLockCount(); + + /** Judges if this object's content is locked. The content is considered locked if the content lock count + * is greater than 0 + * \return \c True if this object's content is locked, \c false otherwise. + * \remarks A locked state prevents the object content from being unloaded from memory but + * does not block the loading. + */ + bool ContentIsLocked() const; + + /** Writes the content of the object to the given stream. + * \param pStream The destination stream. + * \return \c True if the content is successfully processed + * by the receiving stream, \c false otherwise. + */ + virtual bool ContentWriteTo(FbxStream& pStream) const; + + /** Reads the content of the object from the given stream. + * \param pStream The source stream. + * \return \c True if the object fills itself with the received data + * from the stream successfully, \c false otherwise. + */ + virtual bool ContentReadFrom(const FbxStream& pStream); + //@} + + /** + * \name Logging. + */ + //@{ + /** Emits a message in all available message emitters in the document or SDK manager. + * \param pMessage The message to emit. + * \remarks The ownership of the message is transferred, don't delete it. + */ + void EmitMessage(FbxMessage* pMessage) const; + //@} + + /** + * \name Localization helper. + */ + //@{ + /** Localization helper function, it calls the implementation of FBX SDK manager. + * Sub-classes that manage their own localization could over-ride this function. + * \param pID The identifier of the text to be localized. + * \param pDefault The default text. Uses pID as the default text if pDefault is NULL. + * \return The localized text or the default text if the text can't be localized, . + */ + virtual const char* Localize(const char* pID, const char* pDefault=NULL) const; + //@} + + /** + * \name Application Implementation Management + */ + //@{ + /** Returns a handle on the parent library of this object. + * \return The parent library of this object, or \c NULL if the parent library doesn't exist. + */ + FbxLibrary* GetParentLibrary() const; + + /** Adds an implementation. + * \param pImplementation The implementation to be added. + * \return \c True on success, \c false otherwise. + * \remarks To succeed this function must be called with an implementation that has not already been added to this node. + */ + bool AddImplementation(FbxImplementation* pImplementation); + + /** Removes an implementation. + * \param pImplementation The implementation to be removed. + * \return \c True on success, \c false otherwise. + * \remarks To succeed this function must be called with an implementation that has already been added to this node. + */ + bool RemoveImplementation(FbxImplementation* pImplementation); + + /** Determines if this shading node has a default implementation. + * \return \c True if this shading node has a default implementation, \c false otherwise. + */ + bool HasDefaultImplementation(void) const; + + /** Returns the default implementation of this shading node. + * \return The default implementation of this shading node. + */ + FbxImplementation* GetDefaultImplementation(void) const; + + /** Sets the default implementation of this shading node. + * \param pImplementation The implementation to be set. + * \return \c True on success, \c false otherwise. + * \remarks To succeed this function must be called with an implementation that has already been added to this node. + * Only the implementation which has already been added can be set as the default implementation. + */ + bool SetDefaultImplementation(FbxImplementation* pImplementation); + + /** Returns the number of implementations that satisfy a given criteria. + * \param pCriteria The given criteria. + * \returns The number of implementations. + */ + int GetImplementationCount(const FbxImplementationFilter* pCriteria=NULL) const; + + /** Returns the implementation at the specified index that satisfies the given criteria. + * \param pIndex The specified index. + * \param pCriteria The given criteria. + * \return The implementation at the specified index, NULL if not found. + */ + FbxImplementation* GetImplementation(int pIndex, const FbxImplementationFilter* pCriteria=NULL) const; + //@} + + /** + * \name Object Storage && Retrieval + */ + //@{ + /** Returns the URL of this object. + * \return The URL of this object. + * \remarks The URL indicates where the object is stored. + */ + virtual FbxString GetUrl() const; + + /** Sets the URL of this object. + * \param pUrl The URL to be set. + * \return \c True on success, \c false otherwise. + * \remarks The URL indicates where the object is stored. + */ + virtual bool SetUrl(char* pUrl); + //@} + + /** \name Run-time ClassId Management */ + //@{ + /** Set the run-time ClassId for this class. In most contexts, users do not have to change the run-time ClassId, they are automatically generated when registered a new class during run-time. + * \param pClassId The ClassId to set as the run-time ClassId for this object. */ + void SetRuntimeClassId(const FbxClassId& pClassId); + + /** Retrieve the run-time ClassId for this object. + * \return The run-time ClassId for this object. */ + FbxClassId GetRuntimeClassId() const; + + /** Test if this class is a hierarchical children of the specified class type. This test will be performed on the run-time class registered with the FBX SDK Manager rather than the static ClassId generated at compile time. + * \param pClassId The class type to test against self. + * \return True if the object is a hierarchical children of the type specified. + * \remarks 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 IsRuntime(const FbxClassId& pClassId) const; + + /** Find out if the ClassId was registered during run-time rather than at compile time. + * \return True if the run-time ClassId is inequal to the ClassId. */ + bool IsRuntimePlug() const; + //@} + + /** Compact the memory used by this object. + * \remark Note that this function might not result in saved memory because it depends if the sub-class implements it, or if any memory can actually be saved. */ + virtual void Compact(); + + //! The root property that holds all children property for this object + FbxProperty RootProperty; + +protected: + /** Optional constructor override, automatically called by default constructor. + * \param pFrom If not null, the function must take it into account like a copy constructor. + * \remark In case it is decided to override this function, do not forget to call ParentClass::Construct(pFrom) at the beginning. */ + virtual void Construct(const FbxObject* pFrom); + + /** Optional property constructor override, automatically called by default constructor. + * \param pForceSet If the property value must be set regardless of default value. + * \remark If your object have properties, they must be initialized in this function. */ + virtual void ConstructProperties(bool pForceSet); + + /** Optional destructor override, automatically called by default destructor. + * \param pRecursive If true, children objects should be destroyed as well. + * \remark In case it is decided to override this function, do not forget to call ParentClass::Destruct(pResursive) at the end. */ + virtual void Destruct(bool pRecursive); + + /** Clears this object's content from memory. This method must be overridden in the derived classes. + * \remark This method is called by ContentUnload() if the object content's unloading is successful. */ + virtual void ContentClear(); + + /** Retrieves the peripheral of that object. + * \return The current peripheral for that object + * \remark A peripheral manipulates the content of an object. For instance, a peripheral can load the connections of an object on demand. */ + virtual FbxPeripheral* GetPeripheral(); + +/***************************************************************************************************************************** +** 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: + virtual bool Compare(FbxObject* pOtherObject); + + //Basic comparison operator implementation. It simply compare property values between source and target. + //NOTE: If a property cannot be found on one of the object, the comparison fails (return false). + //Different classid will fail comparison as well as different property count. Reference properties are not compared. + bool operator==(const FbxObject& pObject); + bool operator!=(const FbxObject& pObject); + + virtual void SetDocument(FbxDocument* pDocument); + + inline FbxPropertyHandle& GetPropertyHandle() { return RootProperty.mPropertyHandle; } + + //Important note: If this function is not implemented, the pFileSubTypeName string used when registering your + //class via FbxManager::RegisterFbxClass will be used instead. This makes it useless to re-implement this + //function if you do not intend to return a different string for the same class. + virtual const char* GetTypeName() const; + virtual FbxStringList GetTypeFlags() const; + + // This function will go as deep as possible to clear the Connection list without sending + // notifications to the connections to give them the chance to Disconnect themselves. + // This is a bypass of the intended workflow and should be used with care. + void WipeAllConnections(); + + //Used as global flag to modify the behavior of FbxObject::Destruct() during a ForceKill() on the scene. This is for internal use. + static void SetWipeMode(bool pState); + static bool GetWipeMode(); + +protected: + FbxObject(FbxManager& pManager, const char* pName); + + enum EPropertyNotifyType + { + ePropertySetRequest, + ePropertySet, + ePropertyGet + }; + + virtual bool ConnectNotify(const FbxConnectEvent& pEvent); + virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty); + bool Copyable(const FbxObject& pObject); + +private: + void CopyPropertiesFrom(const FbxObject& pFrom); + void SetClassRootProperty(FbxProperty& lProperty); + int GetFlatPropertyCount() const; + + FbxNameHandler mName; + FbxClassId mRuntimeClassId; + FbxUserDataRecord* mUserData; + FbxManager* mManager; + FbxImplementation* mDefaultImplementation; + FbxUInt64 mUniqueID; + FbxInt32 mObjectFlags; + FbxInt32 mContentLockCount; + FbxInt32 mUserDataCount; + static bool mWipeMode; + + friend class FbxProperty; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** A utility class for iterating over the properties (FbxProperty) of any FbxObject. +* \nosubgrouping +*/ +template class FbxIterator +{ +public: + /** Constructor. + *\param pObject The object whose properties are going to be iterated. + */ + FbxIterator(const FbxObject* pObject) : mObject(pObject) {} + + /** Get the first property of the object. + * \return The first property of the object. + */ + inline const FbxProperty& GetFirst() { mProperty = mObject->GetFirstProperty(); return mProperty; } + + /** Get next property of the object. + * \return The next property of the object. + */ + inline const FbxProperty& GetNext() { mProperty = mObject->GetNextProperty(mProperty); return mProperty; } + +private: + FbxProperty mProperty; + const FbxObject* mObject; +}; + +/** A utility class for iterating over source objects that connect to property (FbxProperty) or object (FbxObject). +* \nosubgrouping +*/ +class FbxIteratorSrcBase +{ +public: + /** + * Constructor. + * \param pProperty Property object. The iterator will iterate source objects that connect to it. + * \param pClassId The class ID specifies the type of the source objects. + */ + inline FbxIteratorSrcBase(FbxProperty& pProperty,FbxClassId pClassId) : + mProperty(pProperty), + mClassId(pClassId), + mSize(0), + mIndex(-1) + { + ResetToBegin(); + } + + /** + * Constructor. + * \param pObject FBX object. The iterator will iterate source objects that connect to it. + * \param pClassId The class ID specifies the type of the source objects. + */ + inline FbxIteratorSrcBase(FbxObject* pObject,FbxClassId pClassId) : + mProperty(pObject->RootProperty), + mClassId(pClassId), + mSize(0), + mIndex(-1) + { + ResetToBegin(); + } + + /** + * Get the first source object that connects to the property or object. + * \return The first source object. + */ + inline FbxObject* GetFirst() + { + ResetToBegin(); + return GetNext(); + } + + /** + * Get next source object that connects to the property or object. + * \return The next source object. If there are no more objects, return NULL. + */ + inline FbxObject* GetNext() + { + mIndex++; + return ((mIndex>=0) && (mIndex=0) && (mIndexmSize) mIndex--; + return GetPrevious(); + } + +protected: + /** + * Reset the iterate index to the beginning. + */ + inline void ResetToBegin() + { + mSize = mProperty.GetSrcObjectCount(FbxCriteria::ObjectType(mClassId)); + mIndex = -1; + } + + /** + * Reset the iterate index to the end. + */ + inline void ResetToEnd() + { + mSize = mProperty.GetSrcObjectCount(FbxCriteria::ObjectType(mClassId)); + mIndex = mSize; + } + + FbxProperty mProperty; //! The property to iterate. If iterate an object, this is the root property of the object. + FbxClassId mClassId; //! The class ID specifies the type of the source objects to be retrieved. + int mSize; //! The number of source objects whose type is specified by mClassId. + int mIndex; //! Iterate index. +}; + +/** + * A utility class for iterating over source objects that connect to property (FbxProperty) or object (FbxObject). + * The class is a wrapper of FbxIteratorSrcBase with template. + * \nosubgrouping + */ +template class FbxIteratorSrc : protected FbxIteratorSrcBase +{ +public: + /** + * Constructor. + * \param pObject FBX object. The iterator will iterate source objects that connect to it. + */ + inline FbxIteratorSrc(FbxObject* pObject) : FbxIteratorSrcBase(pObject,Type::ClassId) {} + + /** + * Constructor. + * \param pProperty Property object. The iterator will iterate source objects that connect to it. + */ + inline FbxIteratorSrc(FbxProperty& pProperty) : FbxIteratorSrcBase(pProperty,Type::ClassId) {} + + /** + * Get the first source object that connects to the property or object. + * \return The first source object. + */ + inline Type* GetFirst() { return (Type*)FbxIteratorSrcBase::GetFirst(); } + + /** + * Get next source object that connects to the property or object. + * \return The next source object. If there are no more objects, return NULL. + */ + inline Type* GetNext() { return (Type*)FbxIteratorSrcBase::GetNext(); } + + /** + * Get next source object that connects to the property or object. + * \return The next source object. If there are no more objects, return NULL. + * \remark This method makes sure the iterate index is not out of bounds. + */ + inline Type* GetSafeNext() { return (Type*)FbxIteratorSrcBase::GetSafeNext(); } + + /** + * Get the last source object that connects to the property or object. + * \return The last source object. + */ + inline Type* GetLast() { return (Type*)FbxIteratorSrcBase::GetLast(); } + + + /** + * Get previous source object that connects to the property or object. + * \return The previous source object. If there are no more objects, return NULL. + */ + inline Type* GetPrevious() { return (Type*)FbxIteratorSrcBase::GetPrevious(); } + + /** + * Get previous source object that connects to the property or object. + * \return The previous source object. If there are no more objects, return NULL. + * \remark This method makes sure the iterate index is not out of bounds. + * If the iterate index is out of bounds, the last source object is returned. + */ + inline Type* GetSafePrevious() { return (Type*)FbxIteratorSrcBase::GetSafePrevious(); } +}; + +/** A utility class for iterating over destination objects that connect to property (FbxProperty) or object (FbxObject). +* \nosubgrouping +*/ +class FbxIteratorDstBase +{ +protected: + /** The property to iterate. If iterate an object, this is the root property of the object. */ + FbxProperty mProperty; + /** The class ID specifies the type of the destination objects to be retrieved. */ + FbxClassId mClassId; + /** The number of destination objects whose type is specified by mClassId. */ + int mSize; + /** Iterate index. */ + int mIndex; + +public: + /** + * Constructor. + * \param pProperty Property object. The iterator will iterate destination objects that connect to it. + * \param pClassId The class ID specifies the type of the destination objects. + */ + inline FbxIteratorDstBase(FbxProperty& pProperty,FbxClassId pClassId) : + mProperty(pProperty), + mClassId(pClassId), + mSize(0), + mIndex(-1) + { + ResetToBegin(); + } + + /** + * Constructor. + * \param pObject FBX object. The iterator will iterate source objects that connect to it. + * \param pClassId The class ID specifies the type of the source objects. + */ + inline FbxIteratorDstBase(FbxObject* pObject,FbxClassId pClassId) : + mProperty(pObject->RootProperty), + mClassId(pClassId), + mSize(0), + mIndex(-1) + { + ResetToBegin(); + } + + /** + * Get the first destination object that connects to the property or object. + * \return The first destination object. + */ + inline FbxObject* GetFirst() + { + ResetToBegin(); + return GetNext(); + } + + /** + * Get next destination object that connects to the property or object. + * \return The next destination object. If there are no more objects, return NULL. + */ + inline FbxObject* GetNext() + { + mIndex++; + return ((mIndex>=0) && (mIndex=0) && (mIndexmSize) mIndex--; + return GetPrevious(); + } + +protected: + /** + * Reset the iterate index to the beginning. + */ + inline void ResetToBegin() + { + mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId)); + mIndex = -1; + } + + /** + * Reset the iterate index to the end. + */ + inline void ResetToEnd() + { + mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId)); + mIndex = mSize; + } +}; + +/** + * A utility class for iterating over destination objects that connect to property (FbxProperty) or object (FbxObject). + * The class is a wrapper of FbxIteratorDstBase with template. + * \nosubgrouping + */ +template class FbxIteratorDst : protected FbxIteratorDstBase +{ +public: + /** + * Constructor. + * \param pObject FBX object. The iterator will iterate destination objects that connect to it. + */ + inline FbxIteratorDst(FbxObject* pObject) : FbxIteratorDstBase(pObject,Type::ClassId) {} + + /** + * Constructor. + * \param pProperty Property object. The iterator will iterate destination objects that connect to it. + */ + inline FbxIteratorDst(FbxProperty& pProperty) : FbxIteratorDstBase(pProperty,Type::ClassId) {} + + /** + * Get the first destination object that connects to the property or object. + * \return The first destination object. + */ + inline Type* GetFirst() { return (Type*)FbxIteratorDstBase::GetFirst(); } + + /** + * Get next destination object that connects to the property or object. + * \return The next destination object. If there are no more objects, return NULL. + */ + inline Type* GetNext() { return (Type*)FbxIteratorDstBase::GetNext(); } + + /** + * Get next destination object that connects to the property or object. + * \return The next destination object. If there are no more objects, return NULL. + * \remark This method makes sure the iterate index is not out of bounds. + */ + inline Type* GetSafeNext() { return (Type*)FbxIteratorDstBase::GetSafeNext(); } + + /** + * Get the last destination object that connects to the property or object. + * \return The last destination object. + */ + inline Type* GetLast() { return (Type*)FbxIteratorDstBase::GetLast(); } + + /** + * Get previous destination object that connects to the property or object. + * \return The previous destination object. If there are no more objects, return NULL. + */ + inline Type* GetPrevious() { return (Type*)FbxIteratorDstBase::GetPrevious(); } + + /** + * Get previous destination object that connects to the property or object. + * \return The previous destination object. If there are no more objects, return NULL. + * \remark This method makes sure the iterate index is not out of bounds. + * If the iterate index is out of bounds, the last destination object is returned. + */ + inline Type* GetSafePrevious() { return (Type*)FbxIteratorDstBase::GetSafePrevious(); } +}; + +/** Convert the class type parameter into a C class parameter for other function inputs. + * Usage example: + * \code + * //Assuming MyCamera is a valid FbxCamera object + * bool AreCamerasObject = MyCamera->Is(); //Should return true :) + * \endcode + */ +#define FBX_TYPE(class) ((const class*)0) + +/** Safe casting of FBX SDK objects into other FBX SDK class types. This cast will perform + * the complete test to make sure the object inherits from the requested class type. This is + * the equivalent of a dynamic_cast but much faster. + * \param pObject The object to try to cast into T type. + * \return A non-null pointer if the cast was successful. + */ +template inline T* FbxCast(FbxObject* pObject) +{ + return pObject && pObject->Is() ? (T*)pObject : 0; +} + +/** Safe const casting of FBX SDK objects into other FBX SDK class types. This cast will perform + * the complete test to make sure the object inherits from the requested class type. This is + * the equivalent of a dynamic_cast but much faster. + * \param pObject The object to try to cast into T type. + * \return A non-null pointer if the cast was successful. + */ +template inline const T* FbxCast(const FbxObject* pObject) +{ + return pObject && pObject->Is() ? (const T*)pObject : 0; +} + +//! Macro used to iterate over source or destination objects that connect to property (FbxProperty) or object (FbxObject). +#define FbxForEach(Iterator, Object) for((Object)=(Iterator).GetFirst();(Object)!=0;(Object)=(Iterator).GetNext()) + +//! Macro used to reversely iterate over source or destination objects that connect to property (FbxProperty) or object (FbxObject) +#define FbxForEachReverse(Iterator, Object) for(Object=(Iterator).GetLast();(Object)!=0;Object=(Iterator).GetPrevious()) + +/***************************************************************************************************************************** +** 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 FbxConnectEvent +{ +public: + enum EType + { + eConnectRequest, + eConnect, + eConnected, + eDisconnectRequest, + eDisconnect, + eDisconnected + }; + + enum EDirection + { + eSource, + eDestination + }; + + inline FbxConnectEvent(EType pType,EDirection pDir,FbxProperty *pSrc,FbxProperty *pDst) : + mType(pType), + mDirection(pDir), + mSrc(pSrc), + mDst(pDst) + { + } + inline EType GetType() const { return mType; } + inline EDirection GetDirection() const { return mDirection; } + inline FbxProperty& GetSrc() const { return *mSrc; } + inline FbxProperty& GetDst() const { return *mDst; } + template inline T* GetSrcIfObject() const { return mSrc->IsRoot() ? FbxCast(mSrc->GetFbxObject()) : (T*)0; } + template inline T* GetDstIfObject() const { return mDst->IsRoot() ? FbxCast(mDst->GetFbxObject()) : (T*)0; } + +private: + EType mType; + EDirection mDirection; + FbxProperty* mSrc; + FbxProperty* mDst; +}; + +class FbxObjectPropertyChanged : public FbxEvent +{ + FBXSDK_EVENT_DECLARE(FbxObjectPropertyChanged); + +public: + FbxObjectPropertyChanged(FbxProperty pProp) : mProp(pProp) {} + FbxProperty mProp; +}; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +#include + +#endif /* _FBXSDK_CORE_OBJECT_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxperipheral.h b/libs/fbx/include/fbxsdk/core/fbxperipheral.h new file mode 100644 index 00000000..d5e72659 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxperipheral.h @@ -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 + +#include + +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 + +#endif /* _FBXSDK_CORE_PERIPHERAL_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxplugin.h b/libs/fbx/include/fbxsdk/core/fbxplugin.h new file mode 100644 index 00000000..960e4d9c --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxplugin.h @@ -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 + +#ifndef FBXSDK_ENV_WINSTORE + +#include +#include +#include + +#include + +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(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 inline FbxEventHandler* Bind(void (ListernerType::*pFunc)(const EventType*)) + { + return FbxListener::Bind(*(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 + +#endif /* !FBXSDK_ENV_WINSTORE */ + +#endif /* _FBXSDK_CORE_PLUGIN_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxplugincontainer.h b/libs/fbx/include/fbxsdk/core/fbxplugincontainer.h new file mode 100644 index 00000000..4e5d3894 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxplugincontainer.h @@ -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 + +#ifndef FBXSDK_ENV_WINSTORE + +#include +#include + +#include + +/** 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 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 + +#endif /* !FBXSDK_ENV_WINSTORE */ + +#endif /* _FBXSDK_CORE_PLUGIN_CONTAINER_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxproperty.h b/libs/fbx/include/fbxsdk/core/fbxproperty.h new file mode 100644 index 00000000..41369fc2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxproperty.h @@ -0,0 +1,1238 @@ +/**************************************************************************************** + + 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 fbxproperty.h +#ifndef _FBXSDK_CORE_PROPERTY_H_ +#define _FBXSDK_CORE_PROPERTY_H_ + +#include + +#include +#include +#include +#include +#include +#include + +#include + +class FbxObject; +class FbxAnimStack; +class FbxAnimLayer; +class FbxAnimCurveNode; +class FbxAnimCurve; +class FbxAnimEvaluator; + +/** \brief Class to hold user properties. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxProperty +{ +public: + /** + * \name Constructor and Destructor. + */ + //@{ + /** Creates a runtime property on the specified property. + * \param pCompoundProperty The parent property of this property. + * \param pDataType The data type of this property. + * \param pName The property name. + * \param pLabel The label of this property. + * \param pCheckForDup If \c true, parent property checks if it has a child property already with pName, if \c false, the new property is created. + * \param pWasFound If pCheckForDup is \c true, this flag is set to indicate whether the pCompoundProperty already has a child property with pName. + */ + static FbxProperty Create(const FbxProperty& pCompoundProperty, const FbxDataType& pDataType, const char* pName, const char* pLabel="", bool pCheckForDup=true, bool* pWasFound=NULL); + + /** Creates a runtime property on the specified object. + * \param pObject The object on which the property will be created. + * \param pDataType The data type of this property. + * \param pName The property name. + * \param pLabel The label of this property. + * \param pCheckForDup If \c true, pObject checks whether it already has a property with pName, if \c false, a new property is created. + * \param pWasFound If pCheckForDup is \c true, this flag is set to indicate whether the pObject already has a child property with pName. + */ + static FbxProperty Create(FbxObject* pObject, const FbxDataType& pDataType, const char* pName, const char* pLabel="", bool pCheckForDup=true, bool* pWasFound=NULL); + + /** Creates a dynamic property from another property on the specified property. + * \param pCompoundProperty The parent property of this property. + * \param pFromProperty The property copied by this property. + * \param pCheckForDup If \c true, parent property checks if it already has a child property that has the name of pFromProperty, if \c false, a new property is created. + * \remark Only the property name, label, min/max, enums and flags are copied. + */ + static FbxProperty CreateFrom(const FbxProperty& pCompoundProperty, FbxProperty& pFromProperty, bool pCheckForDup=true); + + /** Creates a dynamic property from another property on the specified object. + * \param pObject The object that contains this property. + * \param pFromProperty The property copied by this property. + * \param pCheckForDup If \c true, pObject checks if it already has a property that has the name of pFromProperty, if \c false, a new property is created. + * \remark Only the property name, label, min/max, enums and flags are copied. + */ + static FbxProperty CreateFrom(FbxObject* pObject, FbxProperty& pFromProperty, bool pCheckForDup=true); + + /** Destroys a dynamic property. + */ + void Destroy(); + + /** Destroys a dynamic property and its children + * \remarks Destroy all children of current property, and current property will also be destroyed. + */ + void DestroyRecursively(); + + /** Destroys children of a dynamic property. + * \remarks Destroy all children of current property, and current property will not be destroyed. + */ + void DestroyChildren(); + + /** Static property constructor. + */ + FbxProperty(); + + /** Copy constructor for properties. + * \param pProperty The property copied to this one. + */ + FbxProperty(const FbxProperty& pProperty); + + /** Copy constructor for properties. + * \param pPropertyHandle The property handle copied to this property handle. + */ + FbxProperty(const FbxPropertyHandle& pPropertyHandle); + + /** Static property destructor. + */ + ~FbxProperty(); + //@} + + /** + * \name Property Identification. + */ + //@{ + /** Returns the property data type. + * \return The property data type. + */ + FbxDataType GetPropertyDataType() const; + + /** Returns the internal name of the property. + * \return Property internal name string. + */ + FbxString GetName() const; + + /** Returns the internal name of the property. + * \return Property internal name string. + */ + const char* GetNameAsCStr() const; + + /** Returns the hierarchical name of the property. + * \return Property hierarchical name string. + */ + FbxString GetHierarchicalName() const; + + /** Returns the property label. + * \param pReturnNameIfEmpty If \c true, lets this method return the internal name if the label is empty. + * \return The property label if set, or the property internal name if the pReturnNameIfEmpty + * flag is set to \c true and the label has not been defined. + * \remarks Some applications may ignore the label field and work uniquely with the + * internal name. Therefore, it should not be taken for granted that a label exists. Also, remember + * that the label does not get saved in the FBX file. It only exists while the property object is + * in memory. + */ + FbxString GetLabel(bool pReturnNameIfEmpty=true) const; + + + /** Sets a label for the property. + * \param pLabel Label string. + */ + void SetLabel(const FbxString& pLabel); + + /** Returns the object that contains the property. + * \return The property object owner (or null if the property is an orphan). + */ + FbxObject* GetFbxObject() const; + //@} + + /** + * \name User data + */ + //@{ + /** Sets the user tag. + * \param pTag The user tag to be set. + */ + void SetUserTag(int pTag); + + //! Gets the user tag. + int GetUserTag(); + + /** Sets the user data pointer. + * \param pUserData The user data pointer. + */ + void SetUserDataPtr(void* pUserData); + + /** Gets the user data pointer. + * \return The user data pointer. + */ + void* GetUserDataPtr(); + //@} + + /** + * \name Property Flags. + */ + //@{ + /** Changes the property attribute. + * \param pFlag Property attribute identifier. + * \param pValue New state of pFlag. + */ + void ModifyFlag(FbxPropertyFlags::EFlags pFlag, bool pValue); + + /** Returns the state of the property attribute. + * \param pFlag Property attribute identifier. + * \return The state of the property attribute(pFlag). + */ + bool GetFlag(FbxPropertyFlags::EFlags pFlag) const; + + /** Returns the state of all of the property attributes. + * \return The state of the property attributes(pFlags). + */ + FbxPropertyFlags::EFlags GetFlags() const; + + /** Returns the inheritance type of the given flag, similar to GetValueInheritType(). + * \param pFlag The flag to be queried. + * \return The inheritance type of the specific flag. + */ + FbxPropertyFlags::EInheritType GetFlagInheritType( FbxPropertyFlags::EFlags pFlag ) const; + + /** Sets the inheritance type for the specific flag, similar to SetValueInheritType(). + * \param pFlag The flag to be set. + * \param pType The inheritance type to be set. + * \return \c True on success, \c false otherwise. + */ + bool SetFlagInheritType( FbxPropertyFlags::EFlags pFlag, FbxPropertyFlags::EInheritType pType ); + + /** Checks if the property flag has been modified from its default value. + * \param pFlag The flag to be queried. + * \return \c True if the value of this property has changed, \c false otherwise + */ + bool ModifiedFlag( FbxPropertyFlags::EFlags pFlag ) const; + //@} + + /** + * \name Assignment and comparison operators + */ + //@{ + /** Assignment operator. + * \param pProperty The property assigned to this property. + * \return This property. + */ + FbxProperty& operator= (const FbxProperty& pProperty); + + /** Equivalence operator. + * \param pProperty The property compared to this property. + * \return \c True if equal, \c false otherwise. + */ + bool operator== (const FbxProperty& pProperty) const; + + /** Non-equivalence operator. + * \param pProperty The property compared to this property. + * \return \c True if unequal, \c false otherwise. + */ + bool operator!= (const FbxProperty& pProperty) const; + + /** Lesser operator, used to sort property in map. + * \param pProperty The property compared to this property. + * \return \c true if less, \c false otherwise. */ + bool operator< (const FbxProperty& pProperty) const; + + /** Greater operator, used to sort property in map. + * \param pProperty The property compared to this property. + * \return \c true if greater, \c false otherwise. */ + bool operator> (const FbxProperty& pProperty) const; + + /** Equivalence operator. + * \param pValue The value compared to this property. + * \return \c True if this property is valid and pValue doesn't equal zero, or this property is invalid and pValue equals zero, \c false otherwise. + */ + inline bool operator== (int pValue) const { return (pValue == 0) ? !IsValid() : IsValid(); } + + /** Non-equivalence operator. + * \param pValue The value compared to this property. + * \return \c True if this property is valid and pValue equals zero, or this property is invalid and pValue doesn't equal zero, \c false otherwise. + */ + inline bool operator!= (int pValue) const { return (pValue != 0) ? !IsValid() : IsValid(); } + + /** Compares this property's value to another property's value. + * \param pProperty The property whose value is compared with this property's value. + * \return \c True if equal, \c false otherwise. + */ + bool CompareValue(const FbxProperty& pProperty) const; + //@} + + /** Copies the value of a property. + * \param pProperty The property from which to derive the value. + * \return \c True if value has been copied successfully, \c false otherwise. + */ + bool CopyValue(const FbxProperty& pProperty); + + /** + * \name Value management. + */ + //@{ + /** Gets the value of the property. + * \tparam T The data type of the value. + * \return The property value. + */ + template inline T Get() const { T lValue; Get(&lValue, FbxTypeOf(lValue)); return lValue; } + + /** Sets the value of the property. + * \param pValue The new value + * \return \c True if type is compatible and the value is set successfully, \c false otherwise. + */ + template inline bool Set(const T& pValue){ return Set(&pValue, FbxTypeOf(pValue)); } + + /** Judges the property's validity. + * \return \c True if this property is valid, \c false otherwise. + */ + bool IsValid() const; + + /** Checks if the specified property's value has changed from its default value. + * \param pProperty Property that is tested. + * \return \c True if the property value is still the default, \c false otherwise. + * \remarks If the inheritance type of pProperty's value is eOverride, pProperty's value should + * have been modified, so pProperty doesn't have the default value. + * If the inheritance type of pProperty's value is eInherit, that means pProperty's value inherits + * the referenced object's property value, so pProperty has the default value. + */ + static bool HasDefaultValue(FbxProperty& pProperty); + + /** Queries the inheritance type of the property. + * Use this method to determine if this property's value is overridden from the default + * value, or from the referenced object, if this object is a clone. + * \return The inheritance type of the property. + */ + FbxPropertyFlags::EInheritType GetValueInheritType() const; + + /** Sets the inheritance type of the property. + * Use the method to explicitly override the default value of the property, + * or the referenced object's property value, if this object is a clone. + * + * You can also use this to explicitly inherit the default value of the property, + * or the referenced object's property value, if this object is a clone. + * + * \param pType The new inheritance type. + * \return \c True on success, \c false otherwise. + */ + bool SetValueInheritType( FbxPropertyFlags::EInheritType pType ); + + /** Checks if the property's value has been modified from its default value. + * \return \c True if the value of the property has changed, \c false otherwise. + * \remarks If the inheritance type of the property's value is eOverride, the property's value should + * have been modified, it returns \c true. + * If the inheritance type of the property's value is eInherit, that means the property's value inherits + * the referenced object's property value, so the property's value is not modified and it returns \c false. + */ + bool Modified() const; + //@} + + /** + * \name Property Limits. + * Property limits are provided for convenience if some applications desire to + * bound the range of possible values for a given type property. FBX will never + * apply these limits internally, however it will store and retrieve the limits values + * from files, and will assure that they are persistent in memory + * while the property exists. + * + * Notes: + * - The limit value is truncated to the property data type. + * + * - These limits are meaningless for the boolean type. It is the responsibility of the + * calling application to implement the necessary instructions to limit the property of boolean type. + * + * - The SetMinLimit/SetMaxLimit methods will do nothing if SupportSetLimitsAsDoube() returns false. + */ + //@{ + /** Returns whether setting limits as a double number on this property type is allowed. + * \return \c True if allowed, \c false otherwise. + */ + bool SupportSetLimitAsDouble() const; + + /** Sets a minimum property value limit. + * \param pMin Minimum value allowed. + * \return \c True if the limit has been set, \c false otherwise. + */ + bool SetMinLimit(double pMin); + + /** Returns whether a minimum limit exists, if it returns false, + * calling GetMinLimit() produces undefined behavior. + * \return \c True when a minimum limit exists, \c false otherwise. + */ + bool HasMinLimit() const; + + /** Returns the minimum property value limit. + * \return The minimum value limit. + */ + double GetMinLimit() const; + + /** Returns whether a maximum limit exists, if it returns false, + * calling GetMaxLimit() produces undefined behavior. + * \return \c True when a maximum limit exists, \c false otherwise. + */ + bool HasMaxLimit() const; + + /** Sets a maximum property value limit. + * \param pMax Maximum value allowed. + * \return \c True if the limit has been set, \c false otherwise. + */ + bool SetMaxLimit(double pMax); + + /** Returns the maximum property value. + * \return The maximum value limit. + */ + double GetMaxLimit() const; + + /** Sets the minimum and maximum value limit of the property. + * \param pMin Minimum value allowed. + * \param pMax Maximum value allowed. + \return \c True if both the min and max limit have been set, \c false otherwise. + */ + bool SetLimits(double pMin, double pMax); + //@} + + /** + * \name Enum and property list + */ + //@{ + /** Adds a string value at the end of the enumeration list. + * \param pStringValue The string value to be added. + * \return The index in the list where the string is added or -1 if the action failed. + * \remarks This function is only valid if the property type is eFbxEnum or eFbxEnumM. + * \remarks If the property is of type eFbxEnum, trying to add a value that is already + * in the enumeration list will fail. + * Empty strings are not allowed. + */ + int AddEnumValue(const char* pStringValue); + + /** Inserts a string value at the specific index. + * \param pIndex Zero bound index. + * \param pStringValue The string value to be inserted. + * \remarks This function is only valid if the property type is eFbxEnum or eFbxEnumM. + * \remarks If the property is of type eFbxEnum, trying to insert a value that is already + * in the enumeration list will fail. + * pIndex must be in the range [0, ListValueGetCount()]. + * Empty strings are not allowed. + */ + void InsertEnumValue(int pIndex, const char* pStringValue); + + /** Returns the number of elements in the enumeration list. + * \return The number of elements in the enumeration list. + * \remarks This function returns 0 if the property type is not eFbxEnum or eFbxEnumM. + */ + int GetEnumCount() const; + + /** Sets a string value at the specific index. + * \param pIndex Zero bound index. + * \param pStringValue The string value at the specific index. + * \remarks This function is only valid if the property type is eFbxEnum or eFbxEnumM. + * \remarks If the property is of type eFbxEnum, trying to set a value that is already + * in the enumeration list will fail. + * The function assigns the string value to the specific index. + * A string value must exist at the specific index in order to be changed. + * Empty strings are not allowed. + */ + void SetEnumValue(int pIndex, const char* pStringValue); + + /** Removes the string value at the specified index. + * \param pIndex Index of the string value to be removed. + * \remarks This function is only valid if the property type is eFbxEnum or eFbxEnuM. + */ + void RemoveEnumValue(int pIndex); + + /** Returns a string value at the specified index + * \param pIndex Zero bound index. + * \remarks This function is only valid if the property type is eFbxEnum or eFbxEnumM. + */ + const char* GetEnumValue(int pIndex) const; + //@} + + /** + * \name Hierarchical properties + */ + //@{ + /** Judges if this property is the root property. + * \return \c True when this property is a root property, \c false otherwise. + */ + inline bool IsRoot() const { return mPropertyHandle.IsRoot(); } + + /** Judges whether this property is a child of the specified property. + * \param pParent The specified property. + * \return \c True when this property is a child of the specified property, \c false otherwise. + */ + inline bool IsChildOf(const FbxProperty& pParent) const { return mPropertyHandle.IsChildOf(pParent.mPropertyHandle); } + + /** Judges whether this property is a descendant of the specified property. + * \param pAncestor The specified property. + * \return \c True when this property is a descendant of the specified property, \c false otherwise. + */ + inline bool IsDescendentOf(const FbxProperty& pAncestor) const { return mPropertyHandle.IsDescendentOf(pAncestor.mPropertyHandle); } + + /** Returns the parent property of this property. + * \return The parent of this property. + */ + inline FbxProperty GetParent() const { return FbxProperty(mPropertyHandle.GetParent()); } + + /** Returns the first child of this property. + * \return The first child of this property, if there is none, an invalid property is returned. + */ + inline FbxProperty GetChild() const { return FbxProperty(mPropertyHandle.GetChild()); } + + /** Returns the sibling of this property. + * \return The sibling of this property, if there is none, an invalid property is returned. + */ + inline FbxProperty GetSibling() const { return FbxProperty(mPropertyHandle.GetSibling()); } + + /** Returns the first property that is a descendant of this property. + * \return The first descendant of this property, if there is none, an invalid property is returned. + */ + inline FbxProperty GetFirstDescendent() const { return FbxProperty(mPropertyHandle.GetFirstDescendent()); } + + /** Returns the property that follows pProperty that is a descendant of this property. + * \param pProperty The last found descendant. + * \return The property that follows pProperty, if there is none, an invalid property is returned. + */ + inline FbxProperty GetNextDescendent(const FbxProperty& pProperty) const { return FbxProperty(mPropertyHandle.GetNextDescendent(pProperty.mPropertyHandle)); } + + /** Searches a property using its name. + * \param pName The name of the property as a \c NULL terminated string. + * \param pCaseSensitive Whether the name is case-sensitive. + * \return A valid FbxProperty if the property is found, else + * an invalid FbxProperty. See FbxProperty::IsValid() + */ + inline FbxProperty Find (const char* pName, bool pCaseSensitive = true) const { return FbxProperty(mPropertyHandle.Find(pName,pCaseSensitive)); } + + /** Searches a property using its name and data type. + * \param pName The name of the property as a \c NULL terminated string. + * \param pDataType The data type of the property. + * \param pCaseSensitive Whether the name is case-sensitive. + * \return A valid FbxProperty if the property is found, else + * an invalid FbxProperty. See FbxProperty::IsValid() + */ + inline FbxProperty Find (const char* pName, const FbxDataType& pDataType, bool pCaseSensitive = true) const { return FbxProperty(mPropertyHandle.Find(pName,pDataType.GetTypeInfoHandle(),pCaseSensitive)); } + + /** Searches a property using its full name. + * \param pName The full name of the property as a \c NULL terminated string. + * \param pCaseSensitive whether the name is case-sensitive. + * \return A valid FbxProperty if the property is found, else + * an invalid FbxProperty. See FbxProperty::IsValid() + */ + inline FbxProperty FindHierarchical (const char* pName, bool pCaseSensitive = true) const { return FbxProperty(mPropertyHandle.Find(pName,sHierarchicalSeparator,pCaseSensitive)); } + + /** Searches a property using its full name and data type. + * \param pName The full name of the property as a \c NULL terminated string. + * \param pDataType The data type of the property. + * \param pCaseSensitive whether the name is case-sensitive. + * \return A valid FbxProperty if the property is found, else + * an invalid FbxProperty. See FbxProperty::IsValid() + */ + inline FbxProperty FindHierarchical (const char* pName, const FbxDataType& pDataType, bool pCaseSensitive = true) const { return FbxProperty(mPropertyHandle.Find(pName,sHierarchicalSeparator,pDataType.GetTypeInfoHandle(),pCaseSensitive)); } + //@} + + /** + * \name Optimizations + */ + //@{ + //! Internal function for building a property name map. + inline void BeginCreateOrFindProperty(){ mPropertyHandle.BeginCreateOrFindProperty(); } + + //! Internal function for clearing the property name map. + inline void EndCreateOrFindProperty(){ mPropertyHandle.EndCreateOrFindProperty(); } + + //!This is an internal class that you can use to build and clear the name map of properties. You can use the name map to speed up searching for property names. + class FbxPropertyNameCache + { + public: + /** Constructor, the name map is created in the constructor. + * \param prop Property for building and clearing the name map. + */ + FbxPropertyNameCache(const FbxProperty& prop) : mProp(const_cast(prop)){ mProp.BeginCreateOrFindProperty(); } + + //! Destructor, the name map is destroyed in destructor. + ~FbxPropertyNameCache(){ mProp.EndCreateOrFindProperty(); } + + private: + FbxProperty& mProp; + FbxPropertyNameCache& operator=(const FbxPropertyNameCache& pOther){ mProp = pOther.mProp; mProp.BeginCreateOrFindProperty(); return *this; } + }; + //@} + + /** + * \name Animation Curve Management + */ + //@{ + /** Retrieve the proper animation evaluator to use for this property. + * \return If the object has no scene, returns the default evaluator, otherwise the object's scene evaluator. */ + FbxAnimEvaluator* GetAnimationEvaluator() const; + + /** Find out if the property is animated: has a curve node with curves. + * \param pAnimLayer The animation layer to test for curve presence. Set to NULL if you want to use the default animation layer of the default animation stack. + * \return \c true if the property is animated. */ + bool IsAnimated(FbxAnimLayer* pAnimLayer=NULL) const; + + /** Evaluate the value of a property if it has animation and return the result as the template type. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The property value at the specified time converted to the template type provided, if possible. + * \remark If the property type versus the template cannot be converted, the result is unknown. */ + template T EvaluateValue(const FbxTime& pTime=FBXSDK_TIME_INFINITE, bool pForceEval=false); + + /** Evaluate the value of a property if it has animation and return the result. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The property value at the specified time. */ + FbxPropertyValue& EvaluateValue(const FbxTime& pTime=FBXSDK_TIME_INFINITE, bool pForceEval=false); + + /** Creates a FbxAnimCurveNode on the specified layer. + * \param pAnimLayer The animation layer the FbxAnimCurveNode object is attached to. + * \return Pointer to the created FbxAnimCurveNode. + * \remarks This function check the property FbxPropertyFlags::eAnimatable flag and fails to execute if it is not set. + * \remarks If created, the FbxAnimCurveNode is automatically connected to the property and the animation layer. + * \remarks The created FbxAnimCurveNode does not automatically allocate anim curves. + * \remarks On the successful execution of this function, the property eAnimated flag is set to \c true. */ + FbxAnimCurveNode* CreateCurveNode(FbxAnimLayer* pAnimLayer); + + /** Get the property's animation curve node on the default animation stack and base layer. + * \param pCreate If \c true, create the animation curve node and return it if none were found. + * \return The animation curve node of this property, if found or created, otherwise NULL. + * \remark If the property flag FbxPropertyFlags::eAnimatable is not set, creating the curve node will fail. */ + FbxAnimCurveNode* GetCurveNode(bool pCreate=false); + + /** Get the property's animation curve node on the specified animation stack, using its base layer. + * \param pAnimStack The animation stack to use to get or create the property's animation curve node. + * \c NULL can be passed to automatically specify the default animation stack. + * \param pCreate If \c true, create the animation curve node and return it if none were found. + * \return The animation curve node of this property, if found or created, otherwise NULL. + * \remark If the property flag FbxPropertyFlags::eAnimatable is not set, creating the curve node will fail. */ + FbxAnimCurveNode* GetCurveNode(FbxAnimStack* pAnimStack, bool pCreate=false); + + /** Get the property's animation curve node on the specified animation layer. + * \param pAnimLayer The animation layer to use to get or create the property's animation curve node. Cannot be NULL. + * \param pCreate If \c true, create the animation curve node and return it if none were found. + * \return The animation curve node of this property, if found or created, otherwise NULL. + * \remark If the property flag FbxPropertyFlags::eAnimatable is not set, creating the curve node will fail. */ + FbxAnimCurveNode* GetCurveNode(FbxAnimLayer* pAnimLayer, bool pCreate=false); + + /** Get the FbxAnimCurve from the specified animation layer. + * This function expects to find a FbxAnimCurveNode object with the same name as the property and it + * attempts to retrieve the FbxAnimCurve from it. + * \param pAnimLayer The searched animation layer. + * \param pCreate Create a FbxAnimCurve if not found. + * \return Pointer to the FbxAnimCurve. Returns NULL in case of errors or pCreate is \c false and the curve is not found. + * \remark If the FbxAnimCurveNode does not exists but the property has the FbxPropertyFlags::eAnimatable flag set and + * pCreate is true, then this function will first create the FbxAnimCurveNode object and then the FbxAnimCurve. + * \remark If more than one FbxAnimCurveNode matching the name criteria are connected, the first one is returned. */ + inline FbxAnimCurve* GetCurve(FbxAnimLayer* pAnimLayer, bool pCreate=false) + { + return GetCurve(pAnimLayer, GetName(), NULL, pCreate); + } + + /** Get the FbxAnimCurve from the specified animation layer. + * This function expects to find a FbxAnimCurveNode object with the same name as the property and it + * attempts to retrieve the FbxAnimCurve from it. + * \param pAnimLayer The searched animation layer. + * \param pChannel Name of the channel we are looking for the animation curve. If NULL use the first defined channel. + * \param pCreate Create a FbxAnimCurve if not found. + * \return Pointer to the FbxAnimCurve. Returns NULL in case of errors or pCreate is \c false and the curve is not found. + * \remark If the FbxAnimCurveNode does not exists but the property has the FbxPropertyFlags::eAnimatable flag set and + * pCreate is true, then this function will first create the FbxAnimCurveNode object and then the FbxAnimCurve. + * \remark If more than one FbxAnimCurveNode matching the name criteria are connected, the first one is returned. */ + inline FbxAnimCurve* GetCurve(FbxAnimLayer* pAnimLayer, const char* pChannel, bool pCreate=false) + { + return GetCurve(pAnimLayer, GetName(), pChannel, pCreate); + } + + /** Get the FbxAnimCurve of the specified channel from the specified animation layer. + * This function looks for the FbxAnimCurveNode named pName and the channel pChannel. It + * will retrieves the FbxAnimCurve from it. + * \param pAnimLayer The searched animation layer. + * \param pName Name of the curve node. It is an error to leave this field empty. + * \param pChannel Name of the channel we are looking for the animation curve. If NULL + * use the first defined channel. + * \param pCreate Create a FbxAnimCurve if not found. + * \return Pointer to the FbxAnimCurve. Returns NULL in case of errors or pCreate is \c false and the curve is not found. + * \remark If the FbxAnimCurveNode does not exists but the property has the FbxPropertyFlags::eAnimatable flag set and + * pCreate is true, then this function will first create the FbxAnimCurveNode object and then the FbxAnimCurve. + * \remark If more than one FbxAnimCurveNode matching the name criteria are connected, the first one is returned. + * \remark If pChannel is NULL, this function is the equivalent of GetCurve(FbxAnimLayer*, bool). */ + FbxAnimCurve* GetCurve(FbxAnimLayer* pAnimLayer, const char* pName, const char* pChannel, bool pCreate); + //@} + + /** + * \name General Object Connection and Relationship Management + */ + //@{ + /** Connects this property to one source object. + * \param pObject The source object to which this property connects. + * \param pType The connection type between the property and the object. + * \return \c True on success, \c false otherwise. + */ + bool ConnectSrcObject(FbxObject* pObject, FbxConnection::EType pType=FbxConnection::eNone); + + /** Judges whether this property connects with the source object. + * \param pObject The source object. + * \return \c True if this property connects with the source object, \c false otherwise. + */ + bool IsConnectedSrcObject(const FbxObject* pObject) const; + + /** Disconnects this property from one source object. + * \param pObject The source object from which this property will be disconnected. + * \return \c True on success, \c false otherwise. + */ + bool DisconnectSrcObject(FbxObject* pObject); + + /** Disconnects this property from all the source objects. + * \return \c True if it disconnects all the source objects successfully, \c false otherwise. + */ + bool DisconnectAllSrcObject(); + + /** Disconnects this property from all source objects that satisfy a given criteria. + * \param pCriteria The given criteria. + * \return \c True if it disconnects all the source objects successfully, \c false otherwise. + */ + bool DisconnectAllSrcObject(const FbxCriteria& pCriteria); + + /** Returns the number of source objects with which this property connects. + * \return The number of source objects with which this property connects. + */ + int GetSrcObjectCount() const; + + /** Returns the number of source objects that satisfy the given criteria with which this property connects. + * \param pCriteria The given criteria. + * \return The number of source objects that satisfy the given criteria with which this property connects. + */ + int GetSrcObjectCount(const FbxCriteria& pCriteria) const; + + /** Returns the source object at the specified index with which this property connects. + * \param pIndex The specified index whose default value is 0. + * \return The source object at the specified index, NULL if not found. + */ + FbxObject* GetSrcObject(const int pIndex=0) const; + + /** Returns the source object that satisfies the criteria at the specified index with which this property connects. + * \param pCriteria The given criteria. + * \param pIndex The specified index whose default value is 0. + * \return The source object that satisfies the given criteria at the specified index, NULL if not found. + */ + FbxObject* GetSrcObject(const FbxCriteria& pCriteria, const int pIndex=0) const; + + /** Searches the source object with the specified name, starting with the specified index. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. + */ + FbxObject* FindSrcObject(const char* pName, const int pStartIndex=0) const; + + /** Searches the source object with the specified name which satisfies the given criteria, starting with the specified index. + * \param pCriteria The given criteria. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. + */ + FbxObject* FindSrcObject(const FbxCriteria& pCriteria, const char* pName, const int pStartIndex=0) const; + + /** Disconnects this property from all source objects of the specified class type. + * \tparam T The specified class type. + * \return \c True if it disconnects all source objects successfully, \c false otherwise. + */ + template inline bool DisconnectAllSrcObject(){ return DisconnectAllSrcObject(FbxCriteria::ObjectType(T::ClassId)); } + + /** Disconnects this property from all source objects which are of the specified class type and satisfy the given criteria. + * \tparam T The specified class type. + * \param pCriteria The given criteria. + * \return \c True if it disconnects all source objects successfully, \c false otherwise. + */ + template inline bool DisconnectAllSrcObject(const FbxCriteria& pCriteria){ return DisconnectAllSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } + + /** Returns the number of source objects of a specific class type with which this property connects. + * \tparam T The specified class type. + * \return The number of source objects of the specified class type with which this property connects. + */ + template inline int GetSrcObjectCount() const { return GetSrcObjectCount(FbxCriteria::ObjectType(T::ClassId)); } + + /** Returns the number of source objects which are of the specified class type and satisfy the given criteria with which this property connects. + * \tparam T The specified class type. + * \param pCriteria The given criteria. + * \return The number of source objects which are of the specified class type and satisfy the given criteria. + */ + template inline int GetSrcObjectCount(const FbxCriteria& pCriteria) const { return GetSrcObjectCount(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } + + /** Returns the source object of the specified class type at the specified index. + * \tparam T The specified class type. + * \param pIndex The specified index whose default value is 0. + * \return The source object of a specified class type at the specified index, NULL if not found. + */ + template inline T* GetSrcObject(const int pIndex=0) const { return (T*)GetSrcObject(FbxCriteria::ObjectType(T::ClassId), pIndex); } + + /** Returns the source object which is of the specified class type and satisfies the given criteria at the specified index. + * \tparam T The specified class type. + * \param pCriteria The given criteria. + * \param pIndex The specified index whose default value is 0. + * \return The source object which is of the specified class type and satisfies the given criteria at the specified index, NULL if not found. + */ + template inline T* GetSrcObject(const FbxCriteria& pCriteria, const int pIndex=0) const { return (T*)GetSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pIndex); } + + /** Searches the source object with the specified name which is of the specified class type, starting with the specified index. + * \tparam T The specified class type. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. + */ + template inline T* FindSrcObject(const char* pName, const int pStartIndex=0) const { return (T*)FindSrcObject(FbxCriteria::ObjectType(T::ClassId), pName, pStartIndex); } + + /** Searches the source object with the specified name which is of the specified class type and satisfies the given criteria, starting with the specified index. + * \tparam T The specified class type. + * \param pCriteria The given criteria. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. + */ + template inline T* FindSrcObject(const FbxCriteria& pCriteria, const char* pName, const int pStartIndex=0) const { return (T*)FindSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pName, pStartIndex); } + + /** Connects this property to one destination object. + * \param pObject The destination object with which this property connects. + * \param pType The connection type between this property and the object. + * \return \c True on success, \c false otherwise. + */ + bool ConnectDstObject(FbxObject* pObject, FbxConnection::EType pType=FbxConnection::eNone); + + /** Judges whether this property connects with the destination object. + * \param pObject The destination object. + * \return \c True if this property connects with the destination object, \c false otherwise. + */ + bool IsConnectedDstObject(const FbxObject* pObject) const; + + /** Disconnects this property from the destination object. + * \param pObject The destination object from which this property disconnects from. + * \return \c True on success, \c false otherwise. + */ + bool DisconnectDstObject(FbxObject* pObject); + + /** Disconnects this property from all the destination objects. + * \return \c True if it disconnects all the destination objects successfully, \c false otherwise. + */ + bool DisconnectAllDstObject(); + + /** Disconnects this property from all the destination objects that satisfy given criteria. + * \param pCriteria The given criteria. + * \return \c True if it disconnects all the destination objects successfully, \c false otherwise. + */ + bool DisconnectAllDstObject(const FbxCriteria& pCriteria); + + /** Returns the number of destination objects with which this property connects. + * \return The number of destination objects with which this property connects. + */ + int GetDstObjectCount() const; + + /** Returns the number of destination objects that satisfy the given criteria with which this property connects. + * \param pCriteria The given criteria. + * \return The number of destination objects that satisfy given criteria with which this property connects. + */ + int GetDstObjectCount(const FbxCriteria& pCriteria) const; + + /** Returns the destination object at the specified index with which this property connects. + * \param pIndex The specified index whose default value is 0. + * \return The destination object at the specified index, NULL if not found. + */ + FbxObject* GetDstObject(const int pIndex=0) const; + + /** Returns the destination object that satisfies given criteria at the specified index with which this property connects. + * \param pCriteria The given criteria. + * \param pIndex The specified index whose default value is 0. + * \return The destination object that satisfies given criteria at the specified index, NULL if not found. + */ + FbxObject* GetDstObject(const FbxCriteria& pCriteria, const int pIndex=0) const; + + /** Searches the destination object with the specified name, starting with the specified index. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The destination object with the name, NULL if not found. + */ + FbxObject* FindDstObject(const char* pName, const int pStartIndex=0) const; + + /** Searches the destination object with the specified name which satisfies the given criteria, starting with the specified index. + * \param pCriteria The given criteria. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The destination object with the name, NULL if not found. + */ + FbxObject* FindDstObject(const FbxCriteria& pCriteria, const char* pName, const int pStartIndex=0) const; + + /** Disconnects this property from all the destination objects of the specified class type. + * \tparam T The specified class type. + * \return \c True if it disconnects all the destination objects successfully, \c false otherwise. + */ + template inline bool DisconnectAllDstObject(){ return DisconnectAllDstObject(FbxCriteria::ObjectType(T::ClassId)); } + + /** Disconnects this property from all the destination objects which are of the specified class type and satisfy the given criteria. + * \tparam T The specified class type. + * \param pCriteria The given criteria. + * \return \c True if it disconnects all the destination objects successfully, \c false otherwise. + */ + template inline bool DisconnectAllDstObject(const FbxCriteria& pCriteria){ return DisconnectAllDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } + + /** Returns the number of destination objects of the specified class type with which this property connects. + * \tparam T The specified class type. + * \return The number of destination objects of the specified class type with which this property connects. + */ + template inline int GetDstObjectCount() const { return GetDstObjectCount(FbxCriteria::ObjectType(T::ClassId)); } + + /** Returns the number of destination objects which are of the specified class type and satisfy the given criteria with which this property connects. + * \tparam T The specified class type. + * \param pCriteria The given criteria. + * \return The number of destination objects which are of the specified class type and satisfy the given criteria with which this property connects. + */ + template inline int GetDstObjectCount(const FbxCriteria& pCriteria) const { return GetDstObjectCount(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } + + /** Returns the destination object of the specified class type at the specified index with which this property connects. + * \tparam T The specified class type. + * \param pIndex The specified index whose default value is 0. + * \return The destination object of the specified class type at the specified index, NULL if not found. + */ + template inline T* GetDstObject(const int pIndex=0) const { return (T*)GetDstObject(FbxCriteria::ObjectType(T::ClassId), pIndex); } + + /** Returns the destination object which is of the specified class type and satisfies the given criteria at the specified index with which this property connects. + * \tparam T The specified class type. + * \param pCriteria The given criteria. + * \param pIndex The specified index whose default value is 0. + * \return The destination object which is of the specified class type and satisfies the given criteria at the specified index, NULL if not found. + */ + template inline T* GetDstObject(const FbxCriteria& pCriteria, const int pIndex=0) const { return (T*)GetDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pIndex); } + + /** Searches the destination object with the specified name which is of the specified class type, starting with the specified index. + * \tparam T The specified class type. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. + */ + template inline T* FindDstObject(const char* pName, const int pStartIndex=0) const { return (T*)FindDstObject(FbxCriteria::ObjectType(T::ClassId), pName, pStartIndex); } + + /** Searches the destination object with the specified name which is of the specified class type and satisfies the given criteria, starting with the specified index. + * \tparam T The specified class type. + * \param pCriteria The given criteria. + * \param pName The object name. + * \param pStartIndex The start index. + * \return The source object with the name, NULL if not found. + */ + template inline T* FindDstObject(const FbxCriteria& pCriteria, const char* pName, const int pStartIndex=0) const { return (T*)FindDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pName, pStartIndex); } + //@} + + /** + * \name General Property Connection and Relationship Management + */ + //@{ + // Properties + /** Connects this property to a source property. + * \param pProperty The source property with which this property connects. + * \return \c True on success, \c false otherwise. + */ + bool ConnectSrcProperty(const FbxProperty& pProperty); + + /** Judges whether this property connects with the specified source property. + * \param pProperty The specified source property. + * \return \c True if this property connects with the specified source property, \c false otherwise. + */ + bool IsConnectedSrcProperty(const FbxProperty& pProperty); + + /** Disconnects this property from the specified source property. + * \param pProperty The specified source property. + * \return \c True on success, \c false otherwise. + */ + bool DisconnectSrcProperty(const FbxProperty& pProperty); + + /** Returns the number of source properties with which this property connects. + * \return The number of source properties with which this property connects. + */ + int GetSrcPropertyCount() const; + + /** Connects this property to a destination property. + * \param pProperty The destination property with which this property connects. + * \return \c True on success, \c false otherwise. + */ + bool ConnectDstProperty(const FbxProperty& pProperty); + + /** Judges if this property connects with the specified destination property. + * \param pProperty The specified destination property. + * \return \c True if this property connects with the specified destination property, \c false otherwise. + */ + bool IsConnectedDstProperty(const FbxProperty& pProperty); + + /** Disconnects this property from the specified destination property. + * \param pProperty The specified destination property. + * \return \c True on success, \c false otherwise. + */ + bool DisconnectDstProperty(const FbxProperty& pProperty); + + /** Returns the number of destination properties with which this property connects. + * \return The number of destination properties with which this property connects. + */ + int GetDstPropertyCount() const; + + //!Clears the connection cache of this property, this cache is used to store the connections that satisfy the given criteria. + void ClearConnectCache(); + + /** Returns the source property at the specified index with which this property connects. + * \param pIndex The specified index. + * \return The source property at the specified index. + */ + FbxProperty GetSrcProperty(const int pIndex=0) const; + + /** Searches the source property with the specified name, starting with the specified index with which this property connects. + * \param pName The specified property name. + * \param pStartIndex The start index. + * \return The source property with the specified name. + */ + FbxProperty FindSrcProperty(const char* pName, const int pStartIndex=0) const; + + /** Returns the destination property at the specified index with which this property connects. + * \param pIndex The specified index. + * \return The destination property at the specified index. + */ + FbxProperty GetDstProperty(const int pIndex=0) const; + + /** Searches the destination property with the specified name, starting with the specified index with which this property connects. + * \param pName The specified property name. + * \param pStartIndex The start index. + * \return The destination property with the specified name. + */ + FbxProperty FindDstProperty(const char* pName, const int pStartIndex=0) const; + //@} + + //! Hierarchical separator of properties. + static const char* sHierarchicalSeparator; + +/***************************************************************************************************************************** +** 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: + FbxProperty(FbxObject* pObject, const char* pName, const FbxDataType& pDataType=FbxDataType(), const char* pLabel=""); + FbxProperty(const FbxProperty& pParent, const char* pName, const FbxDataType& pDataType, const char* pLabel); + + bool Set(const void* pValue, const EFbxType& pValueType, bool pCheckForValueEquality=true); + bool Get(void* pValue, const EFbxType& pValueType) const; + + bool NotifySetRequest(); + bool NotifySet(); + bool NotifyGet() const; + +private: + inline void* Get() const { FBX_ASSERT_NOW("Cannot get property value as void!"); return NULL; } + inline bool Set(const void* &){ FBX_ASSERT_NOW("Cannot set property value as void!"); return false; } + + bool ConnectSrc(const FbxProperty& pProperty, FbxConnection::EType pType=FbxConnection::eNone); + bool DisconnectSrc(const FbxProperty& pProperty); + bool DisconnectAllSrc(); + bool DisconnectAllSrc(const FbxCriteria& pCriteria); + bool IsConnectedSrc(const FbxProperty& pProperty) const; + int GetSrcCount() const; + int GetSrcCount(const FbxCriteria& pCriteria) const; + FbxProperty GetSrc(int pIndex=0) const; + FbxProperty GetSrc(const FbxCriteria& pCriteria, int pIndex=0) const; + FbxProperty FindSrc(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const; + + bool ConnectDst(const FbxProperty& pProperty, FbxConnection::EType pType=FbxConnection::eNone); + bool DisconnectDst(const FbxProperty& pProperty); + bool DisconnectAllDst(); + bool DisconnectAllDst(const FbxCriteria& pCriteria); + bool IsConnectedDst(const FbxProperty& pProperty) const; + int GetDstCount() const; + int GetDstCount(const FbxCriteria& pCriteria) const; + FbxProperty GetDst(int pIndex=0) const; + FbxProperty GetDst(const FbxCriteria& pCriteria, int pIndex=0) const; + FbxProperty FindDst(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const; + + mutable FbxPropertyHandle mPropertyHandle; + + friend class FbxObject; + friend class FbxIOSettings; + friend class FbxBindingOperator; + friend class FbxAnimEvalClassic; + friend void FbxMarkObject(FbxObject* pObject, FbxMap& pObjectDstDisconnectCount, FbxSet& pObjectsToDeleted, FbxArray& pObjectToDeletedInSequence); + friend void FbxCleanUpConnectionsAtDestructionBoundary(FbxScene* pObject, FbxArray& pObjectToDeletedInSequence); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** \brief This template class is used to contain user properties of specific data types. +* \nosubgrouping +*/ +template class FbxPropertyT : public FbxProperty +{ +public: + /** + * \name Static initialization. + */ + //@{ + /** Creates a property and initializes it using a specific value and flag. + * \param pObject The object that contains this property. + * \param pName The name of the property. + * \param pValue The value of the property. + * \param pForceSet If \c true, the value is forcibly set, if \c false the value is not set when it equals the default value. + * \param pFlags The property flag. + */ + FbxProperty& StaticInit(FbxObject* pObject, const char* pName, const T& pValue, bool pForceSet, FbxPropertyFlags::EFlags pFlags=FbxPropertyFlags::eNone) + { + return StaticInit(pObject, pName, FbxGetDataTypeFromEnum(FbxTypeOf(*((T*)0))), pValue, pForceSet, pFlags); + } + + /** Creates a property and initializes it using a specific value and flag. + * \param pObject The object that contains this property. + * \param pName The name of the property. + * \param pDataType The property data type. + * \param pValue The property value. + * \param pForceSet If \c true, the value is forcibly set, if \c false the value is not set when it equals the default value. + * \param pFlags The property flag. + */ + FbxProperty& StaticInit(FbxObject* pObject, const char* pName, const FbxDataType& pDataType, const T& pValue, bool pForceSet, FbxPropertyFlags::EFlags pFlags=FbxPropertyFlags::eNone) + { + bool lWasFound = false; + *this = Create(pObject, pDataType, pName, "", true, &lWasFound); + if( pForceSet || !lWasFound ) + { + ModifyFlag(pFlags, true); // modify the flags before we set the value + FbxProperty::Set(&pValue, FbxTypeOf(pValue), false); + } + ModifyFlag(FbxPropertyFlags::eStatic, true); + return *this; + } + + /** Creates a property and initializes it using a specific value and flag. + * \param pCompound The parent property of this property. + * \param pName The name of the property. + * \param pDataType The property data type. + * \param pValue The property value. + * \param pForceSet If \c true, the value is forcibly set, if \c false the value is not set when it equals to the default value. + * \param pFlags The property flag. + */ + FbxProperty& StaticInit(FbxProperty pCompound, const char* pName, const FbxDataType& pDataType, const T& pValue, bool pForceSet=true, FbxPropertyFlags::EFlags pFlags=FbxPropertyFlags::eNone) + { + bool lWasFound = false; + *this = Create(pCompound, pDataType, pName, "", true, &lWasFound); + if( pForceSet || !lWasFound ) + { + ModifyFlag(pFlags, true); // modify the flags before we set the value + FbxProperty::Set(&pValue, FbxTypeOf(pValue), false); + } + ModifyFlag(FbxPropertyFlags::eStatic, true); + return *this; + } + //@} + + /** \name Value Management */ + //@{ + /** Assignment function + * \param pValue The value assigned to this property. + * \return This property. */ + FbxPropertyT& Set(const T& pValue){ FbxProperty::Set(&pValue, FbxTypeOf(pValue)); return *this; } + + /** Retrieve function + * \return The value of the property. */ + T Get() const { T lValue; FbxProperty::Get(&lValue, FbxTypeOf(lValue)); return lValue; } + + /** Assignment operator + * \param pValue The value of type T assigned to this property. + * \return This property. */ + FbxPropertyT& operator=(const T& pValue){ return Set(pValue); } + + /** Type cast operator + * \return The value of the property of type T. */ + operator T() const { return Get(); } + //@} + + /** \name Animation Evaluation */ + //@{ + /** Evaluate the value of a property if it has animation and return the result. + * \param pTime The time used for evaluate. + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The property value at the specified time. */ + T EvaluateValue(const FbxTime& pTime=FBXSDK_TIME_INFINITE, bool pForceEval=false) + { + return GetAnimationEvaluator()-> template GetPropertyValue(*this, pTime, pForceEval); + } + //@} + +/***************************************************************************************************************************** +** 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 + FbxPropertyT() : FbxProperty(){} + FbxPropertyT(const FbxProperty& pProperty) : FbxProperty(pProperty){} + ~FbxPropertyT(){} +#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 <> class FbxPropertyT : public FbxProperty +{ +public: + FbxPropertyT() : FbxProperty(){} + FbxPropertyT(const FbxProperty& pProperty) : FbxProperty(pProperty){} + ~FbxPropertyT(){} + + const FbxProperty& StaticInit(FbxObject* pObject, const char* pName, const FbxReference& pValue, bool pForceSet, FbxPropertyFlags::EFlags pFlags=FbxPropertyFlags::eNone) + { + return StaticInit(pObject, pName, FbxGetDataTypeFromEnum(FbxTypeOf(*((FbxReference*)0))), pValue, pForceSet, pFlags); + } + + const FbxProperty& StaticInit(FbxObject* pObject, const char* pName, const FbxDataType& pDataType, const FbxReference& pValue, bool pForceSet, FbxPropertyFlags::EFlags pFlags=FbxPropertyFlags::eNone) + { + bool lWasFound = false; + *this = Create(pObject, pDataType, pName, "", true, &lWasFound); + if( pForceSet || !lWasFound ) + { + ModifyFlag(pFlags, true); // modify the flags before we set the value + Set(pValue); // since we will trigger callbacks in there! + } + ModifyFlag(FbxPropertyFlags::eStatic, true); + return *this; + } + + FbxReference Get() const + { + FbxProperty::NotifyGet(); + return GetSrcObject(); + } + + FbxPropertyT& Set(const FbxReference& pValue) + { + if( FbxProperty::NotifySetRequest() ) + { + DisconnectAllSrcObject(); + if( ConnectSrcObject(pValue) ) + { + FbxProperty::SetValueInheritType(FbxPropertyFlags::eOverride); + FbxProperty::NotifySet(); + } + } + return *this; + } + + operator FbxReference() const + { + return Get(); + } + + FbxPropertyT& operator=(const FbxReference& pValue) + { + return Set(pValue); + } +}; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +#include + +#endif /* _FBXSDK_CORE_PROPERTY_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxpropertydef.h b/libs/fbx/include/fbxsdk/core/fbxpropertydef.h new file mode 100644 index 00000000..dbb82aaa --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxpropertydef.h @@ -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 + +#include + +#include + +#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 + +#endif /* _FBXSDK_CORE_PROPERTY_DEFINITION_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxpropertyhandle.h b/libs/fbx/include/fbxsdk/core/fbxpropertyhandle.h new file mode 100644 index 00000000..527a6533 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxpropertyhandle.h @@ -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 + +#include +#include +#include + +#include + +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 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 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 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 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 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 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 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 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 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 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 + +#endif /* _FBXSDK_CORE_PROPERTY_HANDLE_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxpropertypage.h b/libs/fbx/include/fbxsdk/core/fbxpropertypage.h new file mode 100644 index 00000000..89d7335d --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxpropertypage.h @@ -0,0 +1,1747 @@ +/**************************************************************************************** + + 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 fbxpropertypage.h +#ifndef _FBXSDK_CORE_PROPERTY_PAGE_H_ +#define _FBXSDK_CORE_PROPERTY_PAGE_H_ + +#include + +#include +#include +#include +#include + +#include + +typedef FbxPair FbxNameMapKey; + +struct FbxNameMapCompare +{ + inline int operator()(const FbxNameMapKey& pKeyA, const FbxNameMapKey& pKeyB) const + { + if( pKeyA.mFirst < pKeyB.mFirst ) return -1; + else if( pKeyA.mFirst > pKeyB.mFirst ) return 1; + return strcmp(pKeyA.mSecond, pKeyB.mSecond); + } +}; + +class FBXSDK_DLL FbxPropertyInfo +{ +public: + FBXSDK_FRIEND_NEW(); + static FbxPropertyInfo* Create(const char* pName, FbxPropertyPage* pTypeInfo) { return FbxNew< FbxPropertyInfo >(pName,pTypeInfo); } + static FbxPropertyInfo* Create(const char* pName, EFbxType pType=eFbxUndefined) { return FbxNew< FbxPropertyInfo >(pName,pType); } + void Destroy() { FbxDelete(this); } + FbxPropertyInfo* Clone(FbxPropertyPage* /*pPage*/) + { + // @@@@@ Filter is missing + // @@@@@ Clone is incomplete + if (mTypeInfo) + { + return FbxNew< FbxPropertyInfo >(mName,mTypeInfo); + } + else + { + return FbxNew< FbxPropertyInfo >(mName,mType); + } + } + + inline void IncRef() { mRef++; } + inline void DecRef() { mRef--; if (mRef==0) FbxDelete(this); } + inline int GetRef() { return mRef; } + + // Labels and Types + + inline FbxStringSymbol GetName() const { return mName; } + EFbxType GetType() const; + FbxPropertyPage* GetTypeInfo() const { return mTypeInfo; } + + inline void SetLabel(const char* pLabel) { mLabel=pLabel; } + inline const char* GetLabel() const { return mLabel.IsEmpty() ? "" : ((const char*)mLabel); } + + inline void SetUserTag(int pUserTag) { mUserTag=pUserTag; } + inline int GetUserTag() const { return mUserTag; } + + inline void SetUserData(const void* pUserData) { mUserData=(void*)pUserData; } + inline void* GetUserData() const { return mUserData; } + + // Enum list + int AddEnumValue(const char* pStringValue) + { + EFbxType lType = GetType(); + if (lType == eFbxEnum || lType == eFbxEnumM) + { + if (!mEnumList) + mEnumList.Reset(FbxNew< FbxStringList >()); + + bool lCanAdd = (lType == eFbxEnumM || mEnumList->FindIndex( pStringValue ) == -1); + if( lCanAdd ) + return mEnumList->Add((char*)pStringValue); + } + return -1; + } + + void InsertEnumValue(int pIndex, const char* pStringValue) + { + EFbxType lType = GetType(); + if (lType == eFbxEnum || lType == eFbxEnumM) + { + if (!mEnumList) + mEnumList.Reset(FbxNew< FbxStringList >()); + + bool lCanAdd = (lType == eFbxEnumM || mEnumList->FindIndex( pStringValue ) == -1); + if( lCanAdd ) + mEnumList->InsertAt(pIndex,(char*)pStringValue); + } + } + + int GetEnumCount() + { + return mEnumList ? mEnumList->GetCount() : 0; + } + + void SetEnumValue(int pIndex, const char* pStringValue) + { + EFbxType lType = GetType(); + if (lType == eFbxEnum || lType == eFbxEnumM) + { + if (!mEnumList) + mEnumList.Reset(FbxNew< FbxStringList >()); + + bool lCanAdd = (lType == eFbxEnumM || mEnumList->FindIndex( pStringValue ) == -1); + if (lCanAdd) + mEnumList->SetStringAt(pIndex,(char*)pStringValue); + } + } + + void RemoveEnumValue(int pIndex) + { + EFbxType lType = GetType(); + if (lType == eFbxEnum || lType == eFbxEnumM) + { + if (!mEnumList) + mEnumList.Reset(FbxNew< FbxStringList >()); + + mEnumList->RemoveAt(pIndex); + } + } + + char* GetEnumValue(int pIndex) + { + char* lValue = NULL; + EFbxType lType = GetType(); + if (lType == eFbxEnum || lType == eFbxEnumM) + { + lValue = mEnumList ? mEnumList->GetStringAt(pIndex) : 0; + } + return lValue; + } + + + // Min and Max values + enum EValueIndex {eValueMin, eValueSoftMin, eValueMax, eValueSoftMax, eValueCount}; + + bool HasMinMax(EValueIndex pId) const + { + return mMinMaxValue[pId] != NULL; + } + + bool GetMinMax(EValueIndex pId, void* pValue, EFbxType pValueType) const + { + if (mMinMaxValue[pId]) { + return FbxTypeCopy(pValue, pValueType, mMinMaxValue[pId], GetType()); + } + return false; + } + + bool SetMinMax(EValueIndex pId, const void* pValue, EFbxType pValueType) + { + if (!mMinMaxValue[pId]) { + size_t lSize = FbxTypeSizeOf(GetType()); + if (lSize) { + mMinMaxValue[pId] = FbxMalloc(lSize); + } + } + if (mMinMaxValue[pId]) { + return FbxTypeCopy(mMinMaxValue[pId], GetType(), pValue, pValueType); + } + return false; + } + +private: + FbxPropertyInfo(const char* pName, FbxPropertyPage* pTypeInfo) + : mRef(0) + , mName(pName) + , mType(eFbxUndefined) + , mTypeInfo(pTypeInfo) + , mUserTag(0) + , mUserData(0) + , mFilter(0) + { + for (int i=0; i mEnumList; +}; + +#if defined(FBXSDK_COMPILER_MSC) + #pragma warning (push) + #pragma warning (disable: 4355) +#endif + +class FBXSDK_DLL FbxPropertyConnect +{ +public: + FBXSDK_FRIEND_NEW(); + static FbxPropertyConnect* Create(FbxPropertyPage* pPage,FbxInt pId) { return FbxNew< FbxPropertyConnect >(pPage,pId); } + void Destroy() { FbxDelete(this); } + FbxPropertyConnect* Clone(FbxPropertyPage* pPage) + { + return FbxNew< FbxPropertyConnect >(pPage,mId); + } + + inline void IncRef() { mRef++; } + inline void DecRef() { mRef--; if (mRef==0) FbxDelete(this); } + inline int GetRef() { return mRef; } + +// Properties + FbxPropertyPage* GetPage() { return mPage; } + FbxInt GetPropertyId() { return mId; } + +// ClearConnectCache() +// ------------------------------------------------------ + inline void ClearConnectCache() + { + mConnectionPoint.SubConnectRemoveAll(); + } + + //! Clear all connect without sending any notification (Internal use ONLY) + inline void WipeAllConnections() + { + mConnectionPoint.WipeConnectionList(); + } + +// Properties + inline bool ConnectSrc(FbxPropertyConnect* pSrc, FbxConnection::EType pType) + { + return mConnectionPoint.ConnectSrc(&pSrc->mConnectionPoint,pType); + } + inline bool DisconnectSrc(FbxPropertyConnect* pSrc) + { + return mConnectionPoint.DisconnectSrc(&pSrc->mConnectionPoint); + } + inline bool IsConnectedSrc(FbxPropertyConnect* pSrc) + { + return mConnectionPoint.IsConnectedSrc(&pSrc->mConnectionPoint); + } + inline int GetSrcCount(FbxConnectionPointFilter* pFilter) + { + return mConnectionPoint.GetSrcCount(pFilter); + } + inline FbxPropertyConnect* GetSrc(FbxConnectionPointFilter* pFilter, int pIndex) + { + FbxConnectionPoint *lCP = mConnectionPoint.GetSrc(pIndex,pFilter); + return lCP ? (FbxPropertyConnect * )lCP->GetData() : 0; + } + inline bool ConnectDst(FbxPropertyConnect* pDst, FbxConnection::EType pType) + { + return mConnectionPoint.ConnectDst(&pDst->mConnectionPoint,pType); + } + inline bool IsConnectedDst(FbxPropertyConnect* pSrc) + { + return mConnectionPoint.IsConnectedSrc(&pSrc->mConnectionPoint); + } + inline bool DisconnectDst(FbxPropertyConnect* pDst) + { + return mConnectionPoint.DisconnectDst(&pDst->mConnectionPoint); + } + inline int GetDstCount(FbxConnectionPointFilter* pFilter) + { + return mConnectionPoint.GetDstCount(pFilter); + } + inline FbxPropertyConnect* GetDst(FbxConnectionPointFilter* pFilter, int pIndex) + { + FbxConnectionPoint *lCP = mConnectionPoint.GetDst(pIndex,pFilter); + return lCP ? (FbxPropertyConnect * )lCP->GetData() : 0; + } + + int mRef; + FbxConnectionPoint mConnectionPoint; + FbxPropertyPage* mPage; + FbxInt mId; + +private: + FbxPropertyConnect(FbxPropertyPage* pPage,FbxInt pId) : + mRef(0), + mConnectionPoint(this), + mPage(pPage), + mId(pId) + { + } + + ~FbxPropertyConnect(){ if( FbxObject::GetWipeMode() ) mConnectionPoint.WipeConnectionList(); } +}; + +#if defined(FBXSDK_COMPILER_MSC) + #pragma warning (pop) +#endif + +class FBXSDK_DLL FbxPropertyEntry +{ +public: + static FbxPropertyEntry* Create(FbxInt pParentId, FbxPropertyInfo* pInfo, FbxPropertyValue* pValue, FbxPropertyConnect* pConnect){ return FbxNew(pParentId, pInfo, pValue, pConnect); } + + void Destroy() { FbxDelete(this); } + + inline FbxInt GetParentId(){ return mParentId; } + inline bool IsEmpty(){ return (mInfo || mValue || mConnect || mFlags.GetMask() != 0) ? false : true; } + + inline FbxPropertyInfo* Get(const FbxPropertyInfo* /*pType*/){ return mInfo; } + + void Set(FbxPropertyInfo* pInfo) + { + FbxPropertyInfo* lInfo = mInfo; + if( pInfo ) pInfo->IncRef(); + mInfo = pInfo; + if( lInfo ) lInfo->DecRef(); + } + + inline FbxPropertyValue* Get(const FbxPropertyValue* /*pType*/){ return mValue; } + + void Set(FbxPropertyValue* pValue) + { + FbxPropertyValue* lValue = mValue; + if( pValue ) pValue->IncRef(); + mValue = pValue; + if( lValue ) lValue->DecRef(); + } + + inline FbxPropertyConnect* Get(const FbxPropertyConnect* /*pType*/){ return mConnect; } + + void Set(FbxPropertyConnect* pConnect) + { + FbxPropertyConnect* lConnect = mConnect; + if( pConnect ) pConnect->IncRef(); + mConnect = pConnect; + if( lConnect ) lConnect->DecRef(); + } + + inline FbxPropertyFlags* Get(const FbxPropertyFlags* /*pType*/){ return &mFlags; } + inline void Set(FbxPropertyFlags pType){ mFlags = pType; } + inline void Set(FbxPropertyFlags* pType){ mFlags = pType ? *pType : FbxPropertyFlags(FbxPropertyFlags::eNone); } + +private: + FbxPropertyEntry(FbxInt pParentId,FbxPropertyInfo *pInfo,FbxPropertyValue *pValue,FbxPropertyConnect *pConnect) : + mInfo(pInfo), + mValue(pValue), + mConnect(pConnect), + mParentId(pParentId), + mFlags(FbxPropertyFlags::eNone) + { + if( mInfo ) mInfo->IncRef(); + if( mValue ) mValue->IncRef(); + if( mConnect ) mConnect->IncRef(); + } + + ~FbxPropertyEntry() + { + if( mInfo ) mInfo->DecRef(); + if( mValue ) mValue->DecRef(); + if( mConnect ) mConnect->DecRef(); + } + + FbxPropertyInfo* mInfo; + FbxPropertyValue* mValue; + FbxPropertyConnect* mConnect; + FbxInt mParentId; + FbxPropertyFlags mFlags; + + FBXSDK_FRIEND_NEW(); + friend class FbxPropertyPage; +}; + +class FBXSDK_DLL FbxPropertyIdGenerator +{ +public: + FbxPropertyIdGenerator() : mRef(0), mNextId(0) {} + + inline FbxInt GetNextId() const { return mNextId; } + inline FbxInt GetNextIdAndInc() { return mNextId++; } + + inline void IncRef() { mRef++; } + inline void DecRef() { mRef--; if( mRef == 0 ) FbxDelete(this); } + +private: + FbxInt mRef, mNextId; +}; + +class FBXSDK_DLL FbxPropertyPage +{ + +public: + FBXSDK_FRIEND_NEW(); + static FbxPropertyPage* Create (FbxPropertyPage* pInstanceOf=0) { return FbxNew< FbxPropertyPage >(pInstanceOf); } + static FbxPropertyPage* Create (const char* pName, FbxPropertyPage* pTypeInfo) { return FbxNew< FbxPropertyPage >(pName,pTypeInfo); } + static FbxPropertyPage* Create (const char* pName, EFbxType pType=eFbxUndefined) { return FbxNew< FbxPropertyPage >(pName,pType); } + void Destroy() { FbxDelete(this); } + + template inline T* GetPropertyItem(const T* pItemType,FbxInt pIndex,FbxPropertyPage **pFoundIn=0) const + { + FbxPropertyPage* lReferencePage = 0; + FbxPropertyEntry* lReferenceEntry = GetPropertyEntry(pIndex,&lReferencePage); + if (pFoundIn) *pFoundIn = 0; + if (lReferenceEntry) { + T* lItem = lReferenceEntry->Get( FBX_TYPE(T) ); + if (lItem) { + if (pFoundIn) *pFoundIn = lReferencePage; + return lItem; + } else { + return lReferencePage->mInstanceOf ? lReferencePage->mInstanceOf->GetPropertyItem(pItemType,pIndex,pFoundIn) : 0 ; + } + } + return 0; + } + + template inline T* ChangePropertyItemState(const T* pItemType, FbxInt pIndex, FbxPropertyFlags::EInheritType pInheritType) + { + FbxPropertyPage* lReferencePage = NULL; + T* lItem = GetPropertyItem(pItemType, pIndex, &lReferencePage); + if( pInheritType == FbxPropertyFlags::eOverride ) + { + if( lReferencePage == this ) + { + return lItem; + } + else if( lItem ) + { + FbxPropertyEntry* lEntry = ChangePropertyEntryState(pIndex, FbxPropertyFlags::eOverride); + lEntry->Set(lItem->Clone(this)); + return lEntry->Get(FBX_TYPE(T)); + } + } + else + { + // can't inherit entries that were created on our page. + bool lOwnEntry = !mInstanceOf || (mInstanceOf->GetPropertyItem(pItemType, pIndex) == NULL); + if( lOwnEntry && FbxPropertyFlags::eInherit == pInheritType) return 0; + + if( lItem && (lReferencePage == this) ) + { + FbxPropertyEntry* lEntry = GetPropertyEntry(pIndex); + lEntry->Set((T*)0); + if( lEntry->IsEmpty() ) + { + ChangePropertyEntryState(pIndex, FbxPropertyFlags::eInherit); + } + } + return 0; + } + return 0; + } + + template FbxPropertyPage* GetFirstPropertyItem(FbxInt pId, const T* pItem) const + { + FbxPropertyPage* lReferencePage = NULL; + GetPropertyItem(FBX_TYPE(T), pId, &lReferencePage); + if( lReferencePage && lReferencePage->mInstanceOf ) + { + FbxPropertyPage* lReferencePage2 = lReferencePage->mInstanceOf->GetFirstPropertyItem(pId, pItem); + return lReferencePage2 ? lReferencePage2 : lReferencePage; + } + return lReferencePage; + } + + const char* GetName(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + return lPropertyInfo ? ((const char*)lPropertyInfo->GetName()) : ""; + } + + const char* GetLabel(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + return lPropertyInfo ? ((const char*)lPropertyInfo->GetLabel()) : ""; + } + + bool SetLabel(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT, const char* pLabel="") + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + // Don't make it writeable (Keep it shared) + if (lPropertyInfo) { + lPropertyInfo->SetLabel(pLabel); + return true; + } else { + return false; + } + } + + void* GetUserData(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + return lPropertyInfo ? lPropertyInfo->GetUserData() : 0; + } + + bool SetUserData(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT, const void* pUserData=0) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + // Don't make it writeable (Keep it shared) + if (lPropertyInfo) { + lPropertyInfo->SetUserData(pUserData); + return true; + } else { + return false; + } + } + + int GetUserTag(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + return lPropertyInfo ? lPropertyInfo->GetUserTag() : 0; + } + + bool SetUserTag(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT,int pUserTag=0) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + // Don't make it writeable (Keep it shared) + if (lPropertyInfo) { + lPropertyInfo->SetUserTag(pUserTag); + return true; + } else { + return false; + } + } + + EFbxType GetType(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) const + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + return lPropertyInfo ? lPropertyInfo->GetType() : eFbxUndefined; + } + + FbxInt GetParent(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) const + { + FbxPropertyEntry* lPropertyEntry = GetPropertyEntry( pId ); + return lPropertyEntry ? lPropertyEntry->GetParentId() : FBXSDK_PROPERTY_ID_NULL; + } + + FbxPropertyPage* GetTypeInfo(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + return lPropertyInfo ? lPropertyInfo->GetTypeInfo() : 0; + } + FbxInt Add(FbxInt pParentId, const char* pName, EFbxType pType) + { + return Add(pParentId,FbxPropertyInfo::Create(pName,pType),FbxPropertyValue::Create(0,pType),0); + } + FbxInt Add(FbxInt pParentId, const char* pName, FbxPropertyPage* pTypeInfo) + { + return Add(pParentId,FbxPropertyInfo::Create(pName,pTypeInfo),FbxPropertyValue::Create(0,pTypeInfo->GetType()),0); + } + + inline bool Reparent( FbxInt /*pChildId*/, FbxInt /*pNewParentId*/ ) + { + // Not implemented. + /* + if( GetParent(pChildId) != pNewParentId && pChildId < mEntries.GetCount() ) + { + FbxPropertyEntry* lChildEntry = mEntries[pChildId]; + lChildEntry->mParentId = pNewParentId; + + //@@@@@ TODO: propagate to instances + + return true; + } + */ + return false; + } + + inline bool IsChildOf(FbxInt pId,FbxInt pParentId) const + { + return GetParent(pId)==pParentId; + + } + + inline bool IsDescendentOf(FbxInt pId,FbxInt pAncestorId) const + { + if (pAncestorId>0) { + FbxInt lParentId = GetParent(pId); + while (lParentId != FBXSDK_PROPERTY_ID_NULL ) { + if (lParentId==pAncestorId) { + return true; + } + lParentId = GetParent(lParentId); + } + return false; + } else { + return true; + } + + } + + //#define PROPERTY_PAGE_SANITY_CHECK // Debug purpose only. Never enable it in a production release. + + /** Retrieves the first child property id of a specified property id. + * \param pParentId The specified property id + * \return the first child property id + */ + FbxInt GetChild(FbxInt pParentId=FBXSDK_PROPERTY_ID_ROOT) const + { + #ifdef PROPERTY_PAGE_SANITY_CHECK + FbxInt ret0 = FBXSDK_PROPERTY_ID_NULL; + if (pParentId!=FBXSDK_PROPERTY_ID_NULL) { + FbxInt lId = GetMinimumPropertyId(pParentId); + FbxInt lParentId = GetParent(lId); + const FbxInt lLastId = GetPropertyEntryCount(); + + while (lIdGetParentId() != pParentId); + ret1 = lId; + } + #ifdef PROPERTY_PAGE_SANITY_CHECK + FBX_ASSERT(ret0==ret1); + #endif + return ret1; + } + + /** Retrieves the next sibling property id of a specified property id. + * \param pId The specified property id + * \return the next sibling property id + */ + FbxInt GetSibling(FbxInt pId) const + { + #ifdef PROPERTY_PAGE_SANITY_CHECK + FbxInt pIdBackup = pId; + FbxInt ret0 = FBXSDK_PROPERTY_ID_NULL; + if (pId!=FBXSDK_PROPERTY_ID_NULL) { + FbxInt lReferenceParentId = GetParent(pId); + FbxInt lParentId = GetParent(++pId); + const FbxInt lLastId = GetPropertyEntryCount(); + + while (pIdGetParentId() != lReferenceParentId); + + ret1 = pId; + } + } + + #ifdef PROPERTY_PAGE_SANITY_CHECK + FBX_ASSERT(ret0==ret1); + #endif + return ret1; + } + + /** Retrieves the first descendent property id of a specified property id. + * \param pAnscestorId The specified property id + * \return the first descendent property id + */ + FbxInt GetFirstDescendent(FbxInt pAnscestorId=FBXSDK_PROPERTY_ID_ROOT) const + { + #ifdef PROPERTY_PAGE_SANITY_CHECK + FbxInt ret0 = FBXSDK_PROPERTY_ID_NULL; + if (pAnscestorId!=FBXSDK_PROPERTY_ID_NULL) { + FbxInt lId = GetMinimumPropertyId(pAnscestorId); + FbxInt lParentId = GetParent(lId); + const FbxInt lLastId = GetPropertyEntryCount(); + + while (lIdGetParentId() != FBXSDK_PROPERTY_ID_NULL && IsDescendentOf(lId, pAnscestorId)) + { + ret1 = lId; + break; + } + } + } + + #ifdef PROPERTY_PAGE_SANITY_CHECK + FBX_ASSERT(ret0==ret1); + #endif + return ret1; + } + + /** Retrieves the next descendent property id of a specified property id, with given a descendent property id. + * \param pAnscestorId The specified property id + * \param pId The descendent property id + * \return the next descendent property id + */ + FbxInt GetNextDescendent(FbxInt pAnscestorId, FbxInt pId) const + { + #ifdef PROPERTY_PAGE_SANITY_CHECK + FbxInt pIdBackup = pId; + FbxInt ret0 = FBXSDK_PROPERTY_ID_NULL; + if (pId!=FBXSDK_PROPERTY_ID_NULL) { + FbxInt lParentId = GetParent(++pId); + const FbxInt lLastId = GetPropertyEntryCount(); + + while (pIdGetParentId() != FBXSDK_PROPERTY_ID_NULL && IsDescendentOf(pId, pAnscestorId) ) + { + ret1 = pId; + break; + } + } + + } + #ifdef PROPERTY_PAGE_SANITY_CHECK + FBX_ASSERT(ret0==ret1); + #endif + return ret1; + + } + + FbxInt FastFind (FbxInt pId, const char* pName, FbxPropertyPage* pTypeInfo, bool pCaseSensitive) + { + FbxInt lId = FBXSDK_PROPERTY_ID_NULL; + + bool lSlowQuery = true; + if( mNameMap.mSecond.GetSize() > 0 ) + { + lSlowQuery = false; + // try to use the map if we've got it + NameMap::RecordType* lIterator = mNameMap.mSecond.Find( FbxNameMapKey( pId, pName ) ); + if( !lIterator ) + { + lId = FBXSDK_PROPERTY_ID_NULL; + } + else + { + lId = lIterator->GetValue(); + if (lId != FBXSDK_PROPERTY_ID_NULL && pTypeInfo) + { + lSlowQuery = true; + + // Try to match types. + // If they are mismatched, fall back to the slow query, + // since we might have multiple property with the same name but different types + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo), lId ); + if (lPropertyInfo) + { + FbxPropertyPage* lTypeInfo2 = lPropertyInfo->GetTypeInfo(); + if ( lTypeInfo2 && lTypeInfo2->Is(pTypeInfo) ) + { + lSlowQuery = false; + } + } + } + } + } + + if (!lSlowQuery) + return lId; + + // fall back if there's no map or we got one with a different type + + lId = GetChild(pId); + FbxStringSymbol lSearchSymbol( pName ); + while( lId != FBXSDK_PROPERTY_ID_NULL ) { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo), lId ); + if ( (!pTypeInfo || lPropertyInfo->GetTypeInfo()->Is(pTypeInfo)) && + ((!pCaseSensitive && FBXSDK_stricmp(lPropertyInfo->GetName(),pName)==0) || + (pCaseSensitive && lPropertyInfo->GetName() == lSearchSymbol)) ) { + return lId; + } + lId = GetSibling(lId); + } + + return FBXSDK_PROPERTY_ID_NULL; + } + + FbxInt Find (FbxInt pId, const char* pName, FbxPropertyPage* pTypeInfo, bool pCaseSensitive, const char* pChildrenSeparators ) + { + if (pChildrenSeparators) + { + FbxInt lId; + size_t lFoundIndex = strcspn(pName,pChildrenSeparators); + + // Strip the first part of the name and search + if (lFoundIndexAddEnumValue(pStringValue) : - 1; + } + + void InsertEnumValue(FbxInt pId, int pIndex, const char* pStringValue) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + // Don't make it writeable (Keep it shared) + if (lPropertyInfo) lPropertyInfo->InsertEnumValue(pIndex,pStringValue); + } + + int GetEnumCount(FbxInt pId) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + // Don't make it writeable (Keep it shared) + return lPropertyInfo ? lPropertyInfo->GetEnumCount() : 0; + } + + void SetEnumValue(FbxInt pId, int pIndex, const char* pStringValue) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + // Don't make it writeable (Keep it shared) + if (lPropertyInfo) lPropertyInfo->SetEnumValue(pIndex,pStringValue); + } + + void RemoveEnumValue(FbxInt pId, int pIndex) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + // Don't make it writeable (Keep it shared) + if (lPropertyInfo) lPropertyInfo->RemoveEnumValue(pIndex); + } + + char* GetEnumValue(FbxInt pId,int pIndex) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + return lPropertyInfo ? lPropertyInfo->GetEnumValue(pIndex) : (char*)""; + } + + // Connection + // --------------------------------- + void ClearConnectCache(FbxInt pId) + { + FbxPropertyPage* lReferencePage = 0; + FbxPropertyConnect* lPropertyConnect = GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pId,&lReferencePage ); + + // Connections are not considered propagated so + // make sure that we own the FbxPropertyConnect objects + if (lPropertyConnect) { + lPropertyConnect->ClearConnectCache(); + } + } + + void WipeAllConnections(FbxInt pId) + { + FbxPropertyPage* lReferencePage = 0; + FbxPropertyConnect* lPropertyConnect = GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pId,&lReferencePage ); + + if (lPropertyConnect) { + lPropertyConnect->WipeAllConnections(); + } + } + + bool ConnectSrc(FbxInt pDstId, FbxPropertyPage* pSrcPage, FbxInt pSrcId, FbxConnection::EType pType) + { + FbxPropertyEntry* lDstEntry = ChangePropertyEntryState(pDstId,FbxPropertyFlags::eOverride); + FbxPropertyEntry* lSrcEntry = pSrcPage->ChangePropertyEntryState(pSrcId,FbxPropertyFlags::eOverride); + FbxPropertyConnect* lDstConnect= lDstEntry->Get( FBX_TYPE(FbxPropertyConnect) ); + FbxPropertyConnect* lSrcConnect= lSrcEntry->Get( FBX_TYPE(FbxPropertyConnect) ); + + // Make sure we have a connection point on both sides of the connection + if (!lDstConnect) { + lDstConnect = FbxPropertyConnect::Create( this,pDstId ); + lDstEntry->Set( lDstConnect ); + } + if (!lSrcConnect) { + lSrcConnect = FbxPropertyConnect::Create( pSrcPage,pSrcId ); + lSrcEntry->Set( lSrcConnect ); + } + + // Must @@@@@@@ Propagate to inherited children + return lDstConnect->ConnectSrc(lSrcConnect,pType); + + } + + bool DisconnectSrc(FbxInt pDstId,FbxPropertyPage* pSrcPage,FbxInt pSrcId) + { + FbxPropertyPage* lDstReferencePage = 0; + FbxPropertyConnect* lDstConnect = GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pDstId,&lDstReferencePage ); + FbxPropertyPage* lSrcReferencePage = 0; + FbxPropertyConnect* lSrcConnect = pSrcPage->GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pSrcId,&lSrcReferencePage ); + + // Make sure we have a connection point on both sides of the connection + if (lDstConnect && lSrcConnect && lDstReferencePage==this && lSrcReferencePage==pSrcPage) { + // Must @@@@@@@ Remove unused connections + return lDstConnect->DisconnectSrc(lSrcConnect); + } + return false; + } + + bool IsConnectedSrc(FbxInt pDstId, FbxPropertyPage* pSrcPage, FbxInt pSrcId) + { + FbxPropertyPage* lDstReferencePage = 0; + FbxPropertyConnect* lDstConnect = GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pDstId,&lDstReferencePage ); + FbxPropertyPage* lSrcReferencePage = 0; + FbxPropertyConnect* lSrcConnect = pSrcPage->GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pSrcId,&lSrcReferencePage ); + + // Make sure we have a connection point on both sides of the connection + if (lDstConnect && lSrcConnect && lDstReferencePage==this && lSrcReferencePage==pSrcPage) { + // Must @@@@@@@ Remove unused connections + return lDstConnect->IsConnectedSrc(lSrcConnect); + } + return false; + } + + int GetSrcCount(FbxInt pId, FbxConnectionPointFilter* pFilter) + { + FbxPropertyPage* lReferencePage = 0; + FbxPropertyConnect* lPropertyConnect = GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pId,&lReferencePage ); + + // Connections are not considered propagated so + // make sure that we own the FbxPropertyConnect objects + return (lPropertyConnect && lReferencePage==this) ? lPropertyConnect->GetSrcCount(pFilter) : 0; + } + + bool GetSrc(FbxInt pId, int pIndex, FbxConnectionPointFilter* pFilter, FbxPropertyPage** pSrcPage, FbxInt* pSrcId) + { + FbxPropertyPage* lReferencePage = 0; + FbxPropertyConnect* lPropertyConnect = GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pId,&lReferencePage ); + + // Connections are always overridden + // make sure that we own the FbxPropertyConnect Item + if (lPropertyConnect && lReferencePage==this) + { + FbxPropertyConnect* lSrc = lPropertyConnect->GetSrc(pFilter,pIndex); + if (lSrc) + { + if (pSrcPage) *pSrcPage = lSrc->GetPage(); + if (pSrcId) *pSrcId = lSrc->GetPropertyId(); + return true; + } + } + return false; + } + + bool ConnectDst(FbxInt pSrcId, FbxPropertyPage* pDstPage, FbxInt pDstId, FbxConnection::EType pType) + { + return pDstPage->ConnectSrc(pDstId,this,pSrcId,pType); + } + + bool DisconnectDst(FbxInt pSrcId, FbxPropertyPage* pDstPage, FbxInt pDstId) + { + return pDstPage->DisconnectSrc(pDstId,this,pSrcId); + } + + bool IsConnectedDst(FbxInt pSrcId, FbxPropertyPage* pDstPage, FbxInt pDstId) + { + return pDstPage->IsConnectedSrc(pDstId,this,pSrcId); + } + + int GetDstCount(FbxInt pId, FbxConnectionPointFilter* pFilter) + { + FbxPropertyPage* lReferencePage = 0; + FbxPropertyConnect* lPropertyConnect = GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pId,&lReferencePage ); + + // Connections are not considered propagated so + // make sure that we own the FbxPropertyConnect objects + return (lPropertyConnect && lReferencePage==this) ? lPropertyConnect->GetDstCount(pFilter) : 0; + } + + bool GetDst(FbxInt pId, int pIndex, FbxConnectionPointFilter* pFilter, FbxPropertyPage** pDstPage, FbxInt* pDstId) + { + FbxPropertyPage* lReferencePage = 0; + FbxPropertyConnect* lPropertyConnect = GetPropertyItem( FBX_TYPE(FbxPropertyConnect),pId,&lReferencePage ); + + // Connections are always overridden + // make sure that we own the FbxPropertyConnect Item + if (lPropertyConnect && lReferencePage==this) + { + FbxPropertyConnect* lDst = lPropertyConnect->GetDst(pFilter,pIndex); + if (lDst) + { + if (pDstPage) *pDstPage = lDst->GetPage(); + if (pDstId) *pDstId = lDst->GetPropertyId(); + return true; + } + } + return false; + } + + // Min and Max + // --------------------------------- + enum EValueIndex { eValueMin,eValueSoftMin,eValueMax,eValueSoftMax,eValueCount }; + + bool HasMinMax(FbxInt pId, FbxPropertyInfo::EValueIndex pValueId) const + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + + return lPropertyInfo ? lPropertyInfo->HasMinMax(pValueId) : false; + } + + bool GetMinMax(FbxInt pId, FbxPropertyInfo::EValueIndex pValueId, void* pValue, EFbxType pValueType) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + // Don't make it writeable (Keep it shared) + return lPropertyInfo ? lPropertyInfo->GetMinMax(pValueId,pValue,pValueType) : false; + } + + bool SetMinMax(FbxInt pId, FbxPropertyInfo::EValueIndex pValueId, const void* pValue, EFbxType pValueType) + { + FbxPropertyInfo* lPropertyInfo = GetPropertyItem( FBX_TYPE(FbxPropertyInfo),pId ); + // Don't make it writeable (Keep it shared) + return lPropertyInfo ? lPropertyInfo->SetMinMax(pValueId,pValue,pValueType) : false; + } + + // Value + // --------------------------------- + bool Get(FbxInt pId, void* pValue, EFbxType pValueType) + { + FbxPropertyValue* lPropertyValue = GetPropertyItem( FBX_TYPE(FbxPropertyValue),pId ); + return lPropertyValue ? lPropertyValue->Get(pValue,pValueType) : 0; + } + + bool Set(FbxInt pId, const void* pValue, EFbxType pValueType, bool pCheckValueEquality) + { + if( pCheckValueEquality ) + { + FbxPropertyPage* lReferencePage = NULL; + FbxPropertyValue* lPropertyValue = GetPropertyItem( FBX_TYPE(FbxPropertyValue),pId,&lReferencePage ); + void* lCurrentValue = FbxTypeAllocate( pValueType ); + bool lValuesEqual = false; + bool lValueChanged = false; + if( lReferencePage && lReferencePage != this ) + { + // this page inherits, so check if we have to override the value. + if( lPropertyValue ) + { + lPropertyValue->Get( lCurrentValue, pValueType ); + lValuesEqual = FbxTypeCompare( pValue, lCurrentValue, pValueType ); + } + } + else + { + FbxPropertyPage* lReferencePage2 = NULL; + FbxPropertyValue* lPropertyValue2 = mInstanceOf ? mInstanceOf->GetPropertyItem( FBX_TYPE(FbxPropertyValue),pId,&lReferencePage2 ) : NULL; + if( lReferencePage2 && lPropertyValue2 ) + { + // this page is an override, but there is another page before us that overrides the value + lPropertyValue2->Get( lCurrentValue, pValueType ); + lValuesEqual = FbxTypeCompare( pValue, lCurrentValue, pValueType ); + + if( lValuesEqual ) + { + ChangePropertyItemState( FBX_TYPE(FbxPropertyValue), pId, FbxPropertyFlags::eInherit ); + lValueChanged = true; + } + + } + // else this page is the originator of the property, so no need to check, + } + + FbxTypeDeallocate(pValueType, lCurrentValue); + lCurrentValue = NULL; + + if( lValuesEqual ) + return lValueChanged; + } + + FbxPropertyValue* lPropertyValue = ChangePropertyItemState( FBX_TYPE(FbxPropertyValue),pId,FbxPropertyFlags::eOverride ); + return lPropertyValue ? lPropertyValue->Set(pValue,pValueType) : false; + } + + inline FbxPropertyFlags::EInheritType GetValueInherit(FbxInt pId, bool pCheckInstanceOf) const + { + FbxPropertyPage* lReferencePage = NULL; + GetPropertyItem(FBX_TYPE(FbxPropertyValue), pId, &lReferencePage); + + // check one level + if( !pCheckInstanceOf ) + { + return lReferencePage == this ? FbxPropertyFlags::eOverride : FbxPropertyFlags::eInherit; + } + else + { + if( lReferencePage == this ) return FbxPropertyFlags::eOverride; // this page is either an override, or the originator + else if( !lReferencePage->mInstanceOf ) return FbxPropertyFlags::eInherit; // the reference is the class root, so we must be inheriting + + // The reference page is not the class root, might be another override, or the originator. + FbxPropertyValue* lPropertyValue = lReferencePage->mInstanceOf->GetPropertyItem( FBX_TYPE(FbxPropertyValue), pId ); + + // if lReferencePage->mInstanceOf has the property value, + // lReferencePage is an override + // else + // its the originator, so this page inherits from it. + return lPropertyValue ? FbxPropertyFlags::eOverride : FbxPropertyFlags::eInherit; + } + } + + inline bool SetValueInherit(FbxInt pId, FbxPropertyFlags::EInheritType pType) + { + // no support for this mode yet + if( FbxPropertyFlags::eDeleted == pType ) + return false; + + ChangePropertyItemState( FBX_TYPE(FbxPropertyValue), pId, pType ); + + // Above call doesn't return error codes, so just check that we match types. + return GetValueInherit(pId, false) == pType; + } + + inline bool GetDefaultValue(FbxInt pId, void* pValue, EFbxType pValueType) const + { + FbxPropertyPage* lReferencePage = GetFirstPropertyItem( pId, FBX_TYPE(FbxPropertyValue) ); + FbxPropertyValue* lPropertyValue = lReferencePage ? lReferencePage->GetPropertyItem( FBX_TYPE(FbxPropertyValue), pId ) : NULL; + + return lPropertyValue ? lPropertyValue->Get( pValue, pValueType ) : false; + } + + + // useful set and get functions + template inline bool Set( FbxInt pId, const T& pValue ) { return Set( pId,&pValue,FbxTypeOf(pValue),true ); } + template inline T Get( FbxInt pId, const T* pFBX_TYPE) { T lValue; Get( pId,&lValue,FbxTypeOf(lValue) ); return lValue; } + + + void SetDataPtr(void* pDataPtr) { mDataPtr = pDataPtr; } + void* GetDataPtr() const { return mDataPtr; } + + // Instance and override management + // ------------------------------------------ + void PushPropertiesToParentInstance() + { + if (mInstanceOf) { + const int lCount = GetPropertyEntryCount(); + // push the existing properties into the parent + // ---------------------------------------------- + for( int i = 0; i < lCount; ++i ) + { + FbxPropertyEntry* lParentEntry = mInstanceOf->ChangePropertyEntryState( (FbxInt)i,FbxPropertyFlags::eOverride ); + FbxPropertyEntry* lEntry = GetPropertyEntry( (FbxInt)i ); + + if( !lParentEntry ) + { + lParentEntry = FbxPropertyEntry::Create( lEntry->GetParentId(), 0, 0, 0 ); + mInstanceOf->mEntryMap.Insert( i, lParentEntry ); + + //mInstanceOf->AddChild(i); + + } + + FBX_ASSERT( lParentEntry ); + + // Add it to the parent + // Don't touch the connections + // ----------------------------------------- + if (lParentEntry) { + lParentEntry->Set( lEntry->Get(FBX_TYPE(FbxPropertyInfo)) ); + lParentEntry->Set( lEntry->Get(FBX_TYPE(FbxPropertyValue)) ); + lParentEntry->Set( lEntry->Get(FBX_TYPE(FbxPropertyFlags)) ); + } + + /* + else { + mInstanceOf->Add( + lEntry->GetParentId(), + lEntry->Get(FBX_TYPE(FbxPropertyInfo)), // The info + lEntry->Get(FBX_TYPE(FbxPropertyValue)), // The Value + 0, // The connections + false, + false + ); + } + */ + + // Empty the current entry + // Don't touch the connections + // ----------------------------------------- + ChangePropertyItemState(FBX_TYPE(FbxPropertyInfo), i,FbxPropertyFlags::eInherit); + ChangePropertyItemState(FBX_TYPE(FbxPropertyValue), i,FbxPropertyFlags::eInherit); + ChangePropertyItemState(FBX_TYPE(FbxPropertyFlags), i,FbxPropertyFlags::eInherit); + } + } + } + + inline const FbxPropertyPage* GetInstanceOf() const { return mInstanceOf; } + inline FbxPropertyPage* GetInstanceOf() { return mInstanceOf; } + + inline const FbxArray& GetInstances() const { return mInstances; } + inline FbxArray& GetInstances() { return mInstances; } + + + // Flags + // ------------------------------------------ + FbxPropertyFlags::EFlags GetFlags(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) const + { + FbxPropertyPage* lFoundIn = NULL; + FbxPropertyFlags* lPropertyFlags = GetPropertyItem( FBX_TYPE(FbxPropertyFlags), pId, &lFoundIn ); + FbxPropertyFlags::EFlags lFlags = FbxPropertyFlags::eNone; + + if( lPropertyFlags ) + { + if( !mInstanceOf ) // no inheritance. + lFlags = lPropertyFlags->GetFlags(); + else + { + lFlags = mInstanceOf->GetFlags(pId); + lFlags = lPropertyFlags->GetMergedFlags(lFlags); + } + } + return lFlags; + } + + bool ModifyFlags(FbxInt pId=FBXSDK_PROPERTY_ID_ROOT,FbxPropertyFlags::EFlags pFlags=FbxPropertyFlags::eNone,bool pValue=true,bool pCheckFlagEquality=true) + { + if( pCheckFlagEquality ) + { + FbxPropertyPage* lFoundIn = NULL; + FbxPropertyFlags* lFlag = GetPropertyItem( FBX_TYPE(FbxPropertyFlags), pId, &lFoundIn ); + + if( lFlag ) + { + if( lFoundIn == this ) + { + // set them in us. + lFlag->ModifyFlags( pFlags, pValue ); + + // we override this entry, check if we need to revert + FbxPropertyFlags* lInheritedFlags = mInstanceOf ? mInstanceOf->GetPropertyItem( FBX_TYPE(FbxPropertyFlags), pId ) : NULL; + if( lInheritedFlags && lInheritedFlags->Equal( *lFlag, pFlags ) ) + { + lFlag->UnsetMask( pFlags ); + + if( lFlag->GetMask() == 0 ) + ChangePropertyItemState( FBX_TYPE(FbxPropertyFlags), pId, FbxPropertyFlags::eInherit ); + + return true; + } + } + else + { + // its not us. Just check if we need to set. + FbxPropertyFlags lNewValues( pFlags ); + if( lFlag->Equal( lNewValues, pFlags ) ) + return true; + } + } + } + + FbxPropertyFlags* lPropertyFlags = ChangePropertyItemState(FBX_TYPE(FbxPropertyFlags), pId, FbxPropertyFlags::eOverride); + return lPropertyFlags ? lPropertyFlags->ModifyFlags( pFlags, pValue ) : false; + } + + FbxPropertyFlags::EInheritType GetFlagsInheritType(FbxPropertyFlags::EFlags pFlags, bool pCheckInstanceOf, FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) const + { + FbxPropertyPage* lFoundIn = NULL; + FbxPropertyFlags* lPropertyFlags = GetPropertyItem( FBX_TYPE(FbxPropertyFlags), pId, &lFoundIn ); + + if( !pCheckInstanceOf ) + return lFoundIn != this ? FbxPropertyFlags::eInherit : ( lPropertyFlags ? lPropertyFlags->GetFlagsInheritType(pFlags) : FbxPropertyFlags::eInherit ); + else + { + // This code basically counts the number of overrides for the + // given flags. The original entry is always considered an override. + // so if we see more than one, something overrode the original. + // and thus we are an override. + FbxPropertyPage* lRefPage = lFoundIn; + bool lFoundOverride = false; + while( lRefPage ) + { + lPropertyFlags = lRefPage->GetPropertyItem( FBX_TYPE(FbxPropertyFlags), pId ); + + if( !lPropertyFlags ) + break; // gone too far, break. + + if( lPropertyFlags->GetFlagsInheritType( pFlags ) == FbxPropertyFlags::eOverride ) + { + if( this == lRefPage || lFoundOverride ) + return FbxPropertyFlags::eOverride; // found two overrides or this page is the override. + else + lFoundOverride = true; // signal that we found the first override. + } + lRefPage = lRefPage->mInstanceOf; + } + + return FbxPropertyFlags::eInherit; + } + } + + bool SetFlagsInheritType(FbxPropertyFlags::EInheritType pInheritType, FbxPropertyFlags::EFlags pFlags, FbxInt pId=FBXSDK_PROPERTY_ID_ROOT) + { + FbxPropertyPage* lFoundIn = NULL; + FbxPropertyFlags* lPropertyFlags = NULL; + + if( FbxPropertyFlags::eOverride == pInheritType ) + { + lPropertyFlags = ChangePropertyItemState( FBX_TYPE(FbxPropertyFlags), pId, FbxPropertyFlags::eOverride ); + + // we should initialize our flag to the inherited value, if any. + FbxPropertyFlags* lParentFlags = mInstanceOf ? mInstanceOf->GetPropertyItem( FBX_TYPE(FbxPropertyFlags), pId ) : NULL; + if( lParentFlags && lPropertyFlags ) + { + FbxPropertyFlags::EFlags lParentValues = lParentFlags->GetFlags(); + lPropertyFlags->SetFlags( pFlags, lParentValues ); + return lPropertyFlags->SetMask( pFlags ); + } + + return false; + } + else if( FbxPropertyFlags::eInherit == pInheritType ) + { + lPropertyFlags = GetPropertyItem(FBX_TYPE(FbxPropertyFlags), pId, &lFoundIn); + if( !lPropertyFlags ) return false; + if( lFoundIn != this ) return true; // not us + lPropertyFlags->UnsetMask( pFlags ); + if( lPropertyFlags->GetMask() == 0 ) // revert + ChangePropertyItemState( FBX_TYPE(FbxPropertyFlags), pId, FbxPropertyFlags::eInherit ); + + return true; + } + return false; + } + + inline void BeginCreateOrFindProperty() + { + if( 0 == mNameMap.mFirst ) + { + mNameMap.mSecond.Reserve(20); + + // push the existing properties into the map. Note: this includes the root property! + FbxInt lFoundId = FBXSDK_PROPERTY_ID_ROOT; + FbxPropertyEntry* lEntry = GetPropertyEntry(lFoundId); + while(lFoundId != FBXSDK_PROPERTY_ID_NULL) + { + FbxPropertyInfo* lInfo = lEntry->Get(FBX_TYPE(FbxPropertyInfo)); + //FBX_ASSERT( lInfo ); + if (lInfo) + { + mNameMap.mSecond.Insert(FbxNameMapKey(lEntry->GetParentId(), lInfo->GetName()), lFoundId); + } + lFoundId = GetMinimumPropertyIdAndEntry(lFoundId, &lEntry); + } + mNameMap.mFirst++; + } + } + + inline void EndCreateOrFindProperty() + { + if( mNameMap.mFirst > 0 ) + { + if( --(mNameMap.mFirst) == 0 ) + mNameMap.mSecond.Clear(); + } + } + +protected: + FbxPropertyPage(FbxPropertyPage* pInstanceOf=0) + : mInstanceOf(0) + , mDataPtr(0) + , mPropNextId(0) + { + mEntryMap.Reserve(32); + mNameMap.mFirst = 0; + + // instances don't need to create a root property + if( !pInstanceOf ) + { + mPropNextId = FbxNew< FbxPropertyIdGenerator >(); + mPropNextId->IncRef(); + + // First item is the root information + Add(FBXSDK_PROPERTY_ID_NULL,"",eFbxUndefined); + } + + // Hook the instances + // ------------------------ + mInstanceOf = pInstanceOf; + if (mInstanceOf) { + mInstanceOf->mInstances.Add(this); + + mPropNextId = mInstanceOf->mPropNextId; + mPropNextId->IncRef(); + } + } + FbxPropertyPage(const char* pName, EFbxType pType) + : mInstanceOf(0) + , mDataPtr(0) + , mPropNextId(0) + { + mEntryMap.Reserve(32); + mNameMap.mFirst = 0; + + mPropNextId = FbxNew< FbxPropertyIdGenerator >(); + mPropNextId->IncRef(); + + // First item is the root information + Add(FBXSDK_PROPERTY_ID_NULL,pName,pType); + } + FbxPropertyPage(const char* pName, FbxPropertyPage* pTypeInfo) + : mInstanceOf(0) + , mDataPtr(0) + , mPropNextId(0) + { + mEntryMap.Reserve(32); + mNameMap.mFirst = 0; + + mPropNextId = FbxNew< FbxPropertyIdGenerator >(); + mPropNextId->IncRef(); + + // First item is the root information + Add(FBXSDK_PROPERTY_ID_NULL,pName,pTypeInfo); + } + ~FbxPropertyPage() + { + // Propagate our property entries. + int i = 0, j = 0; + for( i = 0; i < mInstances.GetCount(); ++i ) + { + for( j = 0; j < GetPropertyEntryCount(); ++j ) + { + if( mInstances[i]->ChangePropertyEntryState((FbxInt)j, FbxPropertyFlags::eOverride) ) + { + // Clone the info and values. Don't clone the connections, + // since they aren't propagated. + mInstances[i]->ChangePropertyItemState( FBX_TYPE(FbxPropertyInfo), (FbxInt)j, FbxPropertyFlags::eOverride ); + mInstances[i]->ChangePropertyItemState( FBX_TYPE(FbxPropertyValue), (FbxInt)j, FbxPropertyFlags::eOverride ); + + // Since all entries have their own flags, just override the ones in the instance. + mInstances[i]->SetFlagsInheritType(FbxPropertyFlags::eOverride, FbxPropertyFlags::eAllFlags, (FbxInt)j ); + } + } + + // Instances become their own copies. + mInstances[i]->mInstanceOf = NULL; + } + + FbxMapDestroy(mEntryMap); + + if (mInstanceOf) { + int lIndex = mInstanceOf->mInstances.Find(this); + mInstanceOf->mInstances.SetAt(lIndex, mInstanceOf->mInstances[mInstanceOf->mInstances.GetCount()-1]); + mInstanceOf->mInstances.RemoveAt(mInstanceOf->mInstances.GetCount()-1); + + //mInstanceOf->mInstances.RemoveIt(this); + } + + mPropNextId->DecRef(); + mPropNextId = NULL; + + mInstanceOf = NULL; + mInstances.Clear(); + } + + inline bool Is(FbxPropertyPage* pPage) + { + // @@@@@@@@@@@@@@@ Must complete for sub types + return this==pPage; + } + +// Internal entry management +private: + + /** Retrieves the smallest property id of which are larger than a specified one. + * \param pId The specified property id + * \param pIncrementIfNone Whether it returns FBXSDK_PROPERTY_ID_NULL or pId+1, if not found. + * \return The property id described above. + */ + FbxInt GetMinimumPropertyId(FbxInt pId, bool pIncrementIfNone = true) const + { + if( pId == FBXSDK_PROPERTY_ID_NULL ) + pId = FBXSDK_PROPERTY_ID_ROOT; + + FbxInt lMin = FBXSDK_PROPERTY_ID_NULL; + const EntryMap::RecordType* lElement = mEntryMap.UpperBound(pId); + if (NULL != lElement) + { + lMin = lElement->GetKey(); + } + + FbxInt lParentMin = mInstanceOf ? mInstanceOf->GetMinimumPropertyId(pId,false) : FBXSDK_PROPERTY_ID_NULL; + + bool lParentNull = lParentMin == FBXSDK_PROPERTY_ID_NULL; + bool lMinNull = lMin == FBXSDK_PROPERTY_ID_NULL; + + if( lParentNull && lMinNull ) return pIncrementIfNone ? pId+1 : FBXSDK_PROPERTY_ID_NULL; + else if( lMinNull ) lMin = lParentMin; + else if( !lParentNull ) lMin = lMin < lParentMin ? lMin : lParentMin; + + return lMin; + } + + /** Retrieves the smallest property id of which are larger than a specified one, and retrieve its entry. + * \param pId The specified property id + * \param pEntry The returned property entry + * \return The property id described above. + */ + FbxInt GetMinimumPropertyIdAndEntry(FbxInt pId, FbxPropertyEntry** pEntry) const + { + FbxInt lFoundId = FBXSDK_PROPERTY_ID_NULL; + FbxPropertyEntry* lFoundEntry = NULL; + if( pId == FBXSDK_PROPERTY_ID_NULL ) + pId = FBXSDK_PROPERTY_ID_ROOT; + + const EntryMap::RecordType* lElement = mEntryMap.UpperBound(pId); + if (NULL != lElement) + { + lFoundId = lElement->GetKey(); + lFoundEntry = lElement->GetValue(); + } + + FbxPropertyEntry* lParentEntry = NULL; + FbxInt lParentMin = mInstanceOf ? mInstanceOf->GetMinimumPropertyIdAndEntry(pId, &lParentEntry) : FBXSDK_PROPERTY_ID_NULL; + + bool lParentNull = lParentMin == FBXSDK_PROPERTY_ID_NULL; + bool lMinNull = lFoundId == FBXSDK_PROPERTY_ID_NULL; + + if( lMinNull && !lParentNull ) + { + lFoundId = lParentMin; + lFoundEntry = lParentEntry; + } + else if( !lMinNull && !lParentNull ) + { + lFoundId = lFoundId < lParentMin ? lFoundId : lParentMin; + lFoundEntry = lFoundId < lParentMin ? lFoundEntry : lParentEntry; + } + + if (pEntry) + *pEntry = lFoundEntry; + return lFoundId; + } + + int GetPropertyEntryCount() const + { + int lCount = 0; + const EntryMap::RecordType* lElement = mEntryMap.Maximum(); + + if (NULL != lElement) + { + lCount = lElement->GetKey() + 1; + } + + int lParentCount = mInstanceOf ? mInstanceOf->GetPropertyEntryCount() : 0; + return lParentCount > lCount ? lParentCount : lCount; + } + + FbxPropertyEntry* GetPropertyEntry(FbxInt pIndex,FbxPropertyPage **pFoundIn=0) const + { + const EntryMap::RecordType* lElement = mEntryMap.Find(pIndex); + if (NULL != lElement) + { + if( pFoundIn ) + { + *pFoundIn = const_cast(this); + } + return lElement->GetValue(); + } + + if( pFoundIn ) + { + *pFoundIn = 0; + } + + return mInstanceOf ? mInstanceOf->GetPropertyEntry(pIndex,pFoundIn) : 0; + } + + FbxPropertyEntry* ChangePropertyEntryState(FbxInt pIndex,FbxPropertyFlags::EInheritType pInheritType) + { + FbxPropertyPage* lReferencePage = 0; + FbxPropertyEntry* lReferenceEntry = GetPropertyEntry(pIndex,&lReferencePage); + + if (pInheritType==FbxPropertyFlags::eOverride) { + if (lReferencePage==this) { + return lReferenceEntry; + } else if (lReferenceEntry) { + // must create an entry + FbxPropertyEntry* lEntry = FbxPropertyEntry::Create(lReferenceEntry->GetParentId(),0,0,0); + mEntryMap.Insert( pIndex, lEntry ); + + return lEntry; + } + } else { + if (lReferenceEntry && (lReferencePage==this)) { + mEntryMap.Remove(pIndex); + lReferenceEntry->Destroy(); + } + } + return 0; + } + + FbxInt Add(FbxInt pParentId,FbxPropertyInfo* pInfo,FbxPropertyValue* pValue,FbxPropertyConnect* pConnect,bool pRecursive=true) + { + FbxInt lId = mPropNextId->GetNextIdAndInc(); + FbxPropertyEntry* lEntry = FbxPropertyEntry::Create(pParentId,pInfo,pValue,pConnect); + + // entries created through Add() are not overrides of another entry. + // Thus, set all of their flags by default. + FbxPropertyFlags* lFlags = lEntry->Get( FBX_TYPE(FbxPropertyFlags) ); + if( lFlags ) lFlags->ModifyFlags( FbxPropertyFlags::eAllFlags, false ); + + mEntryMap.Insert( lId, lEntry ); + + // We only add to the map if this Add is called after BeginCreateOrFindProperty() + // in which case the size is always > 0 because it includes the root property + if( mNameMap.mSecond.GetSize() > 0 ) + mNameMap.mSecond.Insert( FbxNameMapKey( pParentId, pInfo->GetName()), lId ); + + // If the entry has multiple children(Struct Datatype) + // Recurse for the entries and create an entry in this structure + if (pRecursive) { + FbxPropertyPage* lTypeInfo = pInfo->GetTypeInfo(); + if (lTypeInfo) { + FbxInt lChildId; + lChildId = lTypeInfo->GetChild(); + while (lChildId!=FBXSDK_PROPERTY_ID_NULL) { + FbxPropertyInfo* lPropertyInfo = lTypeInfo->GetPropertyItem( FBX_TYPE(FbxPropertyInfo),lChildId ); + FbxPropertyValue* lPropertyValue = lTypeInfo->GetPropertyItem( FBX_TYPE(FbxPropertyValue),lChildId ); + FbxPropertyConnect* lPropertyConnect = lTypeInfo->GetPropertyItem( FBX_TYPE(FbxPropertyConnect),lChildId ); + + Add ( lId, lPropertyInfo ? lPropertyInfo->Clone(this) : 0 , lPropertyValue ? lPropertyValue->Clone(this) : 0, + lPropertyConnect ? lPropertyConnect->Clone(this) : 0 ); + lChildId = lTypeInfo->GetSibling(lChildId ); + } + } + } + return lId; + } + + // Property management + typedef FbxMap, FbxHungryAllocator> EntryMap; + EntryMap mEntryMap; + + // instance management + FbxPropertyPage* mInstanceOf; + FbxArray mInstances; + + void* mDataPtr; + + // speed up structure + typedef FbxMap NameMap; + typedef FbxPair NameLookupPair; + NameLookupPair mNameMap; + + FbxPropertyIdGenerator* mPropNextId; + + friend class FbxPropertyHandle; +}; + +#include + +#endif /* _FBXSDK_CORE_PROPERTY_PAGE_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxpropertytypes.h b/libs/fbx/include/fbxsdk/core/fbxpropertytypes.h new file mode 100644 index 00000000..a42e4254 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxpropertytypes.h @@ -0,0 +1,1178 @@ +/**************************************************************************************** + + 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 fbxpropertytypes.h +#ifndef _FBXSDK_CORE_PROPERTY_TYPES_H_ +#define _FBXSDK_CORE_PROPERTY_TYPES_H_ + +#include + +#include +#include +#include +#include +#include +#include + +#include + +//! Type identifier constants +enum EFbxType +{ + eFbxUndefined, //!< Unidentified. + eFbxChar, //!< 8 bit signed integer. + eFbxUChar, //!< 8 bit unsigned integer. + eFbxShort, //!< 16 bit signed integer. + eFbxUShort, //!< 16 bit unsigned integer. + eFbxUInt, //!< 32 bit unsigned integer. + eFbxLongLong, //!< 64 bit signed integer. + eFbxULongLong, //!< 64 bit unsigned integer. + eFbxHalfFloat, //!< 16 bit floating point. + eFbxBool, //!< Boolean. + eFbxInt, //!< 32 bit signed integer. + eFbxFloat, //!< Floating point value. + eFbxDouble, //!< Double width floating point value. + eFbxDouble2, //!< Vector of two double values. + eFbxDouble3, //!< Vector of three double values. + eFbxDouble4, //!< Vector of four double values. + eFbxDouble4x4, //!< Four vectors of four double values. + eFbxEnum = 17, //!< Enumeration. + eFbxEnumM =-17, //!< Enumeration allowing duplicated items. + eFbxString = 18, //!< String. + eFbxTime, //!< Time value. + eFbxReference, //!< Reference to object or property. + eFbxBlob, //!< Binary data block type. + eFbxDistance, //!< Distance. + eFbxDateTime, //!< Date and time. + eFbxTypeCount = 24 //!< Indicates the number of type identifiers constants. +}; + +/** Class to represent colors in RGBA format using doubles. + * \nosubgrouping + */ +class FBXSDK_DLL FbxColor +{ +public: + //! Constructor. + FbxColor(); + + /** Constructor. + * \param pRed The Red component value. + * \param pGreen The Green component value. + * \param pBlue The Blue component value. + * \param pAlpha The alpha value of the color. + */ + FbxColor(const double pRed, const double pGreen, const double pBlue, const double pAlpha=1.0); + FbxColor(const FbxDouble3& pRGB, const double pAlpha=1.0); + FbxColor(const FbxDouble4& pRGBA); + + //! Destructor. + ~FbxColor(); + + /** Re-initialize the color object with their new values. + * \param pRed The Red component value. + * \param pGreen The Green component value. + * \param pBlue The Blue component value. + * \param pAlpha The alpha value of the color. + */ + void Set(const double pRed, const double pGreen, const double pBlue, const double pAlpha=1.0); + + /** Indicate if all the members in the color objects are within their valid range. + * \return \c true if all the members are within their valid range. + */ + bool IsValid() const; + + /** Accessors. + * \param pIndex The index of the component to access. + * \return The reference to the indexed component. + * \remarks The pIndex parameter is not checked for values out of bounds. + */ + double& operator[](int pIndex); + + /** Accessors. + * \param pIndex The index of the component to access. + * \return The reference to the indexed component. + * \remarks The pIndex parameter is not checked for values out of bounds. + */ + const double& operator[](int pIndex) const; + + /** + * \name Operators + */ + //@{ + /** Assignment operator. + * \param pColor FbxColor to be copied. + */ + FbxColor& operator=(const FbxColor& pColor); + FbxColor& operator=(const FbxDouble3& pColor); + FbxColor& operator=(const FbxDouble4& pColor); + + /** Equality operator. + * \param pColor FbxColor compared with this one. + * \return \c true if equal, \c false if unequal. + */ + bool operator==(const FbxColor& pColor) const; + + /** Inequality operator. + * \param pColor FbxColor compared with this one. + * \return \c true if unequal, \c false if equal. + */ + bool operator!=(const FbxColor& pColor) const; + //@} + + /** + * name Public Members + */ + //@{ + //! Valid range is from 0.0 to 1.0. + double mRed; + + //! Valid range is from 0.0 to 1.0. + double mGreen; + + //! Valid range is from 0.0 to 1.0. + double mBlue; + + //! Valid range is from 0.0 to 1.0. + double mAlpha; + //@} +}; + +/** FBX SDK half-float class. + * Property used to store half-float (16 bit float) number. + * This class only holds the value in 2 byte buffer (unsigned short). There is + * no direct math manipulation of this type except for the conversion to/from + * float. On disk, this type is also saved as an unsigned short. + * \nosubgrouping + */ +class FBXSDK_DLL FbxHalfFloat +{ +public: + /** + *\name Constructors + */ + //@{ + FbxHalfFloat(); + FbxHalfFloat(float pVal); + FbxHalfFloat(const FbxHalfFloat& pVal); + //@} + + /** Assign operator + * \param pValue The half-float to be assigned to this instance. + * \return This half-float. + */ + FbxHalfFloat& operator=(const FbxHalfFloat& pValue); + + /** + * \name boolean operation + */ + //@{ + /** Equivalence operator. + * \param pRHS The half-float to be compared with this one. + * \return \c True, if the two values are equal, \c false otherwise. + */ + bool operator==(const FbxHalfFloat& pRHS) const; + + /** Non-equivalence operator. + * \param pRHS The half-float to be compared with this one + * \return \c True, if the two values are unequal, \c false otherwise. + */ + bool operator!=(const FbxHalfFloat& pRHS) const; + //@} + + /** + * \name Access + */ + //@{ + /** Retrieve the value as a float. + */ + const float value() const; + + /** Retrieve the value as it is stored. + */ + unsigned const short internal_value() 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: + typedef unsigned short half; + half mValue; + + // we want to extract the mantissa, exponent and sign from the float number. + // by the IEEE 754 binary standard, the float number is divided as: + // sign : 1 bit + // mantissa : 23 bits + // exponent : 8 bits + // exponent bias : 127 + // and the half-float is: + // sing : 1 bit + // mantissa : 10 bits + // exponent : 5 bits + // exponent bias : + + half FtoHF(float *f); + float HFtoF(half h) const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** FBX SDK blob class. + * Uninitialized data of a specified size, to be filled by the user. + * \nosubgrouping + */ +class FBXSDK_DLL FbxBlob +{ +public: + /** + * \name Constructors and Destructor + */ + //@{ + //! Constructor. Set attributes to 0. + FbxBlob(); + + /** Constructor. Construct a buffer with uninitialized data of a specified size, to be filled by the user. + * \param pSize Buffer size. + */ + FbxBlob(int pSize); + + /** Copy constructor. + * \param pRHS The blob to be copied to this blob. + */ + FbxBlob(const FbxBlob& pRHS); + + /** Constructor. + * \param pData The data to be filled in the buffer. + * \param pSize Buffer size. + */ + FbxBlob(const void* pData, int pSize); + + //! Destructor + ~FbxBlob(); + //@} + + /** + * \name Assignment. + */ + //@{ + /** Share the buffer of the specified blob with this blob. + * \param pValue The blob whose buffer is shared with this blob. + * \return This blob. + */ + FbxBlob& operator=(const FbxBlob& pValue); + + /** Copy the data in the buffer. + * \param pData The buffer to be copied data from. + * \param pSize Buffer size. + */ + void Assign(const void* pData, int pSize); // Always makes a copy. + //@} + + /** + * \name Boolean operation + */ + //@{ + /** Equality operator. + * \param pRHS The blob to be compared with this blob. + * \return \c True, if the two blobs are equal, \c false otherwise. + */ + bool operator==(const FbxBlob& pRHS) const; // Compare the contents. + + /** Inequality operator. + * \param pRHS The blob to be compared with this blob. + * \return \c True, if the two blobs are unequal, otherwise false. + */ + bool operator!=(const FbxBlob& pRHS) const; + //@} + + //!Make a copy if the reference count > 1 (i.e. if the buffer is shared). + void* Modify(); + + /** + * \name Access + */ + //@{ + + /** Retrieve the buffer pointer. + * \return The buffer pointer. + */ + const void * Access() const; + + /** Retrieve the buffer size + * \return The buffer size. + */ + int Size() const; + //@} + + //! Free the memory if this blob is the last one to hold it. + void Clear(); + +protected: + int* mRefCount; + void* mData; + int mSize; +}; + +/** FBX SDK date&time class. + * Property used to store date and time information; not related to a FbxTime, which is + * used for film-related operations. + * The date and time property does not make any provisions for UTC, GMT or local + * zones; this is entirely up to client code to know what they are dealing with. + * \nosubgrouping + */ +class FBXSDK_DLL FbxDateTime +{ +public: + /** + *\name Constructors + */ + //@{ + //! Default constructor. Set attributes to 0. + FbxDateTime(); + + /** Constructor. + * \param pDay Day + * \param pMonth Month + * \param pYear Year + * \param pHour Hour + * \param pMin Minute + * \param pSec Second + * \param pMillisecond Millisecond + * \remark If one or more argument is invalid, the object is reset to 0. + */ + FbxDateTime(int pDay, int pMonth, int pYear, int pHour, int pMin, int pSec, int pMillisecond=0); + //@} + + /** + * \name Boolean operation + */ + //@{ + /** Equivalence operator. + *\param pRHS The date&time to be compared with this date&time. + *\return \c True, if the two date&time are equal, \c false otherwise. + */ + bool operator==(const FbxDateTime& pRHS) const; + + /** Non-equivalence operator + *\param pRHS The date&time to be compared with this date&time. + *\return \c True, if the two date&time are not equal, \c false otherwise. + */ + bool operator!=(const FbxDateTime& pRHS) const; + //@} + + //! Set the attributes to 0. + void Clear(); + + /** Validates each field is within a normal range (month is 1-12, etc). + * \return \c True, if each field is within a normal range, \c false otherwise. + */ + bool isValid() const; + + /** + * \name Access + */ + //@{ + /** Set the date. + * \param pDay Day to be set. + * \param pMonth Month to be set. + * \param pYear Year to be set. + * \remark If one or more argument is invalid, the object is reset to 0. + */ + void setDate(int pDay, int pMonth, int pYear); + + /** Set the time. + * \param pHour Hour to be set. + * \param pMin Minute to be set. + * \param pSec Second to be set. + * \param pMillisecond Millisecond to be set. + * \remark If one or more argument is invalid, the object is reset to 0. + */ + void setTime(int pHour, int pMin, int pSec, int pMillisecond = 0); + //@} + + /** + * \name Operation with string + */ + //@{ + /** Get the string format from this date&time. + * \return The string format got from this date&time. + */ + FbxString toString() const; + + /** Get date&time from the string format. + * \return \c True, if get date&time from the string format successfully, \c false otherwise. + * \remarks ! This will only work with the format returned by toString(); if the format + * is not the same will return 'false' and the content of this object will + * remain unchanged. + */ + bool fromString(const char*); + //@} + + /** Get date&time from current date&time of GMT. + * \return The date&time equal to current date&time of GMT. + */ + static FbxDateTime currentDateTimeGMT(); + +private: + FbxShort mMillisecond; // 0-999 + FbxShort mYear; // No check + + FbxChar mMonth; // 1-12 + FbxChar mDay; // 1-31; no check with regards to the month + FbxChar mHour; // 0-23 + FbxChar mMinute; // 0-59 + FbxChar mSecond; // 0-59 +}; + +/** FBX SDK distance class. + * \nosubgrouping + */ +class FBXSDK_DLL FbxDistance +{ +public: + /** + * \name Constructors and Destructor + */ + //@{ + //! Default constructor. + FbxDistance(); + + /** Constructor with default values. + * \param pValue Value of distance using the measurement unit. + * \param pUnit Unit of measurement. + */ + FbxDistance(float pValue, FbxSystemUnit pUnit); + + /** Constructor. + * \param pValue Value of distance using the measurement unit. + * \param pUnit Unit of measurement. + * \remarks This constructor will convert string to FbxSystemUnit. + */ + FbxDistance(float pValue, const char* pUnit); + + //! Destructor. + ~FbxDistance(); + //@} + + /** Assign operator + * \param pValue The distance to be assigned to this distance. + * \return This distance. + */ + FbxDistance& operator=(const FbxDistance& pValue); + + /** + * \name boolean operation + */ + //@{ + /** Equivalence operator. + * \param pRHS The distance to be compared with this distance. + * \return \c True, if the two distances are equal, \c false otherwise. + */ + bool operator==(const FbxDistance& pRHS) const; + + /** Non-equivalence operator. + * \param pRHS The distance to be compared with this distance. + * \return \c True, if the two distances are unequal, \c false otherwise. + */ + bool operator!=(const FbxDistance& pRHS) const; + //@} + + const FbxString unitName() const; + + /** + * \name Access + */ + //@{ + /** Retrieve the measurement unit + * \return The measure unit of the distance. + */ + const FbxSystemUnit unit() const; + + /** Retrieve the distance value + * \return The value of the distance in the defined measurement unit. + */ + const float value() const; + //@} + + /** Get the value of distance when converting this measurement unit to inch. + * \return The value of distance when converting this measurement unit to inch. + */ + const float internalValue() const; + + /** Get the value of distance when converting this measurement unit to the specified measurement unit. + * \param pUnit The measurement unit to be converted to. + * \return The value of distance when using the specified measurement unit. + */ + const float valueAs(const FbxSystemUnit& pUnit) const; + +private: + float mValue; + FbxSystemUnit mUnit; +}; + +/** Retrieve a type enumeration memory footprint size +* \param pType The type enumeration +* \return The size of this type in memory */ +FBXSDK_DLL const size_t FbxTypeSizeOf(const EFbxType pType); + +/** Retrieve a type enumeration component count +* \param pType The type enumeration +* \return The number of component used by this type */ +FBXSDK_DLL const size_t FbxTypeComponentCount(const EFbxType pType); + +// Type management for properties +inline EFbxType FbxTypeOf(const FbxChar&){ return eFbxChar; } +inline EFbxType FbxTypeOf(const FbxUChar&){ return eFbxUChar; } +inline EFbxType FbxTypeOf(const FbxShort&){ return eFbxShort; } +inline EFbxType FbxTypeOf(const FbxUShort&){ return eFbxUShort; } +inline EFbxType FbxTypeOf(const FbxUInt&){ return eFbxUInt; } +inline EFbxType FbxTypeOf(const FbxLongLong&){ return eFbxLongLong; } +inline EFbxType FbxTypeOf(const FbxULongLong&){ return eFbxULongLong; } +inline EFbxType FbxTypeOf(const FbxHalfFloat&){ return eFbxHalfFloat; } +inline EFbxType FbxTypeOf(const FbxBool&){ return eFbxBool; } +inline EFbxType FbxTypeOf(const FbxInt&){ return eFbxInt; } +inline EFbxType FbxTypeOf(const FbxFloat&){ return eFbxFloat; } +inline EFbxType FbxTypeOf(const FbxDouble&){ return eFbxDouble; } +inline EFbxType FbxTypeOf(const FbxDouble2&){ return eFbxDouble2; } +inline EFbxType FbxTypeOf(const FbxDouble3&){ return eFbxDouble3; } +inline EFbxType FbxTypeOf(const FbxDouble4&){ return eFbxDouble4; } +inline EFbxType FbxTypeOf(const FbxDouble4x4&){ return eFbxDouble4x4; } +inline EFbxType FbxTypeOf(const FbxVector2&){ return eFbxDouble2; } +inline EFbxType FbxTypeOf(const FbxVector4&){ return eFbxDouble4; } +inline EFbxType FbxTypeOf(const FbxQuaternion&){ return eFbxDouble4; } +inline EFbxType FbxTypeOf(const FbxMatrix&){ return eFbxDouble4x4; } +inline EFbxType FbxTypeOf(const FbxAMatrix&){ return eFbxDouble4x4; } +inline EFbxType FbxTypeOf(const FbxString&){ return eFbxString; } +inline EFbxType FbxTypeOf(const FbxTime&){ return eFbxTime; } +inline EFbxType FbxTypeOf(const FbxReference&){ return eFbxReference; } +inline EFbxType FbxTypeOf(const FbxBlob&){ return eFbxBlob; } +inline EFbxType FbxTypeOf(const FbxColor&){ return eFbxDouble4; } +inline EFbxType FbxTypeOf(const FbxDistance&){ return eFbxDistance; } +inline EFbxType FbxTypeOf(const FbxDateTime&){ return eFbxDateTime; } + +template inline EFbxType FbxTypeOf(const T&){ FBX_ASSERT_NOW("Unknown type!"); return eFbxUndefined; } + +bool FBXSDK_DLL FbxTypeCopyStr(FbxDouble& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxBool& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxInt& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxChar& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxUChar& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxShort& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxUShort& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxUInt& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxLongLong& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxULongLong& pDst, const FbxString& pSrc); +bool FBXSDK_DLL FbxTypeCopyStr(FbxHalfFloat& pDst, const FbxString& pSrc); + +// Copy types and conversions +template inline bool FbxTypeCopy(T1&, const T2&){ FBX_ASSERT_NOW("Incompatible type assignment!" ); return false; } + +//! Same type conversion +inline bool FbxTypeCopy(FbxChar& pDst, const FbxChar& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxUChar& pDst, const FbxUChar& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxShort& pDst, const FbxShort& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxUShort& pDst, const FbxUShort& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxUInt& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxLongLong& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxULongLong& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxHalfFloat& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxBool& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxInt& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxFloat& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxDouble& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxDouble2& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxDouble3& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble4& pDst, const FbxDouble4& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble4x4& pDst, const FbxDouble4x4& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxString& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxTime& pDst, const FbxTime& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxReference& pDst, const FbxReference& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxBlob& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxDistance& pDst, const FbxDistance& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxDateTime& pDst, const FbxDateTime& pSrc){ pDst = pSrc; return true; } + +//To FbxBool +inline bool FbxTypeCopy(FbxBool& pDst, const FbxChar& pSrc){ pDst = pSrc == 0 ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxUChar& pSrc){ pDst = pSrc == 0 ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxShort& pSrc){ pDst = pSrc == 0 ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxUShort& pSrc){ pDst = pSrc == 0 ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxUInt& pSrc){ pDst = pSrc == 0 ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxLongLong& pSrc){ pDst = pSrc == 0 ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxULongLong& pSrc){ pDst = pSrc == 0 ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxHalfFloat& /*pSrc */){ return false; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxInt& pSrc){ pDst = pSrc == 0 ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxFloat& pSrc){ pDst = pSrc == 0.f ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxDouble& pSrc){ pDst = pSrc == 0. ? false : true; return true; } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBool& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBool& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxChar +inline bool FbxTypeCopy(FbxChar& pDst, const FbxUChar& pSrc){ pDst = (FbxChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxUShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxUInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxLongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxULongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& pDst, const FbxBool& pSrc){ pDst = (FbxChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxChar& pDst, const FbxInt& pSrc){ pDst = (FbxChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxChar& pDst, const FbxFloat& pSrc){ pDst = (FbxChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxChar& pDst, const FbxDouble& pSrc){ pDst = (FbxChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxChar& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxUChar +inline bool FbxTypeCopy(FbxUChar& pDst, const FbxChar& pSrc){ pDst = (FbxUChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxUShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxUInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxLongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxULongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& pDst, const FbxBool& pSrc){ pDst = (FbxUChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxUChar& pDst, const FbxInt& pSrc){ pDst = (FbxUChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxUChar& pDst, const FbxFloat& pSrc){ pDst = (FbxUChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxUChar& pDst, const FbxDouble& pSrc){ pDst = (FbxUChar)pSrc; return true; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUChar& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxShort +inline bool FbxTypeCopy(FbxShort& pDst, const FbxChar& pSrc){ pDst = (FbxShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxShort& pDst, const FbxUChar& pSrc){ pDst = (FbxShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxUShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxUInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxLongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxULongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& pDst, const FbxBool& pSrc){ pDst = (FbxShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxShort& pDst, const FbxInt& pSrc){ pDst = (FbxShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxShort& pDst, const FbxFloat& pSrc){ pDst = (FbxShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxShort& pDst, const FbxDouble& pSrc){ pDst = (FbxShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxShort& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxUShort +inline bool FbxTypeCopy(FbxUShort& pDst, const FbxChar& pSrc){ pDst = (FbxUShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxUShort& pDst, const FbxUChar& pSrc){ pDst = (FbxUShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxUShort& pDst, const FbxShort& pSrc){ pDst = (FbxUShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxUInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxLongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxULongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& pDst, const FbxBool& pSrc){ pDst = (FbxUShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxUShort& pDst, const FbxInt& pSrc){ pDst = (FbxUShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxUShort& pDst, const FbxFloat& pSrc){ pDst = (FbxUShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxUShort& pDst, const FbxDouble& pSrc){ pDst = (FbxUShort)pSrc; return true; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUShort& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxInt +inline bool FbxTypeCopy(FbxInt& pDst, const FbxChar& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxUChar& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxShort& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxUShort& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxUInt& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxLongLong& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxULongLong& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxBool& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxFloat& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxDouble& pSrc){ pDst = (FbxInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxInt& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxInt& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxUInt +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxChar& pSrc){ pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxUChar& pSrc){ pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxShort& pSrc){ pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxUShort& pSrc){ pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxLongLong& pSrc){ pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxULongLong& pSrc) { pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxBool& pSrc){ pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxInt& pSrc){ pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxFloat& pSrc){ pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxDouble& pSrc){ pDst = (FbxUInt)pSrc; return true; } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUInt& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxUInt& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxLongLong +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxChar& pSrc){ pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxUChar& pSrc){ pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxShort& pSrc){ pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxUShort& pSrc){ pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxUInt& pSrc){ pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxULongLong& pSrc) { pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxBool& pSrc){ pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxInt& pSrc){ pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxFloat& pSrc){ pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxDouble& pSrc){ pDst = (FbxLongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxLongLong& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxLongLong& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxULongLong +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxChar& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxUChar& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxShort& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxUShort& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxUInt& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxLongLong& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxBool& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxInt& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxFloat& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxDouble& pSrc){ pDst = (FbxULongLong)pSrc; return true; } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxULongLong& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxULongLong& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxHalfFloat +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxChar& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxUChar& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxShort& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxUShort& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxUInt& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxLongLong& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxULongLong& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxBool& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxInt& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxFloat& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxDouble& pSrc){ FbxHalfFloat hf((float)pSrc); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxHalfFloat& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxHalfFloat& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxHalfFloat& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxHalfFloat& /*pDst*/, const FbxString& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxHalfFloat& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxHalfFloat& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxHalfFloat& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxHalfFloat& pDst, const FbxDistance& pSrc){ FbxHalfFloat hf(pSrc.internalValue()); pDst = hf; return true; } +inline bool FbxTypeCopy(FbxHalfFloat& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxFloat +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxChar& pSrc){ pDst = (FbxFloat)pSrc; return true; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxUChar& pSrc){ pDst = (FbxFloat)pSrc; return true; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxShort& pSrc){ pDst = (FbxFloat)pSrc; return true; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxUShort& pSrc){ pDst = (FbxFloat)pSrc; return true; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxUInt& pSrc){ pDst = (FbxFloat)pSrc; return true; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxLongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxULongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxHalfFloat& pSrc){ pDst = pSrc.value() ; return true; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxBool& pSrc){ pDst = (FbxFloat)pSrc; return true; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxInt& pSrc){ pDst = (FbxFloat)pSrc; return true; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxDouble& pSrc){ pDst = (FbxFloat)pSrc; return true; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxString& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxFloat& pDst, const FbxDistance& pSrc){ pDst = pSrc.internalValue(); return true; } +inline bool FbxTypeCopy(FbxFloat& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxDouble +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxChar& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxUChar& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxShort& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxUShort& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxUInt& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxLongLong& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxULongLong& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxHalfFloat& pSrc){ pDst = (FbxDouble)pSrc.value(); return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxBool& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxInt& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxFloat& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxDouble2& pSrc){ pDst = (FbxDouble)pSrc[0]; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxDouble3& pSrc){ pDst = (FbxDouble)pSrc[0]; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxDouble4& pSrc){ pDst = (FbxDouble)pSrc[0]; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxDouble4x4& pSrc){ pDst = (FbxDouble)pSrc[0][0]; return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxString& pSrc){ return FbxTypeCopyStr(pDst, pSrc); } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxTime& pSrc){ pDst = (FbxDouble)pSrc.GetSecondDouble(); return true; } +inline bool FbxTypeCopy(FbxDouble& pDst, const FbxDistance& pSrc){ pDst = pSrc.internalValue(); return true; } + +//To FbxDouble2 +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxChar& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxUChar& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxShort& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxUShort& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxUInt& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxLongLong& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxULongLong& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxHalfFloat& pSrc){ pDst = (FbxDouble)pSrc.value(); return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxBool& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxInt& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxFloat& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble2& pDst, const FbxDouble& pSrc){ pDst = (FbxDouble)pSrc; return true; } + +//To FbxDouble3 +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxChar& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxUChar& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxShort& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxUShort& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxUInt& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxLongLong& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxULongLong& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxHalfFloat& pSrc){ pDst = (FbxDouble)pSrc.value(); return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxBool& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxInt& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxFloat& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxDouble& pSrc){ pDst = (FbxDouble)pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble3& pDst, const FbxDouble4& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble3& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble3& /*pDst*/, const FbxString& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble3& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble3& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble3& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble3& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble3& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxDouble4 +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxChar& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxUChar& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxUShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxUInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxLongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxULongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxBool& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxDouble& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& pDst, const FbxDouble3& pSrc){ pDst = pSrc; return true; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxString& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDouble4& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxString +inline bool FbxTypeCopy(FbxString& pDst, const FbxChar& pSrc){ pDst=FbxString((int)pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxUChar& pSrc){ pDst=FbxString((int)pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxShort& pSrc){ pDst=FbxString((int)pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxUShort& pSrc){ pDst=FbxString((int)pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxUInt& pSrc){ pDst=FbxString((int)pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxLongLong& pSrc){ pDst=FbxString((int)pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxULongLong& pSrc){ pDst=FbxString((int)pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxHalfFloat& pSrc){ pDst=FbxString((float)pSrc.value()); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxBool& pSrc){ pDst=pSrc ? "true" : "false"; return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxInt& pSrc){ pDst=FbxString((int)pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxFloat& pSrc){ pDst=FbxString(pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxDouble& pSrc){ pDst=FbxString(pSrc); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxDouble2& pSrc){ pDst=FbxString(pSrc[0])+","+FbxString(pSrc[1]); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxDouble3& pSrc){ pDst=FbxString(pSrc[0])+","+FbxString(pSrc[1])+","+FbxString(pSrc[2]); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxDouble4& pSrc){ pDst=FbxString(pSrc[0])+","+FbxString(pSrc[1])+","+FbxString(pSrc[2])+","+FbxString(pSrc[3]); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxDouble4x4& pSrc){ pDst=FbxString(pSrc[0][0])+","+FbxString(pSrc[0][1])+","+FbxString(pSrc[0][2])+","+FbxString(pSrc[0][3]); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxTime& pSrc){ char lTimeStr[128]; pSrc.GetTimeString(lTimeStr, FbxUShort(128)); pDst=lTimeStr; return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxReference& /*pSrc*/){ pDst=""; return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxBlob& /*pSrc*/){ pDst=""; return true; } // Or convert to ASCII-85? +inline bool FbxTypeCopy(FbxString& pDst, const FbxDistance& pSrc){ pDst= FbxString(pSrc.value()) + " " +pSrc.unitName(); return true; } +inline bool FbxTypeCopy(FbxString& pDst, const FbxDateTime& pSrc){ pDst= pSrc.toString(); return true; } + +//To FbxBlob +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxChar& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxUChar& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxShort& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxUShort& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxUInt& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxLongLong& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxULongLong& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxHalfFloat& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxBool& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxInt& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxFloat& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxDouble& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxDouble2& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxDouble3& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxDouble4& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxDouble4x4& pSrc){ pDst.Assign(&pSrc, sizeof(pSrc)); return true; } +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxString& pSrc) +{ + bool lCastable = pSrc.GetLen() == pSrc.GetLen(); + FBX_ASSERT( lCastable ); + if( lCastable ) + pDst.Assign(pSrc.Buffer(), (int)pSrc.GetLen()); + return lCastable; +} +inline bool FbxTypeCopy(FbxBlob& pDst, const FbxTime& pSrc){ FbxLongLong t = pSrc.Get(); pDst.Assign( &t, sizeof(t)); return true; } +inline bool FbxTypeCopy(FbxBlob& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBlob& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxBlob& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxDistance +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxChar& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxUChar& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxUShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxUInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxLongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxULongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxBool& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxDouble& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxString& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDistance& /*pDst*/, const FbxDateTime& /*pSrc*/){ return false; } + +//To FbxDateTime +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxChar& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxUChar& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxUShort& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxUInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxLongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxULongLong& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxHalfFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxBool& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxInt& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxFloat& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxDouble& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxDouble2& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxDouble3& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxDouble4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxDouble4x4& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& pDst, const FbxString& pSrc){ return pDst.fromString(pSrc); } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxTime& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxReference& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxBlob& /*pSrc*/){ return false; } +inline bool FbxTypeCopy(FbxDateTime& /*pDst*/, const FbxDistance& /*pSrc*/){ return false; } + +template inline bool FbxTypeCopy(T& pDst, const void* pSrc, EFbxType pSrcType) +{ + switch( pSrcType ) + { + case eFbxChar: return FbxTypeCopy(pDst, *(FbxChar*)pSrc); + case eFbxUChar: return FbxTypeCopy(pDst, *(FbxUChar*)pSrc); + case eFbxShort: return FbxTypeCopy(pDst, *(FbxShort*)pSrc); + case eFbxUShort: return FbxTypeCopy(pDst, *(FbxUShort*)pSrc); + case eFbxUInt: return FbxTypeCopy(pDst, *(FbxUInt*)pSrc); + case eFbxLongLong: return FbxTypeCopy(pDst, *(FbxLongLong*)pSrc); + case eFbxULongLong: return FbxTypeCopy(pDst, *(FbxULongLong*)pSrc); + case eFbxHalfFloat: return FbxTypeCopy(pDst, *(FbxHalfFloat*)pSrc); + case eFbxBool: return FbxTypeCopy(pDst, *(FbxBool*)pSrc); + case eFbxInt: return FbxTypeCopy(pDst, *(FbxInt*)pSrc); + case eFbxFloat: return FbxTypeCopy(pDst, *(FbxFloat*)pSrc); + case eFbxDouble: return FbxTypeCopy(pDst, *(FbxDouble*)pSrc); + case eFbxDouble2: return FbxTypeCopy(pDst, *(FbxDouble2*)pSrc); + case eFbxDouble3: return FbxTypeCopy(pDst, *(FbxDouble3*)pSrc); + case eFbxDouble4: return FbxTypeCopy(pDst, *(FbxDouble4*)pSrc); + case eFbxDouble4x4: return FbxTypeCopy(pDst, *(FbxDouble4x4*)pSrc); + case eFbxEnumM: + case eFbxEnum: return FbxTypeCopy(pDst, *(FbxEnum*)pSrc); + case eFbxString: return FbxTypeCopy(pDst, *(FbxString*)pSrc); + case eFbxTime: return FbxTypeCopy(pDst, *(FbxTime*)pSrc); + case eFbxBlob: return FbxTypeCopy(pDst, *(FbxBlob*)pSrc); + case eFbxDistance: return FbxTypeCopy(pDst, *(FbxDistance*)pSrc); + case eFbxDateTime: return FbxTypeCopy(pDst, *(FbxDateTime*)pSrc); + + case eFbxReference: + FBX_ASSERT_NOW("Trying to set value on a void Reference type" ); + break; + + default: + FBX_ASSERT_NOW("Trying to assign an unknown type" ); + break; + } + return false; +} + +template inline bool FbxTypeCopy(void* pDst, EFbxType pDstType, const T& pSrc) +{ + switch( pDstType ) + { + case eFbxChar: return FbxTypeCopy(*(FbxChar*)pDst, pSrc); + case eFbxUChar: return FbxTypeCopy(*(FbxUChar*)pDst, pSrc); + case eFbxShort: return FbxTypeCopy(*(FbxShort*)pDst, pSrc); + case eFbxUShort: return FbxTypeCopy(*(FbxUShort*)pDst, pSrc); + case eFbxUInt: return FbxTypeCopy(*(FbxUInt*)pDst, pSrc); + case eFbxLongLong: return FbxTypeCopy(*(FbxLongLong*)pDst, pSrc); + case eFbxULongLong: return FbxTypeCopy(*(FbxULongLong*)pDst, pSrc); + case eFbxHalfFloat: return FbxTypeCopy(*(FbxHalfFloat*)pDst, pSrc); + case eFbxBool: return FbxTypeCopy(*(FbxBool*)pDst, pSrc); + case eFbxInt: return FbxTypeCopy(*(FbxInt*)pDst, pSrc); + case eFbxFloat: return FbxTypeCopy(*(FbxFloat*)pDst, pSrc); + case eFbxDouble: return FbxTypeCopy(*(FbxDouble*)pDst, pSrc); + case eFbxDouble2: return FbxTypeCopy(*(FbxDouble2*)pDst, pSrc); + case eFbxDouble3: return FbxTypeCopy(*(FbxDouble3*)pDst, pSrc); + case eFbxDouble4: return FbxTypeCopy(*(FbxDouble4*)pDst, pSrc); + case eFbxDouble4x4: return FbxTypeCopy(*(FbxDouble4x4*)pDst, pSrc); + case eFbxEnumM: + case eFbxEnum: return FbxTypeCopy(*(FbxEnum*)pDst, pSrc); + case eFbxString: return FbxTypeCopy(*(FbxString*)pDst, pSrc); + case eFbxTime: return FbxTypeCopy(*(FbxTime*)pDst, pSrc); + case eFbxBlob: return FbxTypeCopy(*(FbxBlob*)pDst, pSrc); + case eFbxDistance: return FbxTypeCopy(*(FbxDistance*)pDst, pSrc); + case eFbxDateTime: return FbxTypeCopy(*(FbxDateTime*)pDst, pSrc); + + case eFbxReference: + FBX_ASSERT_NOW("Trying to set value on a void Reference type" ); + break; + + default: + FBX_ASSERT_NOW("Trying to assign an unknown type" ); + break; + } + return false; +} + +inline bool FbxTypeCopy(void* pDst, EFbxType pDstType, const void* pSrc, EFbxType pSrcType) +{ + switch( pSrcType ) + { + case eFbxChar: return FbxTypeCopy(pDst, pDstType, *(FbxChar*)pSrc); + case eFbxUChar: return FbxTypeCopy(pDst, pDstType, *(FbxUChar*)pSrc); + case eFbxShort: return FbxTypeCopy(pDst, pDstType, *(FbxShort*)pSrc); + case eFbxUShort: return FbxTypeCopy(pDst, pDstType, *(FbxUShort*)pSrc); + case eFbxUInt: return FbxTypeCopy(pDst, pDstType, *(FbxUInt*)pSrc); + case eFbxLongLong: return FbxTypeCopy(pDst, pDstType, *(FbxLongLong*)pSrc); + case eFbxULongLong: return FbxTypeCopy(pDst, pDstType, *(FbxULongLong*)pSrc); + case eFbxHalfFloat: return FbxTypeCopy(pDst, pDstType, *(FbxHalfFloat*)pSrc); + case eFbxBool: return FbxTypeCopy(pDst, pDstType, *(FbxBool*)pSrc); + case eFbxInt: return FbxTypeCopy(pDst, pDstType, *(FbxInt*)pSrc); + case eFbxFloat: return FbxTypeCopy(pDst, pDstType, *(FbxFloat*)pSrc); + case eFbxDouble: return FbxTypeCopy(pDst, pDstType, *(FbxDouble*)pSrc); + case eFbxDouble2: return FbxTypeCopy(pDst, pDstType, *(FbxDouble2*)pSrc); + case eFbxDouble3: return FbxTypeCopy(pDst, pDstType, *(FbxDouble3*)pSrc); + case eFbxDouble4: return FbxTypeCopy(pDst, pDstType, *(FbxDouble4*)pSrc); + case eFbxDouble4x4: return FbxTypeCopy(pDst, pDstType, *(FbxDouble4x4*)pSrc); + case eFbxEnumM: + case eFbxEnum: return FbxTypeCopy(pDst, pDstType, *(FbxEnum*)pSrc); + case eFbxString: return FbxTypeCopy(pDst, pDstType, *(FbxString*)pSrc); + case eFbxTime: return FbxTypeCopy(pDst, pDstType, *(FbxTime*)pSrc); + case eFbxBlob: return FbxTypeCopy(pDst, pDstType, *(FbxBlob*)pSrc); + case eFbxDistance: return FbxTypeCopy(pDst, pDstType, *(FbxDistance*)pSrc); + case eFbxDateTime: return FbxTypeCopy(pDst, pDstType, *(FbxDateTime*)pSrc); + + case eFbxReference: + FBX_ASSERT_NOW("Trying to set value on a void Reference type" ); + break; + + default: + FBX_ASSERT_NOW("Trying to assign an unknown type" ); + break; + } + return false; +} + +/** Creates a fbx primitive type and initializes its memory. + * \param pType The type of object to create. + * \return A pointer to the new primitive object. Note that the caller owns the returned object. + * The pointer returned is NULL if pType is eFbxUndefined or an unknown type. + */ +FBXSDK_DLL void* FbxTypeAllocate(const EFbxType pType); + +/** Destroys an fbx primitive type. If the return value is true + * the memory pointed to by pData has been deleted and should + * no longer be accessed. + * \param pType The type of object being deleted + * \param pData Pointer to the object being deleted. + * \return true if the object was destroyed, false otherwise. + */ +FBXSDK_DLL bool FbxTypeDeallocate(const EFbxType pType, void* pData); + +/** Compare two values of the same type + * \param pA first value + * \param pB second value + * \param pType The data type of both values + * \return \c true if equal, \c false otherwise + */ +FBXSDK_DLL bool FbxTypeCompare(const void* pA, const void* pB, const EFbxType pType); + +#include + +#endif /* _FBXSDK_CORE_PROPERTY_TYPES_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxquery.h b/libs/fbx/include/fbxsdk/core/fbxquery.h new file mode 100644 index 00000000..8a5d9712 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxquery.h @@ -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 + +#include +#include +#include +#include + +#include + +#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 + +#endif /* _FBXSDK_CORE_QUERY_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxqueryevent.h b/libs/fbx/include/fbxsdk/core/fbxqueryevent.h new file mode 100644 index 00000000..2608ed51 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxqueryevent.h @@ -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 + +#include + +#include + +/** 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 class FbxQueryEvent : public FbxEvent > +{ +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 >; +}; + +#include + +#endif /* _FBXSDK_CORE_QUERY_EVENT_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxscopedloadingdirectory.h b/libs/fbx/include/fbxsdk/core/fbxscopedloadingdirectory.h new file mode 100644 index 00000000..38ebfee1 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxscopedloadingdirectory.h @@ -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 + +#ifndef FBXSDK_ENV_WINSTORE + +#include +#include + +#include + +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 mPluginHandles; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* !FBXSDK_ENV_WINSTORE */ + +#endif /* _FBXSDK_CORE_SCOPED_LOADING_DIRECTORY_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxscopedloadingfilename.h b/libs/fbx/include/fbxsdk/core/fbxscopedloadingfilename.h new file mode 100644 index 00000000..66529e8b --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxscopedloadingfilename.h @@ -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 + +#ifndef FBXSDK_ENV_WINSTORE + +#include +#include + +#include + +/** + * 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 + +#endif /* !FBXSDK_ENV_WINSTORE */ + +#endif /* _FBXSDK_CORE_SCOPED_LOADING_FILENAME_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxstream.h b/libs/fbx/include/fbxsdk/core/fbxstream.h new file mode 100644 index 00000000..ef349a40 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxstream.h @@ -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 + +#include + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_STREAM_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxsymbol.h b/libs/fbx/include/fbxsdk/core/fbxsymbol.h new file mode 100644 index 00000000..260fe40e --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxsymbol.h @@ -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 + +#include +#include + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_SYMBOL_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxsystemunit.h b/libs/fbx/include/fbxsdk/core/fbxsystemunit.h new file mode 100644 index 00000000..92fa5e58 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxsystemunit.h @@ -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 + +#include +#include + +#include + +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& pNodes, double pConversionFactor) const; + void ConvertSProperty(FbxArray& pNodes, double pConversionFactor) const; + void ConvertAnimCurveNode(FbxArray& 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 + +#endif /* _FBXSDK_CORE_SYSTEM_UNIT_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/fbxxref.h b/libs/fbx/include/fbxsdk/core/fbxxref.h new file mode 100644 index 00000000..cee8a59b --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/fbxxref.h @@ -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 + +#include +#include + +#include + +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 mProjects; + + static bool UrlExist(const char* pUrl); +}; + +#include + +#endif /* _FBXSDK_CORE_XREF_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/math/fbxaffinematrix.h b/libs/fbx/include/fbxsdk/core/math/fbxaffinematrix.h new file mode 100644 index 00000000..288d3793 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/math/fbxaffinematrix.h @@ -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 + +#include + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_MATH_AFFINE_MATRIX_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/math/fbxdualquaternion.h b/libs/fbx/include/fbxsdk/core/math/fbxdualquaternion.h new file mode 100644 index 00000000..234866af --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/math/fbxdualquaternion.h @@ -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 + +#include + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_MATH_DUAL_QUATERNION_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/math/fbxmath.h b/libs/fbx/include/fbxsdk/core/math/fbxmath.h new file mode 100644 index 00000000..d55e7417 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/math/fbxmath.h @@ -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 + +#include +#include +#include +#include + +//On Mac OS, cmath will include math.h and undef "isnan" +#if defined(FBXSDK_ENV_MAC) + #include + extern "C" int isnan (double); +#endif + +#include + +#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 inline T FbxSign(const T x) +{ + return (x < 0) ? T(-1) : T(1); +} + +template 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 inline T FbxAbs(const T x) +{ + return (x >= 0) ? x : ((x > FbxMin(x)) ? -x : FbxMax(x)); +} + +template inline T FbxClamp(const T value, const T min, const T max) +{ + return (value < min) ? min : ((value > max) ? max : value); +} + +template 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 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 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 inline T FbxPow(const T x, const T y) +{ + return (T)FbxExp(y * FbxLog((double)x)); +} + +template 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 inline T FbxSinCos(const T x, T* y) +{ + return *y = FbxCos(x), FbxSin(x); +} + +// *y = cos(x * pi/180), sin(x * pi/180) +template 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 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 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 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 inline T FbxATand(const T y, const T x) +{ + return (T)(FbxATan(y, x) * FBXSDK_180_DIV_PI); +} + +template inline T FbxNorm(const T x, const T y) +{ + return FbxSqrt(x * x + y * y); +} + +template inline T FbxNorm(const T x, const T y, const T z) +{ + return FbxSqrt(x * x + y * y + z * z); +} + +template 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 inline T FbxHypot(const T x, const T y) +{ + return FbxSqrt(x * x + y * y); +} + +template inline T FbxHypot(const T x, const T y, const T z) +{ + return FbxSqrt(x * x + y * y + z * z); +} + +template 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 inline int FbxBitCount(const T x) +{ + int n = 0; + T c = x; + while( c ) + { + n += int(c & 1); + c = (c >> 1); + } + return n; +} + +template inline void FbxFixInfinite(T& x) +{ + if( x != x || x > FbxMax(x) || x < -FbxMax(x) ) + { + x = T(0); + } +} + +template inline T FbxExp(const T x); +template inline T FbxLog(const T x); +template inline T FbxSin(const T x); +template inline T FbxCos(const T x); +template inline T FbxASin(const T x); +template inline T FbxACos(const T x); +template inline T FbxATan(const T x); +template inline T FbxATan(const T y, const T x); + +#include + +#endif /* _FBXSDK_CORE_MATH_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/math/fbxmatrix.h b/libs/fbx/include/fbxsdk/core/math/fbxmatrix.h new file mode 100644 index 00000000..8ecf8155 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/math/fbxmatrix.h @@ -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 + +#include + +#include + +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 + +#endif /* _FBXSDK_CORE_MATH_MATRIX_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/math/fbxquaternion.h b/libs/fbx/include/fbxsdk/core/math/fbxquaternion.h new file mode 100644 index 00000000..9f02f4db --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/math/fbxquaternion.h @@ -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 + +#include + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_MATH_QUATERNION_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/math/fbxtransforms.h b/libs/fbx/include/fbxsdk/core/math/fbxtransforms.h new file mode 100644 index 00000000..d73ce5cf --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/math/fbxtransforms.h @@ -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 + +#include +#include + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_MATH_TRANSFORMS_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/math/fbxvector2.h b/libs/fbx/include/fbxsdk/core/math/fbxvector2.h new file mode 100644 index 00000000..acd71c39 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/math/fbxvector2.h @@ -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 + +#include + +/** 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 + +#endif /* _FBXSDK_CORE_MATH_VECTOR_2_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/math/fbxvector4.h b/libs/fbx/include/fbxsdk/core/math/fbxvector4.h new file mode 100644 index 00000000..83e47612 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/math/fbxvector4.h @@ -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 + +#include + +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 + +#endif /* _FBXSDK_CORE_MATH_VECTOR_4_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/sync/fbxatomic.h b/libs/fbx/include/fbxsdk/core/sync/fbxatomic.h new file mode 100644 index 00000000..6e666f39 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/sync/fbxatomic.h @@ -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 + +#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN) + +#include + +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 + +#endif /* !FBXSDK_ENV_WINSTORE && !FBXSDK_ENV_EMSCRIPTEN */ + +#endif /* _FBXSDK_CORE_SYNC_ATOMIC_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/sync/fbxclock.h b/libs/fbx/include/fbxsdk/core/sync/fbxclock.h new file mode 100644 index 00000000..e419646a --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/sync/fbxclock.h @@ -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 + +#ifndef FBXSDK_ENV_WINSTORE + +#include + +/** 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 + +#endif /* !FBXSDK_ENV_WINSTORE */ + +#endif /* _FBXSDK_CORE_SYNC_CLOCK_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/sync/fbxsync.h b/libs/fbx/include/fbxsdk/core/sync/fbxsync.h new file mode 100644 index 00000000..39b6a527 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/sync/fbxsync.h @@ -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 + +#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN) + +#include +#include + +#include + +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 + +#endif /* !FBXSDK_ENV_WINSTORE && !FBXSDK_ENV_EMSCRIPTEN */ + +#endif /* _FBXSDK_CORE_SYNC_H_ */ diff --git a/libs/fbx/include/fbxsdk/core/sync/fbxthread.h b/libs/fbx/include/fbxsdk/core/sync/fbxthread.h new file mode 100644 index 00000000..fcbde874 --- /dev/null +++ b/libs/fbx/include/fbxsdk/core/sync/fbxthread.h @@ -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 + +#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN) + +#include + +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 + +#endif /* !FBXSDK_ENV_WINSTORE && !FBXSDK_ENV_EMSCRIPTEN */ + +#endif /* _FBXSDK_CORE_SYNC_THREAD_H_ */ diff --git a/libs/fbx/include/fbxsdk/fbxsdk_def.h b/libs/fbx/include/fbxsdk/fbxsdk_def.h new file mode 100644 index 00000000..d84469d5 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fbxsdk_def.h @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//Define Version and Namespace +#include + +//--------------------------------------------------------------------------------------- +//Define Architecture +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------- +//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_ */ diff --git a/libs/fbx/include/fbxsdk/fbxsdk_nsbegin.h b/libs/fbx/include/fbxsdk/fbxsdk_nsbegin.h new file mode 100644 index 00000000..1b891868 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fbxsdk_nsbegin.h @@ -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 + +#if FBXSDK_DEFINE_NAMESPACE == 1 + namespace FBXSDK_NAMESPACE { +#endif diff --git a/libs/fbx/include/fbxsdk/fbxsdk_nsend.h b/libs/fbx/include/fbxsdk/fbxsdk_nsend.h new file mode 100644 index 00000000..1aab836d --- /dev/null +++ b/libs/fbx/include/fbxsdk/fbxsdk_nsend.h @@ -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 diff --git a/libs/fbx/include/fbxsdk/fbxsdk_version.h b/libs/fbx/include/fbxsdk/fbxsdk_version.h new file mode 100644 index 00000000..4e2d3363 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fbxsdk_version.h @@ -0,0 +1,57 @@ +/**************************************************************************************** + + 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 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 // + +#include + +#include + +#include + +/** 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 + +#endif /* _FBXSDK_FILEIO_COLLADA_ANIMATION_ELEMENT_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladaelement.h b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladaelement.h new file mode 100644 index 00000000..7018ea73 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladaelement.h @@ -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 + +#include + +// Utility functions to convert type to array tag used in COLLADA source element +template +inline const FbxString TypeToArrayTag() +{ + return COLLADA_FLOAT_ARRAY_STRUCTURE; +} + +template <> +inline const FbxString TypeToArrayTag() +{ + return COLLADA_BOOL_ARRAY_STRUCTURE; +} + +template <> +inline const FbxString TypeToArrayTag() +{ + return COLLADA_INT_ARRAY_STRUCTURE; +} + +template <> +inline const FbxString TypeToArrayTag() +{ + return COLLADA_NAME_ARRAY_STRUCTURE; +} + +// Utility functions to convert type to parameter tag used in COLLADA source element +template +inline const FbxString TypeToParameterTag() +{ + return COLLADA_FLOAT_TYPE; +} + +template <> +inline const FbxString TypeToParameterTag() +{ + return COLLADA_BOOL_TYPE; +} + +template <> +inline const FbxString TypeToParameterTag() +{ + return COLLADA_INT_TYPE; +} + +template <> +inline const FbxString TypeToParameterTag() +{ + 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 + bool GetNext(TYPE * pData) + { + return FromString(pData, mPointer, &mPointer); + } + + template + 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 +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()); + // Some COLLADA exporters use IDREF_array instead of Name_array + if (!lDataArrayElement && TypeToArrayTag() == 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 +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(), 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()); + } + + 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 FbxLayerElementArray * PopulateLayerElementDirectArray(FbxLayerElement * pLayerElement, xmlNode * pSourceElement, int pSize) +{ + SourceElementContentAccessor lSourceElementAccessor(pSourceElement); + + FbxLayerElementTemplate * lLayerElement = (FbxLayerElementTemplate *)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 + +#endif /* _FBXSDK_FILEIO_COLLADA_ELEMENT_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladaiostream.h b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladaiostream.h new file mode 100644 index 00000000..b0f79f55 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladaiostream.h @@ -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 + +#include + +//----------------------------------------------------------------------------// + +/** 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 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 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 +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 + +#endif /* _FBXSDK_FILEIO_COLLADA_IO_STREAM_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladanamespace.h b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladanamespace.h new file mode 100644 index 00000000..1e977fd9 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladanamespace.h @@ -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 + +#include + +#include + +/** 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 mParamDefinition; + FbxArray mParamDefinitionCount; + + FbxArray mParamModification; + FbxArray mParamModificationCount; +}; + +#include + +#endif /* _FBXSDK_FILEIO_COLLADA_NAMESPACE_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladatokens.h b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladatokens.h new file mode 100644 index 00000000..bffd356a --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladatokens.h @@ -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_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladautils.h b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladautils.h new file mode 100644 index 00000000..83f81f8c --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/collada/fbxcolladautils.h @@ -0,0 +1,388 @@ +/**************************************************************************************** + + 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 + +#include +#include +#include +#include +#include + +#include + +#include + +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 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& arr); +void DAE_ExportArray(xmlNode* parentXmlNode, const char* id, FbxArray& arr); +void DAE_ExportArray(xmlNode* parentXmlNode, const char* id, FbxArray& arr); +void DAE_ExportArray(xmlNode* parentXmlNode, const char* id, FbxArray& 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& arr, bool isCommonProfile=true); +xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray& arr); +xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray& arr); +xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray& arr); +xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray& arr); +xmlNode* DAE_ExportSource14(xmlNode* parentXmlNode, const char* id, FbxArray& 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& arr); +void DAE_ExportSourceArray14(xmlNode* sourceNode, const char* id, FbxArray& 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 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& 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 +void DAE_GetElementContent(xmlNode * pElement, TYPE & pData) +{ + if (pElement != NULL) + { + FbxAutoFreePtr lContent(xmlNodeGetContent(pElement)); + FromString(&pData, (const char *)lContent.Get()); + } +} + +/** 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 +bool DAE_GetElementAttributeValue(xmlNode * pElement, const char * pAttributeName, TYPE & pData) +{ + if (!pElement || !pAttributeName) + return false; + + FbxAutoFreePtr lPropertyValue(xmlGetProp(pElement, (const xmlChar *)pAttributeName)); + if (lPropertyValue) + { + FromString(&pData, (const char *)lPropertyValue.Get()); + 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; + + FbxAutoFreePtr lPropertyValue(xmlGetProp(pElement, (const xmlChar *)pAttributeName)); + if (lPropertyValue) + { + pData = (const char *)lPropertyValue.Get(); + 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 +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(const_cast(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 +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 & pResult); + +#include + +#endif /* _FBXSDK_FILEIO_COLLADA_UTILS_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/collada/fbxreadercollada14.h b/libs/fbx/include/fbxsdk/fileio/collada/fbxreadercollada14.h new file mode 100644 index 00000000..d0a43b28 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/collada/fbxreadercollada14.h @@ -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 + +#include +#include + +#include + + +/** 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 + * + * \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* 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 & 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 & 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 & 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 & pMaterialSequence, FbxArray& 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 & 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 & 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 & 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 mTakeInfo; + + xmlNode * mColladaElement; + + struct ColladaElementData + { + explicit ColladaElementData(xmlNode * pElement = NULL) + : mColladaElement(pElement), mFBXObject(NULL) {} + xmlNode * mColladaElement; + FbxObject * mFBXObject; + FbxArray mFBXObjects; + }; + typedef FbxMap ColladaElementMapType; + ColladaElementMapType mColladaElements; + + LibraryTypeTraits mEffectTypeTraits; + LibraryTypeTraits mMaterialTypeTraits; + LibraryTypeTraits mImageTypeTraits; + LibraryTypeTraits mGeometryTypeTraits; + LibraryTypeTraits mControllerTypeTraits; + LibraryTypeTraits mLightTypeTraits; + LibraryTypeTraits mCameraTypeTraits; + LibraryTypeTraits mNodeTypeTraits; + LibraryTypeTraits mAnimationTypeTraits; + + typedef FbxMap > 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 mAnimationElementIDs; // IDs of animation belong to this animation clip + FbxAnimLayer * mAnimLayer; // The corresponding animation layer + }; + FbxDynamicArray 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 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 TargetIDMapType; + TargetIDMapType mTargetIDs; + + FbxColladaNamespace mNamespace; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_FILEIO_COLLADA_READER_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/collada/fbxwritercollada14.h b/libs/fbx/include/fbxsdk/fileio/collada/fbxwritercollada14.h new file mode 100644 index 00000000..1674bd58 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/collada/fbxwritercollada14.h @@ -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 + +#include + +#include + +/** \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 + +#endif /* _FBXSDK_FILEIO_COLLADA_WRITER_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbx/fbxio.h b/libs/fbx/include/fbxsdk/fileio/fbx/fbxio.h new file mode 100644 index 00000000..7618151a --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbx/fbxio.h @@ -0,0 +1,1746 @@ +/**************************************************************************************** + + 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 fbxio.h +#ifndef _FBXSDK_FILEIO_FBX_IO_H_ +#define _FBXSDK_FILEIO_FBX_IO_H_ + +#include + +#include +#include +#include + +#include + +class FbxIO; +class FbxReader; +class FbxWriter; +class FbxFile; +class FbxStream; +class FbxXRefManager; + +/** + Defines the current FBX file version number in four digits. The first digit is the + major version number a the last three digits are the minor version number (e.g. 7100 = 7.1). + The following is the version history of FBX: + + \li Version 2000 - New KFCurve and embedded FBX, no FCurve/FCurve node storing. + No more .takf file like in earlier version, no history. + + \li Version 2001 - Version incremented to support FbxTime save in native (integer, not double) + format. + + \li Version 3000 - FiLMBOX 3.0 version, nothing changed in current class since version 2001. + FBX SDK 3.0 and 3.6 + + \li Version 3001 - FiLMBOX 3.0 encrypted version, only a trial. Encrypted files could only + be written in debug versions. Cannot switch to a higher version number now because any + file with a version number >= 3001 is read as encrypted. + Hence, this value now only gives file type. (3000 or less -> binary, 3001 or more -> encrypted) + FiLMBOX 3.2, FiLMBOX 3.5 and "Online" 3.51 have been released with version 3000. + + \li Version 4000 - MotionBuilder 4.0, new type in KFCurve tangents, supported in FiLMBOX 3.5 + but not by earlier versions. Version number is now stored in section footer. + Before September 3rd 2002, the version number was always 3000 in main section footer. + Now the main section footer has version number 4000. The minimum version number in footer of + an extension section is 4000. + + \li Version 4001 - ASCII Header is 4.1. MotionBuilder 4.01, to fix FCurveNode problem with + layer types in version 4000 the main section footer has version number 4001. + Now the footer for extension sections has version number 4001. + + \li Version 4050 - ASCII Header is 4.5. MotionBuilder 4.1 or 4.5 before + January 22nd 2003. This is because EvaluationProperties now have color. Now the main section footer + has version number 4050. + Now the footer for extension sections has version number 4050. + + \li Version 5000 - ASCII Header is not compatible anymore with MotionBuilder 4.0, 4.01 and 4.02 and FBX SDK 3.6 and 3.7 + MotionBuilder 4.03 and 4.1 or 4.5 from January 22nd 2003 + FBX SDK 3.6.1. New extended header to improve FBX file version management. Now the extended header and + the main section footer have version number 5000. Now the footer for extension sections has version number 5000. + + \li Version 5800 - This was a temporary version while waiting for version 6000 renders the previous versions + incompatible with MotionBuilder 6.0. For now, however, this format is needed to allow + some tools/plugins (For example Maya) to correctly detect that the file has some features that are not + completely backward compatible (For example: pivots defined with _pre/_post nodes which require a special + processing). By incrementing only the minor version we do not compromise the integrity of the + files. + + \li Version 6000 - Header version is now 6.0. + Extended header now contain a creation time stamp + that can be retrieve without parsing the main section of the file. + A creator tag (string) is now stored in the Extended header. This contain the originator (MB/FBXSDK) + of the file and the build number of the originator. + First release of the file format using the KProperties to store/retrieve information. + + \li Version 6100 - Added support for multiple attributes (mainly multiple geometry) at the node level. + The pointer to the node attribute have been replaced by a connection between the node and its attribute(s). + + \li Version 7000 - + First version of the 7.0 series; most likely very short-lived, developed for Protein, before ADP. + Supports reference cloning, external documents, blobs, unique IDs (per file), property templates. + So many changes that it was decided to break from 6.0 to keep Motion Builder intact. + + \li Version 7099 - Temporary version for FBX 2011 alpha releases. + + \li Version 7100 + Official file version for FBX 2011, add support for animation to FBX 7. + First version of FBX SDK with FBX 7 files as the default file format. + + \li Version 7200 + Added support for multiple blend shape deformers and In-Between blend-shapes on each geometry. + Moved shape(FbxShape) to its own section other than as a part of geometry section. + Add support to store blend shape deformer(FbxBlendShape), blend shape channel(FbxBlendShapeChannel), + Substance(FbxProceduralTexture) and Lines(FbxLine). + Add support to store 3 different smooth binding modes of FbxSkin, including classic linear, dual quaternion + and blended mode of previous two modes. + Added the CLAMP_PROGRESSIVE tangent mode. + The KFCurve::KeyAttrDataFloat data array now stores as integer values (ASCII mode) to to eliminate float to int precision errors. + FbxLayeredTexture now stores alphas for its sub textures. + + \li Version 7300 + Changed the way the CharacterPoses are written. + Changed light property name HotSpot and ConeAngle to InnerAngle and OuterAngle + + \li Version 7400 + Normals, tangents and binormals save the 4th component into a separate array + + \li Version 7500 + Added support for large files (>2GB). NOTE: This breaks forward compatibility (i.e. older products won't be able to open these files!!) + + */ + +//File version numbers +#define FBX_FILE_VERSION_2000 2000 //FBX 2.0 +#define FBX_FILE_VERSION_2001 2001 //FBX 2.01 +#define FBX_FILE_VERSION_3000 3000 //FBX 3.0 +#define FBX_FILE_VERSION_3001 3001 //FBX 3.01 +#define FBX_FILE_VERSION_4000 4000 //FBX 4.0 +#define FBX_FILE_VERSION_4001 4001 //FBX 4.01 +#define FBX_FILE_VERSION_4050 4050 //FBX 4.5 +#define FBX_FILE_VERSION_5000 5000 //FBX 5.0 +#define FBX_FILE_VERSION_5800 5800 //FBX 5.8 +#define FBX_FILE_VERSION_6000 6000 //FBX 6.0 +#define FBX_FILE_VERSION_6100 6100 //FBX 6.1 (guarantee compatibility with Autodesk 2010 products) +#define FBX_FILE_VERSION_7000 7000 //Compatible with 7.1, and taken as such +#define FBX_FILE_VERSION_7099 7099 //Compatible with 7.1, and taken as such +#define FBX_FILE_VERSION_7100 7100 //FBX 7.1 (guarantee compatibility with Autodesk 2011 products) +#define FBX_FILE_VERSION_7200 7200 //FBX 7.2 (guarantee compatibility with Autodesk 2012 products) +#define FBX_FILE_VERSION_7300 7300 //FBX 7.3 (guarantee compatibility with Autodesk 2013 products) +#define FBX_FILE_VERSION_7400 7400 //FBX 7.4 (guarantee compatibility with Autodesk 2014/2015 products) +#define FBX_FILE_VERSION_7500 7500 //FBX 7.5 (guarantee compatibility with Autodesk 2016 products) + +//File version compatibility strings +#define FBX_53_MB55_COMPATIBLE "FBX53_MB55" +#define FBX_60_COMPATIBLE "FBX60_MB60" +#define FBX_2005_08_COMPATIBLE "FBX200508_MB70" +#define FBX_2006_02_COMPATIBLE "FBX200602_MB75" +#define FBX_2006_08_COMPATIBLE "FBX200608" +#define FBX_2006_11_COMPATIBLE "FBX200611" +#define FBX_2009_00_COMPATIBLE "FBX200900" +#define FBX_2009_00_V7_COMPATIBLE "FBX200900v7" +#define FBX_2010_00_COMPATIBLE "FBX201000" +#define FBX_2011_00_COMPATIBLE "FBX201100" +#define FBX_2012_00_COMPATIBLE "FBX201200" +#define FBX_2013_00_COMPATIBLE "FBX201300" +#define FBX_2014_00_COMPATIBLE "FBX201400" +#define FBX_2016_00_COMPATIBLE "FBX201600" +#define FBX_2018_00_COMPATIBLE "FBX201800" +#define FBX_2019_00_COMPATIBLE "FBX201900" + +//Default file version number used when writing new FBX files +#define FBX_DEFAULT_FILE_VERSION FBX_FILE_VERSION_7500 +#define FBX_DEFAULT_FILE_COMPATIBILITY FBX_2019_00_COMPATIBLE + +/** Convert the FBX file version string to an integral number for <= or >= tests purposes. + * \param pFileVersion File version string. + * Some examples: + * \code + * int version; + * version = FileVersionStrToInt(FBX2012_00_COMPATIBLE); // version = 201200 + * version = FileVersionStrToInt(FBX60_COMPATIBLE); // version = 6000 + * version = FileVersionStrToInt("FBX200900"); // version = 200900 + * version = FileVersionStrToInt("Toto"); // version = 0 + * version = FileVersionStrToInt(""); // version = -1 + * \endcode + * \returns the file version number or 0 if an unsupported string value is passed. + */ +FBXSDK_DLL int FbxFileVersionStrToInt(const char* pFileVersion); + +/** \internal Used internally by readers to evaluate what is the current section */ +enum +{ + FBX_NO_SECTION = -1, //!< indicate not in a valid section + FBX_MAIN_SECTION, //!< indicate currently in the main section + FBX_EXTENSION_SECTION_0 //!< indicate currently in the extention section 0 +}; + +/** Render and resolution information. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxIODefaultRenderResolution +{ +public: + /** If the resolution data is ready. */ + bool mIsOK; + /** camera name. */ + FbxString mCameraName; + /** resolution mode. ex: "Fixed Resolution","Fixed Ratio","Fixed Width","Fixed Height","Window Size"*/ + FbxString mResolutionMode; + /** resolution width. */ + double mResolutionW; + /** resolution height. */ + double mResolutionH; + + /** + * \name Constructors and Destructor + */ + //@{ + //! Default constructor. + FbxIODefaultRenderResolution(); + //@} + + /** + * \name Member Access + */ + //@{ + //! Reset values to default. + void Reset(); + //@} +}; + +/** FBX header information used at beginning of the FBX file +* to get or set important values like the file format version number (mFileVersion). +* The file version number will be used to select a particular Reader or Writer. +* \nosubgrouping */ +class FBXSDK_DLL FbxIOFileHeaderInfo +{ +public: + /** + * \name Constructors and Destructor + */ + //@{ + //! Default constructor. + FbxIOFileHeaderInfo(); + + //! Destructor. + virtual ~FbxIOFileHeaderInfo(); + //@} + + /** + * \name Public Member + */ + //@{ + + //! Reset values to default. + virtual void Reset(); + + /** A derived class can override this function to read additional information from the file header. + * \return false in case of failure that should stop loading the file. + */ + virtual bool ReadExtendedHeaderInformation(FbxIO*); + //@} + + //! FbxIODefaultRenderResolution to handle default resolution values + FbxIODefaultRenderResolution mDefaultRenderResolution; + + //!Read only properties (not used for file write) + + //@{ + /** File version ex; 5000, 6000, 6100, 7000, 7099, 7100 + * the major part is the first digit, the minor part, 3 other digits + * ex: 7100 means version 7.1 + */ + int mFileVersion; + + /** Indicates whether a creation time stamp is preset */ + bool mCreationTimeStampPresent; + + /** Indicates whether the mCreationTimeStamp member variable contains the actual creation time of the file. */ + FbxLocalTime mCreationTimeStamp; + + /** Indicates who is the creator of the file + * Ex: "FBX SDK/FBX Plugins version 2011.2" + */ + FbxString mCreator; + + /** Indicates whether the file is created by a genuine Autodesk plug-in or not */ + bool mIOPlugin; + + /** The flag indicates that the header was created by a personal learning edition (PLE) of FBX. */ + bool mPLE; + //@} +}; + +/** FbxIO represents an FBX file. + * It is primarily used by FBX importers (FbxImporter) and exporter (FbxExporter) + * when reading or writing data from or to a disk or memory. + * Most users will not use the FbxIO class directly + * but will use an instance of either FbxImporter or FbxExporter + * to read or write FBX files. + * + * An FBX file may contain binary data or ASCII data. + * A good way to learn the internal structure of a FBX file + * is to open a FBX file saved in ASCII in a text editor. + * + * Ex: to read a FBX file content using FbxIO class directly + * \code + * // Create a FbxIO object with FbxIO::Create() + * // Open the file with ProjectOpen( ... ) a NULL pointer can be passed for (FbxReader)* param + * // ProjectOpen_xxx_Section() to open a particular section + * int nbSec = FieldGetCount(); // to get the number of fields of the current section opened + * for(int i=0; i < nbSec; i++) // read all fields + * { + * // check if the field is a block + * if(FieldReadIsBlock()){ } ... Read sub fields recursively ... may contain other blocks and fields + * else + * { + * FieldReadBegin(); // navigate on the field + * char fieldType = FieldReadGetType(); // get the data type + * + * // According to the Field data type, call the appropriate read functions + * + * if(fieldType == 'S') FieldReadS(...) to read a string + * else if(fieldType == 'B') FieldReadB(...) to read a bool + * else if(fieldType == 'I') FieldReadI(...) to read a int + * ... + * FieldReadEnd(); // navigate to next field + * } + * } + * + * ProjectCloseSection() // close the section opened + * // repeat for another section ... + * // finally close the Project + * ProjectClose(); // or delete the FbxIO object created. + * \endcode + */ +class FBXSDK_DLL FbxIO +{ +public: + + /** \internal Exception-safe way of setting/resetting the xref manager in a FbxIO object. + */ + struct FbxAutoResetXRefManager + { + FbxIO* mFbx; + const FbxXRefManager* mXRefManager; + + /** Default constructor */ + FbxAutoResetXRefManager(FbxIO* pFbx, FbxXRefManager& pXRefManager) + : mFbx(pFbx) + , mXRefManager(NULL) + { + if( mFbx ) + { + mXRefManager = mFbx->ProjectGetXRefManager(); + mFbx->ProjectSetXRefManager(&pXRefManager); + } + } + + /** Destructor */ + ~FbxAutoResetXRefManager() + { + if( mFbx ) + { + mFbx->ProjectSetXRefManager(mXRefManager); + } + } + }; + + enum BinaryType + { + BinaryNormal, //(pBinaryType, pStatus); } + + /** Default constructor */ + FbxIO(BinaryType pBinaryType, FbxStatus& pStatus); + + /** Destructor */ + virtual ~FbxIO(); + + /** + * \name Project Global + * The term "Project" here is an abstract name chosen to represent a group of data + * ex: a file, a stream, a memory buffer, etc. + */ + //@{ + + /** Open a project already in Memory + * \param pAddress + * \param pMaxLength + * \param pReader + * \param pCheckCRC + * \param pOpenMainSection + * \param pFileHeaderInfo + * \return \c true on success, \c false otherwise. + */ + bool ProjectOpen(void* pAddress, FbxULong pMaxLength, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL); + + /** Open a project. + * \param pName + * \param pReader + * \param pCheckCRC + * \param pOpenMainSection + * \param pFileHeaderInfo + * \return \c true on success, \c false otherwise. + */ + bool ProjectOpen(const char* pName, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL); + + /** Open a project. + * \param pStream + * \param pStreamData + * \param pReader + * \param pCheckCRC + * \param pOpenMainSection + * \param pFileHeaderInfo + * \return \c true on success, \c false otherwise. + */ + bool ProjectOpen(FbxStream* pStream, void* pStreamData, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL); + + /** Open project file without necessarily an .fbx extension. + * \param pName + * \param pReader + * \param pCheckCRC + * \param pOpenMainSection + * \param pFileHeaderInfo + * \return \c true on success, \c false otherwise. + */ + bool ProjectOpenDirect(const char* pName, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL); + + /** Create a project in Memory + * \param pAddress + * \param pSize + * \param pWriter + * \param pBinary + * \param pEncrypted + * \param pFileHeaderInfo + * \return \c true on success, \c false otherwise. + */ + bool ProjectCreate(void* pAddress, FbxUInt pSize, FbxWriter* pWriter, bool pBinary, bool pEncrypted, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL); + + /** Create a project. + * \param pName + * \param pWriter + * \param pBinary + * \param pEncrypted + * \param pFileHeaderInfo + * \return \c true on success, \c false otherwise. + */ + bool ProjectCreate(const char* pName, FbxWriter* pWriter, bool pBinary, bool pEncrypted, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL); + + /** Create a project. + * \param pStream + * \param pStreamData + * \param pWriter + * \param pBinary + * \param pEncrypted + * \param pFileHeaderInfo + * \return \c true on success, \c false otherwise. + */ + bool ProjectCreate(FbxStream* pStream, void* pStreamData, FbxWriter* pWriter, bool pBinary, bool pEncrypted, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL); + + /** Create a project without necessary an .fbx extension. + * \param pName + * \param pWriter + * \param pBinary + * \param pEncrypted + * \param pFileHeaderInfo + * \return \c true on success, \c false otherwise. + */ + bool ProjectCreateDirect(const char* pName, FbxWriter* pWriter, bool pBinary, bool pEncrypted, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL); + + /** Create a project, without writing out the header (yet) + * \param pName + * \param pWriter + * \param pVersion + * \param pBinary + * \param pEncrypted + * \return \c true on success, \c false otherwise. + */ + bool ProjectCreateEmpty(const char* pName, FbxWriter* pWriter, int pVersion, bool pBinary, bool pEncrypted); + + /** Create a project, without writing out the header (yet) + * \param pStream + * \param pStreamData + * \param pWriter + * \param pVersion + * \param pBinary + * \param pEncrypted + * \return \c true on success, \c false otherwise. + */ + bool ProjectCreateEmpty(FbxStream* pStream, void* pStreamData, FbxWriter* pWriter, int pVersion, bool pBinary, bool pEncrypted); + + /** Write FBX signature at the top of the file, prepare file for writing header information + * \return \c true on success, \c false otherwise. + */ + bool ProjectWrite_BeginFileHeader(); + + /** Open up the 'extended header' + * \return \c true on success, \c false otherwise. + */ + bool ProjectWrite_BeginExtendedHeader(); + + /** Write the contents of the extended header + * \param pExtendedHeader + * \return \c true on success, \c false otherwise. + */ + bool ProjectWrite_WriteExtendedHeader(const FbxIOFileHeaderInfo* pExtendedHeader); + + /** Close the extended header + * \return \c true on success, \c false otherwise. + */ + bool ProjectWrite_EndExtendedHeader(); + + /** Close up the header, prepare file for payload write. + * \return \c true on success, \c false otherwise. + */ + bool ProjectWrite_EndFileHeader(); + + /** Close the project. + * \param pData + * \param pSize + * \return \c true on success, \c false otherwise. + */ + bool ProjectClose(void** pData=0, size_t* pSize=0); + + /** Provide the XRef Manager to use to create the .fbm folder. + * \remarks If NULL is used, the old behavior (using the .fbx's folder) is used instead. + */ + void ProjectSetXRefManager(const FbxXRefManager*); + + /** Get the XRef Manager to use. + * \return NULL if no XRef manager has been set. + */ + const FbxXRefManager* ProjectGetXRefManager() const; + + /** Select (and create) a folder to store embedded files (the .fbm + * file folder). Takes into account the settings from the XRef Manager. + * \param pXRefManager + * \param pCreatedFolder + * \param pUserDefinedFolder User defined "working folder" + * \return \c true on success, \c false otherwise. + * \remarks If this already been called successfully, uses the path + * previously created. + * + * Client application is responsible for cleaning up this folder. + * + * This will be automatically called if ProjectSetXRefManager() + * has been called before the .fbm folder needs to be created. + */ + bool ProjectCreateEmbeddedFolder(const FbxXRefManager& pXRefManager, FbxString& pCreatedFolder, const char* pUserDefinedFolder = NULL); + + /** On store event, use this function to tell if we are embedding. + * \param pValue + */ + void SetEmbedded(bool pValue); + + /** Explicitly set the embedding extraction folder. If this is never called, the FBX SDK will determine the best folder to extract embedded files. + * \param pExtractionFolder The file path name where the embedded files should be extracted. + */ + void SetEmbeddingExtractionFolder(const char* pExtractionFolder); + + /** 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(); + + /** Check if file is embedded or not. + * \return \c true if file is embedded, false otherwise. + */ + bool IsEmbedded() const; + + /** Check if file is binary or ASCII + * \return \c true if file is binary, false otherwise. + */ + bool IsBinary() const; + + /** Return if binary file is encrypted + * \return \c true if file is encrypted, false otherwise. + */ + bool IsEncrypted () const; + + /** Check CRC code. File must be open, binary and encrypted. + * \return \c true if CRC code is valid or file is not open, binary and encrypted. + */ + bool CheckCRC(); + + /** Return the file version number + * \return the file version number + */ + FbxUInt32 GetFileVersionNumber() const; + + /** Set the cache size for accelerated IO + * \param pCacheSize cache size to set (Kilo Byte) + */ + void CacheSize(FbxUInt32 pCacheSize); + + /** Return the current cache size + * \return the current cache size + */ + FbxUInt32 CacheSize() const; + + //@} + + /** + * \name FBX 7 Format specific functions. + + The FBX 7 format can compress internal arrays to make the file smaller. + The writer may decide not to compress all arrays, or it may even decide + not to compress anyway. Flags are written in the file to help the FBX7 reader + to know if a decompression is required, on a per-array basis. + The following functions address specific topics of the FBX 7 file format. + */ + //@{ + + //! \return Current state of the flag. + bool Fbx7Support() const; + + /** Set the flag state to tell the parser to handle FBX7 files. + * \param pSupport New flag state. + */ + void Fbx7Support(bool pSupport); + + //! \return Current State of the flag. + bool CompressArrays() const; + + /** Set the flag state. + * \param pCompress New flag state. + */ + void CompressArrays(bool pCompress); + + //! \return Current compression minimum size. + int CompressMinimumSize() const; + + /** Set the compression minimum size. + * \param pSize Threshold at which compression may embark. + */ + void CompressMinimumSize(int pSize); + + //! \return Current compression level. + int CompressLevel() const; + + /** Set the compression level. + * \param pLevel Value of the desired compression. + * \remarks The allowed range for pLevel is [0-9] where 0 equals no compression and + * 9 is as-much-as-we-can. + */ + void CompressLevel(int pLevel); + //@} + + /** + * \name Project related functions used to navigate on particular + * sections. + */ + //@{ + + /** Open the main section of a project. + * \return \c true on success, \c false otherwise. + */ + bool ProjectOpenMainSection(); + + /** Get the number of extension sections of a project. + * \return the number of extension sections of a project. + */ + int ProjectGetExtensionSectionCount() const; + + /** Open an extension section of a project. + * \param pExtensionSectionIndex + * \return \c true on success, \c false otherwise. + */ + bool ProjectOpenExtensionSection(int pExtensionSectionIndex); + + /** Create an extension section in a project, not allowed in ASCII and encrypted modes. + * \param pOverwriteLastExtensionSection + * \return \c true on success, \c false otherwise. + */ + bool ProjectCreateExtensionSection(bool pOverwriteLastExtensionSection = false); + + /** Close current section. + */ + void ProjectCloseSection(); + + /** Get current section. + * \return the current section. + */ + int ProjectGetCurrentSection() const; + + /** Get current section mode. + * \return the current section mode. + */ + int ProjectGetCurrentSectionMode() const; + + /** Get current section version. + * \return the current section version. + */ + int ProjectGetCurrentSectionVersion() const; + + /** Get the version number of a section. + * \param pSection + * \return the version number of a section. + * \remarks For main section it can be either 1000, 2000, 2001, 3000, 3001, 4000, 4001 or 4050. + * For the extension section it can be either 4000, 4001 or 4050. + * Returns 0 if section number does not exist. + */ + int ProjectGetSectionVersion(int pSection) const; + + /** Split a version number into major, minor and revision numbers. + * \param pVersion Version number to split. + * \param pMajor Integer to receive major version number. + * \param pMinor Integer to receive minor version number. + * \param pRevision Integer to receive revision version number. + */ + static void ProjectConvertVersionNumber(int pVersion, int& pMajor, int& pMinor, int& pRevision); + + /** Check the password protection flag. + * \return \c true if the current section has a password, \c false otherwise. + */ + bool IsPasswordProtected() const; + + /** Set password protection flag to \c false if the argument matches the password stored in the section. + * \param pPassword + * \return \c true if the argument matches the password stored in the section, \c false otherwise. + * \remarks This function only works in read mode. + */ + bool CheckPassword(const char* pPassword); + + /** Encrypt and store password in a section. + * \param pPassword + * \return \c true on success, \c false otherwise. + * \remarks This function only works in write mode and out of any enclosing block. + * \remarks This function must not be called more than once per section. + */ + bool WritePassword(const char* pPassword); + + //@} + + /** + * \name Directory related functions used to get or set file path information. + */ + //@{ + + /** Get project file name. + * \return project file name. + */ + const char* GetFilename() const; + + /** Get project data directory name. + * \param pAutoCreate + * \return project data directory name. + */ + FbxString GetDataDirectory(bool pAutoCreate = true); + + /** Get the current embedded folder used by this object. + * \param pCreate Whether create the media or not if no such folder is found + * \param pUserDefinedFolder User define working folder + * \return the current embedded folder used by this object. + * \remarks If ProjectCreateEmbeddedFolder has never been called this will + * return an empty string, unless we're explicitly asked to + * create it. + */ + FbxString GetMediaDirectory(bool pCreate = false, const char* pUserDefinedFolder = NULL); + + /** Get the full path of the directory to extract the template file. + * \param pTemplateName + * \param pCreate + * \return the full path of the directory to extract the template file. + */ + FbxString GetContainerTemplateDirectory(const char* pTemplateName, bool pCreate); + + /** Get the path relative to project directory. + * \param pPath + * \return the path relative to project directory. + */ + char* GetRelativePath(const char* pPath); + + /** Get the file path relative to project directory. + * \param pFilePath + * \return the file path relative to project directory. + */ + char* GetRelativeFilePath(const char* pFilePath); + + /** Get the full path of path relative to project directory. + * \param pRelativePath + * \return the full path of path relative to project directory. + */ + char* GetFullPath(const char* pRelativePath); + + /** Get the full file path of path relative to project directory. + * \param pRelativeFilePath + * \return the full file path of path relative to project directory. + */ + char* GetFullFilePath(const char* pRelativeFilePath); + + /** Get the temporary project name. + * \param pName + * \return the temporary project name. + */ + char* GetTmpProjectName(const char* pName) const; + + /** Swap from temporary project. + * \param pName + * \param pError + * \param pErrorSize + * \return \c true on success, \c false otherwise. + */ + bool SwapFromTmpProject(const char* pName, char* pError=NULL, int pErrorSize=0); + + //@} + + /** + * \name Read related functions used to get information of a field or a group of fields. + * Can be used to get the field content data or to navigate from field to field. + */ + //@{ + + /** Reset the field read position. + */ + void FieldReadResetPosition(); + + /** Get the number of fields. + * \return the number of fields. + */ + int FieldGetCount() const; + + /** Get the name of field indexed pFieldIndex. + * \param pFieldIndex + * \return the name of field indexed pFieldIndex. + */ + const char* FieldGetName(int pFieldIndex) const; + + /** Get number of instance field pFieldName has. + * \param pFieldName + * \return the number of instance field pFieldName has. + */ + int FieldGetInstanceCount(const char* pFieldName) const; + + /** Start to read field instance referred by field indexed pFieldIndex, instance indexed pInstance. + * \param pFieldIndex + * \param pInstance + * \return \c true on success, \c false otherwise. + */ + bool FieldReadBegin(int pFieldIndex, int pInstance); + + /** Start to read field pFieldName. + * \param pFieldName + * \return \c true on success, \c false otherwise. + */ + bool FieldReadBegin(const char* pFieldName); + + /** Start to read field instance referred field pFieldName, instance indexed pInstance. + * \param pFieldName + * \param pInstance + * \return \c true on success, \c false otherwise. + */ + bool FieldReadBegin(const char* pFieldName, int pInstance); + + //! Stop to read the current field. + void FieldReadEnd(); + + //! Return if current field is a block. + bool FieldReadIsBlock(); + + //! Start to read a field block. + bool FieldReadBlockBegin(); + + //! Stop to read a field block. + void FieldReadBlockEnd(); + + //! Return the number of read field. + int FieldReadGetCount() const; + + //! Return the number of field remaining to be read. + int FieldReadGetRemain() const; + + //! Return current field value type. + char FieldReadGetType() const; + + //! Return current field value as a char. + char FieldReadCH(); + + /** Return field pFieldName's value as a char. + * \param pFieldName + * \param pDefault + */ + char FieldReadCH(const char* pFieldName, char pDefault=0); + + //! Return current field value as a char pointer. + const char* FieldReadC(); + + /** Return field pFieldName's value as a char pointer. + * \param pFieldName + * \param pDefault + */ + const char* FieldReadC(const char* pFieldName, const char* pDefault=""); + + //! Return current field value as a string (a char pointer). + const char* FieldReadS(); + + /** Return field pFieldName's value as a char pointer. + * \param pFieldName + * \param pDefault + */ + const char* FieldReadS(const char* pFieldName, const char* pDefault=""); + + //! Return current field value as an bool. + bool FieldReadB(); + + /** Return field pFieldName's value as an integer. + * \param pFieldName + * \param pDefault + */ + bool FieldReadB(const char* pFieldName, bool pDefault = false); + + //! Return current field value as an integer. + int FieldReadI(); + + /** Return field pFieldName's value as an integer. + * \param pFieldName + * \param pDefault + */int FieldReadI(const char* pFieldName, int pDefault=0); + + //! Return current field value as an integer. + FbxLongLong FieldReadLL(); + + /** Return field pFieldName's value as an integer. + * \param pFieldName + * \param pDefault + */ + FbxLongLong FieldReadLL(const char* pFieldName, FbxLongLong pDefault=0); + + //! Return current field value as a float. + float FieldReadF(); + + /** Return field pFieldName's value as a float. + * \param pFieldName + * \param pDefault + */ + float FieldReadF(const char* pFieldName, float pDefault=0); + + //! Return current field value as a double. + double FieldReadD(); + + /** Return field pFieldName's value as a double. + * \param pFieldName + * \param pDefault + */ + double FieldReadD(const char* pFieldName, double pDefault=0); + + /** Return field pFieldName's value as a time value. + * \param pFieldName + */ + FbxTime FieldReadT(const char* pFieldName); + + //! Return field pFieldName's value as a time value. + FbxTime FieldReadT(); + + /** Return field pFieldName's value as a timespan value. + * \param pFieldName + */ + FbxTimeSpan FieldReadTS(const char* pFieldName); + + //! Return field pFieldName's value as a timespan value. + FbxTimeSpan FieldReadTS(); + + /** Return current field value as a n floats array. + * \param pValue + * \param pn + */ + void FieldReadFn(float* pValue, FbxUInt pn); + + /** Return current field value as a 3 floats array. + * \param pValue + */ + void FieldRead3F(float* pValue); + + /** Return current field value as a 4 floats array. + * \param pValue + */ + void FieldRead4F(float* pValue); + + /** Return field pFieldName's value as n floats array. + * \param pFieldName + * \param pValue + * \param pDefault + * \param pn + */ + void FieldReadFn(const char* pFieldName, float* pValue, const float *pDefault, FbxUInt pn); + + /** Return field pFieldName's value as 4 floats array. + * \param pFieldName + * \param pValue + * \param pDefault + */ + void FieldRead3F(const char* pFieldName, float* pValue, const float* pDefault=NULL); + + /** Return field pFieldName's value as 3 floats array. + * \param pFieldName + * \param pValue + * \param pDefault + */ + void FieldRead4F(const char* pFieldName, float* pValue, const float* pDefault=NULL); + + /** Return current field value as a n doubles array. + * \param pValue + * \param pn + */ + void FieldReadDn(double* pValue, FbxUInt pn); + + /** Return current field value as a 3 doubles array. + * \param pValue + */ + void FieldRead3D(double* pValue); + + /** Return current field value as a 4 doubles array. + * \param pValue + */ + void FieldRead4D(double* pValue); + + /** Return field pFieldName's value as n doubles array. + * \param pFieldName + * \param pValue + * \param pDefault + * \param pn + */ + void FieldReadDn(const char* pFieldName, double* pValue, const double *pDefault, FbxUInt pn); + + /** Return field pFieldName's value as 4 doubles array. + * \param pFieldName + * \param pValue + * \param pDefault + */ + void FieldRead3D(const char* pFieldName, double* pValue, const double* pDefault=NULL); + + /** Return field pFieldName's value as 3 doubles array. + * \param pFieldName + * \param pValue + * \param pDefault + */ + void FieldRead4D(const char* pFieldName, double* pValue, const double* pDefault=NULL); + + /** Return current field value as raw data. + * \param pByteSize + */ + void* FieldReadR(int* pByteSize); + + /** Return field pFieldName's value as raw data. + * \param pFieldName + * \param pByteSize + */ + void* FieldReadR(const char* pFieldName,int* pByteSize); + + /** + * \name FBX SDK 2009.3 and later + */ + //@{ + //! Return field pFieldName's value as byte. + FbxChar FieldReadByte(); + + /** Return field pFieldName's value as a byte value. + * \param pFieldName + * \param pDefault + */ + FbxChar FieldReadByte(const char* pFieldName, FbxChar pDefault=0); + + //! Return field pFieldName's value as unsigned byte. + FbxUChar FieldReadUByte(); + + /** Return field pFieldName's value as an unsigned byte value. + * \param pFieldName + * \param pDefault + */ + FbxUChar FieldReadUByte(const char* pFieldName, FbxUChar pDefault=0); + + //! Return field pFieldName's value as short. + FbxShort FieldReadShort(); + + /** Return field pFieldName's value as a short value. + * \param pFieldName + * \param pDefault + */ + FbxShort FieldReadShort(const char* pFieldName, FbxShort pDefault=0); + + //! Return field pFieldName's value as unsigned short. + FbxUShort FieldReadUShort(); + + /** Return field pFieldName's value as an unsigned short value. + * \param pFieldName + * \param pDefault + */ + FbxUShort FieldReadUShort(const char* pFieldName, FbxUShort pDefault=0); + + //! Return field pFieldName's value as unsigned integer. + unsigned int FieldReadUI(); + + /** Return field pFieldName's value as an unsigned int as a value. + * \param pFieldName + * \param pDefault + */ + unsigned int FieldReadUI(const char* pFieldName, unsigned int pDefault=0); + + //! Return field pFieldName's value as 64 bit unsigned integer. + FbxULongLong FieldReadULL(); + + /** Return field pFieldName's value as an 64 bit unsigned int as a value. + * \param pFieldName + * \param pDefault + */ + FbxULongLong FieldReadULL(const char* pFieldName, FbxULongLong pDefault=0); + + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxChar* FieldReadArraySBytes( int &pCount ); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxShort* FieldReadArrayShort ( int &pCount ); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxUShort* FieldReadArrayUShort( int &pCount ); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const unsigned int* FieldReadArrayUI ( int &pCount ); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxULongLong* FieldReadArrayULL ( int &pCount ); + + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxChar* FieldReadArray(int &pCount, const FbxChar*); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxShort* FieldReadArray(int &pCount, const FbxShort*); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxUShort* FieldReadArray(int &pCount, const FbxUShort*); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const unsigned int* FieldReadArray(int &pCount, const unsigned int*); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxULongLong* FieldReadArray(int &pCount, const FbxULongLong*); + //@} + + /** Read field and copy it into a file. + * \param pFileName Embedded file full path+name. + *\param pRelativeFileName Relative path+name of the embedded file. + * \param pEmbeddedMediaDirectory Directory of the embedded media. + * \param pIsFileCreated Status of the extraction of the embedded data. Set to \c true if the embedded media is correctly extracted in the media directory. + * \remarks Only works when file is binary. This function is not related to flag mEmbedded. + * \return \c false if operation failed. + */ + virtual bool FieldReadEmbeddedFile (FbxString& pFileName, FbxString& pRelativeFileName, const char* pEmbeddedMediaDirectory = "", bool *pIsFileCreated=NULL); + + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const double* FieldReadArrayD( int &pCount ); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const float* FieldReadArrayF( int &pCount ); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const int* FieldReadArrayI( int &pCount ); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxLongLong*FieldReadArrayLL(int &pCount ); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const bool* FieldReadArrayB( int &pCount ); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxUChar* FieldReadArrayBytes( int &pCount ); + + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const int* FieldReadArray(int& pCount, const int*); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const float* FieldReadArray(int& pCount, const float*); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const double* FieldReadArray(int& pCount, const double*); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxLongLong* FieldReadArray(int& pCount, const FbxLongLong*); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const bool* FieldReadArray(int& pCount, const bool*); + /** Read the whole array and return the pointer to it. + * \param pCount Nb of items in the array. + */ + const FbxUChar* FieldReadArray(int& pCount, const FbxUChar*); + + //@} + + /** + * \name Write related functions used to write information of a field or a group of fields. + * Can be used to write the field content data or to navigate from field to field. + */ + //@{ + + /** Start to write a field called pFieldName. + * \param pFieldName + */ + void FieldWriteBegin(const char* pFieldName); + + //! Stop to write the current field. + void FieldWriteEnd(); + + //! Start to write a field block. + void FieldWriteBlockBegin(); + + /** Start to write an object reference field. + * \param pObjectType + * \param pName + * \param pSubType + */ + void FieldWriteObjectBegin(const char* pObjectType, const char* pName, const char* pSubType=NULL); + + //! Stop to write an object reference field. + void FieldWriteObjectEnd(); + + /** Start to write a field block in file pFileName. + * \param pFileName + * \remarks This function is disabled but kept accessible for the FBX SDK. + */ + void FieldWriteBlockBegin(const char* pFileName); + + //! Stop to write a block of field. + void FieldWriteBlockEnd (); + + /** Write field value as a char. + * \param pValue + */ + void FieldWriteCH(char pValue); + + /** Write field pFieldName field with a char as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteCH(const char* pFieldName, char pValue); + + /** Write field value as char pointer pValue. + * \param pValue + */ + void FieldWriteC(const char* pValue); + + /** Write field pFieldName with a char pointer as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteC(const char* pFieldName, const char* pValue); + + /** Write field value as FbxString pValue. + * \param pValue + */ + void FieldWriteS(const char* pValue); + + /** Write field value as FbxString pValue. + * \param pValue + */ + void FieldWriteS(const FbxString& pValue); + + /** Write field pFieldName field with a FbxString as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteS(const char* pFieldName, const char* pValue); + + /** Write field pFieldName field with a FbxString as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteS(const char* pFieldName, const FbxString& pValue); + + /** Write field value as bool. + * \param pValue + */ + void FieldWriteB(bool pValue); + + /** Write field pFieldName field with a bool value. + * \param pFieldName + * \param pValue + */ + void FieldWriteB(const char* pFieldName, bool pValue); + + /** Write field value as integer. + * \param pValue + */ + void FieldWriteI(int pValue); + + /** Write field pFieldName field with an int as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteI(const char* pFieldName, int pValue); + + /** Write field value as 64 bit integer. + * \param pValue + */ + void FieldWriteLL(FbxLongLong pValue); + + /** Write field pFieldName field with an 64 bit int as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteLL(const char* pFieldName, FbxLongLong pValue); + + /** Write field value as float. + * \param pValue + * \remarks Only compatible with 1) MotionBuilder 4.0 and later 2) FBX SDK 3.6.1 and later. + */ + void FieldWriteF(float pValue); + + /** Write field pFieldName field with a float as a value. + * \param pFieldName + * \param pValue + * \remarks Only compatible with 1) MotionBuilder 4.0 and later 2) FBX SDK 3.6.1 and later. + */ + void FieldWriteF(const char* pFieldName, float pValue); + + /** Write field value as double. + * \param pValue + */ + void FieldWriteD(double pValue); + + /** Write field pFieldName field with a double as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteD(const char* pFieldName, double pValue); + + /** Write field value as time value. + * \param pTime + */ + void FieldWriteT(FbxTime pTime); + + /** Write field pFieldName field with a time as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteT(const char* pFieldName,FbxTime pValue); + + /** Write field value as timespan value. + * \param pTimeSpan + */ + void FieldWriteTS(FbxTimeSpan pTimeSpan); + + /** Write field pFieldName field with a timespan as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteTS(const char* pFieldName,FbxTimeSpan pValue); + + /** Write field value as an array of n floats (nF vector). + * \param pValue + * \param pn + */ + void FieldWriteFn(const float* pValue, FbxUInt pn); + + /** Write field pFieldName field with a array of n floats as a value. + * \param pFieldName + * \param pValue + * \param pn + */ + void FieldWriteFn(const char* pFieldName, const float* pValue, FbxUInt pn); + + /** Write field value as an array of 3 floats (3F vector). + * \param pValue + */ + void FieldWrite3F(const float* pValue); + + /** Write field pFieldName field with a array of 3 floats as a value. + * \param pFieldName + * \param pValue + */ + void FieldWrite3F(const char* pFieldName, const float* pValue); + + /** Write field value as an array of 4 floats (4F vector). + * \param pValue + */ + void FieldWrite4F(const float* pValue); + + /** Write field pFieldName field with a array of 4 floats as a value. + * \param pFieldName + * \param pValue + */ + void FieldWrite4F(const char* pFieldName, const float* pValue); + + /** Write field value as an array of n doubles (nD vector). + * \param pValue + * \param pn + */ + void FieldWriteDn(const double* pValue, FbxUInt pn); + + /** Write field pFieldName field with a array of n doubles as a value. + * \param pFieldName + * \param pValue + * \param pn + */ + void FieldWriteDn(const char* pFieldName, const double* pValue, FbxUInt pn); + + /** Write field value as an array of 3 doubles (3D vector). + * \param pValue + */ + void FieldWrite3D(const double* pValue); + + /** Write field pFieldName field with a array of 3 doubles as a value. + * \param pFieldName + * \param pValue + */ + void FieldWrite3D(const char* pFieldName, const double* pValue); + + /** Write field value as an array of 4 doubles (4D vector). + * \param pValue + */ + void FieldWrite4D(const double* pValue); + + /** Write field pFieldName field with a array of 4 doubles as a value. + * \param pFieldName + * \param pValue + */ + void FieldWrite4D(const char* pFieldName, const double* pValue); + + // The maximum number of value entries is, in theory, 2**32. In practice it should be a lot less than that. + // pSize is the number of values to write from each pointer location, and stride is how much we + // advance to get to the next value; if the stride is zero, values are tighly packed together. + // So in total we'll write n * pSize items. + + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayD( int n, const double* pValue, int pSize = 1, int pStride = 0 ); + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayF( int n, const float* pValue, int pSize = 1, int pStride = 0 ); + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayI( int n, const int* pValue, int pSize = 1, int pStride = 0 ); + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayLL(int n, const FbxLongLong* pValue, int pSize = 1, int pStride = 0 ); + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayB( int n, const bool* pValue, int pSize = 1, int pStride = 0 ); + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayBytes( int n, const FbxUChar* pValue, int pSize = 1, int pStride = 0 ); + + /** Write field value as a raw data. + * \param pRawData + * \param pByteSize + */ + void FieldWriteR(const void* pRawData, int pByteSize); + + /** Write field pFieldName field with raw data as a value. + * \param pFieldName + * \param pRawData + * \param pByteSize + */ + void FieldWriteR(const char* pFieldName, const void* pRawData, int pByteSize); + + /** + * \name FBX SDK 2009.3 and later + */ + //@{ + + /** Write field value as byte. + * \param pValue + */ + void FieldWriteByte(FbxChar pValue); + + /** Write field pFieldName field with a byte value. + * \param pFieldName + * \param pValue + */ + void FieldWriteByte(const char* pFieldName, FbxChar pValue); + + /** Write field value as unsigned byte. + * \param pValue + */ + void FieldWriteUByte(FbxUChar pValue); + + /** Write field pFieldName field with an unsigned byte value. + * \param pFieldName + * \param pValue + */ + void FieldWriteUByte(const char* pFieldName, FbxUChar pValue); + + /** Write field value as short. + * \param pValue + */ + void FieldWriteShort(FbxShort pValue); + + /** Write field pFieldName field with a short value. + * \param pFieldName + * \param pValue + */ + void FieldWriteShort(const char* pFieldName, FbxShort pValue); + + /** Write field value as unsigned short. + * \param pValue + */ + void FieldWriteUShort(FbxUShort pValue); + + /** Write field pFieldName field with an unsigned short value. + * \param pFieldName + * \param pValue + */ + void FieldWriteUShort(const char* pFieldName, FbxUShort pValue); + + /** Write field value as an unsigned integer. + * \param pValue + */ + void FieldWriteUI(unsigned int pValue); + + /** Write field pFieldName field with an unsigned int as a value. + * \param pFieldName + * \param pValue + */ + void FieldWriteUI(const char* pFieldName, unsigned int pValue); + + /** Write field value as 64 bit unsigned integer. + * \param pValue + */ + void FieldWriteULL(FbxULongLong pValue); + + /** Write field pFieldName field with an 64 bit unsigned int as a value. + * \param pFieldName + * \param pValue + * \return void + */ + void FieldWriteULL(const char* pFieldName, FbxULongLong pValue); + + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArraySBytes( int n, const FbxChar* pValue, int pSize = 1, int pStride = 0 ); + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayShort( int n, const FbxShort* pValue, int pSize = 1, int pStride = 0 ); + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayUShort( int n, const FbxUShort* pValue, int pSize = 1, int pStride = 0 ); + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayUI( int n, const unsigned int* pValue, int pSize = 1, int pStride = 0 ); + /** Write array to file. + * \param n Nb of items in the array. + * \param pValue Pointer to the data. + * \param pSize Size of each item in the array. + * \param pStride Array stride. + */ + void FieldWriteArrayULL(int n, const FbxULongLong* pValue, int pSize = 1, int pStride = 0 ); + //@} + + /** ASCII files may limit how big you can write your raw data, forcing you to break it down into chunks. + * \return int + */ + int GetFieldRMaxChunkSize() const; + + /** Write object reference pName in the current field. + * \param pName + */ + void FieldWriteObjectReference(const char* pName); + + /** Write object reference pName in field pFieldName. + * \param pFieldName + * \param pName + */ + void FieldWriteObjectReference(const char* pFieldName, const char* pName); + + /** Write field with file content as a value. + * \param pFileName + * \param pRelativeFileName + * \remarks Only works when file is binary. This function is not related to flag mEmbedded. + * \return \c false if operation failed. + */ + bool FieldWriteEmbeddedFile (FbxString pFileName, FbxString pRelativeFileName); + + /** Write comments, only effective in ASCII mode. + * \param pFieldName + */ + void WriteComments(const char* pFieldName); + + //@} + +#ifdef _DEBUG + // Dump function for debugging purpose only + void StdoutDump(); +#endif + + /** Get if the embedded file is currently loaded + * \return true if loaded, false otherwise + * \remarks An embedded file is a file like a JPEG image used for texture or an AVI file for video. + * When files are embedded, the size of the FBX file can be very large since other files are embedded in it. + * FBX Version 6 and lower cannot embed files when saved in ASCII. + * FBX Version 7 and over can embed files even when saved in ASCII mode. + */ + bool GetHaveLoadedEmbededFile() const; + + /** Get the maximum byte count written + * \param pMemPtr The address of the memory file + * \param[out] pSize Stores the maximum byte count written + */ + void GetMemoryFileInfo(void** pMemPtr, size_t& pSize) const; + + /** Get a internal flag to manage pre FBX version 6 data format + * Used for backwards compatibility + */ + bool IsBeforeVersion6() const; + + /** Set a internal flag to manage pre FBX version 6 data format + * Used for backwards compatibility + */ + void SetIsBeforeVersion6(bool pIsBeforeVersion6); + +/***************************************************************************************************************************** +** 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 ProjectOpen (FbxFile * pFile, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL); + FbxStatus& GetStatus() { return mStatus; } + +private: + // to resolve warning C4512: 'class' : assignment operator could not be generated + FbxIO& operator=(const FbxIO& pOther); + + FbxStatus& mStatus; + + struct InternalImpl; + struct InternalImpl32; + struct InternalImpl64; + InternalImpl* mImpl; + + //! Project Global + + void ProjectClear(); + void ProjectReset(); + + bool ProjectReadHeader(bool pCheckASCIIHeader, bool pCheckCRC, bool pOpenMainSection, FbxIOFileHeaderInfo* pFileHeaderInfo); + bool ProjectReadExtendedHeader(FbxInt64& pExtendedHeaderEnd, FbxIOFileHeaderInfo* pFileHeaderInfo); + bool BinaryReadHeader(); + bool BinaryReadSectionPosition(); + bool ASCIIReadHeader(); + bool ASCIIReadSectionPosition(); + + bool ProjectWriteHeader(FbxIOFileHeaderInfo* pFileHeaderInfo); + bool ProjectWriteExtendedHeader(FbxIOFileHeaderInfo* pFileHeaderInfo); + void BinaryWriteHeader(); + void ASCIIWriteHeader(); + + void ReadEncryptionKey(char* pEncryptionKey); + void WriteEncryptionKey(char* pEncryptionKey); + + //! Project Section + + bool ProjectClearSection(); + bool ProjectOpenSection(int pSection); + bool BinaryReadSectionHeader(); + FbxInt64 BinaryReadSectionFooter(char* pSourceCheck); + bool BinaryReadExtensionCode(FbxInt64 pFollowingSectionStart, FbxInt64& pSectionStart, FbxUInt32& pSectionVersion); + void BinaryReadSectionPassword(); + + bool ProjectWriteSectionHeader(); + void BinaryWriteSectionFooter(); + bool BinaryWriteExtensionCode(FbxInt64 pSectionStart, FbxUInt32 pSectionVersion); + + FbxString GetCreationTime() const; + void SetCreationTime(FbxString pCreationTime); + void CreateSourceCheck(char* lSourceCheck); + bool TestSourceCheck(char* pSourceCheck, char* pSourceCompany); + FbxString GetMangledCreationTime(); + void EncryptSourceCheck(char* pSourceCheck, char* pEncryptionData); + void DecryptSourceCheck(char* pSourceCheck, const char* pEncryptionData); + + void EncryptPasswordV1(FbxString pOriginalPassword, FbxString &pEncryptedPassword); + void DecryptPasswordV1(FbxString pEncryptedPassword, FbxString &pDecryptedPassword); + + //! Read + + void CheckValidityOfFieldName(const char* pFieldName); + void GetUnusedEmbeddedName(const FbxString& pDirectory, const FbxString& pName, FbxString& pResult, bool pCreateSubdirectory); + + //! Get project media directory name + FbxString GetDirectory(bool pAutoCreate, const char* pExtension); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_FILEIO_FBX_IO_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbx/fbxreaderfbx5.h b/libs/fbx/include/fbxsdk/fileio/fbx/fbxreaderfbx5.h new file mode 100644 index 00000000..2018a229 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbx/fbxreaderfbx5.h @@ -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 + +#include + +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* 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& pObjectContent); + bool ReadObjectSection(FbxScene& pScene, FbxArray& 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& pElementsMaterial); + bool ReadLayerElementsNormal (FbxGeometry* pGeometry, FbxArray& pElementsNormal); + bool ReadLayerElementsVertexColor (FbxGeometry* pGeometry, FbxArray& pElementsVertexColor); + bool ReadLayerElementsTexture (FbxGeometry* pGeometry, FbxArray& pElementsTexture); + bool ReadLayerElementsUV (FbxGeometry* pGeometry, FbxArray& pElementsUV); + bool ReadLayerElementsPolygonGroup (FbxGeometry* pGeometry, FbxArray& 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& 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 mTakeInfo; + FbxDocumentInfo * mSceneInfo; + FbxAnimLayer* mAnimLayer; + + // Temporary storage + FbxArray mTemporaryTextures; +}; + +#include + +#endif /* _FBXSDK_FILEIO_FBX_READER_FBX5_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbx/fbxreaderfbx6.h b/libs/fbx/include/fbxsdk/fileio/fbx/fbxreaderfbx6.h new file mode 100644 index 00000000..55af3f4f --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbx/fbxreaderfbx6.h @@ -0,0 +1,1102 @@ +/**************************************************************************************** + + 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 fbxreaderfbx6.h +#ifndef _FBXSDK_FILEIO_FBX_READER_FBX6_H_ +#define _FBXSDK_FILEIO_FBX_READER_FBX6_H_ + +#include + +#include + +class FbxAnimStack; +class FbxAnimLayer; +class Fbx6ObjectTypeInfo; +class Fbx6TypeReadReferences; + + +/** \brief Helper class to merge Class root property templates. + * Add class id and object to the template and search object by + * class id. + */ +class Fbx6ClassTemplateMap +{ +public: + + /** Constructor + * + */ + Fbx6ClassTemplateMap(); + + /** Destructor + * + */ + ~Fbx6ClassTemplateMap(); + + // Fbx6ClassTemplateMap will own this template object. + + /** Add the template object to template map + * \param pId Class Id + * \param pTemplateObject template object + * \return if the object is successfully added return \c true, otherwise return \c false. + */ + bool AddClassId( FbxClassId pId, FbxObject* pTemplateObject ); + + /** Merge the properties of FbxObject with the object with the same class id + * \param pObject The FbxObject to merge + * \return if the object is merged return \c true, otherwise return \c false. + */ + bool MergeWithTemplate( FbxObject* pObject ) const; + + /** Delete all FbxObject in template map + * + */ + void Clear(); + +private: + typedef FbxMap< FbxClassId, FbxObject*, FbxClassIdCompare > MapType; + MapType mClassMap; + + /** Whether the property is modified + * \param lProp The property to check + * \return If the property has been modified return \c true, otherwise return \c false + */ + bool HasModifiedFlags(FbxProperty lProp) const; + inline FbxPropertyFlags::EFlags IndexToFlag( int i ) const { return static_cast(1 << i); } +}; + + + +/** \brief This class is the FBX v6 reader. +* The reader provide you the ability to read the global settings, objects and animation information from file. +* +*/ +class FbxReaderFbx6 : public FbxReader +{ +public: + + /** 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 + */ + FbxReaderFbx6(FbxManager& pManager, FbxImporter& pImporter, int pID, FbxStatus& pStatus); + + /** Destructor + * + */ + virtual ~FbxReaderFbx6(); + + /** 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 FbxFile handle + * \param pFile the FbxFile handle + * \return if the file is open successfully return \c true, otherwise return \c false + */ + 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(); + + /** \enum EImportMode File import mode. + * + */ + typedef enum + { + eASCII, /**< Plain text mode */ + eBINARY, /**< Binary mode */ + eENCRYPTED /**< Encrypted mode */ + } EImportMode; + + /** Get current Import mode + * \return return the EImportMode value + */ + 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); + + /** 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); + + + /** Read all the properties and flags + * \param pParams settings to assign properties and flags + */ + virtual void PluginReadParameters(FbxObject& pParams); + + /** Returns the scene info from the file. + * \return The pointer to file scene info defined by this reader. + */ + virtual FbxDocumentInfo* GetSceneInfo() { return mSceneInfo; } + + + /** Returns the pointer to the list of TakeInfo from the file. + * \return NULL + */ + virtual FbxArray* GetTakeInfo() { return &mTakeInfo; } + + /** 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: + + /** Read scene information + * \return A pointer of document info. Return \c NULL if any error exist + */ + FbxDocumentInfo* ReadSceneInfo(); + + /** Read scene information by type + * \param pType the type to read + * \return A pointer of document info. Return \c NULL if any error exist + */ + FbxDocumentInfo* ReadSceneInfo(FbxString& pType); + + /** Write scene information + * + */ + void WriteSceneInfo(FbxDocumentInfo*); + + /** Write thumbnail + * + */ + bool WriteThumbnail(FbxThumbnail*); + + /** + * \name FBX File sections + */ + //@{ + + /** Create generic object and connect with FbxIO document + * \param pDocument FbxDocument to connect with the generic object + * \param pObjectType type of generic object + * \param pObjectSubType Subtype of generic object + * \param pObjectName Name of generic object + * \param pFlags Object flag + * \return A pointer of the generic object. Return \c NULL if creation fails. + */ + FbxObject* CreateGenericObject(FbxDocument *pDocument, char* pObjectType, char* pObjectSubType, char* pObjectName, FbxObject::EObjectFlag pFlags=FbxObject::eSavable); + + /** Read description section and assign the document name + * \param pDocument Document to read + * \param pDocumentName Document name to assign + * \return if reading description section is successful return \c true, otherwise return \c false. + */ + bool ReadDescriptionSection(FbxDocument *pDocument, FbxString& pDocumentName); + + /** Read reference section and fill the external references + * \param pDocument Document to read + * \param pDocReferences External references to fill + * \return if reading reference section is successful return \c true, otherwise return \c false. + */ + bool ReadReferenceSection(FbxDocument *pDocument, Fbx6TypeReadReferences& pDocReferences); + + /** Read definition section and fill object type info array + * \param pDocument Document to read + * \param pObjectContent Object type info array to fill + * \return if reading definition section is successful return \c true, otherwise return \c false. + */ + bool ReadDefinitionSection(FbxDocument *pDocument, FbxArray& pObjectContent ); + + /** Read object section and fill object type info array and external reference + * \param pDocument Document to read + * \param pObjectContent Object type info array to fill + * \param pDocReferences External references to fill + * \return if reading object section is successful return \c true, otherwise return \c false. + */ + bool ReadObjectSection(FbxDocument *pDocument, FbxArray& pObjectContent, Fbx6TypeReadReferences& pDocReferences ); + + /** Read object information from document + * \param pDocument Document to read + * \param pObjectType Object type to assign + * \param pObjectSubType Object subtype to assign + * \param pObjectName Object Name + * \param pObjectUniqueId Object unique id + * \param pReferencedObject Reference object + * \param pDocReferences External reference + * \return if reading object is successful return \c true, otherwise return \c false. + */ + bool ReadObject(FbxDocument *pDocument, FbxString& pObjectType, FbxString& pObjectSubType, FbxString& pObjectName, FbxString& pObjectUniqueId, FbxObject* pReferencedObject, Fbx6TypeReadReferences& pDocReferences); + + /** Read the connection section from document + * \param pDocument Document to read + * \return if reading connection section is successful return \c true, otherwise return \c false. + */ + bool ReadConnectionSection(FbxDocument *pDocument ); + //@} + + /** + * \name Takes and animation + */ + //@{ + + /** Read animation from document + * \param pDocument Document to read + * \return if reading animation is successful return \c true, otherwise return \c false. + */ + bool ReadDocumentAnimation(FbxDocument *pDocument); + + /** Read object animation from file object + * \param pFileObject File object handle + * \param pNode Fill this node with animation + * \param pAnimStack Animation stack to read from + * \param pExceptionFlag Exception flag + */ + void ReadObjectAnimation(FbxIO& pFileObject, FbxObject* pNode, FbxAnimStack& pAnimStack, int pExceptionFlag); + + /** Read property animation from file object + * \param pFileObject File object handle + * \param pProp Fill the property with animation + * \param pAnimStack Animation stack to read from + */ + void ReadPropertyAnimation(FbxIO& pFileObject, FbxProperty* pProp, FbxAnimStack& pAnimStack); + + /** Read take animation from fbx scene + * \param pScene Scene to read animation + * \param pTakeInfo Take info to read from + * \remarks This function will allocate the corresponding FbxAnimStack with the base animation layer. + */ + bool ReadTakeAnimation(FbxScene& pScene, FbxTakeInfo* pTakeInfo); + + /** Read node animation from file + * \param pFileObject File object to read + * \param pScene Scene to read animation + * \param pAnimStack The animation stack to read from + * \param pTakeInfo Take info to read from + */ + bool ReadNodeAnimation(FbxIO& pFileObject, FbxScene& pScene, FbxAnimStack& pAnimStack, FbxTakeInfo* pTakeInfo); + + + /** Read layer information from file + * \param pFileObject File object to read + * \param pTakeInfo Take info to read from + */ + void ReadLayers(FbxIO& pFileObject, FbxTakeInfo* pTakeInfo); + + /** Read time warps from file + * \param pFileObject File object to read + * \param pTimeWarpSet Time warp set to fill + * \param pScene Scene holding the time warp curves. + */ + void ReadTimeWarps(FbxIO& pFileObject, FbxMultiMap& pTimeWarpSet, FbxScene& pScene); + + /** Read thumbnail + * \return A pointer of thumbnail. Return \c NULL if any error exist + */ + FbxThumbnail* ReadThumbnail(); + + /** Set time shift for node animation from take information + * \param pScene Scene to read + * \param pAnimStack The animation stack to modify + * \param pTimeOffsetType A value from the FbxTakeInfo::EImportOffsetType enumeration that indicates the time shift offset type + * \param pTimeOffset The time shift offset + * \return if time shifting is successful return \c true, otherwise return \c false. + */ + bool TimeShiftNodeAnimation(FbxScene& pScene, FbxAnimStack& pAnimStack, int pTimeOffsetType, FbxTime pTimeOffset); + //@} + + /** + * \name Camera switcher + */ + //@{ + + /** Read camera switcher from scene + * \param pScene Scene to read from + */ + void ReadCameraSwitcher(FbxScene& pScene); + + /** Fill camera switcher object with data + * \param pCameraSwitcher Camera switcher to fill + */ + bool ReadCameraSwitcher( FbxCameraSwitcher& pCameraSwitcher ); + + /** Reorder camera switcher indices in the scene + * \param pScene Scene to read from + */ + void ReorderCameraSwitcherIndices(FbxScene& pScene); + //@} + + /** + * \name Global parameters + */ + //@{ + + /** Read global light settings from scene + * \param pScene Scene to read from + */ + void ReadGlobalLightSettings(FbxScene& pScene); + + /** Read global time settings from scene + * \param pScene Scene to read from + */ + void ReadGlobalTimeSettings(FbxScene& pScene); + + /** Read global camera settings from scene + * \param pScene Scene to read from + */ + void ReadGlobalCameraSettings(FbxScene& pScene); + + /** Read shadow plane from scene + * \param pScene Scene to read from + */ + void ReadShadowPlane(FbxScene& pScene); + + /** Read ambient color from scene + * \param pScene Scene to read from + */ + void ReadAmbientColor(FbxScene& pScene); + + /** Read fog option from scene + * \param pScene Scene to read from + */ + void ReadFogOption(FbxScene& pScene); + //@} + + /** + * \name Character + */ + //@{ + + /** Read character information from file + * \param pCharacter Character object to fill + * \param pInputType Unused. + * \param pInputIndex Unused. + */ + void ReadCharacter(FbxCharacter& pCharacter,int& pInputType, int& pInputIndex); + + /** Read character link group information from file by group id + * \param pCharacter Character object to fill + * \param pCharacterGroupId Group id to read character link + */ + void ReadCharacterLinkGroup(FbxCharacter& pCharacter, int pCharacterGroupId); + + /** Read character link information from file by node id + * \param pCharacter Character object to fill + * \param pCharacterNodeId Character node id + */ + void ReadCharacterLink(FbxCharacter& pCharacter, int pCharacterNodeId); + + /** Read character link formation in rotation space + * \param pCharacterLink Character link object to fill + */ + void ReadCharacterLinkRotationSpace(FbxCharacterLink& pCharacterLink); + + /** Read character pose from file + * \param pCharacterPose Character pose to fill + * \return if reading character pose is successful return \c true, otherwise return \c false. + */ + bool ReadCharacterPose(FbxCharacterPose& pCharacterPose); // TBV + //@} + + /** + * \name Misc + */ + //@{ + /** Read pose object from scene + * \param pScene Scene to read from + * \param pPose Pose object + * \param pAsBindPose whether to treat the pose as BindPose + * \return if reading pose is successful return \c true, otherwise return \c false. + */ + bool ReadPose(FbxScene& pScene, FbxPose* pPose, bool pAsBindPose); + + /** Read media data from document + * \param pDocument Document to read from + * \param pEmbeddedMediaDirectory the directory path storing the embedded media + * \return if reading media is successful return \c true, otherwise return \c false. + */ + bool ReadMedia(FbxDocument *pDocument, const char* pEmbeddedMediaDirectory = ""); + + /** Read global settings from file + * \param pGlobalSettings global settings object to fill + * \return if reading global settings is successful return \c true, otherwise return \c false. + */ + bool ReadGlobalSettings(FbxGlobalSettings& pGlobalSettings); + //@} + + /** + * \name Objects + */ + //@{ + + /** Read node data from file + * \param pNode Node object to fill data + * \param pObjectSubType Subtype of object + * \param pDocReferences External reference + * \return if reading node data is successful return \c true, otherwise return \c false. + */ + bool ReadNode ( FbxNode& pNode, FbxString& pObjectSubType, Fbx6TypeReadReferences& pDocReferences ); + + /** Read properties and flags for fbx container + * \param pContainer container to fill data + * \return if reading data to container is successful return \c true, otherwise return \c false. + */ + bool ReadContainer ( FbxContainer& pContainer ); + + /** Read properties and flags for fbx generic node + * \param pNode generic node to fill data + * \return if reading data to generic node is successful return \c true, otherwise return \c false. + */ + bool ReadGenericNode ( FbxGenericNode& pNode ); + + /** Read shading information of node + * \param pNode fbx node to fill shading information + * \return if reading shading information to node is successful return \c true, otherwise return \c false. + */ + bool ReadNodeShading ( FbxNode& pNode ); + + /** Read back-face culling type for node + * \param pNode fbx node + * \return if reading culling type to node is successful return \c true, otherwise return \c false. + */ + bool ReadNodeCullingType ( FbxNode& pNode ); // TBV, probablement passe tout en property + + /** Read target transform for node + * \param pNode fbx node + * \return if reading target transform to node is successful return \c true, otherwise return \c false. + */ + bool ReadNodeTarget ( FbxNode& pNode ); + + /** Read node attribute according to object subtype + * \param pNode fbx node + * \param pObjectSubType object subtype + * \param pCreatedAttribute set to true if attribute exists + * \param pDocReferences external reference to search + * \return if reading node attribute is successful return \c true, otherwise return \c false. + */ + bool ReadNodeAttribute ( FbxNode& pNode , FbxString& pObjectSubType, bool& pCreatedAttribute, Fbx6TypeReadReferences& pDocReferences); + + /** Read node attribute according to object subtype + * \param pObjectSubType object subtype + * \param pObjectName object name + * \param pObjectUniqueId unique id of object + * \param pReferencedObject pointer of reference object + * \return A pointer of node attribute. Return \c NULL if the attribute does not exist + */ + FbxNodeAttribute* ReadNodeAttribute( FbxString& pObjectSubType, FbxString& pObjectName, FbxString& pObjectUniqueId, FbxObject* pReferencedObject); + + /** Read node properties , flags and update the + * node pivot and limits according to properties + * \param pNode FBX node + * \param pReadNodeAttributeProperties whether to + * \return if reading node properties is successful return \c true, otherwise return \c false. + */ + bool ReadNodeProperties ( FbxNode& pNode, bool pReadNodeAttributeProperties ); + + /** Read layered texture from file + * \param pTex Layered texture to fill + * \return if reading layered texture is successful return \c true, otherwise return \c false. + */ + bool ReadLayeredTexture ( FbxLayeredTexture& pTex ); + + /** Read FBX links for geometry + * \param pGeometry FBX geometry + * \return if reading geometry links is successful return \c true, otherwise return \c false. + */ + bool ReadGeometryLinks ( FbxGeometry& pGeometry ); + + /** Read FBX shapes for geometry + * \param pGeometry FBX geometry + * \return if reading geometry shapes is successful return \c true, otherwise return \c false. + */ + bool ReadGeometryShapes ( FbxGeometry& pGeometry ); + + /** Read the null node from file + * \param pNull Null node + * \return if reading null node is successful return \c true, otherwise return \c false. + */ + bool ReadNull ( FbxNull& pNull ); + + /** Read the marker node from file + * \param pMarker Marker node + * \return if reading marker node is successful return \c true, otherwise return \c false. + */ + bool ReadMarker ( FbxMarker& pMarker ); + + /** Read the camera node from file + * \param pCamera Camera node + * \return if reading camera node is successful return \c true, otherwise return \c false. + */ + bool ReadCamera ( FbxCamera& pCamera ); + + /** Read the stereo camera node from file + * \param pCameraStereo Stereo camera node + * \return if reading stereo camera node is successful return \c true, otherwise return \c false. + */ + bool ReadCameraStereo ( FbxCameraStereo& pCameraStereo ); + + /** Read the precomp file from binary file + * \param pCameraStereo Stereo camera node + * \return if reading precomp file is successful return \c true, otherwise return \c false. + */ + bool ReadCameraStereoPrecomp (FbxCameraStereo& pCameraStereo); + + /** Read the light node from file + * \param pLight light node + * \return if reading light node is successful return \c true, otherwise return \c false. + */ + bool ReadLight ( FbxLight& pLight ); + + /** Read the binding table node from file. + * Create all the binding table entries and fill with embedded data + * \param pTable binding table + * \return if reading binding table is successful return \c true, otherwise return \c false. + */ + bool ReadBindingTable ( FbxBindingTable& pTable ); + + /** Read the binding operator from file + * \param pOperator binding operator + * \return if reading binding operator is successful return \c true, otherwise return \c false. + */ + bool ReadBindingOperator ( FbxBindingOperator& pOperator ); + + /** Read vertices, polygon indices, edges, layer elements, geometry links and shapes to mesh object + * \param pMesh fbx mesh + * \return if reading mesh object is successful return \c true, otherwise return \c false. + */ + bool ReadMesh ( FbxMesh& pMesh ); + + /** Read mesh smoothness factor from mesh + * \param pMesh fbx mesh + * \return if reading mesh smoothness is successful return \c true, otherwise return \c false. + */ + bool ReadMeshSmoothness ( FbxMesh& pMesh ); + + /** Read vertices of mesh object + * \param pMesh fbx mesh + * \return if reading mesh vertices is successful return \c true, otherwise return \c false. + */ + bool ReadMeshVertices ( FbxMesh& pMesh ); + + /** Read polygon indices of mesh object + * \param pMesh fbx mesh + * \return if reading polygon indices is successful return \c true, otherwise return \c false. + */ + bool ReadMeshPolygonIndex ( FbxMesh& pMesh ); + + /** Read edges of mesh object + * \param pMesh fbx mesh + * \return if reading mesh edges is successful return \c true, otherwise return \c false. + */ + bool ReadMeshEdges ( FbxMesh& pMesh ); + + //** Read FBX subdiv, base mesh, finest mesh, current subdiv level... + //* \param pSubdiv fbx subdiv + //* \param pObjectName Object Name + //* \param pReferencedObject pointer of reference object + //* \return if reading subdiv object is successful return \c true, otherwise return \c false. + //*/ + //bool ReadSubdiv( FbxSubDiv& pSubdiv, FbxString& pObjectName, FbxObject* pReferencedObject); + + /** Read FBX subdiv, base mesh, finest mesh, current subdiv level... + * \param pSubdiv fbx subdiv + * \return if reading subdiv object is successful return \c true, otherwise return \c false. + */ + bool ReadSubdiv( FbxSubDiv& pSubdiv); + + /** Read properties and flags for fbx document + * \param pSubDocument fbx document + * \return if reading document information is successful return \c true, otherwise return \c false. + */ + bool ReadDocument ( FbxDocument& pSubDocument ); + + /** Read properties and flags for fbx collection + * \param pCollection fbx collection + * \return if reading fbx collection is successful return \c true, otherwise return \c false. + */ + bool ReadCollection ( FbxCollection& pCollection ); + + /** Read properties and flags for fbx selection set + * \param pSelectionSet fbx selection set + * \return if reading fbx selection set is successful return \c true, otherwise return \c false. + */ + bool ReadSelectionSet ( FbxSelectionSet& pSelectionSet); + + bool ReadSelectionNode (FbxSelectionNode& pSelectionNode); + + /** Read nurb data including surface types, nurb type, display type, steps, control points and UV. + * \param pNurbs Nurb object + * \return if reading nurb data is successful return \c true, otherwise return \c false. + */ + bool ReadNurb ( FbxNurbs& pNurbs ); + + /** Read nurb surface data including surface types, surface type, display type, steps, control points and UV vectors. + * \param pNurbs Nurb surface object + * \return if reading nurb surface data is successful return \c true, otherwise return \c false. + */ + bool ReadNurbsSurface ( FbxNurbsSurface& pNurbs ); + + /** Read patch data including patch type, dimension, display type, steps, UV cap and control points. + * \param pPatch Patch object + * \return if reading patch data is successful return \c true, otherwise return \c false. + */ + bool ReadPatch ( FbxPatch& pPatch ); + + /** Read patch type in string and return type in enum + * \param pPatch Patch object + * \return patch type in enum + */ + int ReadPatchType ( FbxPatch& pPatch ); + + + /** Read nurb curve data including types, dimension, rational-ness, control points and knots. + * \param pNurbsCurve Nurb curve + * \return if reading nurb curve data is successful return \c true, otherwise return \c false. + */ + bool ReadNurbsCurve ( FbxNurbsCurve& pNurbsCurve ); + + /** Read trim Nurb surface objects with properties + * \param pNurbs Trim nurb surface * \return if reading trim nurb surface is successful return \c true, otherwise return \c false. + */ + bool ReadTrimNurbsSurface ( FbxTrimNurbsSurface& pNurbs ); + + /** Read properties and flags of fbx boundary + * \param pBoundary Fbx boundary object + * \return if reading fbx boundary is successful return \c true, otherwise return \c false. + */ + bool ReadBoundary ( FbxBoundary& pBoundary ); + + /** Read shape object properties from file + * \param pShape Fbx Shape + * \param pGeometry Geometry contains the shape + * \return if reading shape object properties is successful return \c true, otherwise return \c false. + */ + bool ReadShape ( FbxShape& pShape, FbxGeometry& pGeometry); + + /** Read properties and flags of fbx implementation + * \param pImplementation Fbx implementation + * \return if reading fbx implementation is successful return \c true, otherwise return \c false. + */ + bool ReadImplementation ( FbxImplementation& pImplementation ); + + /** Read texture object data including name, UV transform, alpha and cropping. + * \param pTexture Fbx texture object + * \return if reading texture object is successful return \c true, otherwise return \c false. + */ + bool ReadFileTexture (FbxFileTexture& pTexture); + + /** Read surface material from file + * \param pName Material Name + * \param pMaterialType Material type + * \param pReferencedMaterial Reference material to clone from if it is not \c NULL + * \return A pointer of read surface material + */ + FbxSurfaceMaterial* ReadSurfaceMaterial(const char* pName, const char* pMaterialType, FbxSurfaceMaterial* pReferencedMaterial); + + /** Read video object from file + * \param pVideo Fbx video object + * \return if reading video object is successful return \c true, otherwise return \c false. + */ + bool ReadVideo (FbxVideo& pVideo); + + /** Read thumbnail object from file + * \param pThumbnail Fbx thumbnail + * \return if reading thumbnail is successful return \c true, otherwise return \c false. + */ + bool ReadThumbnail (FbxThumbnail& pThumbnail); + //@} + + + /** + * \name Layer elements + */ + //@{ + + /** Read all layer elements for geometry + * \param pGeometry geometry to fill + * \return if reading all layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElements (FbxGeometry& pGeometry); + + /** Read material layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsMaterial material layer element array + * \return if reading material layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsMaterial (FbxGeometry* pGeometry, FbxArray& pElementsMaterial); + + /** Read normal layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsNormal normal layer element array + * \return if reading normal layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsNormal (FbxGeometry* pGeometry, FbxArray& pElementsNormal); + + /** Read Tangent layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsTangent Tangent layer element array + * \return if reading Tangent layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsTangent (FbxGeometry* pGeometry, FbxArray& pElementsTangent); + + /** Read Binormal layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsBinormal Binormal layer element array + * \return if reading Binormal layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsBinormal (FbxGeometry* pGeometry, FbxArray& pElementsBinormal); + + /** Read vertex color layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsVertexColor vertex color layer element array + * \return if reading vertex color layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsVertexColor (FbxGeometry* pGeometry, FbxArray& pElementsVertexColor); + + /** Read texture layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsTexture texture layer element array + * \param pTextureType the type of elements to read + * \return if reading texture layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsTexture (FbxGeometry* pGeometry, FbxArray& pElementsTexture, FbxLayerElement::EType pTextureType); + + /** Read UV layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsUV UV layer element array + * \param pTextureType the type of elements to read + * \return if reading UV layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsChannelUV (FbxGeometry* pGeometry, FbxArray& pElementsUV, FbxLayerElement::EType pTextureType); + + /** Read polygon group layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsPolygonGroup polygon group layer element array + * \return if reading polygon group layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsPolygonGroup (FbxGeometry* pGeometry, FbxArray& pElementsPolygonGroup); + + /** Read smoothing layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsSmoothing Smoothing group layer element array + * \return if reading smoothing layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsSmoothing (FbxGeometry* pGeometry, FbxArray& pElementsSmoothing); + + /** Read user data layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsUserData User data layer element array + * \return if reading user data layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsUserData (FbxGeometry* pGeometry, FbxArray& pElementsUserData); + + /** Read visibility layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsVisibility visibility layer element array + * \return if reading visibility layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementsVisibility (FbxGeometry* pGeometry, FbxArray& pElementsVisibility); + + /** Read edge crease layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsEdgeCrease edge crease layer element array + * \return if reading edge crease layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementEdgeCrease (FbxGeometry*pGeometry, FbxArray& pElementsEdgeCrease); + + /** Read vertex crease layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsVertexCrease vertex crease layer element array + * \return if reading vertex crease layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementVertexCrease (FbxGeometry*pGeometry, FbxArray& pElementsVertexCrease); + + /** Read hole layer elements for geometry + * \param pGeometry geometry to fill + * \param pElementsHole hole layer element array + * \return if reading hole layer elements is successful return \c true, otherwise return \c false. + */ + bool ReadLayerElementHole (FbxGeometry*pGeometry, FbxArray& pElementsHole); + //@} + + /** + * \name Geometry weighted maps + */ + //@{ + + /** Read geometry weight map from file + * \param pGeometryWeightedMap geometry weighted + * \return if reading geometry weight map is successful return \c true, otherwise return \c false. + */ + bool ReadGeometryWeightedMap(FbxGeometryWeightedMap& pGeometryWeightedMap); + //@} + + /** + * \name Deformers / Constraints + */ + //@{ + + /** Read link object from file + * \param pLink fbx link object + * \return if reading link object is successful return \c true, otherwise return \c false. + */ + bool ReadLink(FbxCluster& pLink); + + /** Read SDK skin from file + * \param pSkin SDK skin object + * \return if reading skin object is successful return \c true, otherwise return \c false. + */ + bool ReadSkin(FbxSkin& pSkin); + + /** Read properties and flags for vertex cache deformer from file + * \param pDeformer fbx vertex cache deformer + * \return if reading vertex cache deformer is successful return \c true, otherwise return \c false. + */ + bool ReadVertexCacheDeformer(FbxVertexCacheDeformer& pDeformer); + + /** Read cluster object data from file + * \param pCluster fbx cluster object + * \return if reading cluster object is successful return \c true, otherwise return \c false. + */ + bool ReadCluster(FbxCluster& pCluster); + + /** Read constraint object from file + * \param pPosition fbx constraint object + * \return if reading constraint object is successful return \c true, otherwise return \c false. + */ + bool ReadConstraint(FbxConstraint& pPosition); + //@} + + // Cache + + /** Read fbx cache file + * \param pCache fbx cache + * \return if reading cache data is successful return \c true, otherwise return \c false. + */ + bool ReadCache(FbxCache& pCache); + + /** + * \name Post-processing / utility functions + */ + //@{ + + /** Make sure the Camera's background textures are properly connected + * \param pScene fbx scene + * \remarks This function only applies when it detects older file versions in + * which the background texture is connected directly to the object instead of + * the corresponding property. + */ + bool ResolveCameraBackgrounds(FbxScene& pScene); + + /** Remove duplicate textures in the same scene + * \param pScene fbx scene + */ + void RemoveDuplicateTextures(FbxScene& pScene); + + /** Replace textures in the geometry + * \param pTextureDuplicate texture array + * \param pTextureReplacement texture array to replace + * \param pGeometry geometry owns these textures + * \param pTextureType layer element type + */ + void ReplaceTextures(FbxArray const& pTextureDuplicate, + FbxArray const& pTextureReplacement, + FbxGeometry* pGeometry, FbxLayerElement::EType pTextureType); + + /** Remove duplicated materials in the same scene + * \param pScene FBX scene + */ + void RemoveDuplicateMaterials(FbxScene& pScene); + + /** convert camera name for naming convention + * \param pCameraName original camera name + * \return new name for the camera + */ + FbxString ConvertCameraName(FbxString pCameraName); + + /** Search string in a string array + * \param pString the string to search + * \param pStringArray string array + * \return return the index of the array if the string is found, otherwise return \c -1 + */ + int FindString(FbxString pString, FbxArray& pStringArray); + + /** Read password from string + * \param pPassword password in string + * \return if the password is valid return \c true, otherwise return \c false + */ + bool ReadPassword(FbxString pPassword); + + /** Publish properties + * \param pObject fbx object + */ + void PublishProperties(FbxObject& pObject); + + /** Read properties for fbx object from file object + * \param pFbxObject fbx object + * \param pFbxFileObject fbx file object + * \param pReadNodeAttributeProperties whether to read properties for node attributes + */ + bool ReadProperties(FbxObject *pFbxObject, FbxIO *pFbxFileObject, bool pReadNodeAttributeProperties=true); + + + /** Read properties and flags for fbx object from file object + * \param pFbxObject fbx object + * \param pFbxFileObject fbx file object + * \param pReadNodeAttributeProperties whether to read properties for node attributes + * \return if reading properties and flags is successful return \c true, otherwise return \c false. + */ + bool ReadPropertiesAndFlags(FbxObject *pFbxObject, FbxIO *pFbxFileObject, bool pReadNodeAttributeProperties=true); + + /** Read flags for fbx object from file object + * \param pFbxObject object to set flags + * \param pFbxFileObject file to read + * \return if reading flags is successful return \c true, otherwise return \c false. + */ + bool ReadFlags(FbxObject *pFbxObject, FbxIO* pFbxFileObject); + + /** Rebuild trim regions indices from the boundary connections + * \param pScene Fbx scene + */ + void RebuildTrimRegions(FbxScene& pScene) const; + + /** Rebuild subdivision object from subdiv-mesh connections + * \param pScene Fbx scene + */ + void SetSubdivision(FbxScene& pScene) const; + + /** Convert shape deform property to DeformPercent property of FbxBlendShapeChannel + * \param pScene Fbx scene + */ + void ConvertShapeDeformProperty(FbxScene& pScene) const; + + /** Rebuild layered texture alphas from sub texture connections. + * \param pScene Fbx scene + */ + void RebuildLayeredTextureAlphas(FbxScene& pScene) const; + + //---------------- in progress ------------------------------- + void ReadOptionsInMainSection(); + void ReadTakeOptions(); + bool ReadOptionsInExtensionSection(int& pSectionIndex); + bool WriteOptionsInExtensionSection(bool pOverwriteLastExtensionSection=false); + //--------------- end in progress ---------------------------- + + /** Read global settings, axis system, system unit from main section of file + * + */ + void ReadGlobalSettingsInMainSection(); + + /** Read statistic data from definition section + * + */ + void ReadDefinitionSectionForStats(); + //@} + +private: + + FbxReaderFbx6& operator=(FbxReaderFbx6 const&) { return *this; } + + FbxIO* mFileObject; + FbxImporter& mImporter; + FbxCharPtrSet mNodeArrayName; + FbxObjectStringMap mObjectMap; + + bool mParseGlobalSettings; + FbxAxisSystem mAxisSystem; + FbxSystemUnit mSystemUnit; + FbxTime::EMode mFrameRate; + + bool mRetrieveStats; + FbxStatistics* mDefinitionsStatistics; + FbxArray mTakeInfo; + FbxDocumentInfo* mSceneInfo; + FbxAnimLayer* mAnimLayer; + FbxMultiMap mNickToKFCurveNodeTimeWarpsSet; + FbxMultiMap* mNickToAnimCurveTimeWarpsSet; + + Fbx6ClassTemplateMap mClassTemplateMap; + FbxProgress* mProgress; + bool mProgressPause; +}; + +#include + +#endif /* _FBXSDK_FILEIO_FBX_READER_FBX6_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbx/fbxreaderfbx7.h b/libs/fbx/include/fbxsdk/fileio/fbx/fbxreaderfbx7.h new file mode 100644 index 00000000..d8f420bb --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbx/fbxreaderfbx7.h @@ -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 + +#include + +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* 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 + +#endif /* _FBXSDK_FILEIO_FBX_READER_FBX7_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbx/fbxwriterfbx5.h b/libs/fbx/include/fbxsdk/fileio/fbx/fbxwriterfbx5.h new file mode 100644 index 00000000..d1d28491 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbx/fbxwriterfbx5.h @@ -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 + +#include + +//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& pStringArray); + void FindShapeValidIndices(FbxArray& pGeometryControlPoints, FbxArray& pShapeControlPoints, FbxArray& 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 + +#endif /* _FBXSDK_FILEIO_FBX_WRITER_FBX5_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbx/fbxwriterfbx6.h b/libs/fbx/include/fbxsdk/fileio/fbx/fbxwriterfbx6.h new file mode 100644 index 00000000..de3ccf6f --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbx/fbxwriterfbx6.h @@ -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 + +#include + +class Fbx6TypeDefinition; +class Fbx6TypeWriteReferences; +class Fbx6TypeObjectHierarchy; + +typedef FbxArray 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& pGeometryControlPoints, FbxArray& pShapeControlPoints, FbxArray& 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& 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 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 + +#endif /* _FBXSDK_FILEIO_FBX_WRITER_FBX6_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbx/fbxwriterfbx7.h b/libs/fbx/include/fbxsdk/fileio/fbx/fbxwriterfbx7.h new file mode 100644 index 00000000..b62f34e7 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbx/fbxwriterfbx7.h @@ -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 + +#include + +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 mModifiedProperties; + void StoreUnsupportedProperty(FbxObject* pObject, FbxProperty& pProperty); + + void MakeNonSavableAndRemember(FbxObject* pObj); + FbxArray mSwitchedToNonSavablesObjects; + FbxArray mAnimLayerInternallyAdded; + +private: + FbxWriterFbx7_Impl* mImpl; +}; + +#include + +#endif /* _FBXSDK_FILEIO_FBX_WRITER_FBX7_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxbase64coder.h b/libs/fbx/include/fbxsdk/fileio/fbxbase64coder.h new file mode 100644 index 00000000..abbd14cc --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxbase64coder.h @@ -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 + +#include + +#include + +/** 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 + +#endif /* _FBXSDK_FILEIO_BASE64CODER_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxexporter.h b/libs/fbx/include/fbxsdk/fileio/fbxexporter.h new file mode 100644 index 00000000..f77fa7de --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxexporter.h @@ -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 + +#include +#include +#include +#include +#include +#include + +#include + +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. + */ + virtual bool Initialize(const char* pFileName, int pFileFormat = -1, FbxIOSettings* pIOSettings = NULL); + + /** 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: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + 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 +{ + 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 +{ + FBXSDK_EVENT_DECLARE(FbxEventPostExport); + +public: + FbxEventPostExport(FbxDocument* pDocument) : mDocument(pDocument) {}; + + //! The document to be exported + FbxDocument* mDocument; +}; + +#include + +#endif /* _FBXSDK_FILEIO_EXPORTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxexternaldocreflistener.h b/libs/fbx/include/fbxsdk/fileio/fbxexternaldocreflistener.h new file mode 100644 index 00000000..5075ca58 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxexternaldocreflistener.h @@ -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 + +#include + +#include + +/** 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, 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 + +#endif /* _FBXSDK_FILEIO_EXTERNAL_DOCREF_LISTENER_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxfiletokens.h b/libs/fbx/include/fbxsdk/fileio/fbxfiletokens.h new file mode 100644 index 00000000..0b2b02c7 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxfiletokens.h @@ -0,0 +1,1087 @@ +/**************************************************************************************** + + 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 fbxfiletokens.h +#ifndef _FBXSDK_FILEIO_FILE_TOKENS_H_ +#define _FBXSDK_FILEIO_FILE_TOKENS_H_ + +#include + +#include + +// +// Summary +// +#define FIELD_SUMMARY "Summary" +#define FIELD_SUMMARY_VERSION "Version" +#define FIELD_SUMMARY_TEMPLATE "Template" +#define FIELD_SUMMARY_PASSWORD_PROTECTION "PasswordProtection" +#define FIELD_SUMMARY_CONTENT_COUNT "ContentCount" +#define FIELD_SUMMARY_CONTENT_COUNT_MODEL "Model" +#define FIELD_SUMMARY_CONTENT_COUNT_DEVICE "Device" +#define FIELD_SUMMARY_CONTENT_COUNT_CHARACTER "Character" +#define FIELD_SUMMARY_CONTENT_COUNT_ACTOR "Actor" +#define FIELD_SUMMARY_CONTENT_COUNT_CONSTRAINT "Constraint" +#define FIELD_SUMMARY_CONTENT_COUNT_MEDIA "Media" +#define FIELD_SUMMARY_CONTENT_COUNT_COMPONENT "Component" +#define FIELD_SUMMARY_TAKES "Takes" +#define FIELD_SUMMARY_TAKES_VERSION "Version" +#define FIELD_SUMMARY_TAKES_CURRENT "Current" +#define FIELD_SUMMARY_TAKES_TAKE "Take" +#define FIELD_SUMMARY_TAKES_TAKE_COMMENT "Comments" +#define FIELD_SUMMARY_TAKES_TAKE_LOCAL_TIME "LocalTime" +#define FIELD_SUMMARY_TAKES_TAKE_REFERENCE_TIME "ReferenceTime" + + +// +// FbxObject references, document ownership +// +#define FIELD_KFBXOBJECT_REFERENCE_TO "ReferenceTo" +#define FIELD_KFBXOBJECT_DOCUMENT "Doc" + +// (sic) +#define FIELD_KFBXOBECT_REFERENCE_TO FIELD_KFBXOBJECT_REFERENCE_TO + +// +// FbxContainer +// +#define FIELD_KFBXCONTAINER_VERSION "Version" +#define FIELD_KFBXCONTAINER_CONTAINER "Container" + + +// +// Thumbnail +// +#define FIELD_THUMBNAIL "Thumbnail" +#define FIELD_THUMBNAIL_VERSION "Version" +#define FIELD_THUMBNAIL_SIZE "Size" +#define FIELD_THUMBNAIL_FORMAT "Format" +#define FIELD_THUMBNAIL_ENCODING "ImageEncoding" +#define FIELD_THUMBNAIL_IMAGE "ImageData" + + +// +// FbxGlobalLightSettings +// +#define FIELD_KFBXGLOBALLIGHTSETTINGS_VERSION "Version" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_SHADOWPLANES "ShadowPlanes" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_COUNT "Count" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_PLANE "Plane" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_USESHADOW "UseShadow" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_SHADOWINTENSITY "ShadowIntensity" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_AMBIENTRENDER "AmbientRenderSettings" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_AMBIENTLIGHTCOLOR "AmbientLightColor" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_FOGOPTIONS "FogOptions" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_FOGENABLE "FlogEnable" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_FOGMODE "FogMode" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_FOGDENSITY "FogDensity" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_FOGSTART "FogStart" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_FOGEND "FogEnd" +#define FIELD_KFBXGLOBALLIGHTSETTINGS_FOGCOLOR "FogColor" + + +// +// FbxGlobalCameraSettings +// +#define FIELD_KFBXGLOBALCAMERASETTINGS_RENDERER_SETTINGS "RendererSetting" +#define FIELD_KFBXGLOBALCAMERASETTINGS_DEFAULT_CAMERA "DefaultCamera" +#define FIELD_KFBXGLOBALCAMERASETTINGS_DEFAULT_VIEWING_MODE "DefaultViewingMode" +#define FIELD_KFBXGLOBALCAMERASETTINGS_SETTINGS "Settings" +#define FIELD_KFBXGLOBALCAMERASETTINGS_CAMERA "Camera" + + +// +// FbxGlobalTimeSettings +// +#define FIELD_KFBXGLOBALTIMESETTINGS_TIME_MODE "TimeMode" +#define FIELD_KFBXGLOBALTIMESETTINGS_FRAMERATE "FrameRate" +#define FIELD_KFBXGLOBALTIMESETTINGS_TIME_PROTOCOL "TimeFormat" +#define FIELD_KFBXGLOBALTIMESETTINGS_SNAP_ON_FRAMES "SnapOnFrames" +#define FIELD_KFBXGLOBALTIMESETTINGS_REFERENCE_TIME_INDEX "ReferenceTimeIndex" +#define FIELD_KFBXGLOBALTIMESETTINGS_REFERENCE_TIME_MARKER "TimeMarker" +#define FIELD_KFBXGLOBALTIMESETTINGS_REFERENCE_TIME "Time" +#define FIELD_KFBXGLOBALTIMESETTINGS_REFERENCE_LOOP "Loop" +#define FIELD_KFBXGLOBALTIMESETTINGS_TIMELINE_START_TIME "TimeLineStartTime" +#define FIELD_KFBXGLOBALTIMESETTINGS_TIMELINE_STOP_TIME "TimeLineStopTime" + + +// +// Media +// +#define FIELD_MEDIA_MEDIA "Media" +#define FIELD_MEDIA_AUDIO "Audio" +#define FIELD_MEDIA_VIDEO "Video" +#define FIELD_MEDIA_TYPE "Type" +#define TOKEN_MEDIA_CLIP "Clip" +#define FIELD_MEDIA_VERSION "Version" +#define FIELD_MEDIA_ORIGINAL_FORMAT "OriginalFormat" +#define FIELD_MEDIA_ORIGINAL_FILENAME "OriginalFilename" +#define FIELD_MEDIA_FILENAME "Filename" +#define FIELD_MEDIA_RELATIVE_FILENAME "RelativeFilename" +#define FIELD_MEDIA_CONTENT "Content" + + +// +// Properties +// +#define FIELD_PROPERTIES "Properties" +#define FIELD_PROPERTIES_VERSION "Version" +#define FIELD_USERPROPERTIES "UserProperty" +#define FIELD_USERPROPERTIES_NAME "Name" +#define FIELD_USERPROPERTIES_TYPE "Type" +#define FIELD_USERPROPERTIES_LABEL "Label" +#define FIELD_USERPROPERTIES_MIN "Min" +#define FIELD_USERPROPERTIES_MAX "Max" +#define FIELD_USERPROPERTIES_VALUE "Value" + + +// +// FbxNode +// +#define FIELD_KFBXNODE_VERSION "Version" +#define FIELD_KFBXNODE_ANIMATION_MODE "AnimationMode" +#define FIELD_KFBXNODE_TYPE "Type" +#define FIELD_KFBXNODE_TYPE_FLAGS "TypeFlags" +#define FIELD_KFBXNODE_MODEL "Model" +#define FIELD_KFBXNODE_HIDDEN "Hidden" +#define FIELD_KFBXNODE_SHADING "Shading" +#define FIELD_KFBXNODE_TRANSFORM "Transform" +#define FIELD_KFBXNODE_DEFAULT "Default" +#define FIELD_KFBXNODE_TRANSLATION "T" +#define FIELD_KFBXNODE_ROTATION "R" +#define FIELD_KFBXNODE_SCALING "S" +#define FIELD_KFBXNODE_CHILDREN "Children" + +#define FIELD_KFBXNODE_CULLING_TYPE "Culling" +#define TOKEN_KFBXNODE_CULLING_OFF "CullingOff" +#define TOKEN_KFBXNODE_CULLING_ON_CCW "CullingOnCCW" +#define TOKEN_KFBXNODE_CULLING_ON_CW "CullingOnCW" + +#define FIELD_KFBXNODE_LIMITS "Limits" +#define FIELD_KFBXNODE_LIMITS_T_AUTO "TAuto" +#define FIELD_KFBXNODE_LIMITS_R_AUTO "RAuto" +#define FIELD_KFBXNODE_LIMITS_S_AUTO "SAuto" +#define FIELD_KFBXNODE_LIMITS_T_ENABLE "TEnable" +#define FIELD_KFBXNODE_LIMITS_R_ENABLE "REnable" +#define FIELD_KFBXNODE_LIMITS_S_ENABLE "SEnable" +#define FIELD_KFBXNODE_LIMITS_T_X_DEFAULT "TXDefault" +#define FIELD_KFBXNODE_LIMITS_T_Y_DEFAULT "TYDefault" +#define FIELD_KFBXNODE_LIMITS_T_Z_DEFAULT "TZDefault" +#define FIELD_KFBXNODE_LIMITS_R_X_DEFAULT "RXDefault" +#define FIELD_KFBXNODE_LIMITS_R_Y_DEFAULT "RYDefault" +#define FIELD_KFBXNODE_LIMITS_R_Z_DEFAULT "RZDefault" +#define FIELD_KFBXNODE_LIMITS_S_X_DEFAULT "SXDefault" +#define FIELD_KFBXNODE_LIMITS_S_Y_DEFAULT "SYDefault" +#define FIELD_KFBXNODE_LIMITS_S_Z_DEFAULT "SZDefault" +#define FIELD_KFBXNODE_LIMITS_T_X_MIN "TXMin" +#define FIELD_KFBXNODE_LIMITS_T_Y_MIN "TYMin" +#define FIELD_KFBXNODE_LIMITS_T_Z_MIN "TZMin" +#define FIELD_KFBXNODE_LIMITS_R_X_MIN "RXMin" +#define FIELD_KFBXNODE_LIMITS_R_Y_MIN "RYMin" +#define FIELD_KFBXNODE_LIMITS_R_Z_MIN "RZMin" +#define FIELD_KFBXNODE_LIMITS_S_X_MIN "SXMin" +#define FIELD_KFBXNODE_LIMITS_S_Y_MIN "SYMin" +#define FIELD_KFBXNODE_LIMITS_S_Z_MIN "SZMin" +#define FIELD_KFBXNODE_LIMITS_T_X_MAX "TXMax" +#define FIELD_KFBXNODE_LIMITS_T_Y_MAX "TYMax" +#define FIELD_KFBXNODE_LIMITS_T_Z_MAX "TZMax" +#define FIELD_KFBXNODE_LIMITS_R_X_MAX "RXMax" +#define FIELD_KFBXNODE_LIMITS_R_Y_MAX "RYMax" +#define FIELD_KFBXNODE_LIMITS_R_Z_MAX "RZMax" +#define FIELD_KFBXNODE_LIMITS_S_X_MAX "SXMax" +#define FIELD_KFBXNODE_LIMITS_S_Y_MAX "SYMax" +#define FIELD_KFBXNODE_LIMITS_S_Z_MAX "SZMax" +#define FIELD_KFBXNODE_LIMITS_R_TYPE "RType" +#define FIELD_KFBXNODE_LIMITS_R_CLAMP_TYPE "RClampType" +#define FIELD_KFBXNODE_LIMITS_R_X_AXIS "RXAxis" +#define FIELD_KFBXNODE_LIMITS_R_Y_AXIS "RYAxis" +#define FIELD_KFBXNODE_LIMITS_R_Z_AXIS "RZAxis" +#define FIELD_KFBXNODE_LIMITS_AXIS_LENGTH "AxisLen" + +#define FIELD_KFBXNODE_TARGET "LookAtModel" +#define FIELD_KFBXNODE_UP_VECTOR_MODEL "UpVectorModel" +#define FIELD_KFBXNODE_POST_TARGET_ROTATION "PostTargetRotation" +#define FIELD_KFBXNODE_TARGET_UP_VECTOR "UpTargetRotation" + +#define FIELD_KFBXNODE_PIVOTS "Pivots" +#define FIELD_KFBXNODE_PACKAGE "Package" +#define FIELD_KFBXNODE_FILE "File" +#define FIELD_KFBXNODE_TRANSLATION_OFFSET "TranslationOffset" +#define FIELD_KFBXNODE_ROTATION_PIVOT "RotationPivot" +#define FIELD_KFBXNODE_PRE_ROTATION "PreRotation" +#define FIELD_KFBXNODE_POST_ROTATION "PostRotation" +#define FIELD_KFBXNODE_SCALING_PIVOT "ScalingPivot" +#define FIELD_KFBXNODE_PIVOT_ENABLED "PivotEnabled" + +// +// FbxGenericNode +// +#define FIELD_KFBXGENERICNODE_VERSION "Version" +#define FIELD_KFBXGENERICNODE_GENERICNODE "GenericNode" + +// +// FbxGeometry +// +#define FIELD_KFBXGEOMETRY_MATERIAL "Material" +#define FIELD_KFBXGEOMETRY_TEXTURE "Texture" +#define FIELD_KFBXGEOMETRY_LINK "Link" +#define FIELD_KFBXGEOMETRY_SHAPE "Shape" + +// +// FbxMarker +// +#define FIELD_KFBXMARKER_LOOK "Look" +#define FIELD_KFBXMARKER_SIZE "Size" +#define FIELD_KFBXMARKER_COLOR "Color" +#define FIELD_KFBXMARKER_SHOW_LABEL "ShowLabel" +#define FIELD_KFBXMARKER_IK_PIVOT "IKPivot" +#define FIELD_KFBXMARKER_IK_REACH_TRANSLATION "IKReachTranslation" +#define FIELD_KFBXMARKER_IK_REACH_ROTATION "IKReachRotation" +#define FIELD_KFBXMARKER_IK_PULL "IKPull" +#define FIELD_KFBXMARKER_IK_PULL_HIPS "IKPullHips" + +// +// FbxCamera +// +#define FIELD_KFBXGEOMETRYCAMERA_VERSION "Version" +#define FIELD_KFBXGEOMETRYCAMERA_GEOMETRY_VERSION "GeometryVersion" +#define FIELD_KFBXGEOMETRYCAMERA_NAME "Name" + +// Camera Position and Orientation +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_POSITION "Position" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_UP_VECTOR "Up" +#define FIELD_KFBXGEOMETRYCAMERA_DEFAULT_CAMERA_INTEREST_POSITION "LookAt" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_ROLL "Roll" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_TURNTABLE "TurnTable" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_PROJECTION_TYPE "Type" + +// Viewing Area Controls +#define FIELD_KFBXGEOMETRYCAMERA_FORMAT_NAME "FormatName" +#define TOKEN_KFBXGEOMETRYCAMERA_NTSC "NTSC" +#define TOKEN_KFBXGEOMETRYCAMERA_D1_NTSC "D1 NTSC" +#define TOKEN_KFBXGEOMETRYCAMERA_PAL "PAL" +#define TOKEN_KFBXGEOMETRYCAMERA_D1_PAL "D1 PAL" +#define TOKEN_KFBXGEOMETRYCAMERA_HD "HD" +#define TOKEN_KFBXGEOMETRYCAMERA_640x480 "640x480" +#define TOKEN_KFBXGEOMETRYCAMERA_320x200 "320x200" +#define TOKEN_KFBXGEOMETRYCAMERA_320x240 "320x240" +#define TOKEN_KFBXGEOMETRYCAMERA_128x128 "128x128" +#define TOKEN_KFBXGEOMETRYCAMERA_FULL_SCREEN "Full Screen" +#define TOKEN_KFBXGEOMETRYCAMERA_CUSTOM_FORMAT "Custom" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_ASPECT_TYPE "AspectType" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_ASPECT_WIDTH "AspectW" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_ASPECT_HEIGHT "AspectH" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_PIXEL_RATIO "PixelRatio" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_NEAR_PLANE "NearPlane" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_FAR_PLANE "FarPlane" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_LOCK "CameraLock" + +// Aperture and Film Controls +#define FIELD_KFBXGEOMETRYCAMERA_APERTURE_FORMAT_NAME "ApertureFormat" +#define TOKEN_KFBXGEOMETRYCAMERA_16MM_THEATRICAL "16mm Theatrical" +#define TOKEN_KFBXGEOMETRYCAMERA_SUPER_16MM "Super 16mm" +#define TOKEN_KFBXGEOMETRYCAMERA_35MM_ACADEMY "35mm Academy" +#define TOKEN_KFBXGEOMETRYCAMERA_35MM_TV_PROJECTION "35mm TV Projection" +#define TOKEN_KFBXGEOMETRYCAMERA_35MM_FULL_APERTURE "35mm Full Aperture" +#define TOKEN_KFBXGEOMETRYCAMERA_35MM_185_PROJECTION "35mm 1.85 Projection" +#define TOKEN_KFBXGEOMETRYCAMERA_35MM_ANAMORPHIC "35mm Anamorphic" +#define TOKEN_KFBXGEOMETRYCAMERA_70MM_PROJECTION "70mm Projection" +#define TOKEN_KFBXGEOMETRYCAMERA_VISTA_VISION "VistaVision" +#define TOKEN_KFBXGEOMETRYCAMERA_DYNAVISION "Dynavision" +#define TOKEN_KFBXGEOMETRYCAMERA_IMAX "Imax" +#define TOKEN_KFBXGEOMETRYCAMERA_CUSTOM_APERTURE_FORMAT "Custom" +#define FIELD_KFBXGEOMETRYCAMERA_APERTURE_MODE "ApertureMode" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_APERTURE_DIMENSION "CameraAperture" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_SQUEEZERATIO "SqueezeRatio" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_FOCAL_LENGTH "FocalLength" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_APERTURE "Aperture" + +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_APERTURE_X "FieldOfViewXProperty" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_APERTURE_Y "FieldOfViewYProperty" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_OPTICAL_CENTER_X "OpticalCenterXProperty" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_OPTICAL_CENTER_Y "OpticalCenterYProperty" + +// Background Properties +#define FIELD_KFBXGEOMETRYCAMERA_BACKGROUND_MEDIA_NAME "Media" +#define FIELD_KFBXGEOMETRYCAMERA_BACKGROUND_TEXTURE "BackgroundTexture" +#define FIELD_KFBXGEOMETRYCAMERA_BACKGROUND_VIDEO_CLIP_TEXTURE "VideoClipTexture" +#define FIELD_KFBXGEOMETRYCAMERA_BACKGROUND_DISPLAY_MODE "ViewFrustumPlane" +#define FIELD_KFBXGEOMETRYCAMERA_BACKGROUND_DRAWING_MODE "BackgroundMode" +#define FIELD_KFBXGEOMETRYCAMERA_FOREGROUND_MATTE_THRESHOLD_ENABLE "ForegroundTransparent" +#define FIELD_KFBXGEOMETRYCAMERA_FOREGROUND_MATTE_TRESHOLD "BackgroundTreshold" +#define FIELD_KFBXGEOMETRYCAMERA_BACKGROUND_PLACEMENT_OPTIONS "DisplayMode" +#define FIELD_KFBXGEOMETRYCAMERA_BACKGROUND_DISTANCE "ViewFrustumPlaneDistance" +#define FIELD_KFBXGEOMETRYCAMERA_BACKGROUND_DISTANCE_MODE "ViewFrustumPlaneDistanceMode" + +// Camera View Options +#define FIELD_KFBXGEOMETRYCAMERA_VIEW_CAMERA_INTEREST "ViewLookAt" +#define FIELD_KFBXGEOMETRYCAMERA_VIEW_NEAR_FAR_PLANES "ViewFrustum" +#define FIELD_KFBXGEOMETRYCAMERA_SHOW_GRID "ShowGrid" +#define FIELD_KFBXGEOMETRYCAMERA_SHOW_AXIS "ShowAzimut" +#define FIELD_KFBXGEOMETRYCAMERA_SHOW_NAME "ShowName" +#define FIELD_KFBXGEOMETRYCAMERA_SHOW_INFO_ON_MOVING "ShowInfoOnMoving" +#define FIELD_KFBXGEOMETRYCAMERA_SHOW_TIME_CODE "ShowTimeCode" +#define FIELD_KFBXGEOMETRYCAMERA_DISPLAY_SAFE_AREA "DisplaySafeArea" +#define FIELD_KFBXGEOMETRYCAMERA_SAFE_AREA_STYLE "SafeAreaStyle" +#define FIELD_KFBXGEOMETRYCAMERA_DISPLAY_SAFE_AREA_ON_RENDER "DisplaySafeAreaOnRender" +#define FIELD_KFBXGEOMETRYCAMERA_SHOW_AUDIO "ShowAudio" + +#define FIELD_KFBXGEOMETRYCAMERA_BACKGROUND_COLOR "BackGroundColor" +#define FIELD_KFBXGEOMETRYCAMERA_AUDIO_COLOR "AudioColor" +#define FIELD_KFBXGEOMETRYCAMERA_USE_FRAME_COLOR "UseFrameColor" +#define FIELD_KFBXGEOMETRYCAMERA_FRAME_COLOR "FrameColor" +#define FIELD_KFBXGEOMETRYCAMERA_ORTHO_ZOOM "CameraOrthoZoom" + +// Rendering Options +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_LENS "CameraAndLens" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_LENS_DEPTH_OF_FIELD "DepthOfField" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_LENS_ANTIALIASING "Antialiasing" +#define FIELD_KFBXGEOMETRYCAMERA_CAMERA_LENS_OVERSAMPLING "OverSampling" +#define FIELD_KFBXGEOMETRYCAMERA_RENDER_OPTIONS_USAGE_TIME "UseOverSamplingTime" + +// +// FbxCameraStereo +// +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_VERSION "Version" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_GEOMETRY_VERSION "GeometryVersion" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_NAME "Name" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_STEREO "Stereo" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_INTERAXIAL_SEP "InteraxialSeparation" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_ZERO_PARALLAX "ZeroParallax" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_TOE_IN_ADJUST "ToeInAdjust" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_FILM_OFFSET_RIGHT_CAM "FilmOffsetRightCam" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_FILM_OFFSET_LEFT_CAM "FilmOffsetLeftCam" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_PRECOMP_FILE_NAME "PrecompFileName" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_RELATIVE_PRECOMP_FILE_NAME "RelativePrecompFileName" +#define FIELD_KFBXGEOMETRYCAMERA_STEREO_PRECOMP_FILE_CONTENT "PrecompFileContent" + +// +// FbxCameraSwitcher +// +#define FIELD_KFBXGEOMETRYCAMERASWITCHER_SWITCHER "Switcher" +#define FIELD_KFBXGEOMETRYCAMERASWITCHER_NAME "Name" +#define FIELD_KFBXGEOMETRYCAMERASWITCHER_CAMERA_ID "CameraId" +#define FIELD_KFBXGEOMETRYCAMERASWITCHER_CAMERA_NAME "CameraName" +#define FIELD_KFBXGEOMETRYCAMERASWITCHER_CAMERA_INDEX_NAME "CameraIndexName" + + +// +// FbxLight +// +#define FIELD_KFBXGEOMETRYLIGHT_GEOMETRY_VERSION "GeometryVersion" +#define FIELD_KFBXGEOMETRYLIGHT_LIGHT_TYPE "LightType" +#define FIELD_KFBXGEOMETRYLIGHT_LIGHT_TYPE_VERSION "LightTypeVersion" +#define FIELD_KFBXGEOMETRYLIGHT_CAST_LIGHT "CastLight" + + +// +// FbxMesh +// +#define FIELD_KFBXGEOMETRYMESH_UV_VERSION "Version" +#define FIELD_KFBXGEOMETRYMESH_GEOMETRY_VERSION "GeometryVersion" +#define FIELD_KFBXGEOMETRYMESH_VERTICES "Vertices" +#define FIELD_KFBXGEOMETRYMESH_EDGES "Edges" +#define FIELD_KFBXGEOMETRYMESH_INTERNAL_EDGES "InternalEdges" +#define FIELD_KFBXGEOMETRYMESH_NORMALS "Normals" +#define FIELD_KFBXGEOMETRYMESH_NORMALS_WCOMPONENT "NormalsW" +#define FIELD_KFBXGEOMETRYMESH_BINORMALS "Binormals" +#define FIELD_KFBXGEOMETRYMESH_BINORMALS_WCOMPONENT "BinormalsW" +#define FIELD_KFBXGEOMETRYMESH_TANGENTS "Tangents" +#define FIELD_KFBXGEOMETRYMESH_TANGENTS_WCOMPONENT "TangentsW" +#define FIELD_KFBXGEOMETRYMESH_NORMALS_INDEX "NormalsIndex" +#define FIELD_KFBXGEOMETRYMESH_BINORMALS_INDEX "BinormalsIndex" +#define FIELD_KFBXGEOMETRYMESH_TANGENTS_INDEX "TangentsIndex" +#define FIELD_KFBXGEOMETRYMESH_MATERIAL_ASSIGNATION "MaterialAssignation" +#define FIELD_KFBXGEOMETRYMESH_TEXTURE_ASSIGNATION "TextureMode" +#define FIELD_KFBXGEOMETRYMESH_POLYGON_INDEX "PolygonVertexIndex" +#define FIELD_KFBXGEOMETRYMESH_POLYGON_GROUP "PolygonGroup" +#define FIELD_KFBXGEOMETRYMESH_MATERIALS_ID "Materials" +#define FIELD_KFBXGEOMETRYMESH_TEXTURE_ID "TextureId" +#define FIELD_KFBXGEOMETRYMESH_TEXTURE_TYPE "TextureType" +#define FIELD_KFBXGEOMETRYMESH_UV_TYPE "UVType" +#define FIELD_KFBXGEOMETRYMESH_MAPPING_INFO_TYPE "MappingInformationType" +#define FIELD_KFBXGEOMETRYMESH_TEXTURE_UV "TextureUV" +#define FIELD_KFBXGEOMETRYMESH_TEXTURE_POLYGON_UV "TexturePUV" +#define FIELD_KFBXGEOMETRYMESH_GEOMETRY_UV_INFO "GeometryUVInfo" +#define FIELD_KFBXGEOMETRYMESH_TEXTURE_VERTEX_INDEX "TextureVertexIndex" +#define FIELD_KFBXGEOMETRYMESH_TEXTURE_UV_INDEX "TextureUVVerticeIndex" +#define FIELD_KFBXGEOMETRYMESH_VERTEX_COLOR_INFO "VertexColorInfo" +#define FIELD_KFBXGEOMETRYMESH_VERTEX_COLOR_VERSION "Version" +#define FIELD_KFBXGEOMETRYMESH_VERTEX_COLOR_ASSIGNATION "MappingInformationType" +#define FIELD_KFBXGEOMETRYMESH_VERTEX_COLOR_VALUES "Colors" +#define FIELD_KFBXGEOMETRYMESH_VERTEX_COLOR_INDEX "ColorIndex" +#define FIELD_KFBXGEOMETRYMESH_SMOOTHING "Smoothing" +#define FIELD_KFBXGEOMETRYMESH_VERTEX_CREASE "VertexCrease" +#define FIELD_KFBXGEOMETRYMESH_EDGE_CREASE "EdgeCrease" +#define FIELD_KFBXGEOMETRYMESH_HOLE "Hole" +#define FIELD_KFBXGEOMETRYMESH_USER_DATA "UserData" +#define FIELD_KFBXGEOMETRYMESH_USER_DATA_INDEX "UserDataIndex" +#define FIELD_KFBXGEOMETRYMESH_USER_DATA_TYPE "UserDataType" +#define FIELD_KFBXGEOMETRYMESH_USER_DATA_DIRECT_INDICES "UserDataDirectIndices"// remove me +#define FIELD_KFBXGEOMETRYMESH_USER_DATA_DIRECT_COUNT "UserDataDirectCount" //remove me +#define FIELD_KFBXGEOMETRYMESH_USER_DATA_ID "UserDataId" +#define FIELD_KFBXGEOMETRYMESH_USER_DATA_ARRAY "UserDataArray" +#define FIELD_KFBXGEOMETRYMESH_USER_DATA_NAME "UserDataName" +#define FIELD_KFBXGEOMETRYMESH_VISIBILITY "Visibility" +#define FIELD_KFBXGEOMETRYMESH_SMOOTHNESS "Smoothness" +#define FIELD_KFBXGEOMETRYMESH_PREVIEW_DIVSION_LEVELS "PreviewDivisionLevels" +#define FIELD_KFBXGEOMETRYMESH_RENDER_DIVSION_LEVELS "RenderDivisionLevels" +#define FIELD_KFBXGEOMETRYMESH_DISPLAY_SUBDIVISIONS "DisplaySubdivisions" +#define FIELD_KFBXGEOMETRYMESH_PRESERVE_BORDERS "PreserveBorders" +#define FIELD_KFBXGEOMETRYMESH_PRESERVE_HARD_EDGES "PreserveHardEdges" +#define FIELD_KFBXGEOMETRYMESH_PROPAGATE_EDGE_HARDNESS "PropagateEdgeHardness" +#define FIELD_KFBXGEOMETRYMESH_BOUNDARY_RULE "BoundaryRule" + +#define FIELD_KFBXGEOMETRYMESH_U_EXTENDED_COUNT "UExtendedCount" +#define FIELD_KFBXGEOMETRYMESH_U_CLOSED "UClosed" +#define FIELD_KFBXGEOMETRYMESH_U_TOPCAP "UTopCap" +#define FIELD_KFBXGEOMETRYMESH_U_STEP "UStep" +#define FIELD_KFBXGEOMETRYMESH_U_COUNT "UCount" + +#define FIELD_KFBXGEOMETRYMESH_V_EXTENDED_COUNT "VExtendedCount" +#define FIELD_KFBXGEOMETRYMESH_V_CLOSED "VClosed" +#define FIELD_KFBXGEOMETRYMESH_V_TOPCAP "VTopCap" +#define FIELD_KFBXGEOMETRYMESH_V_STEP "VStep" +#define FIELD_KFBXGEOMETRYMESH_V_COUNT "VCount" + +#define TOKEN_KFBXGEOMETRYMESH_NO_MAPPING_INFORMATION "NoMappingInformation" +#define TOKEN_KFBXGEOMETRYMESH_BY_VERTICE "ByVertice" +#define TOKEN_KFBXGEOMETRYMESH_BY_POLYGON "ByPolygon" +#define TOKEN_KFBXGEOMETRYMESH_BY_POLYGON_VERTEX "ByPolygonVertex" +#define TOKEN_KFBXGEOMETRYMESH_BY_FACE "ByFace" +#define TOKEN_KFBXGEOMETRYMESH_BY_EDGE "ByEdge" +#define TOKEN_KFBXGEOMETRYMESH_ALL_SAME "AllSame" +#define TOKEN_KFBXGEOMETRYMESH_BY_MODEL "ByModel" + +// +// FbxSubDiv +// +#define FIELD_KFBXGEOMETRYSUBDIV_GEOMETRY "SubdivGeometry" +#define FIELD_KFBXGEOMETRYSUBDIV_GEOMETRY_VERSION "GeometryVersion" +#define FIELD_KFBXGEOMETRYSUBDIV_LEVEL_COUNT "LevelCount" +#define FIELD_KFBXGEOMETRYSUBDIV_CURRENT_LEVEL "CurrentLevel" +#define FIELD_KFBXGEOMETRYSUBDIV_DISPLAY_SMOOTHNESS "Smoothness" + +// +// Reference +// +#define TOKEN_REFERENCE_DIRECT "Direct" +#define TOKEN_REFERENCE_INDEX "Index" +#define TOKEN_REFERENCE_INDEX_TO_DIRECT "IndexToDirect" + +// +// FbxNurbs +// +#define FIELD_KFBXGEOMETRYNURB_NURB_VERSION "NurbVersion" +#define FIELD_KFBXGEOMETRYNURB_NURB_ORDER "NurbOrder" +#define FIELD_KFBXGEOMETRYNURB_DIMENSION "Dimensions" +#define FIELD_KFBXGEOMETRYNURB_STEP "Step" +#define FIELD_KFBXGEOMETRYNURB_FORM "Form" +#define FIELD_KFBXGEOMETRYNURB_UCAPPED "UCapped" +#define FIELD_KFBXGEOMETRYNURB_VCAPPED "VCapped" +#define FIELD_KFBXGEOMETRYNURB_POINTS "Points" +#define FIELD_KFBXGEOMETRYNURB_MULTIPLICITY_U "MultiplicityU" +#define FIELD_KFBXGEOMETRYNURB_MULTIPLICITY_V "MultiplicityV" +#define FIELD_KFBXGEOMETRYNURB_KNOTVECTOR_U "KnotVectorU" +#define FIELD_KFBXGEOMETRYNURB_KNOTVECTOR_V "KnotVectorV" +#define FIELD_KFBXGEOMETRYNURB_MATERIALS "Materials" +#define FIELD_KFBXGEOMETRYNURB_SURFACE_DISPLAY "SurfaceDisplay" + +// +// FbxNurbsSurface +// +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_NURB_VERSION "NurbsSurfaceVersion" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_NURB_ORDER "NurbsSurfaceOrder" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_DIMENSION "Dimensions" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_STEP "Step" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_FORM "Form" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_UCAPPED "UCapped" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_VCAPPED "VCapped" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_POINTS "Points" +//#define FIELD_KFBXGEOMETRYNURBS_SURFACE_MULTIPLICITY_U "MultiplicityU" +//#define FIELD_KFBXGEOMETRYNURBS_SURFACE_MULTIPLICITY_V "MultiplicityV" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_KNOTVECTOR_U "KnotVectorU" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_KNOTVECTOR_V "KnotVectorV" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_MATERIALS "Materials" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_SURFACE_DISPLAY "SurfaceDisplay" +#define FIELD_KFBXGEOMETRYNURBS_SURFACE_FLIP_NORMALS "FlipNormals" + +// +// FbxTrimNurbsSurface +// +#define FIELD_KFBXGEOMETRYTRIM_NURBS_SURFACE_VERSION "TrimmedNurbVersion" +#define FIELD_KFBXGEOMETRYTRIM_NURBS_SURFACE_FLIP_NORMALS "FlipNormals" +//#define FIELD_KFBXGEOMETRYTRIM_NURB_SURFACE "NurbSurface" +//#define FIELD_KFBXGEOMETRYTRIM_NURB_BOUNDARY "TrimBoundary" +//#define FIELD_KFBXGEOMETRYTRIM_NURB_EDGE "BoundaryEdge" + +// +// FbxBoundary +// +#define FIELD_KFBXGEOMETRYBOUNDARY_VERSION "BoundaryVersion" + +// +// FbxLine +// +#define FIELD_KFBXGEOMETRYLINE_VERSION "LineVersion" +#define FIELD_KFBXGEOMETRYLINE_POINTS "Points" +#define FIELD_KFBXGEOMETRYLINE_POINTS_INDEX "PointsIndex" + +// +// FbxSubDiv +// +#define FIELD_KFBXGEOMETRYSUBDIVISION_VERSION "SubdivisionVersion" + +// +// FbxNurbsCurve +// +#define FIELD_KFBXGEOMETRYNURBS_CURVE_VERSION "NurbsCurveVersion" +#define FIELD_KFBXGEOMETRYNURBS_CURVE_ORDER "Order" +#define FIELD_KFBXGEOMETRYNURBS_CURVE_DIMENSION "Dimension" +#define FIELD_KFBXGEOMETRYNURBS_CURVE_KNOTVECTOR "KnotVector" +#define FIELD_KFBXGEOMETRYNURBS_CURVE_FORM "Form" +#define FIELD_KFBXGEOMETRYNURBS_CURVE_POINTS "Points" +#define FIELD_KFBXGEOMETRYNURBS_CURVE_RATIONAL "Rational" + +// +// FbxPatch +// +#define FIELD_KFBXGEOMETRYPATCH_PATCH_VERSION "PatchVersion" +#define FIELD_KFBXGEOMETRYPATCH_PATCH_TYPE "PatchType" +#define FIELD_KFBXGEOMETRYPATCH_DIMENSIONS "Dimensions" +#define FIELD_KFBXGEOMETRYPATCH_STEP "Step" +#define FIELD_KFBXGEOMETRYPATCH_CLOSED "Closed" +#define FIELD_KFBXGEOMETRYPATCH_UCAPPED "UCapped" +#define FIELD_KFBXGEOMETRYPATCH_VCAPPED "VCapped" +#define FIELD_KFBXGEOMETRYPATCH_POINTS "Points" +#define FIELD_KFBXGEOMETRYPATCH_SURFACE_DISPLAY "SurfaceDisplay" +#define FIELD_KFBXGEOMETRYPATCH_MATERIALS "Materials" + + +// +// FbxGeometryWeightedMap +// + +#define FIELD_KFBXGEOMETRY_WEIGHTED_MAP_VERSION "Version" +#define FIELD_KFBXGEOMETRY_WEIGHTED_MAP_SRC_COUNT "SourceCount" +#define FIELD_KFBXGEOMETRY_WEIGHTED_MAP_DST_COUNT "DestinationCount" +#define FIELD_KFBXGEOMETRY_WEIGHTED_MAP_INDEX_MAPPING "IndexMapping" + +// +// FbxSkeleton +// +#define FIELD_KFBXGEOMETRYSKELETON_LIMB_LENGTH "LimbLength" +#define FIELD_KFBXGEOMETRYSKELETON_LIMB_NODE_SIZE "Size" +#define FIELD_KFBXGEOMETRYSKELETON_LIMB_NODE_COLOR "Color" + +// +// FbxVideo +// +#define FIELD_KFBXVIDEO_USEMIPMAP "UseMipMap" + +// +// FbxTexture +// +#define FIELD_KFBXTEXTURE_TEXTURE "Texture" +#define FIELD_KFBXTEXTURE_TYPE "Type" +#define FIELD_KFBXTEXTURE_VERSION "Version" +#define FIELD_KFBXTEXTURE_TEXTURE_NAME "TextureName" +#define FIELD_KFBXTEXTURE_MEDIA "Media" +#define FIELD_KFBXTEXTURE_FILENAME "FileName" +#define FIELD_KFBXTEXTURE_RELATIVE_FILENAME "RelativeFilename" +#define FIELD_KFBXTEXTURE_TRANSLATION "Translation" +#define FIELD_KFBXTEXTURE_SCALING "Scaling" +#define FIELD_KFBXTEXTURE_UV_TRANSLATION "ModelUVTranslation" +#define FIELD_KFBXTEXTURE_UV_SCALING "ModelUVScaling" +#define FIELD_KFBXTEXTURE_ROTATION "Rotation" +#define FIELD_KFBXTEXTURE_TILING "Tilling" +#define FIELD_KFBXTEXTURE_ALPHA_SRC "Texture_Alpha_Source" +#define FIELD_KFBXTEXTURE_CROPPING "Cropping" +#define FIELD_KFBXTEXTURE_MAPPING_TYPE "Texture_Mapping_Type" +#define FIELD_KFBXTEXTURE_PLANAR_NORMAL "Texture_Planar_Mapping_Normal" +#define FIELD_KFBXTEXTURE_SWAPUV "SwapUV" +#define FIELD_KFBXTEXTURE_MATERIAL_USE "MaterialMode" +#define FIELD_KFBXTEXTURE_TEXTURE_USE "TextureUse" +#define TOKEN_KFBXTEXTURE_TEXTURE_USE_STANDARD "Standard" +#define TOKEN_KFBXTEXTURE_TEXTURE_USE_SHADOW_MAP "ShadowMap" +#define TOKEN_KFBXTEXTURE_TEXTURE_USE_LIGHT_MAP "LightMap" +#define TOKEN_KFBXTEXTURE_TEXTURE_USE_SPHERICAL_REFLEXION_MAP "SphericalReflexionMap" +#define TOKEN_KFBXTEXTURE_TEXTURE_USE_SPHERE_REFLEXION_MAP "SphereReflexionMap" +#define TOKEN_KFBXTEXTURE_TEXTURE_USE_BUMP_NORMAL_MAP "BumpNormalMap" +#define TOKEN_KFBXTEXTURE_BLEND_TRANSLUCENT "Translucent" +#define TOKEN_KFBXTEXTURE_BLEND_ADD "Add" +#define TOKEN_KFBXTEXTURE_BLEND_MODULATE "Modulate" +#define TOKEN_KFBXTEXTURE_BLEND_MODULATE2 "Modulate2" +#define TOKEN_KFBXTEXTURE_BLEND_OVER "Over" +#define TOKEN_KFBXTEXTURE_BLEND_NORMAL "Normal" +#define TOKEN_KFBXTEXTURE_BLEND_DISSOLVE "Dissolve" +#define TOKEN_KFBXTEXTURE_BLEND_DARKEN "Darken" +#define TOKEN_KFBXTEXTURE_BLEND_COLORBURN "Colorburn" +#define TOKEN_KFBXTEXTURE_BLEND_LINEARBURN "Linearburn" +#define TOKEN_KFBXTEXTURE_BLEND_DARKERCOLOR "Darkercolor" +#define TOKEN_KFBXTEXTURE_BLEND_LIGHTEN "Lighten" +#define TOKEN_KFBXTEXTURE_BLEND_SCREEN "Screen " +#define TOKEN_KFBXTEXTURE_BLEND_COLORDODGE "Colordodge" +#define TOKEN_KFBXTEXTURE_BLEND_LINEARDODGE "Lineardodge" +#define TOKEN_KFBXTEXTURE_BLEND_LIGHTERCOLOR "Lightercolor" +#define TOKEN_KFBXTEXTURE_BLEND_SOFTLIGHT "Softlight" +#define TOKEN_KFBXTEXTURE_BLEND_HARDLIGHT "Hardlight " +#define TOKEN_KFBXTEXTURE_BLEND_VIVIDLIGHT "Vividlight" +#define TOKEN_KFBXTEXTURE_BLEND_LINEARLIGHT "Linearlight" +#define TOKEN_KFBXTEXTURE_BLEND_PINLIGHT "Pinlight" +#define TOKEN_KFBXTEXTURE_BLEND_HARDMIX "Hardmix" +#define TOKEN_KFBXTEXTURE_BLEND_DIFFERENCE "Difference" +#define TOKEN_KFBXTEXTURE_BLEND_EXCLUSION "Exclusion" +#define TOKEN_KFBXTEXTURE_BLEND_SUBTRACT "Subtract" +#define TOKEN_KFBXTEXTURE_BLEND_DIVIDE "Divide" +#define TOKEN_KFBXTEXTURE_BLEND_HUE "Hue" +#define TOKEN_KFBXTEXTURE_BLEND_SATURATION "Saturation" +#define TOKEN_KFBXTEXTURE_BLEND_COLOR "Color" +#define TOKEN_KFBXTEXTURE_BLEND_LUMINOSITY "Luminosity" +#define TOKEN_KFBXTEXTURE_BLEND_OVERLAY "Overlay" +#define TOKEN_KFBXTEXTURE_BLEND_MAXBLEND "MaxBlend" +#define FIELD_KFBXTEXTURE_WRAP_U "WrapU" +#define FIELD_KFBXTEXTURE_WRAP_V "WrapV" +#define FIELD_KFBXTEXTURE_BLEND_MODE "BlendMode" +#define FIELD_KFBXTEXTURE_ALPHA "TextureAlpha" + +// +// FbxSurfaceMaterial +// +#define FIELD_KFBXMATERIAL_MATERIAL "Material" +#define FIELD_KFBXMATERIAL_VERSION "Version" +#define FIELD_KFBXMATERIAL_SHADING_MODEL "ShadingModel" +#define FIELD_KFBXMATERIAL_AMBIENT "Ambient" +#define FIELD_KFBXMATERIAL_DIFFUSE "Diffuse" +#define FIELD_KFBXMATERIAL_SPECULAR "Specular" +#define FIELD_KFBXMATERIAL_EMISSIVE "Emissive" +#define FIELD_KFBXMATERIAL_SHININESS "Shininess" +#define FIELD_KFBXMATERIAL_REFLECTIVITY "Reflectivity" +#define FIELD_KFBXMATERIAL_ALPHA "Alpha" +#define FIELD_KFBXMATERIAL_MULTI_LAYER "MultiLayer" + +// +// FbxCluster +// +#define FIELD_KFBXLINK_LINK "Link" +#define FIELD_KFBXLINK_MODE "Mode" +#define FIELD_KFBXLINK_USERDATA "UserData" +#define FIELD_KFBXLINK_INDEXES "Indexes" +#define FIELD_KFBXLINK_WEIGHTS "Weights" +#define FIELD_KFBXLINK_TRANSFORM "Transform" +#define FIELD_KFBXLINK_TRANSFORM_LINK "TransformLink" +#define FIELD_KFBXLINK_ASSOCIATE_MODEL "AssociateModel" +#define FIELD_KFBXLINK_TRANSFORM_PARENT "TransformParent" +#define TOKEN_KFBXLINK_AVERAGE "Average" +#define TOKEN_KFBXLINK_ADDITIVE "Additive" +#define TOKEN_KFBXLINK_TOTAL1 "Total1" + +// +// FbxDeformer +// +#define FIELD_KFBXDEFORMER_DEFORMER "Deformer" +#define FIELD_KFBXDEFORMER_VERSION "Version" +#define FIELD_KFBXDEFORMER_TYPE "Type" +#define FIELD_KFBXDEFORMER_MULTI_LAYER "MultiLayer" +#define FIELD_KFBXDEFORMER_MODE "Mode" +#define FIELD_KFBXDEFORMER_USERDATA "UserData" +#define FIELD_KFBXDEFORMER_INDEXES "Indexes" +#define FIELD_KFBXDEFORMER_WEIGHTS "Weights" +#define FIELD_KFBXDEFORMER_TRANSFORM "Transform" +#define FIELD_KFBXDEFORMER_TRANSFORM_LINK "TransformLink" +#define FIELD_KFBXDEFORMER_ASSOCIATE_MODEL "AssociateModel" +#define FIELD_KFBXDEFORMER_TRANSFORM_PARENT "TransformParent" +#define TOKEN_KFBXDEFORMER_AVERAGE "Average" +#define TOKEN_KFBXDEFORMER_ADDITIVE "Additive" +#define TOKEN_KFBXDEFORMER_TOTAL1 "Total1" + +// +// FbxSkin +// +#define FIELD_KFBXSKIN_VERSION "Version" +#define FIELD_KFBXSKIN_DEFORM_ACCURACY "Link_DeformAcuracy" +#define FIELD_KFBXSKIN_SKINNINGTYPE "SkinningType" +#define TOKEN_KFBXSKIN_LINEAR "Linear" +#define TOKEN_KFBXSKIN_DUALQUATERNION "DualQuaternion" +#define TOKEN_KFBXSKIN_BLEND "Blend" +#define FIELD_KFBXSKIN_INDEXES "Indexes" +#define FIELD_KFBXSKIN_BLENDWEIGHTS "BlendWeights" + +// +// FbxCluster +// +#define FIELD_KFBXCLUSTER_VERSION "Version" +#define FIELD_KFBXCLUSTER_MODE "Mode" +#define FIELD_KFBXCLUSTER_USERDATA "UserData" +#define FIELD_KFBXCLUSTER_INDEXES "Indexes" +#define FIELD_KFBXCLUSTER_WEIGHTS "Weights" +#define FIELD_KFBXCLUSTER_TRANSFORM "Transform" +#define FIELD_KFBXCLUSTER_TRANSFORM_LINK "TransformLink" +#define FIELD_KFBXCLUSTER_ASSOCIATE_MODEL "AssociateModel" +#define FIELD_KFBXCLUSTER_TRANSFORM_PARENT "TransformParent" +#define TOKEN_KFBXCLUSTER_AVERAGE "Average" +#define TOKEN_KFBXCLUSTER_ADDITIVE "Additive" +#define TOKEN_KFBXCLUSTER_TOTAL1 "Total1" + +// +// FbxBlendShape +// +#define FIELD_KFBXBLENDSHAPE_VERSION "Version" + +// +// FbxBlendShapeChannel +// +#define FIELD_KFBXBLENDSHAPECHANNEL_VERSION "Version" +#define FIELD_KFBXBLENDSHAPECHANNEL_DEFORMPERCENT "DeformPercent" +#define FIELD_KFBXBLENDSHAPECHANNEL_FULLWEIGHTS "FullWeights" + +// +// FbxShape +// +#define FIELD_KFBXSHAPE_SHAPE "Shape" +#define FIELD_KFBXSHAPE_VERSION "Version" +#define FIELD_KFBXSHAPE_INDEXES "Indexes" +#define FIELD_KFBXSHAPE_VERTICES "Vertices" +#define FIELD_KFBXSHAPE_NORMALS "Normals" + +// +// FbxVertexCacheDeformer +// +#define FILED_KFBXVERTEXCACHEDEFORMER_VERSION "Version" +#define FILED_KFBXVERTEXCACHEDEFORMER_CACHE_CHANNEL "CacheChannel" + +// +// FbxCache +// +#define FIELD_KFBXCACHE_VERTEX_CACHE "Cache" +#define FIELD_KFBXCACHE_VERSION "Version" +#define FIELD_KFBXCACHE_CACHE_PATH "CachePath" + +// +// FbxBindingTable +// +#define FIELD_KFBXBINDINGTABLE_BINDING_TABLE "BindingTable" +#define FIELD_KFBXBINDINGTABLE_VERSION "Version" +#define FIELD_KFBXBINDINGTABLE_TARGET "Target" +#define FIELD_KFBXBINDINGTABLE_ENTRY "Entry" + +// +// FbxImplementation +// +#define FIELD_KFBXIMPLEMENTATION_IMPLEMENTATION "Implementation" +#define FIELD_KFBXIMPLEMENTATION_VERSION "Version" + +// +// FbxBindingOperator +// +#define FIELD_KFBXBINDINGOPERATOR_BINDING_OPERATOR "BindingOperator" +#define FIELD_KFBXBINDINGOPERATOR_VERSION "Version" +#define FIELD_KFBXBINDINGOPERATOR_ENTRY "Entry" + +// +// FbxCollection +// +#define FIELD_KFBXCOLLECTION_COLLECTION "Collection" +#define FIELD_KFBXCOLLECTION_VERSION "Version" + +// +// FbxCollectionExclusive +// +#define FIELD_KFBXCOLLECTIONEXCLUSIVE_COLLECTIONEXCLUSIVE "CollectionExclusive" +#define FIELD_KFBXCOLLECTIONEXCLUSIVE_VERSION "Version" + +// +// FbxSelectionSet +// +#define FIELD_KFBXSELECTIONSET_VERTICE_INDEXARRAY "VertexIndexArray" +#define FIELD_KFBXSELECTIONSET_EDGE_INDEXARRAY "EdgeIndexArray" +#define FIELD_KFBXSELECTIONSET_POLYGONVERTICES_INDEXARRAY "PolygonIndexArray" + +// +// FbxDisplayLayer +// +#define FIELD_KFBXDISPLAYLAYER_DISPLAYLAYER "DisplayLayer" +#define FIELD_KFBXDISPLAYLAYER_VERSION "Version" + +// +// FbxDocument +// +#define FIELD_KFBXDOCUMENT_DOCUMENT "Document" +#define FIELD_KFBXDOCUMENT_VERSION "Version" + +// +// FbxLayeredTexture +// +#define FIELD_KFBXLAYEREDTEXTURE_LAYERED_TEXTURE "LayeredTexture" +#define FIELD_KFBXLAYEREDTEXTURE_VERSION "Version" +#define FIELD_KFBXLAYEREDTEXTURE_BLENDMODES "BlendModes" +#define FIELD_KFBXLAYEREDTEXTURE_ALPHAS "Alphas" + +// +// FbxGobo +// +#define FIELD_KFBXGOBO_GOBOMANAGER "GoboManager" +#define FIELD_KFBXGOBO_GOBO "Gobo" +#define FIELD_KFBXGOBO_LIGHTGOBO "LightGobo" +#define FIELD_KFBXGOBO_VERSION "Version" +#define FIELD_KFBXGOBO_GOBONAME "GoboName" +#define FIELD_KFBXGOBO_GOBOPATH "GoboPath" +#define FIELD_KFBXGOBO_DRAWCOMPONENT "DrawComponent" + + +// +// Password +// +#define FIELD_PASSWORD "NodeId" +#define FIELD_OLD_PASSWORD "Param2a" +#define FIELD_XOR_STRING "?|/?*" + + +// Meanfull names for MB 6.0 +#define FIELD_KFBXLAYER_ELEMENT_UV "LayerElementUV" +#define FIELD_KFBXLAYER_ELEMENT_SMOOTHING "LayerElementSmoothing" +#define FIELD_KFBXLAYER_ELEMENT_VERTEX_CREASE "LayerElementVertexCrease" +#define FIELD_KFBXLAYER_ELEMENT_EDGE_CREASE "LayerElementEdgeCrease" +#define FIELD_KFBXLAYER_ELEMENT_HOLE "LayerElementHole" +#define FIELD_KFBXLAYER_ELEMENT_USER_DATA "LayerElementUserData" +#define FIELD_KFBXLAYER_ELEMENT_VISIBILITY "LayerElementVisibility" +#define FIELD_KFBXLAYER_ELEMENT_NORMAL "LayerElementNormal" +#define FIELD_KFBXLAYER_ELEMENT_BINORMAL "LayerElementBinormal" +#define FIELD_KFBXLAYER_ELEMENT_TANGENT "LayerElementTangent" +#define FIELD_KFBXLAYER_ELEMENT_MATERIAL "LayerElementMaterial" +#define FIELD_KFBXLAYER_ELEMENT_TEXTURE "LayerElementTexture" +#define FIELD_KFBXLAYER_ELEMENT_COLOR "LayerElementColor" +#define FIELD_KFBXLAYER_ELEMENT_POLYGON_GROUP "LayerElementPolygonGroup" +#define FIELD_KFBXLAYER_ELEMENT_VERSION "Version" +#define FIELD_KFBXLAYER_ELEMENT_NAME "Name" +#define FIELD_KFBXLAYER_ELEMENT_TYPED_INDEX "TypedIndex" +#define FIELD_KFBXLAYER_ELEMENT_MAPPING_INFO_TYPE "MappingInformationType" +#define FIELD_KFBXLAYER_ELEMENT_REFERENCE_INFO_TYPE "ReferenceInformationType" +#define FIELD_KFBXLAYER "Layer" +#define FIELD_KFBXLAYER_VERSION "Version" +#define FIELD_KFBXLAYER_ELEMENT "LayerElement" +#define FIELD_KFBXLAYER_ELEMENT_TYPE "Type" + +// +// FbxLayer +// +#define FIELD_KFBXLAYER_GEOMETRY_LAYER "GeometryLayer" +#define FIELD_KFBXLAYER_LAYER_TEXTURE_INFO "LayerTextureInfo" +#define FIELD_KFBXLAYER_TEXTURE_MODE "TextureMode" +#define FIELD_KFBXLAYER_TEXTURE_BLEND_MODE "TextureBlendMode" +#define FIELD_KFBXLAYER_TEXTURE_ID_COUNT "TextureIdCount" +#define FIELD_KFBXLAYER_TEXTURE_ID "TextureId" +#define FIELD_KFBXLAYER_UV_MODE "UVMode" +#define FIELD_KFBXLAYER_UV_COUNT "UVCount" +#define FIELD_KFBXLAYER_UV "UV" +#define FIELD_KFBXLAYER_UV_INDEX "UVIndex" +#define FIELD_KFBXLAYER_UV_ID_COUNT "UVIdCount" +#define FIELD_KFBXLAYER_UV_ID "UVId" + +// +// FbxPose +// +#define FIELD_KFBXPOSE_VERSION "Version" +#define FIELD_KFBXPOSE_TYPE "Type" +#define FIELD_KFBXPOSE_POSE "Pose" +#define FIELD_KFBXPOSE_BIND_POSE "BindPose" +#define FIELD_KFBXPOSE_REST_POSE "RestPose" + + +// +// KSceneInfo +// +#define FIELD_SCENEINFO "SceneInfo" +#define FIELD_SCENEINFO_TYPE "Type" +#define FIELD_SCENEINFO_VERSION "Version" +#define FIELD_SCENEINFO_METADATA "MetaData" +#define FIELD_SCENEINFO_METADATA_VERSION "Version" +#define FIELD_SCENEINFO_METADATA_TITLE "Title" +#define FIELD_SCENEINFO_METADATA_SUBJECT "Subject" +#define FIELD_SCENEINFO_METADATA_AUTHOR "Author" +#define FIELD_SCENEINFO_METADATA_KEYWORDS "Keywords" +#define FIELD_SCENEINFO_METADATA_REVISION "Revision" +#define FIELD_SCENEINFO_METADATA_COMMENT "Comment" + +// +// Global setting: +// +#define FIELD_GLOBAL_SETTINGS "GlobalSettings" +#define FIELD_GLOBAL_SETTINGS_VERSION "Version" + +// +// FbxSceneReference: +// +#define FIELD_KFBXREFERENCE_REFERENCE "SceneReference" +#define FIELD_KFBXREFERENCE_VERSION "Version" + +// +// Constraints +// +#define FIELD_CONSTRAINT "Constraint" +#define FIELD_CONSTRAINT_VERSION "Version" +#define FIELD_CONSTRAINT_OFFSET "Offset" +#define TOKEN_KFBXCONSTRAINT_CONSTRAINT "Constraint" +#define TOKEN_KFBXCONSTRAINT_POSITION "Position From Positions" +#define TOKEN_KFBXCONSTRAINT_ROTATION "Rotation From Rotations" +#define TOKEN_KFBXCONSTRAINT_SCALE "Scale From Scales" +#define TOKEN_KFBXCONSTRAINT_PARENT "Parent-Child" +#define TOKEN_KFBXCONSTRAINT_SINGLECHAINIK "Single Chain IK" +#define TOKEN_KFBXCONSTRAINT_AIM "Aim" +#define TOKEN_KFBXCONSTRAINT_CHARACTER "Character" +#define TOKEN_KFBXCONSTRAINT_CUSTOM "Custom" + +// +// Controlset plug +// + + +// +// Object definition +// +#define FIELD_OBJECT_DESCRIPTION "Document" +#define FIELD_OBJECT_DESCRIPTION_NAME "Name" +#define FIELD_OBJECT_REFERENCES "References" +#define FIELD_OBJECT_REFERENCES_FILE_PATH_URL "FilePathUrl" +#define FIELD_OBJECT_REFERENCES_REFERENCE "Reference" +#define FIELD_OBJECT_DEFINITION "Definitions" +#define FIELD_OBJECT_PROPERTY_TEMPLATE "PropertyTemplate" +#define FIELD_OBJECT_DEFINITION_VERSION "Version" +#define FIELD_OBJECT_DEFINITION_COUNT "Count" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE "ObjectType" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_AUDIO "Audio" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_AUDIO_LAYER "AudioLayer" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_REFERENCE "SceneReference" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_CONTAINER "Container" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_MODEL "Model" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_GEOMETRY "Geometry" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_NODE_ATTRIBUTE "NodeAttribute" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_GEOMETRY_WEIGHTED_MAP "GeometryWeightedMap" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_MARKETSET "MarkerSet" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_MATERIAL "Material" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_COLLECTION "Collection" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_COLLECTION_EXCLUSIVE "CollectionExclusive" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_DISPLAY_LAYER "DisplayLayer" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_TEXTURE "Texture" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_THUMBNAIL "Thumbnail" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_VIDEO "Video" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_DEFORMER "Deformer" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_SUBDEFORMER "SubDeformer" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_SHAPE "Shape" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_BLENDSHAPE "BlendShape" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_BLENDSHAPECHANNEL "BlendShapeChannel" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_CONSTRAINT "Constraint" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_CONTROLSET_PLUG "ControlSetPlug" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_POSE "Pose" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_GENERIC_NODE "GenericNode" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_BOUNDARY "Boundary" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_CACHE "Cache" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_IMPLEMENTATION "Implementation" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_BINDINGTABLE "BindingTable" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_BINDINGOPERATOR "BindingOperator" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_LAYERED_TEXTURE "LayeredTexture" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_PROCEDURAL_TEXTURE "ProceduralTexture" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_SCENEINFO FIELD_SCENEINFO +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_SCENE "Scene" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_LIBRARY "Library" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_DOCUMENT "Document" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_FOLDER "Folder" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_CLIP "Clip" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_TIMELINE "TimelineX" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_TIMELINE_TRACK "TimelineXTrack" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_ENVIRONMENT "KFbxEnvironment" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_OBJECTMETADATA "ObjectMetaData" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_PLUGIN_PARAMS "PluginParameters" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_ANIM_STACK "AnimationStack" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_ANIM_LAYER "AnimationLayer" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_ANIM_CURVENODE "AnimationCurveNode" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_ANIM_CURVE "AnimationCurve" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_ANIM_EVALUATOR "AnimationEvaluator" + +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_SELECTIONNODE "SelectionNode" + +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_MESH "Mesh" +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_SUBDIV "Subdiv" +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_PATCH "Patch" +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_NURB "Nurb" +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_NURBS_SURFACE "NurbsSurface" +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_NURBS_CURVE "NurbsCurve" +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_TRIM_NURB_SURFACE "TrimNurbsSurface" +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_BOUNDARY "Boundary" +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_LINE "Line" +#define FIELD_OBJECT_TYPE_GEOMETRY_SUBTYPE_SHAPE "Shape" +#define FIELD_OBJECT_DEFINITION_OBJECT_TYPE_GLOBAL_SETTINGS FIELD_GLOBAL_SETTINGS + +// +// Object properties +// +#define FIELD_OBJECT_PROPERTIES "Objects" + + +// +// Object relations +// +#define FIELD_OBJECT_RELATIONS "Relations" +#define FIELD_OBJECT_RELATIONS_TYPE_MODEL "Model" +#define FIELD_OBJECT_RELATIONS_TYPE_MATERIAL "Material" +#define FIELD_OBJECT_RELATIONS_TYPE_TEXTURE "Texture" +#define FIELD_OBJECT_RELATIONS_TYPE_AUDIO "Audio" +#define FIELD_OBJECT_RELATIONS_TYPE_VIDEO "Video" +#define FIELD_OBJECT_RELATIONS_TYPE_CONSTRAINT "Constraint" +#define FIELD_OBJECT_RELATIONS_TYPE_DEFORMER "Deformer" +#define FIELD_OBJECT_RELATIONS_TYPE_POSE "Pose" +#define FIELD_OBJECT_RELATIONS_TYPE_SCENEINFO FIELD_SCENEINFO +#define FIELD_OBJECT_RELATIONS_TYPE_CACHE "Cache" + +// +// Object connections +// +#define FIELD_OBJECT_CONNECTIONS "Connections" + + +// +// Takes +// +#define FIELD_TAKES "Takes" + +// Embedded files +#define FIELD_EMBEDDED_FILES "Embedding" +#define FIELD_EMBEDDED_FILE "File" +// Original filename, relative to the fbx +// It may point to a file not below the fbx. +#define FIELD_EMBEDDED_ORIGINAL_FILENAME "Original" +// Embedded filename, unique to the fbx, always relative to the fbx file; +// if two original filenames, in separate folders, are embedded in an fbx file, +// one of them will be renamed by using a folder. +#define FIELD_EMBEDDED_FILENAME "Filename" + +// Link back to the objects which use this file. +#define FIELD_EMBEDDED_CONSUMERS "Consumers" +#define FIELD_EMBEDDED_CONSUMER "Consumer" + +// +// Node Attribute +// +#define FIELD_NODE_ATTRIBUTE_NAME "NodeAttributeName" +#define FIELD_NODE_ATTRIBUTE_REFTO "NodeAttributeRefTo" + +// +// Old sections +// +#define FIELD_OLD_SECTION_VERSION5 "Version5" +#define FIELD_OLD_SECTION_HIERARCHYVIEW "HierarchyView" + +#define OBJECT_OLD_SECTION_VERSION5 "OldSection_VersionFive" +#define OBJECT_OLD_SECTION_HIERARCHYVIEW "OldSection_HierarchyView" + +#include + +#endif /* _FBXSDK_FILEIO_FILE_TOKENS_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxglobalcamerasettings.h b/libs/fbx/include/fbxsdk/fileio/fbxglobalcamerasettings.h new file mode 100644 index 00000000..453f2583 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxglobalcamerasettings.h @@ -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 + +#include + +#include + +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, // + +#endif /* _FBXSDK_FILEIO_GLOBAL_CAMERA_SETTINGS_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxgloballightsettings.h b/libs/fbx/include/fbxsdk/fileio/fbxgloballightsettings.h new file mode 100644 index 00000000..d33b14ea --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxgloballightsettings.h @@ -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 + +#include + +#include + +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 + +#endif /* _FBXSDK_FILEIO_GLOBAL_LIGHT_SETTINGS_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxglobalsettings.h b/libs/fbx/include/fbxsdk/fileio/fbxglobalsettings.h new file mode 100644 index 00000000..a70af283 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxglobalsettings.h @@ -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 + +#include +#include +#include + +#include + +/** \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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + FbxPropertyT UpAxis; + FbxPropertyT UpAxisSign; + + FbxPropertyT FrontAxis; + FbxPropertyT FrontAxisSign; + + FbxPropertyT CoordAxis; + FbxPropertyT CoordAxisSign; + + FbxPropertyT OriginalUpAxis; + FbxPropertyT OriginalUpAxisSign; + + FbxPropertyT UnitScaleFactor; + FbxPropertyT OriginalUnitScaleFactor; + + FbxPropertyT AmbientColor; + FbxPropertyT DefaultCamera; + FbxPropertyT TimeMode; + FbxPropertyT TimeProtocol; + FbxPropertyT SnapOnFrameMode; + FbxPropertyT TimeSpanStart; + FbxPropertyT TimeSpanStop; + FbxPropertyT CustomFrameRate; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + +private: + void AxisSystemToProperties(); + void PropertiesToAxisSystem(); + + void Init(); + + FbxAxisSystem mAxisSystem; + int mNbTimeMarkers; + + friend class FbxWriterFbx6; + + FbxProperty mTimeMarkers; + FbxPropertyT 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 + +#endif /* _FBXSDK_FILEIO_GLOBAL_SETTINGS_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxgobo.h b/libs/fbx/include/fbxsdk/fileio/fbxgobo.h new file mode 100644 index 00000000..1cad49ab --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxgobo.h @@ -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 + +#include + +#include + +/** + * \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 + +#endif /* _FBXSDK_FILEIO_GOBO_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbximporter.h b/libs/fbx/include/fbxsdk/fileio/fbximporter.h new file mode 100644 index 00000000..097e43f8 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbximporter.h @@ -0,0 +1,392 @@ +/**************************************************************************************** + + 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 + +#include +#include +#include +#include +#include +#include +#include + +#include + +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 + */ + virtual bool Initialize(const char* pFileName, int pFileFormat=-1, FbxIOSettings * pIOSettings=NULL); + + /** 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: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + 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 + 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 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 +{ + 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 +{ + FBXSDK_EVENT_DECLARE(FbxEventPostImport); +public: + inline FbxEventPostImport( FbxDocument* pDocument ) : mDocument(pDocument) {}; + + //! The imported document + FbxDocument* mDocument; +}; + +#include + +#endif /* _FBXSDK_FILEIO_IMPORTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxiobase.h b/libs/fbx/include/fbxsdk/fileio/fbxiobase.h new file mode 100644 index 00000000..fa99fad5 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxiobase.h @@ -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 + +#include +#include + +#include + +#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: + virtual void Construct(const FbxObject* pFrom); + + int DetectReaderFileFormat(const char *pFileName); + int DetectWriterFileFormat(const char *pFileName); + + FbxStatus mStatus; + FbxString mFilename; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_FILEIO_IO_BASE_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxiopluginregistry.h b/libs/fbx/include/fbxsdk/fileio/fbxiopluginregistry.h new file mode 100644 index 00000000..1c274049 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxiopluginregistry.h @@ -0,0 +1,305 @@ +/**************************************************************************************** + + 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 fbxiopluginregistry.h +#ifndef _FBXSDK_FILEIO_IO_PLUGIN_REGISTRY_H_ +#define _FBXSDK_FILEIO_IO_PLUGIN_REGISTRY_H_ + +#include + +#include +#include + +#include + +/** \brief This class serves as the registrar for file formats. + * A file format must be registered when it is used by the FBX SDK. + * + * This class also lets you create and read formats other than FBX SDK native formats. + * Users of FBX SDK can write their own plug-ins to read or write arbitrary file formats. + * Once their plug-ins are registered in this class, FBX SDK is able to read or write + * these file formats. + * + * Each FbxManager has a unique FbxIOPluginRegistry. To get an instance of this class: + * \code + * FbxIOPluginRegistry* registry = manager->GetIOPluginRegistry(); + * \endcode + * \see FbxManager::GetIOPluginRegistry() + */ +class FBXSDK_DLL FbxIOPluginRegistry +{ +public: + + /** Constructor. + */ + FbxIOPluginRegistry(); + + /** Destructor. + */ + virtual ~FbxIOPluginRegistry(); + +#ifndef FBXSDK_ENV_WINSTORE + /** Registers a Reader from a plug-in path. + * \param pPluginPath The plug-in path. + * \param pFirstPluginID Contains the ID of the first plug-in found. + * \param pRegisteredCount Contains the number of registered Readers. + * \param pOverride Override any existing writer that is using the same extension. + */ + void RegisterReader(const char* pPluginPath, + int& pFirstPluginID, + int& pRegisteredCount, + bool pOverride = false); +#endif /* !FBXSDK_ENV_WINSTORE */ + + /** Registers a Reader. + * \param pCreateF The function that creates the Reader to be registered. + * \param pInfoF The function that provides information about the Reader file format, such as the file extension and description. + * \param pFirstPluginID Contains the ID of the first plug-in found. + * \param pRegisteredCount Contains the number of registered Readers. + * \param pIOSettingsFillerF The function that fills the IO settings for the Reader. + * \param pOverride Override any existing writer that is using the same extension. + */ + void RegisterReader(FbxReader::CreateFuncType pCreateF, + FbxReader::GetInfoFuncType pInfoF, + int& pFirstPluginID, + int& pRegisteredCount, + FbxReader::IOSettingsFillerFuncType pIOSettingsFillerF = NULL, + bool pOverride = false); + +#ifndef FBXSDK_ENV_WINSTORE + /** Registers a Writer from a plug-in path + * \param pPluginPath The plug-in path. + * \param pFirstPluginID Contains the ID of the first plug-in found. + * \param pRegisteredCount Contains the number of registered Writers. + * \param pOverride Override any existing writer that is using the same extension. + */ + void RegisterWriter(const char* pPluginPath, + int& pFirstPluginID, + int& pRegisteredCount, + bool pOverride = false); +#endif /* !FBXSDK_ENV_WINSTORE */ + + /** Registers a Writer. + * \param pCreateF The function that creates the Writer to be registered. + * \param pInfoF The function that provides information about the Writer file format, such as the file extension, description and version. + * \param pFirstPluginID Contains the ID of the first plug-in found. + * \param pRegisteredCount Contains the number of registered Writers. + * \param pIOSettingsFillerF The function that fills the IO settings for the Writer. + * \param pOverride Override any existing writer that is using the same extension. + */ + void RegisterWriter(FbxWriter::CreateFuncType pCreateF, + FbxWriter::GetInfoFuncType pInfoF, + int& pFirstPluginID, + int& pRegisteredCount, + FbxWriter::IOSettingsFillerFuncType pIOSettingsFillerF = NULL, + bool pOverride = false); + + /** Creates a Reader. + * \param pManager The SDK Manager where the Reader is created. + * \param pImporter The importer that holds the created Reader. + * \param pPluginID The Reader ID. + */ + FbxReader* CreateReader(FbxManager& pManager, + FbxImporter& pImporter, + int pPluginID) const; + + /** Creates a Writer. + * \param pManager The SDK Manager where the Writer is created. + * \param pExporter The exporter that holds the created Writer. + * \param pPluginID The Writer ID. + */ + FbxWriter* CreateWriter(FbxManager& pManager, + FbxExporter& pExporter, + int pPluginID) const; + + /** Searches for the Reader ID by the file extension. + * \param pExt The file extension. + * \return The Reader ID if found, if not found, returns -1 + */ + int FindReaderIDByExtension(const char* pExt) const; + + /** Searches for the Writer ID by the file extension. + * \param pExt The file extension. + * \return The Writer ID if found, if not found, returns -1 + */ + int FindWriterIDByExtension(const char* pExt) const; + + /** Searches for the Reader ID by the file format description. + * \param pDesc The file format description. + * \return The Reader ID if found, if not found, returns -1 + */ + int FindReaderIDByDescription(const char* pDesc) const; + + /** Searches for the Writer ID by the file format description. + * \param pDesc The file format description. + * \return The Writer ID if found, if not found, returns -1. + */ + int FindWriterIDByDescription(const char* pDesc) const; + + /** Verifies if the file format of the Reader is FBX. + * \param pFileFormat The file format identifier. + * \return \c True if the file format of the Reader is FBX, return \c false otherwise.. + */ + bool ReaderIsFBX(int pFileFormat) const; + + /** Verifies if the file format of the Writer is FBX. + * \param pFileFormat The file format identifier. + * \return \c True if the file format of the Writer is FBX, return \c false otherwise. + */ + bool WriterIsFBX(int pFileFormat) const; + + /** Verifies if the file format of the Reader is genuine (internal). + * \param pFileFormat The file format identifier. + * \return \c True if the file format of the Reader is FBX, DXF, 3DS, OBJ and DAE, return \c false otherwise. + */ + bool ReaderIsGenuine(int pFileFormat) const; + + /** Verifies if the file format of the Writer is genuine (internal). + * \param pFileFormat The file format identifier. + * \return \c True if the file format of the Writer is FBX, DXF, 3DS, OBJ and DAE, return \c false otherwise. + */ + bool WriterIsGenuine(int pFileFormat) const; + + /** Returns the number of file formats that can be imported. + * \return The number of importable formats. + */ + int GetReaderFormatCount() const; + + /** Returns the number of file formats that can be exported. + * \return The number of exportable formats. + * \remarks Multiple identifiers for the same format count as + * different file formats. For example, eFBX_BINARY, eFBX_ASCII and eFBX_ENCRYPTED + * are counted as three separate file formats. + */ + int GetWriterFormatCount() const; + + /** Returns the description of an importable file format. + * \param pFileFormat The file format identifier. + * \return A pointer to the character representation of the description. + */ + const char* GetReaderFormatDescription(int pFileFormat) const; + + /** Returns the description of an exportable file format. + * \param pFileFormat The file format identifier. + * \return A pointer to the character representation of the description. + */ + const char* GetWriterFormatDescription(int pFileFormat) const; + + /** Returns an importable file format's file extension. + * \param pFileFormat The file format identifier. + * \return A pointer to the character representation of the file extension. + */ + const char* GetReaderFormatExtension(int pFileFormat) const; + + /** Returns an exportable file format's file extension. + * \param pFileFormat The file format identifier. + * \return A pointer to the character representation of the file extension. + */ + const char* GetWriterFormatExtension(int pFileFormat) const; + + /** Returns a list of the writable file format versions. + * \param pFileFormat The file format identifier. + * \return A pointer to a list of user-readable strings that represent the versions. + */ + char const* const* GetWritableVersions(int pFileFormat) const; + + /** Detects the import (reader) file format specified for the file. + * \param pFileName The file whose file format is to be determined. + * \param pFileFormat It equals the file format identifier if this function returns \c true. If this function returns \c false, it is unmodified. + * \return \c True if the file has been determined successfully, + * returns \c false otherwise. + * \remarks This function attempts to detect the specified file's file format based on the file extension and, + * in some cases, its content. This function may not be able to determine all file formats. + * Use this function as a helper before calling \c SetFileFormat(). + * \note The file must be unlocked (already open) for this function to succeed. + */ + bool DetectReaderFileFormat(const char* pFileName, int& pFileFormat) const; + + /** Detects the export (writer) file format specified for the file. + * \param pFileName The file whose file format is to be determined. + * \param pFileFormat It equals the file format identifier if this function returns \c true. If this function returns \c false, it is unmodified. + * \return \c True if the file has been determined successfully, + * returns \c false otherwise. + * \remarks This function attempts to detect the specified file's file format based on the file extension and, + * in some cases, its content. This function may not be able to determine all file formats. + * Use this function as a helper before calling \c SetFileFormat(). + * \note The file must be unlocked (already open) for this function to succeed. + */ + bool DetectWriterFileFormat(const char* pFileName, int& pFileFormat) const; + + /** Returns the file format of the native Reader. + * \return The ID of the native Reader's file format. + */ + int GetNativeReaderFormat(); + + /** Returns the file format of the native Writer. + * \return The ID of the native Writer's file format. + */ + int GetNativeWriterFormat(); + + /** Fills the IO Settings for all registered readers. + * \param pIOS The IO settings to be filled. + */ + void FillIOSettingsForReadersRegistered(FbxIOSettings & pIOS); + + /** Fills the IO Settings for all registered writers. + * \param pIOS The IO settings to be filled. + */ + void FillIOSettingsForWritersRegistered(FbxIOSettings & pIOS); + + +/***************************************************************************************************************************** +** 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 RegisterInternalIOPlugins(); + + struct ReaderPluginEntry + { + ReaderPluginEntry(const char* pExtension, const char* pDescription, FbxReader::CreateFuncType pCreatorFunction, int pBaseID, + FbxReader::IOSettingsFillerFuncType pIOSettingsFillerFunction=NULL); + + const char* mExtension; + const char* mDescription; + FbxReader::CreateFuncType mCreatorFunction; + FbxReader::IOSettingsFillerFuncType mIOSettingsFillerFunction; + int mBaseID; + bool mIsFBX; + bool mIsInternalPlugin; + }; + + struct WriterPluginEntry + { + WriterPluginEntry(const char* pExtension, const char* pDescription, char const* const* pVersions, FbxWriter::CreateFuncType pCreatorFunction, int pBaseID, + FbxWriter::IOSettingsFillerFuncType pIOSettingsFillerFunction=NULL); + + const char* mExtension; + const char* mDescription; + char const* const* mVersions; + FbxWriter::CreateFuncType mCreatorFunction; + FbxWriter::IOSettingsFillerFuncType mIOSettingsFillerFunction; + int mBaseID; + bool mIsFBX; + bool mIsInternalPlugin; + }; + + FbxArray mReaders; + FbxArray mWriters; + int mNativeReaderFormat; + int mNativeWriterFormat; + bool mInternalPluginMode; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_FILEIO_IO_PLUGIN_REGISTRY_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxiosettings.h b/libs/fbx/include/fbxsdk/fileio/fbxiosettings.h new file mode 100644 index 00000000..27bfc311 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxiosettings.h @@ -0,0 +1,584 @@ +/**************************************************************************************** + + 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 fbxiosettings.h +#ifndef _FBXSDK_FILEIO_IO_SETTINGS_H_ +#define _FBXSDK_FILEIO_IO_SETTINGS_H_ + +#include + +#include +#include + +#include + +//Undefine the macro mkdir, since it conflict with function mkdir in Qt\4.2.3\src\corelib\io\qdir.h +#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(mkdir) + #undef mkdir +#endif + +#define IOSVisible true +#define IOSHidden false + +#define IOSSavable true +#define IOSNotSavable false + +#define IOSEnabled true +#define IOSDisabled false + +#define IOSBinary 0 +#define IOSASCII 1 + +class FbxManager; +class FbxIOSettings; + +/***************************************************************************************************************************** +** 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 FbxIOPropInfo +{ +public: + FbxIOPropInfo(); + ~FbxIOPropInfo(); + + void* UIWidget; // UI widget for showing the property + void* cbValueChanged; // call back when value changed + void* cbDirty; // call back when value changed + FbxStringList labels; // list of labels in many languages +}; + +class FBXSDK_DLL FbxIOInfo +{ +public: + enum EImpExp {eImport, eExport}; + + FbxIOInfo(); + + void Reset(EImpExp pImpExp); + void SetTimeMode(FbxTime::EMode pTimeMode, double pCustomFrameRate = 0.0); + FbxTime::EMode GetTimeMode(){ return mTimeMode; } + FbxTime GetFramePeriod(); + void SetASFScene(FbxObject* pASFScene, bool pASFSceneOwned = false); + FbxObject* GetASFScene(){ return mASFScene; } + void Set_IOS(FbxIOSettings* pIOS){ios = pIOS;} + void SetImportExportMode(EImpExp pImpExp){mImpExp = pImpExp;} + +private: + FbxTime::EMode mTimeMode; + FbxObject* mASFScene; + EImpExp mImpExp; + FbxIOSettings* ios; +}; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +/** FbxIOSettings is a collection of properties, arranged as a tree, that + * can be used by FBX file readers and writers to represent import and export + * options. + * It is primarily used by FBX importers (FbxImporter) and FBX exporter (FbxExporter) + * when reading or writing data from or to a disk. + * The FBX plugins of some Autodesk products expose a UI representing the content of those options + * to let users see and choose options when an import or export operation is about to be done. + * The tree of options is extensible. + * + * Options can be saved or loaded from an XML file using the functions: + * ReadXMLFile(), WriteXMLFile(), WriteXmlPropToFile(). This functionality can be useful + * for plugins that use preset files. + * + * An instance of FbxIOSettings must be created to be used before an import/export operation. + * When a new FbxIOSettings instance is created, all options are created with default values. + * The new instance of FbxIOSettings can be passed to the FbxManager, + * this way that instance will be used by all import/export operations. + * + * Ex: to set an instance of FbxIOSettings to the FbxManager + * + * \code + * // First create a new instance of FbxIOSettings + * FbxIOSettings * ios = FbxIOSettings::Create((FbxManager *) mManager, IOSROOT); + * // then set the FbxManager + * mManager->SetIOSettings(ios); + * \endcode + * + * It's also possible for a developer to create another instance + * of FbxIOSettings, set particular options and use it for import/export operation. + * + * Ex: to set an instance of FbxIOSettings to a FbxImporter/FbxExporter + * \code + * mImporter->SetIOSettings(ios); / mExporter->SetIOSettings(ios); + * \endcode + * + * A schematic view of the FbxIOSettings tree : + * + * \verbatim + + OPTION_GROUP_ROOT (IOSROOT) + | + | + ________________________________________ + | | + -OPTION_GROUP_EXPORT (IOSN_EXPORT) -OPTION_GROUP_IMPORT (IOSN_IMPORT) + | | + -OPTION_GROUP_A -OPTION_GROUP_A + | | | | + | -OPTION_A | -OPTION_A + | -OPTION_B | -OPTION_B + | | + -OPTION_GROUP_B -OPTION_GROUP_B + | | | | + | -OPTION_GROUP_A | -OPTION_GROUP_A + | | | | | | + | | -OPTION_A | | -OPTION_A + | | -OPTION_B | | -OPTION_B + | | | | + | -OPTION_GROUP_B | -OPTION_GROUP_B + | | | | + | -OPTION_A | -OPTION_A + | -OPTION_B | -OPTION_B + | | + -OPTION_GROUP_C -OPTION_GROUP_C + | | + -OPTION_A -OPTION_A + + \endverbatim + * + * Any group of options can contain sub options, or group of sub options. + * To access an option value, we must pass the full path to the Get/Set functions + * Ex: + * \code + * ios->GetBoolProp("Import|IncludeGrp|Animation", true); // the root node name is not required + * \endcode + * + * All options path are defined in the file kfbxiosettingspath.h to ease the access of any options. + * Then "Import|IncludeGrp|Animation" == IMP_ANIMATION since IMP_ANIMATION is defined in kfbxiosettingspath.h + * All options defined path start with "IMP_" for import branch or "EXP_" for export branch. + * + * We strongly encourage to use the defined path in kfbxiosettingspath.h, this way if the parent group of an option is changed + * the change occur only in kfbxiosettingspath.h not in the code elsewhere. + * + * Ex: to get the boolean import "Animation" option + * \code + * bool anim = ios->GetBoolProp(IMP_ANIMATION, true); // will return true if not found, since we pass true as second param + * \endcode + * + * Ex: to set the boolean import "Animation" option to false + * \code + * ios->SetBoolProp(IMP_ANIMATION, false); + * \endcode + * + * Ex: to create a new option group under the "Import" branch + * \code + * // get the parent "Import" property + * FbxProperty import_Group = ios->GetProperty( IOSN_IMPORT ); // IOSN_IMPORT is defined as "Import" in kfbxiosettingspath.h + * if(import_Group.IsValid()) // check if we have found the IOSN_IMPORT parent option + * { + * // add a new group of options "myOptionGroup" + * FbxProperty myOptionGrp = ios->AddPropertyGroup(import_Group, "myOptionGroup", FbxStringDT, "My Option Group UI Label"); + * } + * \endcode + * + * Ex: to create a new boolean option under the "myOptionGroup" + * \code + * FbxProperty myOptionGrp = ios->GetProperty( "Import|myOptionGroup" ); // can also use IOSN_IMPORT|"myOptionGroup" + * if(myOptionGrp.IsValid()) // check if we have found the "myOptionGroup" + * { + * bool defaultValue = true; + * FbxProperty myOption = ios->AddProperty(myOptionGrp, "myOptionName", FbxBoolDT, "My Option UI label" , &defaultValue, eFbxBool); + * } + * \endcode + * + * Ex: to set some flags to myOption + * \code + * FbxProperty myOption = ios->GetProperty( "Import|myOptionGroup|myOptionName" ); + * if(myOption.IsValid()) + * { + * myOPtion.ModifyFlag(FbxPropertyFlags::eUIHidden, true); // to make that option not visible to the UI + * myOPtion.ModifyFlag(FbxPropertyFlags::eNotSavable, true); // to avoid the read/save of that option in XML file + * } + * \endcode + */ +class FBXSDK_DLL FbxIOSettings : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxIOSettings, FbxObject); + +public: + //! Supported languages enumeration list + enum ELanguage + { + eENU, //!< English - United States + eDEU, //!< German - Germany + eFRA, //!< French - France + eJPN, //!< Japanese - Japan + eKOR, //!< Korean(Extended Wansung) - Korea + eCHS, //!< Chinese - PRC + ePTB, //!< Portuguese - Brasil + eLanguageCount //!< Total language count + }; + + /** Add a property group under the root prop to be a direct child of IOSROOT + * \param pName + * \param pDataType + * \param pLabel + * \return a new FbxProperty created + */ + FbxProperty AddPropertyGroup(const char* pName, const FbxDataType& pDataType=FbxDataType(), const char* pLabel=""); + + /** Add a property group under another parent property + * \param pParentProperty + * \param pName + * \param pDataType + * \param pLabel (optional, used by the UI as widget label) + * \param pVisible (used by the UI to show or not that property) + * \param pSavable (to enable a read & write to an XML file) + * \param pEnabled (used by the widget UI to show enabled or disabled) + * \return a new FbxProperty created + */ + FbxProperty AddPropertyGroup(const FbxProperty& pParentProperty, const char* pName, const FbxDataType& pDataType = FbxDataType(), + const char* pLabel = "", bool pVisible = true, bool pSavable = true, bool pEnabled = true ); + + /** Add a property under another parent property with a value to set + * \param pParentProperty + * \param pName + * \param pDataType + * \param pLabel (optional, used by the UI as widget label) + * \param pValue + * \param pVisible (used by the UI to show or not that property) + * \param pSavable (to enable a read & write to an XML file) + * \param pEnabled (used by the widget UI to show enabled or disabled) + * \return a new FbxProperty created + */ + FbxProperty AddProperty(const FbxProperty& pParentProperty, const char* pName, const FbxDataType& pDataType = FbxDataType(), + const char* pLabel = "", const void* pValue = NULL, bool pVisible = true, + bool pSavable = true, bool pEnabled = true ); + + /** Add a property under another parent property with a value to set and a min max values + * \param pParentProperty + * \param pName + * \param pDataType + * \param pLabel (optional, used by the UI as widget label) + * \param pValue + * \param pMinValue + * \param pMaxValue + * \param pVisible (used by the UI to show or not that property) + * \param pSavable (to enable a read & write to an XML file) + * \param pEnabled (used by the widget UI to show enabled or disabled) + * \return a new FbxProperty created + * \remarks Normally used with numeric properties Ex: integer, float, double, etc. + */ + FbxProperty AddPropertyMinMax(const FbxProperty& pParentProperty, const char* pName, const FbxDataType& pDataType = FbxDataType(), + const char* pLabel = "", const void* pValue = NULL, const double* pMinValue = NULL, const double* pMaxValue = NULL, + bool pVisible = true, bool pSavable = true, bool pEnabled = true ); + + + /** Get a property using the full path in the tree ex: "Export|IncludeGrp|Animation" + * \param pName + * \return a FbxProperty found + * \remarks We strongly encourage to use the defined path in kfbxiosettingspath.h + * ex: EXP_ANIMATION == "Export|IncludeGrp|Animation" + */ + FbxProperty GetProperty(const char* pName) const; + + /** Get a property using a short path found under the parent property. + * \param pParentProperty + * \param pName + * \return a FbxProperty found + * \remarks This is a faster way to access a property when the parent is known + */ + FbxProperty GetProperty(const FbxProperty& pParentProperty, const char* pName) const; + + /** Get a bool property value using the full path + * \param pName + * \param pDefValue Value returned if the property is not found + * \return true or false + */ + bool GetBoolProp(const char* pName, bool pDefValue) const; + + /** set a bool property value using the full path + * \param pName + * \param pValue + */ + void SetBoolProp(const char* pName, bool pValue); + + /** Get a double property value using the full path + * \param pName + * \param pDefValue Value returned if the property is not found + * \return a double + */ + double GetDoubleProp(const char* pName, double pDefValue) const; + + /** Set a double property using the full path + * \param pName + * \param pValue + */ + void SetDoubleProp(const char* pName, double pValue); + + /** Get a int property value using the full path + * \param pName + * \param pDefValue Value returned if the property is not found + * \return a int + */ + int GetIntProp(const char* pName, int pDefValue) const; + + /** Set a int property value using the full path + * \param pName + * \param pValue + */ + void SetIntProp(const char* pName, int pValue); + + /** Get a FbxTime property value using the full path + * \param pName + * \param pDefValue Value returned if the property is not found + */ + FbxTime GetTimeProp(const char* pName, FbxTime pDefValue) const; + + /** Set a FbxTime property value using the full path + * \param pName + * \param pValue + * \return a FbxTime + */ + void SetTimeProp(const char* pName, FbxTime pValue); + + /** \name Enum Properties + * An enum property is a list of FbxString and integer pairs. + * A current index value is available to get the selected pair + * of FbxString+integer + * + * Ex: Content of an enum property + * \code + * 0 -> (14, "Bird") + * 1 -> (17, "Horse") + * 2 -> (93, "Cat") + * 3 -> (45, "Dog") + * \endcode + * + * If current index is 2: the current int value is 93, + * and the current FbxString value is "Cat" + */ + + //@{ + + /** Get the FbxString at current index of an enum property using the full path. + * \param pName + * \param pDefValue Value returned if the property is not found + * \return a FbxString + */ + FbxString GetEnumProp(const char* pName, FbxString pDefValue) const; + + /** Get the integer at current index of an enum property using the full path. + * \param pName + * \param pDefValue Value returned if the property is not found + * \return a int + */ + int GetEnumProp(const char* pName, int pDefValue) const; + + /** Get the index of a FbxString from the enum property using the full path. + * \param pName + * \param pValue Return -1 if the FbxString is not found + * \return a int + */ + int GetEnumIndex(const char* pName, FbxString pValue) const; + + /** Set the current index using an existing FbxString of an enum property using the full path. + * \param pName + * \param pValue + * \remarks The current index will not change if the FbxString is not found + */ + void SetEnumProp(const char* pName, FbxString pValue); + + /** Set the current index of an enum property using the full path. + * \param pName + * \param pValue + * \remarks The current index will not change if the pValue is out of bound + */ + void SetEnumProp(const char* pName, int pValue); + + /** Remove a pair of FbxString+integer from an enum property. + * \param pName + * \param pValue The FbxString to find + * \remarks The first FbxString found from 0 index will be removed only even + * if the same FbxString exist in other index, if the current index was on the FbxString found + * the current index will be set to 0 + */ + void RemoveEnumPropValue(const char* pName, FbxString pValue); + + /** Empty all the FbxString+integer pair of the enum property + * \param pName + */ + void EmptyEnumProp(const char* pName); + + /** Check if a FbxString is present in the enum property. + * \param &pProp a ref to an enum prop + * \param &enumString ref to a FbxString to find + * \return \c true if found, \c false otherwise. + */ + bool IsEnumExist(FbxProperty& pProp, const FbxString& enumString) const; + + /** Get the enum index of a FbxString + * \param &pProp a ref to an enum prop + * \param &enumString ref to string to find + * \param pNoCase To match case sensitive or not + * \return the index found or -1 if not found + */ + int GetEnumIndex(FbxProperty& pProp, const FbxString& enumString, bool pNoCase = false) const; + //@} + + /** Set a specific flag value on a property using the full path + * \param pName + * \param propFlag + * \param pValue + * \return Always true + */ + bool SetFlag(const char* pName, FbxPropertyFlags::EFlags propFlag, bool pValue); + + /** Get a FbxString property value using the full path. + * \param pName + * \param pDefValue Value returned if the property is not found + * \return The FbxString value + */ + FbxString GetStringProp(const char* pName, FbxString pDefValue) const; + + /** Set a FbxString property value using the full path + * \param pName + * \param pValue + */ + void SetStringProp(const char* pName, FbxString pValue); + + /** \name XML Serialization Functions */ + //@{ + + /** Load the settings values from an XML file. + * \param path The path of the XML file. + * \return \c True on success, \c false otherwise. + */ + virtual bool ReadXMLFile(const FbxString& path); + + /** Write the settings values to an XML file. + * \param path The path of the XML file. + * \return \c True on success, \c false otherwise. + * \remarks The flag of the property must be FbxPropertyFlags::eNotSavable == false + */ + virtual bool WriteXMLFile(const FbxString& path); + + /** Write the settings values to an XML file. + * \param pFullPath The path of the XML file. + * \param propPath a prop Path + * \return \c True on success, \c false otherwise. + * \remarks To save only a branch of the settings ex: Import branch only + */ + bool WriteXmlPropToFile(const FbxString& pFullPath, const FbxString& propPath); + //@} + +/***************************************************************************************************************************** +** 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 + FbxIOPropInfo* GetPropInfo(FbxProperty &pProp); + + ELanguage UILanguage; + FbxString GetLanguageLabel(FbxProperty& pProp); + void SetLanguageLabel(FbxProperty& pProp, FbxString& pLabel); + + FbxIOInfo impInfo; + FbxIOInfo expInfo; + + static FbxString GetUserMyDocumentDir(); + void SetPropVisible(FbxProperty& pProp, bool pWithChildren, bool pVisible); + + // Read an XML file from MyDocument dir + bool ReadXmlPropFromMyDocument(const FbxString& subDir, const FbxString& filename); + + // Write property branch to an XML file in MyDocument dir + bool WriteXmlPropToMyDocument(const FbxString& subDir, const FbxString& filename, const FbxString& propPath); + + static const char* GetFileMergeDescription(int pIndex); + + enum ELoadMode + { + eCreate, /*!< Add to scene(duplicate the ones with the same name) */ + eMerge, /*!< Add to scene and update animation */ + eExclusiveMerge /*!< Update animation */ + }; + + + enum EQuaternionMode { eAsQuaternion, eAsEuler, eResample }; + enum EObjectDerivation { eByLayer, eByEntity, eByBlock }; + + enum ESysUnits + { + eUnitsUser, + eUnitsInches, + eUnitsFeet, + eUnitYards, + eUnitsMiles, + eUnitsMillimeters, + eUnitsCentimeters, + eUnitsMeters, + eUnitsKilometers + }; + + enum ESysFrameRate + { + eFrameRateUser, + eFrameRateHours, + eFrameRateMinutes, + eFrameRateSeconds, + eFrameRateMilliseconds, + eFrameRateGames15, + eFrameRateFilm24, + eFrameRatePAL25, + eFrameRateNTSC30, + eFrameRateShowScan48, + eFrameRatePALField50, + eFrameRateNTSCField60 + }; + +// Max + enum EEnveloppeSystem + { + eSkinModifier, + ePhysic, + eBonePro, + eEnveloppeSystemCount + }; + +// Max + enum EGeometryType + { + eTriangle, + eSimplifiedPoly, + ePolygon, + eNurbs, + ePatch, + eGeometryTypeCount + }; + +// Maya IK type + enum EIKType + { + eNone, + eFBIK, + eHumanIK + }; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); + +private: + void AddNewPropInfo(FbxProperty& pProp); + void DeletePropInfo(FbxProperty& pProp); + void DeleteAllPropInfo(FbxProperty& pProp); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_FILEIO_IO_SETTINGS_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxiosettingspath.h b/libs/fbx/include/fbxsdk/fileio/fbxiosettingspath.h new file mode 100644 index 00000000..7b905054 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxiosettingspath.h @@ -0,0 +1,938 @@ +/**************************************************************************************** + + 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 fbxiosettingspath.h +#ifndef _FBXSDK_FILEIO_IO_SETTINGS_PATH_H_ +#define _FBXSDK_FILEIO_IO_SETTINGS_PATH_H_ + +#include + +#include + +#define KS_BS FbxString("\\") + +#define KS_IMPORT FbxString("\\import") +#define KS_EXPORT FbxString("\\export") + +#define KS_FBX FbxString("\\FBX") // must be upper case +#define KS_PRESETS FbxString("\\Presets") +#define KS_LOG FbxString("\\Logs") +#define KS_FBXPRESETS KS_FBX + KS_PRESETS +#define KS_FBXLOGS KS_FBX + KS_LOG + +#define KS_MAYA FbxString("\\maya") +#define KS_3DSMAX FbxString("\\3dsmax") +#define KS_3DSMAX_VIZ KS_3DSMAX // use same name in "My Document" directory +#define KS_3DSMAX_DESIGN FbxString("\\3dsMaxDesign") + +#define KS_VERSION FbxString(FBXSDK_VERSION_STRING) + +#define FBXSDK_PLUGINS_REGISTRY_PATH "SOFTWARE\\Autodesk\\FBX_Plugins_" FBXSDK_VERSION_STRING + +#define IMP_FBX_PRESET_EXT "fbximportpreset" +#define EXP_FBX_PRESET_EXT "fbxexportpreset" + +#define M_E_FILENAME "Autodesk Media & Entertainment." +#define ARCH_FILENAME "Autodesk Architectural (Revit)." +#define MOBU_FILENAME "Autodesk MotionBuilder." +#define USERDEFINED_FILENAME "User defined." + +#define IMP_DIR KS_FBXPRESETS + KS_BS + KS_VERSION + KS_IMPORT +#define EXP_DIR KS_FBXPRESETS + KS_BS + KS_VERSION + KS_EXPORT + +#define LOG_VERSION_DIR KS_FBXLOGS + KS_BS + KS_VERSION + +#define MAX_LOG_VERSION_DIR KS_3DSMAX + LOG_VERSION_DIR +#define MAX_DESIGN_LOG_VERSION_DIR KS_3DSMAX_DESIGN + LOG_VERSION_DIR + +#define PRESET_VERSION_DIR KS_FBXPRESETS + KS_BS + KS_VERSION + +#define FN_LOCALIZATION_PREFIX "localization_" +#define FN_LOCALIZATION_EXT ".xlf" + +#define FN_LANGUAGE "lang.dat" +#define LANGUAGE_PATH KS_FBXPRESETS + KS_BS + KS_VERSION + KS_BS + FN_LANGUAGE + +// these defines are used for hierarchical properties names +#define IOSROOT "IOSRoot" + +#define IOSN_EXPORT "Export" +#define IOSN_IMPORT "Import" + +#define IOSN_PLUGIN_GRP "PlugInGrp" + +#define IOSN_PLUGIN_UI_WIDTH "PlugInUIWidth" +#define IOSN_PLUGIN_UI_HEIGHT "PlugInUIHeight" +#define IOSN_PLUGIN_VERSIONS_URL "PluginVersionsURL" +#define IOSN_PI_VERSION "PIVersion" + + +#define IOSN_PRESET_SELECTED "PresetSelected" + +#define IOSN_PRESETS_GRP "PresetsGrp" +#define IOSN_STATISTICS_GRP "StatisticsGrp" +#define IOSN_UNITS_GRP "UnitsGrp" +#define IOSN_INCLUDE_GRP "IncludeGrp" +#define IOSN_ADV_OPT_GRP "AdvOptGrp" +#define IOSN_AXISCONV_GRP "AxisConvGrp" +#define IOSN_CAMERA_GRP "CameraGrp" +#define IOSN_LIGHT_GRP "LightGrp" +#define IOSN_EXTRA_GRP "ExtraGrp" +#define IOSN_CONSTRAINTS_GRP "ConstraintsGrp" +#define IOSN_INPUTCONNECTIONS_GRP "InputConnectionsGrp" +#define IOSN_INFORMATION_GRP "InformationGrp" + +#define IOSN_UP_AXIS "UpAxis" +#define IOSN_UP_AXIS_MAX "UpAxisMax" +#define IOSN_ZUPROTATION_MAX "ZUProtation_max" +#define IOSN_AXISCONVERSION "AxisConversion" +#define IOSN_AUTO_AXIS "AutoAxis" +#define IOSN_FILE_UP_AXIS "FileUpAxis" + +#define IOSN_PRESETS "Presets" +#define IOSN_STATISTICS "Statistics" +#define IOSN_UNITS_SCALE "UnitsScale" +#define IOSN_TOTAL_UNITS_SCALE_TB "TotalUnitsScale" + +#define IOSN_SCALECONVERSION "ScaleConversion" +#define IOSN_MASTERSCALE "MasterScale" + +#define IOSN_DYN_SCALE_CONVERSION "DynamicScaleConversion" +#define IOSN_UNITSELECTOR "UnitsSelector" + +#define IOSN_AUDIO "Audio" +#define IOSN_ANIMATION "Animation" +#define IOSN_GEOMETRY "Geometry" +#define IOSN_DEFORMATION "Deformation" +#define IOSN_MARKERS "Markers" + +#define IOSN_CHARACTER "Character" +#define IOSN_CHARACTER_AS_MAYA_HIK "CharacterAsMayaHIK" +#define IOSN_CHARACTER_TYPE "CharacterType" +#define IOSN_CHARACTER_TYPE_DESC "CharacterTypeDesc" + +#define IOSN_SETLOCKEDATTRIB "LockedAttribute" +#define IOSN_TRIANGULATE "Triangulate" + +#define IOSN_MRCUSTOMATTRIBUTES "MRCustomAttributes" +#define IOSN_MESHPRIMITIVE "MeshPrimitive" +#define IOSN_MESHTRIANGLE "MeshTriangle" +#define IOSN_MESHPOLY "MeshPoly" +#define IOSN_NURB "Nurb" +#define IOSN_PATCH "Patch" +#define IOSN_BIP2FBX "Bip2Fbx" +#define IOSN_ASCIIFBX "AsciiFbx" + +#define IOSN_TAKE "Take" + +#define IOSN_GEOMETRYMESHPRIMITIVEAS "GeometryMeshPrimitiveAs" +#define IOSN_GEOMETRYMESHTRIANGLEAS "GeometryMeshTriangleAs" +#define IOSN_GEOMETRYMESHPOLYAS "GeometryMeshPolyAs" +#define IOSN_GEOMETRYNURBSAS "GeometryNurbsAs" + +#define IOSN_GEOMETRYNURBSSURFACEAS "GeometryNurbsSurfaceAs" +#define IOSN_GEOMETRYPATCHAS "GeometryPatchAs" + +#define IOSN_TANGENTS_BINORMALS "TangentsandBinormals" +#define IOSN_SMOOTH_MESH "SmoothMesh" +#define IOSN_SELECTION_SET "SelectionSet" +#define IOSN_ANIMATIONONLY "AnimationOnly" +#define IOSN_SELECTIONONLY "SelectionOnly" + +#define IOSN_BONE "Bone" +#define IOSN_BONEWIDTHHEIGHTLOCK "BoneWidthHeightLock" +#define IOSN_BONEASDUMMY "BoneAsDummy" +#define IOSN_BONEMAX4BONEWIDTH "Max4BoneWidth" +#define IOSN_BONEMAX4BONEHEIGHT "Max4BoneHeight" +#define IOSN_BONEMAX4BONETAPER "Max4BoneTaper" + +#define IOSN_REMOVE_SINGLE_KEY "RemoveSingleKey" +#define IOSN_CURVE_FILTER "CurveFilter" +#define IOSN_CONSTRAINT "Constraint" +#define IOSN_UI "UI" +#define IOSN_SHOW_UI_MODE "ShowUIMode" +#define IOSN_SHOW_WARNINGS_MANAGER "ShowWarningsManager" +#define IOSN_GENERATE_LOG_DATA "GenerateLogData" + +#define IOSN_PERF_GRP "Performance" +#define IOSN_REMOVEBADPOLYSFROMMESH "RemoveBadPolysFromMesh" +#define IOSN_META_DATA "MetaData" + +#define IOSN_CACHE_GRP "Cache" +#define IOSN_CACHE_SIZE "CacheSize" + +#define IOSN_MERGE_MODE "MergeMode" +#define IOSN_MERGE_MODE_DESCRIPTION "MergeModeDescription" +#define IOSN_ONE_CLICK_MERGE "OneClickMerge" +#define IOSN_ONE_CLICK_MERGE_TEXTURE "OneClickMergeTexture" + +#define IOSN_SAMPLINGPANEL "SamplingPanel" + +#define IOSN_FILE_FORMAT "FileFormat" +#define IOSN_FBX "Fbx" +#define IOSN_DXF "Dxf" +#define IOSN_OBJ "Obj" +#define IOSN_3DS "Max_3ds" // can't start by a number for xml node name +#define IOSN_COLLADA "Collada" + +#define IOSN_MOTION_BASE "Motion_Base" // for commond Motion Readers/Writers stream options +#define IOSN_BIOVISION_BVH "Biovision_BVH" +#define IOSN_MOTIONANALYSIS_HTR "MotionAnalysis_HTR" +#define IOSN_MOTIONANALYSIS_TRC "MotionAnalysis_TRC" +#define IOSN_ACCLAIM_ASF "Acclaim_ASF" +#define IOSN_ACCLAIM_AMC "Acclaim_AMC" +#define IOSN_VICON_C3D "Vicon_C3D" + +#define IOSN_SKINS "Skins" +#define IOSN_POINTCACHE "PointCache" +#define IOSN_QUATERNION "Quaternion" +#define IOSN_NAMETAKE "UseSceneName" + +#define IOSN_SHAPE "Shape" +#define IOSN_LIGHT "Light" +#define IOSN_LIGHTATTENUATION "LightAttenuation" +#define IOSN_CAMERA "Camera" +#define IOSN_VIEW_CUBE "ViewCube" + +#define IOSN_BINDPOSE "BindPose" + +#define IOSN_EMBEDTEXTURE_GRP "EmbedTextureGrp" +#define IOSN_EMBEDTEXTURE "EmbedTexture" +#define IOSN_EMBEDDED_FOLDER "ExtractFolder" +#define IOSN_CONVERTTOTIFF "Convert_2Tiff" + +#define IOSN_UNLOCK_NORMALS "UnlockNormals" +#define IOSN_CREASE "Crease" +#define IOSN_FINESTSUBDIVLEVEL "FinestSubdivLevel" + +#define IOSN_BAKEANIMATIONLAYERS "BakeAnimationLayers" +#define IOSN_BAKECOMPLEXANIMATION "BakeComplexAnimation" + +#define IOSN_BAKEFRAMESTART "BakeFrameStart" +#define IOSN_BAKEFRAMEEND "BakeFrameEnd" +#define IOSN_BAKEFRAMESTEP "BakeFrameStep" +#define IOSN_BAKEFRAMESTARTNORESET "BakeFrameStartNoReset" +#define IOSN_BAKEFRAMEENDNORESET "BakeFrameEndNoReset" +#define IOSN_BAKEFRAMESTEPNORESET "BakeFrameStepNoReset" + +#define IOSN_USEMATRIXFROMPOSE "UseMatrixFromPose" +#define IOSN_NULLSTOPIVOT "NullsToPivot" +#define IOSN_PIVOTTONULLS "PivotToNulls" + +#define IOSN_GEOMNORMALPERPOLY "GeomNormalPerPoly" +#define IOSN_MAXBONEASBONE "MaxBoneAsBone" +#define IOSN_MAXNURBSSTEP "MaxNurbsStep" +#define IOSN_PROTECTDRIVENKEYS "ProtectDrivenKeys" +#define IOSN_DEFORMNULLSASJOINTS "DeformNullsAsJoints" + +#define IOSN_ENVIRONMENT "Environment" + +// Note this will use IOSN_SAMPLINGRATE +#define IOSN_SAMPLINGRATESELECTOR "SamplingRateSelector" + +#define IOSN_SAMPLINGRATE "CurveFilterSamplingRate" +#define IOSN_APPLYCSTKEYRED "CurveFilterApplyCstKeyRed" +#define IOSN_CSTKEYREDTPREC "CurveFilterCstKeyRedTPrec" +#define IOSN_CSTKEYREDRPREC "CurveFilterCstKeyRedRPrec" +#define IOSN_CSTKEYREDSPREC "CurveFilterCstKeyRedSPrec" +#define IOSN_CSTKEYREDOPREC "CurveFilterCstKeyRedOPrec" +#define IOSN_APPLYKEYREDUCE "CurveFilterApplyKeyReduce" +#define IOSN_KEYREDUCEPREC "CurveFilterKeyReducePrec" +#define IOSN_APPLYKEYSONFRM "CurveFilterApplyKeysOnFrm" +#define IOSN_APPLYKEYSYNC "CurveFilterApplyKeySync" +#define IOSN_APPLYUNROLL "CurveFilterApplyUnroll" +#define IOSN_UNROLLPREC "CurveFilterUnrollPrec" +#define IOSN_UNROLLPATH "CurveFilterUnrollPath" +#define IOSN_UNROLLFORCEAUTO "CurveFilterUnrollForceAuto" + +#define IOSN_AUTOTANGENTSONLY "AutoTangentsOnly" + +#define IOSN_SMOOTHING_GROUPS "SmoothingGroups" +#define IOSN_HARDEDGES "HardEdges" +#define IOSN_EXP_HARDEDGES "expHardEdges" +#define IOSN_BLINDDATA "BlindData" +#define IOSN_INPUTCONNECTIONS "InputConnections" +#define IOSN_INSTANCES "Instances" +#define IOSN_REFERENCES "References" +#define IOSN_CONTAINEROBJECTS "ContainerObjects" +#define IOSN_BYPASSRRSINHERITANCE "BypassRrsInheritance" +#define IOSN_FORCEWEIGHTNORMALIZE "ForceWeightNormalize" +#define IOSN_SHAPEANIMATION "ShapeAnimation" +#define IOSN_SMOOTHKEYASUSER "SmoothKeyAsUser" + +#define IOSN_SCALEFACTOR "ScaleFactor" +#define IOSN_AXISCONVERSIONMETHOD "AxisConversionMethod" +#define IOSN_UPAXIS "UpAxis" +#define IOSN_SELECTIONSETNAMEASPOINTCACHE "SelectionSetNameAsPointCache" + +#define IOSN_KEEPFRAMERATE "KeepFrameRate" +#define IOSN_ATTENUATIONASINTENSITYCURVE "AttenuationAsIntensityCurve" + +#define IOSN_RESAMPLE_ANIMATION_CURVES "ResampleAnimationCurves" + +#define IOSN_TIMELINE "TimeLine" +#define IOSN_TIMELINE_SPAN "TimeLineSpan" + +#define IOSN_BUTTON_WEB_UPDATE "WebUpdateButton" +#define IOSN_BUTTON_EDIT "EditButton" +#define IOSN_BUTTON_OK "OKButton" +#define IOSN_BUTTON_CANCEL "CancelButton" +#define IOSN_MENU_EDIT_PRESET "EditPresetMenu" +#define IOSN_MENU_SAVE_PRESET "SavePresetMenu" + +#define IOSN_UIL "UILIndex" +#define IOSN_PLUGIN_PRODUCT_FAMILY "PluginProductFamily" + +#define IOSN_PLUGIN_UI_XPOS "PlugInUIXpos" +#define IOSN_PLUGIN_UI_YPOS "PlugInUIYpos" + +#define IOSN_FBX_EXTENTIONS_SDK "FBXExtentionsSDK" +#define IOSN_FBX_EXTENTIONS_SDK_WARNING "FBXExtentionsSDKWarning" + +#define IOSN_COLLADA_FRAME_COUNT "FrameCount" +#define IOSN_COLLADA_START "Start" +#define IOSN_COLLADA_TAKE_NAME "TakeName" + +#define IOSN_COLLADA_TRIANGULATE "Triangulate" +#define IOSN_COLLADA_SINGLEMATRIX "SingleMatrix" +#define IOSN_COLLADA_FRAME_RATE "FrameRate" + +#define IOSN_DXF_TRIANGULATE "Triangulate" +#define IOSN_DXF_DEFORMATION "Deformation" + +#define IOSN_DXF_WELD_VERTICES "WeldVertices" +#define IOSN_DXF_OBJECT_DERIVATION "ObjectDerivation" +#define IOSN_DXF_REFERENCE_NODE "ReferenceNode" + +#define IOSN_OBJ_REFERENCE_NODE "ReferenceNode" +#define IOSN_OBJ_TRIANGULATE "Triangulate" +#define IOSN_OBJ_DEFORMATION "Deformation" + +#define IOSN_3DS_REFERENCENODE "ReferenceNode" +#define IOSN_3DS_TEXTURE "Texture" +#define IOSN_3DS_MATERIAL "Material" +#define IOSN_3DS_ANIMATION "Animation" +#define IOSN_3DS_MESH "Mesh" +#define IOSN_3DS_LIGHT "Light" +#define IOSN_3DS_CAMERA "Camera" +#define IOSN_3DS_AMBIENT_LIGHT "AmbientLight" +#define IOSN_3DS_RESCALING "Rescaling" +#define IOSN_3DS_FILTER "Filter" +#define IOSN_3DS_SMOOTHGROUP "Smoothgroup" +#define IOSN_3DS_TAKE_NAME "TakeName" +#define IOSN_3DS_TEXUVBYPOLY "TexuvbyPoly" + +// so far, these three are for 3dsMax plug-in only +#define IOSN_ZOOMEXTENTS "ZoomExtents" +#define IOSN_GLOBAL_AMBIENT_COLOR "GlobalAmbientColor" +#define IOSN_EDGE_ORIENTATION "PreserveEdgeOrientation" + +#define IOSN_VERSIONS_UI_ALIAS "VersionsUIAlias" +#define IOSN_VERSIONS_COMP_DESCRIPTIONS "VersionsCompDescriptions" + +// FBX specific +#define IOSN_MODEL_COUNT "Model_Count" +#define IOSN_DEVICE_COUNT "Device_Count" +#define IOSN_CHARACTER_COUNT "Character_Count" +#define IOSN_ACTOR_COUNT "Actor_Count" +#define IOSN_CONSTRAINT_COUNT "Constraint_Count" +#define IOSN_MEDIA_COUNT "Media_Count" +#define IOSN_TEMPLATE "Template" +#define IOSN_PIVOT "Pivot" +#define IOSN_GLOBAL_SETTINGS "Global_Settings" +#define IOSN_MERGE_LAYER_AND_TIMEWARP "Merge_Layer_and_Timewarp" +#define IOSN_GOBO "Gobo" +#define IOSN_LINK "Link" +#define IOSN_MATERIAL "Material" +#define IOSN_TEXTURE "Texture" +#define IOSN_MODEL "Model" +#define IOSN_EMBEDDED "EMBEDDED" +#define IOSN_PASSWORD "Password" +#define IOSN_PASSWORD_ENABLE "Password_Enable" +#define IOSN_CURRENT_TAKE_NAME "Current_Take_Name" +#define IOSN_COLLAPSE_EXTERNALS "COLLAPSE EXTERNALS" +#define IOSN_COMPRESS_ARRAYS "Compress_Arrays" +#define IOSN_COMPRESS_LEVEL "Compress_Level" +#define IOSN_COMPRESS_MINSIZE "Compress_Minsize" +#define IOSN_EMBEDDED_PROPERTIES_SKIP "Embedded_Skipped_Properties" +#define IOSN_EXPORT_FILE_VERSION "ExportFileVersion" +#define IOSN_SHOW_UI_WARNING "ShowUIWarning" +#define IOSN_ADD_MATERIAL_TO_EDIT "AddMaterialToEdit" +#define IOSN_ENABLE_TEX_DISPLAY "EnableTexDisplay" +#define IOSN_PREFERED_ENVELOPPE_SYSTEM "kImportPreferedEnveloppeSystem" +#define IOSN_FIRST_TIME_RUN_NOTICE "FirstTimeRunNotice" +#define IOSN_EXTRACT_EMBEDDED_DATA "ExtractEmbeddedData" + +// internal usage +#define IOSN_USETMPFILEPERIPHERAL "UseTmpFilePeripheral" +#define IOSN_CONSTRUCTIONHISTORY "ConstructionHistory" +#define IOSN_RELAXED_FBX_CHECK "RelaxedFbxCheck" + +//--------------------------- +// import defined path + +#define IMP_PRESETS IOSN_IMPORT "|" IOSN_PRESETS_GRP "|" IOSN_PRESETS +#define IMP_STATISTICS IOSN_IMPORT "|" IOSN_STATISTICS_GRP "|" IOSN_STATISTICS + + +#define IMP_STATISTICS_GRP IOSN_IMPORT "|" IOSN_STATISTICS_GRP +#define IMP_PRESETS_GRP IOSN_IMPORT "|" IOSN_PRESETS_GRP +#define IMP_PLUGIN_GRP IOSN_IMPORT "|" IOSN_PLUGIN_GRP +#define IMP_INCLUDE_GRP IOSN_IMPORT "|" IOSN_INCLUDE_GRP +#define IMP_ADV_OPT_GRP IOSN_IMPORT "|" IOSN_ADV_OPT_GRP +#define IMP_FBX_EXT_SDK_GRP IOSN_IMPORT "|" IOSN_FBX_EXTENTIONS_SDK +#define IMP_FIRST_TIME_RUN_NOTICE_GRP IOSN_IMPORT "|" IOSN_FIRST_TIME_RUN_NOTICE +#define IMP_INFORMATION_GRP IOSN_IMPORT "|" IOSN_INFORMATION_GRP + +#define IMP_FIRST_TIME_RUN_NOTICE IMP_FIRST_TIME_RUN_NOTICE_GRP "|" IOSN_FIRST_TIME_RUN_NOTICE + +#define IMP_GEOMETRY IMP_INCLUDE_GRP "|" IOSN_GEOMETRY +#define IMP_AUDIO IMP_INCLUDE_GRP "|" IOSN_AUDIO +#define IMP_ANIMATION IMP_INCLUDE_GRP "|" IOSN_ANIMATION +#define IMP_SETLOCKEDATTRIB IMP_INCLUDE_GRP "|" IOSN_SETLOCKEDATTRIB + +#define IMP_MERGE_MODE IMP_INCLUDE_GRP "|" IOSN_MERGE_MODE +#define IMP_MERGE_MODE_DESCRIPTION IMP_INCLUDE_GRP "|" IOSN_MERGE_MODE_DESCRIPTION +#define IMP_ONE_CLICK_MERGE IMP_INCLUDE_GRP "|" IOSN_ONE_CLICK_MERGE +#define IMP_ONE_CLICK_MERGE_TEXTURE IMP_INCLUDE_GRP "|" IOSN_ONE_CLICK_MERGE_TEXTURE + +#define IMP_ADD_MATERIAL_TO_EDIT IMP_INCLUDE_GRP "|" IOSN_ADD_MATERIAL_TO_EDIT +#define IMP_ENABLE_TEX_DISPLAY IMP_INCLUDE_GRP "|" IOSN_ENABLE_TEX_DISPLAY +#define IMP_PREFERED_ENVELOPPE_SYSTEM IMP_INCLUDE_GRP "|" IOSN_PREFERED_ENVELOPPE_SYSTEM + +#define IMP_CAMERA_GRP IMP_INCLUDE_GRP "|" IOSN_CAMERA_GRP +#define IMP_LIGHT_GRP IMP_INCLUDE_GRP "|" IOSN_LIGHT_GRP +#define IMP_EMBEDDED_GRP IMP_INCLUDE_GRP "|" IOSN_EMBEDTEXTURE +#define IMP_EXTRACT_FOLDER IMP_EMBEDDED_GRP "|" IOSN_EMBEDDED_FOLDER + +#define IMP_LIGHT IMP_LIGHT_GRP "|" IOSN_LIGHT +#define IMP_ENVIRONMENT IMP_LIGHT_GRP "|" IOSN_ENVIRONMENT +#define IMP_CAMERA IMP_CAMERA_GRP "|" IOSN_CAMERA +#define IMP_VIEW_CUBE IMP_INCLUDE_GRP "|" IOSN_VIEW_CUBE + +// so far, this one is for 3dsMax plug-in only +#define IMP_ZOOMEXTENTS IMP_INCLUDE_GRP "|" IOSN_ZOOMEXTENTS +#define IMP_GLOBAL_AMBIENT_COLOR IMP_LIGHT_GRP "|" IOSN_GLOBAL_AMBIENT_COLOR + +#define IMP_CURVEFILTERS IMP_ANIMATION "|" IOSN_CURVE_FILTER +#define IMP_SAMPLINGPANEL IMP_ANIMATION "|" IOSN_SAMPLINGPANEL + +#define IMP_DEFORMATION IMP_ANIMATION "|" IOSN_DEFORMATION +#define IMP_BONE IMP_ANIMATION "|" IOSN_BONE +#define IMP_ATTENUATIONASINTENSITYCURVE IMP_ANIMATION "|" IOSN_ATTENUATIONASINTENSITYCURVE + +#define IMP_EXTRA_GRP IMP_ANIMATION "|" IOSN_EXTRA_GRP + +#define IMP_TAKE IMP_EXTRA_GRP "|" IOSN_TAKE +#define IMP_KEEPFRAMERATE IMP_EXTRA_GRP "|" IOSN_KEEPFRAMERATE +#define IMP_TIMELINE IMP_EXTRA_GRP "|" IOSN_TIMELINE +#define IMP_TIMELINE_SPAN IMP_EXTRA_GRP "|" IOSN_TIMELINE_SPAN +#define IMP_BAKEANIMATIONLAYERS IMP_EXTRA_GRP "|" IOSN_BAKEANIMATIONLAYERS +#define IMP_MARKERS IMP_EXTRA_GRP "|" IOSN_MARKERS +#define IMP_QUATERNION IMP_EXTRA_GRP "|" IOSN_QUATERNION +#define IMP_PROTECTDRIVENKEYS IMP_EXTRA_GRP "|" IOSN_PROTECTDRIVENKEYS +#define IMP_DEFORMNULLSASJOINTS IMP_EXTRA_GRP "|" IOSN_DEFORMNULLSASJOINTS +#define IMP_NULLSTOPIVOT IMP_EXTRA_GRP "|" IOSN_NULLSTOPIVOT +#define IMP_POINTCACHE IMP_EXTRA_GRP "|" IOSN_POINTCACHE +#define IMP_SHAPEANIMATION IMP_EXTRA_GRP "|" IOSN_SHAPEANIMATION + +#define IMP_CONSTRAINTS_GRP IMP_ANIMATION "|" IOSN_CONSTRAINTS_GRP + +#define IMP_CONSTRAINT IMP_CONSTRAINTS_GRP "|" IOSN_CONSTRAINT + +#define IMP_CHARACTER IMP_CONSTRAINTS_GRP "|" IOSN_CHARACTER +#define IMP_CHARACTER_AS_MAYA_HIK IMP_CONSTRAINTS_GRP "|" IOSN_CHARACTER_AS_MAYA_HIK +#define IMP_CHARACTER_TYPE IMP_CONSTRAINTS_GRP "|" IOSN_CHARACTER_TYPE + + +#define IMP_SAMPLINGRATESELECTOR IMP_SAMPLINGPANEL "|" IOSN_SAMPLINGRATESELECTOR +#define IMP_SAMPLINGRATE IMP_SAMPLINGPANEL "|" IOSN_SAMPLINGRATE + +#define IMP_UNITS_GRP IMP_ADV_OPT_GRP "|" IOSN_UNITS_GRP +#define IMP_AXISCONV_GRP IMP_ADV_OPT_GRP "|" IOSN_AXISCONV_GRP +#define IMP_CACHE_GRP IMP_ADV_OPT_GRP "|" IOSN_CACHE_GRP + +#define IMP_UI IMP_ADV_OPT_GRP "|" IOSN_UI +#define IMP_FILEFORMAT IMP_ADV_OPT_GRP "|" IOSN_FILE_FORMAT +#define IMP_PERF_GRP IMP_ADV_OPT_GRP "|" IOSN_PERF_GRP + +#define IMP_REMOVEBADPOLYSFROMMESH IMP_PERF_GRP "|" IOSN_REMOVEBADPOLYSFROMMESH +#define IMP_META_DATA IMP_PERF_GRP "|" IOSN_META_DATA + +#define IMP_FBX_EXTENTIONS_SDK_WARNING IMP_FBX_EXT_SDK_GRP "|" IOSN_FBX_EXTENTIONS_SDK_WARNING + +#define IMP_SCALECONVERSION IMP_UNITS_GRP "|" IOSN_SCALECONVERSION +#define IMP_UNITS_TB IMP_UNITS_GRP "|" IOSN_UNITS_TB +#define IMP_MASTERSCALE IMP_UNITS_GRP "|" IOSN_MASTERSCALE +#define IMP_UNITS_SCALE IMP_UNITS_GRP "|" IOSN_UNITS_SCALE + +#define IMP_DYN_SCALE_CONVERSION IMP_UNITS_GRP "|" IOSN_DYN_SCALE_CONVERSION +#define IMP_UNITSELECTOR IMP_UNITS_GRP "|" IOSN_UNITSELECTOR +#define IMP_TOTAL_UNITS_SCALE_TB IMP_UNITS_GRP "|" IOSN_TOTAL_UNITS_SCALE_TB + +#define IMP_SHOW_UI_MODE IMP_UI "|" IOSN_SHOW_UI_MODE +#define IMP_SHOW_UI_WARNING IMP_UI "|" IOSN_SHOW_UI_WARNING +#define IMP_SHOW_WARNINGS_MANAGER IMP_UI "|" IOSN_SHOW_WARNINGS_MANAGER +#define IMP_GENERATE_LOG_DATA IMP_UI "|" IOSN_GENERATE_LOG_DATA +#define IMP_PLUGIN_VERSIONS_URL IMP_UI "|" IOSN_PLUGIN_VERSIONS_URL + +#define IMP_DXF IMP_ADV_OPT_GRP "|" IOSN_DXF + +// note: IMP_FILEFORMAT group is not visible +#define IMP_FBX IMP_FILEFORMAT "|" IOSN_FBX +#define IMP_OBJ IMP_FILEFORMAT "|" IOSN_OBJ +#define IMP_3DS IMP_FILEFORMAT "|" IOSN_3DS + +#define IMP_MOTION_BASE IMP_FILEFORMAT "|" IOSN_MOTION_BASE +#define IMP_BIOVISION_BVH IMP_FILEFORMAT "|" IOSN_BIOVISION_BVH +#define IMP_MOTIONANALYSIS_HTR IMP_FILEFORMAT "|" IOSN_MOTIONANALYSIS_HTR +#define IMP_ACCLAIM_ASF IMP_FILEFORMAT "|" IOSN_ACCLAIM_ASF +#define IMP_ACCLAIM_AMC IMP_FILEFORMAT "|" IOSN_ACCLAIM_AMC + +#define IMP_UNLOCK_NORMALS IMP_GEOMETRY "|" IOSN_UNLOCK_NORMALS +#define IMP_CREASE IMP_GEOMETRY "|" IOSN_CREASE + +#define IMP_SMOOTHING_GROUPS IMP_GEOMETRY "|" IOSN_SMOOTHING_GROUPS +#define IMP_HARDEDGES IMP_GEOMETRY "|" IOSN_HARDEDGES +#define IMP_BLINDDATA IMP_GEOMETRY "|" IOSN_BLINDDATA + +#define IMP_BONE_WIDTHHEIGHTLOCK IMP_BONE "|" IOSN_BONEWIDTHHEIGHTLOCK +#define IMP_BONEASDUMMY IMP_BONE "|" IOSN_BONEASDUMMY +#define IMP_BONEMAX4BONEWIDTH IMP_BONE "|" IOSN_BONEMAX4BONEWIDTH +#define IMP_BONEMAX4BONEHEIGHT IMP_BONE "|" IOSN_BONEMAX4BONEHEIGHT +#define IMP_BONEMAX4BONETAPER IMP_BONE "|" IOSN_BONEMAX4BONETAPER + +#define IMP_SHAPE IMP_DEFORMATION "|" IOSN_SHAPE +#define IMP_SKINS IMP_DEFORMATION "|" IOSN_SKINS +#define IMP_USEMATRIXFROMPOSE IMP_DEFORMATION "|" IOSN_USEMATRIXFROMPOSE +#define IMP_FORCEWEIGHTNORMALIZE IMP_DEFORMATION "|" IOSN_FORCEWEIGHTNORMALIZE + + + +#define IMP_APPLYCSTKEYRED IMP_CURVEFILTERS "|" IOSN_APPLYCSTKEYRED +#define IMP_CSTKEYREDTPREC IMP_APPLYCSTKEYRED "|" IOSN_CSTKEYREDTPREC +#define IMP_CSTKEYREDRPREC IMP_APPLYCSTKEYRED "|" IOSN_CSTKEYREDRPREC +#define IMP_CSTKEYREDSPREC IMP_APPLYCSTKEYRED "|" IOSN_CSTKEYREDSPREC +#define IMP_CSTKEYREDOPREC IMP_APPLYCSTKEYRED "|" IOSN_CSTKEYREDOPREC +#define IMP_AUTOTANGENTSONLY IMP_APPLYCSTKEYRED "|" IOSN_AUTOTANGENTSONLY + +#define IMP_APPLYKEYREDUCE IMP_CURVEFILTERS "|" IOSN_APPLYKEYREDUCE +#define IMP_KEYREDUCEPREC IMP_APPLYKEYREDUCE "|" IOSN_KEYREDUCEPREC +#define IMP_APPLYKEYSONFRM IMP_APPLYKEYREDUCE "|" IOSN_APPLYKEYSONFRM +#define IMP_APPLYKEYSYNC IMP_APPLYKEYREDUCE "|" IOSN_APPLYKEYSYNC + +#define IMP_APPLYUNROLL IMP_CURVEFILTERS "|" IOSN_APPLYUNROLL +#define IMP_UNROLLPREC IMP_APPLYUNROLL "|" IOSN_UNROLLPREC +#define IMP_UNROLLPATH IMP_APPLYUNROLL "|" IOSN_UNROLLPATH +#define IMP_UNROLLFORCEAUTO IMP_APPLYUNROLL "|" IOSN_UNROLLFORCEAUTO + +#define IMP_UP_AXIS IMP_AXISCONV_GRP "|" IOSN_UP_AXIS +#define IMP_UP_AXIS_MAX IMP_AXISCONV_GRP "|" IOSN_UP_AXIS_MAX +#define IMP_ZUPROTATION_MAX IMP_AXISCONV_GRP "|" IOSN_ZUPROTATION_MAX +#define IMP_AXISCONVERSION IMP_AXISCONV_GRP "|" IOSN_AXISCONVERSION +#define IMP_AUTO_AXIS IMP_AXISCONV_GRP "|" IOSN_AUTO_AXIS +#define IMP_FILE_UP_AXIS IMP_AXISCONV_GRP "|" IOSN_FILE_UP_AXIS + +#define IMP_CACHE_SIZE IMP_CACHE_GRP "|" IOSN_CACHE_SIZE + +#define IMP_PLUGIN_UI_WIDTH IMP_PLUGIN_GRP "|" IOSN_PLUGIN_UI_WIDTH +#define IMP_PLUGIN_UI_HEIGHT IMP_PLUGIN_GRP "|" IOSN_PLUGIN_UI_HEIGHT +#define IMP_PRESET_SELECTED IMP_PLUGIN_GRP "|" IOSN_PRESET_SELECTED + +#define IMP_UIL IMP_PLUGIN_GRP "|" IOSN_UIL +#define IMP_PLUGIN_PRODUCT_FAMILY IMP_PLUGIN_GRP "|" IOSN_PLUGIN_PRODUCT_FAMILY + +#define IMP_PLUGIN_UI_XPOS IMP_PLUGIN_GRP "|" IOSN_PLUGIN_UI_XPOS +#define IMP_PLUGIN_UI_YPOS IMP_PLUGIN_GRP "|" IOSN_PLUGIN_UI_YPOS + +#define IMP_DXF_WELD_VERTICES IMP_DXF "|" IOSN_DXF_WELD_VERTICES +#define IMP_DXF_OBJECT_DERIVATION IMP_DXF "|" IOSN_DXF_OBJECT_DERIVATION +#define IMP_DXF_REFERENCE_NODE IMP_DXF "|" IOSN_DXF_REFERENCE_NODE + +#define IMP_OBJ_REFERENCE_NODE IMP_OBJ "|" IOSN_OBJ_REFERENCE_NODE + +#define IMP_3DS_REFERENCENODE IMP_3DS "|" IOSN_3DS_REFERENCENODE +#define IMP_3DS_TEXTURE IMP_3DS "|" IOSN_3DS_TEXTURE +#define IMP_3DS_MATERIAL IMP_3DS "|" IOSN_3DS_MATERIAL +#define IMP_3DS_ANIMATION IMP_3DS "|" IOSN_3DS_ANIMATION +#define IMP_3DS_MESH IMP_3DS "|" IOSN_3DS_MESH +#define IMP_3DS_LIGHT IMP_3DS "|" IOSN_3DS_LIGHT +#define IMP_3DS_CAMERA IMP_3DS "|" IOSN_3DS_CAMERA +#define IMP_3DS_AMBIENT_LIGHT IMP_3DS "|" IOSN_3DS_AMBIENT_LIGHT +#define IMP_3DS_RESCALING IMP_3DS "|" IOSN_3DS_RESCALING +#define IMP_3DS_FILTER IMP_3DS "|" IOSN_3DS_FILTER +#define IMP_3DS_SMOOTHGROUP IMP_3DS "|" IOSN_3DS_SMOOTHGROUP + +#define IMP_FBX_MODEL_COUNT IMP_FBX "|" IOSN_MODEL_COUNT +#define IMP_FBX_DEVICE_COUNT IMP_FBX "|" IOSN_DEVICE_COUNT +#define IMP_FBX_CHARACTER_COUNT IMP_FBX "|" IOSN_CHARACTER_COUNT +#define IMP_FBX_ACTOR_COUNT IMP_FBX "|" IOSN_ACTOR_COUNT +#define IMP_FBX_CONSTRAINT_COUNT IMP_FBX "|" IOSN_CONSTRAINT_COUNT +#define IMP_FBX_MEDIA_COUNT IMP_FBX "|" IOSN_MEDIA_COUNT + +#define IMP_FBX_TEMPLATE IMP_FBX "|" IOSN_TEMPLATE +#define IMP_FBX_PIVOT IMP_FBX "|" IOSN_PIVOT +#define IMP_FBX_GLOBAL_SETTINGS IMP_FBX "|" IOSN_GLOBAL_SETTINGS +#define IMP_FBX_CHARACTER IMP_FBX "|" IOSN_CHARACTER +#define IMP_FBX_CONSTRAINT IMP_FBX "|" IOSN_CONSTRAINT +#define IMP_FBX_MERGE_LAYER_AND_TIMEWARP IMP_FBX "|" IOSN_MERGE_LAYER_AND_TIMEWARP +#define IMP_FBX_GOBO IMP_FBX "|" IOSN_GOBO +#define IMP_FBX_SHAPE IMP_FBX "|" IOSN_SHAPE +#define IMP_FBX_LINK IMP_FBX "|" IOSN_LINK +#define IMP_FBX_MATERIAL IMP_FBX "|" IOSN_MATERIAL +#define IMP_FBX_TEXTURE IMP_FBX "|" IOSN_TEXTURE +#define IMP_FBX_MODEL IMP_FBX "|" IOSN_MODEL +#define IMP_FBX_AUDIO IMP_FBX "|" IOSN_AUDIO +#define IMP_FBX_ANIMATION IMP_FBX "|" IOSN_ANIMATION +#define IMP_FBX_PASSWORD IMP_FBX "|" IOSN_PASSWORD +#define IMP_FBX_PASSWORD_ENABLE IMP_FBX "|" IOSN_PASSWORD_ENABLE +#define IMP_FBX_CURRENT_TAKE_NAME IMP_FBX "|" IOSN_CURRENT_TAKE_NAME +#define IMP_FBX_EXTRACT_EMBEDDED_DATA IMP_FBX "|" IOSN_EXTRACT_EMBEDDED_DATA +// internal use +#define IMP_RELAXED_FBX_CHECK IMP_FBX "|" IOSN_RELAXED_FBX_CHECK + +#define IMP_BUTTON_WEB_UPDATE IMP_INFORMATION_GRP "|" IOSN_BUTTON_WEB_UPDATE +#define IMP_PI_VERSION IMP_INFORMATION_GRP "|" IOSN_PI_VERSION + + +// end of import defined path +//--------------------------- + +//--------------------------- +// export defined path + +#define EXP_STATISTICS_GRP IOSN_EXPORT "|" IOSN_STATISTICS_GRP +#define EXP_ADV_OPT_GRP IOSN_EXPORT "|" IOSN_ADV_OPT_GRP +#define EXP_PRESETS_GRP IOSN_EXPORT "|" IOSN_PRESETS_GRP +#define EXP_STATISTICS IOSN_EXPORT "|" IOSN_STATISTICS_GRP "|" IOSN_STATISTICS +#define EXP_FIRST_TIME_RUN_NOTICE_GRP IOSN_EXPORT "|" IOSN_FIRST_TIME_RUN_NOTICE +#define EXP_INFORMATION_GRP IOSN_EXPORT "|" IOSN_INFORMATION_GRP + +#define EXP_PLUGIN_GRP IOSN_EXPORT "|" IOSN_PLUGIN_GRP +#define EXP_INCLUDE_GRP IOSN_EXPORT "|" IOSN_INCLUDE_GRP +#define EXP_FBX_EXT_SDK_GRP IOSN_EXPORT "|" IOSN_FBX_EXTENTIONS_SDK + +#define EXP_UNITS_GRP EXP_ADV_OPT_GRP "|" IOSN_UNITS_GRP +#define EXP_FILEFORMAT EXP_ADV_OPT_GRP "|" IOSN_FILE_FORMAT +#define EXP_AXISCONV_GRP EXP_ADV_OPT_GRP "|" IOSN_AXISCONV_GRP +#define EXP_CACHE_GRP EXP_ADV_OPT_GRP "|" IOSN_CACHE_GRP + +#define EXP_UI EXP_ADV_OPT_GRP "|" IOSN_UI + +#define EXP_FBX_EXTENTIONS_SDK_WARNING EXP_FBX_EXT_SDK_GRP "|" IOSN_FBX_EXTENTIONS_SDK_WARNING +#define EXP_FIRST_TIME_RUN_NOTICE EXP_FIRST_TIME_RUN_NOTICE_GRP "|" IOSN_FIRST_TIME_RUN_NOTICE + +#define EXP_SCALEFACTOR EXP_AXISCONV_GRP "|" IOSN_SCALEFACTOR +#define EXP_AXISCONVERSIONMETHOD EXP_AXISCONV_GRP "|" IOSN_AXISCONVERSIONMETHOD +#define EXP_UPAXIS EXP_AXISCONV_GRP "|" IOSN_UPAXIS + +#define EXP_UNITS_SCALE EXP_UNITS_GRP "|" IOSN_UNITS_SCALE +#define EXP_MASTERSCALE EXP_UNITS_GRP "|" IOSN_MASTERSCALE + +#define EXP_DYN_SCALE_CONVERSION EXP_UNITS_GRP "|" IOSN_DYN_SCALE_CONVERSION +#define EXP_UNITSELECTOR EXP_UNITS_GRP "|" IOSN_UNITSELECTOR + +#define EXP_TOTAL_UNITS_SCALE_TB EXP_UNITS_GRP "|" IOSN_TOTAL_UNITS_SCALE_TB + +#define EXP_SHOW_UI_MODE EXP_UI "|" IOSN_SHOW_UI_MODE +#define EXP_SHOW_UI_WARNING EXP_UI "|" IOSN_SHOW_UI_WARNING +#define EXP_SHOW_WARNINGS_MANAGER EXP_UI "|" IOSN_SHOW_WARNINGS_MANAGER +#define EXP_GENERATE_LOG_DATA EXP_UI "|" IOSN_GENERATE_LOG_DATA +#define EXP_PLUGIN_VERSIONS_URL EXP_UI "|" IOSN_PLUGIN_VERSIONS_URL + +#define EXP_PRESETS EXP_PRESETS_GRP "|" IOSN_PRESETS + +#define EXP_CAMERA_GRP EXP_INCLUDE_GRP "|" IOSN_CAMERA_GRP +#define EXP_LIGHT_GRP EXP_INCLUDE_GRP "|" IOSN_LIGHT_GRP + +#define EXP_GEOMETRY EXP_INCLUDE_GRP "|" IOSN_GEOMETRY +#define EXP_AUDIO EXP_INCLUDE_GRP "|" IOSN_AUDIO +#define EXP_ANIMATION EXP_INCLUDE_GRP "|" IOSN_ANIMATION +#define EXP_PIVOTTONULLS EXP_INCLUDE_GRP "|" IOSN_PIVOTTONULLS +#define EXP_LIGHT EXP_LIGHT_GRP "|" IOSN_LIGHT +#define EXP_LIGHTATTENUATION EXP_INCLUDE_GRP "|" IOSN_LIGHTATTENUATION +#define EXP_ENVIRONMENT EXP_LIGHT_GRP "|" IOSN_ENVIRONMENT +#define EXP_CAMERA EXP_CAMERA_GRP "|" IOSN_CAMERA +#define EXP_BINDPOSE EXP_INCLUDE_GRP "|" IOSN_BINDPOSE +#define EXP_SELECTIONONLY EXP_INCLUDE_GRP "|" IOSN_SELECTIONONLY + + +#define EXP_INPUTCONNECTIONS_GRP EXP_INCLUDE_GRP "|" IOSN_INPUTCONNECTIONS_GRP +#define EXP_INPUTCONNECTIONS EXP_INPUTCONNECTIONS_GRP "|" IOSN_INPUTCONNECTIONS + +#define EXP_BYPASSRRSINHERITANCE EXP_INCLUDE_GRP "|" IOSN_BYPASSRRSINHERITANCE + +#define EXP_EMBEDTEXTURE_GRP EXP_INCLUDE_GRP "|" IOSN_EMBEDTEXTURE_GRP +#define EXP_EMBEDTEXTURE EXP_EMBEDTEXTURE_GRP "|" IOSN_EMBEDTEXTURE +#define EXP_CONVERTTOTIFF EXP_EMBEDTEXTURE "|" IOSN_CONVERTTOTIFF + + +#define EXP_CURVEFILTERS EXP_ANIMATION "|" IOSN_CURVE_FILTER + +#define EXP_DEFORMATION EXP_ANIMATION "|" IOSN_DEFORMATION +#define EXP_BAKECOMPLEXANIMATION EXP_ANIMATION "|" IOSN_BAKECOMPLEXANIMATION +#define EXP_BONE EXP_ANIMATION "|" IOSN_BONE + +#define EXP_SAMPLINGFRAMERATE EXP_ANIMATION "|" IOSN_SAMPLINGFRAMERATE +#define EXP_POINTCACHE EXP_ANIMATION "|" IOSN_POINTCACHE +#define EXP_SMOOTHKEYASUSER EXP_ANIMATION "|" IOSN_SMOOTHKEYASUSER + +#define EXP_EXTRA_GRP EXP_ANIMATION "|" IOSN_EXTRA_GRP + +#define EXP_REMOVE_SINGLE_KEY EXP_EXTRA_GRP "|" IOSN_REMOVE_SINGLE_KEY +#define EXP_NAMETAKE EXP_EXTRA_GRP "|" IOSN_NAMETAKE +#define EXP_QUATERNION EXP_EXTRA_GRP "|" IOSN_QUATERNION + +#define EXP_CONSTRAINTS_GRP EXP_ANIMATION "|" IOSN_CONSTRAINTS_GRP + +#define EXP_CONSTRAINT EXP_CONSTRAINTS_GRP "|" IOSN_CONSTRAINT +#define EXP_CHARACTER EXP_CONSTRAINTS_GRP "|" IOSN_CHARACTER + + +#define EXP_MRCUSTOMATTRIBUTES EXP_GEOMETRY "|" IOSN_MRCUSTOMATTRIBUTES +#define EXP_MESHPRIMITIVE EXP_GEOMETRY "|" IOSN_MESHPRIMITIVE +#define EXP_MESHTRIANGLE EXP_GEOMETRY "|" IOSN_MESHTRIANGLE +#define EXP_MESHPOLY EXP_GEOMETRY "|" IOSN_MESHPOLY +#define EXP_NURB EXP_GEOMETRY "|" IOSN_NURB +#define EXP_PATCH EXP_GEOMETRY "|" IOSN_PATCH +#define EXP_BIP2FBX EXP_GEOMETRY "|" IOSN_BIP2FBX +#define EXP_GEOMNORMALPERPOLY EXP_GEOMETRY "|" IOSN_GEOMNORMALPERPOLY +#define EXP_TANGENTSPACE EXP_GEOMETRY "|" IOSN_TANGENTS_BINORMALS +#define EXP_SMOOTHMESH EXP_GEOMETRY "|" IOSN_SMOOTH_MESH +#define EXP_SELECTIONSET EXP_GEOMETRY "|" IOSN_SELECTION_SET + +#define EXP_FINESTSUBDIVLEVEL EXP_GEOMETRY "|" IOSN_FINESTSUBDIVLEVEL +#define EXP_MAXBONEASBONE EXP_GEOMETRY "|" IOSN_MAXBONEASBONE +#define EXP_MAXNURBSSTEP EXP_GEOMETRY "|" IOSN_MAXNURBSSTEP +#define EXP_CREASE EXP_GEOMETRY "|" IOSN_CREASE +#define EXP_BLINDDATA EXP_GEOMETRY "|" IOSN_BLINDDATA +#define EXP_NURBSSURFACEAS EXP_GEOMETRY "|" IOSN_GEOMETRYNURBSSURFACEAS +#define EXP_SMOOTHING_GROUPS EXP_GEOMETRY "|" IOSN_SMOOTHING_GROUPS +#define EXP_HARDEDGES EXP_GEOMETRY "|" IOSN_EXP_HARDEDGES +#define EXP_ANIMATIONONLY EXP_GEOMETRY "|" IOSN_ANIMATIONONLY +#define EXP_INSTANCES EXP_GEOMETRY "|" IOSN_INSTANCES +#define EXP_CONTAINEROBJECTS EXP_GEOMETRY "|" IOSN_CONTAINEROBJECTS +#define EXP_TRIANGULATE EXP_GEOMETRY "|" IOSN_TRIANGULATE +#define EXP_EDGE_ORIENTATION EXP_GEOMETRY "|" IOSN_EDGE_ORIENTATION + +#define EXP_SELECTIONSETNAMEASPOINTCACHE EXP_POINTCACHE "|" IOSN_SELECTIONSETNAMEASPOINTCACHE + +#define EXP_GEOMETRYMESHPRIMITIVEAS EXP_GEOMETRY "|" IOSN_GEOMETRYMESHPRIMITIVEAS +#define EXP_GEOMETRYMESHTRIANGLEAS EXP_GEOMETRY "|" IOSN_GEOMETRYMESHTRIANGLEAS +#define EXP_GEOMETRYMESHPOLYAS EXP_GEOMETRY "|" IOSN_GEOMETRYMESHPOLYAS +#define EXP_GEOMETRYNURBSAS EXP_GEOMETRY "|" IOSN_GEOMETRYNURBSAS +#define EXP_GEOMETRYPATCHAS EXP_GEOMETRY "|" IOSN_GEOMETRYPATCHAS + +#define EXP_BAKEFRAMESTART EXP_BAKECOMPLEXANIMATION "|" IOSN_BAKEFRAMESTART +#define EXP_BAKEFRAMEEND EXP_BAKECOMPLEXANIMATION "|" IOSN_BAKEFRAMEEND +#define EXP_BAKEFRAMESTEP EXP_BAKECOMPLEXANIMATION "|" IOSN_BAKEFRAMESTEP + +#define EXP_BAKE_RESAMPLE_ANIMATION_CURVES EXP_BAKECOMPLEXANIMATION "|" IOSN_RESAMPLE_ANIMATION_CURVES + +#define EXP_BAKEFRAMESTARTNORESET EXP_BAKECOMPLEXANIMATION "|" IOSN_BAKEFRAMESTARTNORESET +#define EXP_BAKEFRAMEENDNORESET EXP_BAKECOMPLEXANIMATION "|" IOSN_BAKEFRAMEENDNORESET +#define EXP_BAKEFRAMESTEPNORESET EXP_BAKECOMPLEXANIMATION "|" IOSN_BAKEFRAMESTEPNORESET + +#define EXP_FBX EXP_ADV_OPT_GRP "|" IOSN_FBX +#define EXP_DXF EXP_ADV_OPT_GRP "|" IOSN_DXF +#define EXP_COLLADA EXP_ADV_OPT_GRP "|" IOSN_COLLADA + +// note: EXP_FILEFORMAT group is not visible +#define EXP_OBJ EXP_FILEFORMAT "|" IOSN_OBJ +#define EXP_3DS EXP_FILEFORMAT "|" IOSN_3DS +#define EXP_MOTION_BASE EXP_FILEFORMAT "|" IOSN_MOTION_BASE +#define EXP_BIOVISION_BVH EXP_FILEFORMAT "|" IOSN_BIOVISION_BVH +#define EXP_ACCLAIM_ASF EXP_FILEFORMAT "|" IOSN_ACCLAIM_ASF +#define EXP_ACCLAIM_AMC EXP_FILEFORMAT "|" IOSN_ACCLAIM_AMC + + +#define EXP_ASCIIFBX EXP_FBX "|" IOSN_ASCIIFBX + +#define EXP_CACHE_SIZE EXP_CACHE_GRP "|" IOSN_CACHE_SIZE + +#define EXP_SHAPE EXP_DEFORMATION "|" IOSN_SHAPE +#define EXP_SKINS EXP_DEFORMATION "|" IOSN_SKINS + +#define EXP_APPLYCSTKEYRED EXP_CURVEFILTERS "|" IOSN_APPLYCSTKEYRED +#define EXP_SAMPLINGRATE EXP_APPLYCSTKEYRED "|" IOSN_SAMPLINGRATE +#define EXP_CSTKEYREDTPREC EXP_APPLYCSTKEYRED "|" IOSN_CSTKEYREDTPREC +#define EXP_CSTKEYREDRPREC EXP_APPLYCSTKEYRED "|" IOSN_CSTKEYREDRPREC +#define EXP_CSTKEYREDSPREC EXP_APPLYCSTKEYRED "|" IOSN_CSTKEYREDSPREC +#define EXP_CSTKEYREDOPREC EXP_APPLYCSTKEYRED "|" IOSN_CSTKEYREDOPREC +#define EXP_AUTOTANGENTSONLY EXP_APPLYCSTKEYRED "|" IOSN_AUTOTANGENTSONLY + +#define EXP_APPLYKEYREDUCE EXP_CURVEFILTERS "|" IOSN_APPLYKEYREDUCE +#define EXP_KEYREDUCEPREC EXP_APPLYKEYREDUCE "|" IOSN_KEYREDUCEPREC +#define EXP_APPLYKEYSONFRM EXP_APPLYKEYREDUCE "|" IOSN_APPLYKEYSONFRM +#define EXP_APPLYKEYSYNC EXP_APPLYKEYREDUCE "|" IOSN_APPLYKEYSYNC + +#define EXP_APPLYUNROLL EXP_CURVEFILTERS "|" IOSN_APPLYUNROLL +#define EXP_UNROLLPREC EXP_APPLYUNROLL "|" IOSN_UNROLLPREC +#define EXP_UNROLLPATH EXP_APPLYUNROLL "|" IOSN_UNROLLPATH +#define EXP_UNROLLFORCEAUTO EXP_APPLYUNROLL "|" IOSN_UNROLLFORCEAUTO + +#define EXP_PLUGIN_UI_WIDTH EXP_PLUGIN_GRP "|" IOSN_PLUGIN_UI_WIDTH +#define EXP_PLUGIN_UI_HEIGHT EXP_PLUGIN_GRP "|" IOSN_PLUGIN_UI_HEIGHT +#define EXP_PRESET_SELECTED EXP_PLUGIN_GRP "|" IOSN_PRESET_SELECTED + +#define EXP_UIL EXP_PLUGIN_GRP "|" IOSN_UIL +#define EXP_PLUGIN_PRODUCT_FAMILY EXP_PLUGIN_GRP "|" IOSN_PLUGIN_PRODUCT_FAMILY + +#define EXP_PLUGIN_UI_XPOS EXP_PLUGIN_GRP "|" IOSN_PLUGIN_UI_XPOS +#define EXP_PLUGIN_UI_YPOS EXP_PLUGIN_GRP "|" IOSN_PLUGIN_UI_YPOS + +#define EXP_BUTTON_WEB_UPDATE EXP_INFORMATION_GRP "|" IOSN_BUTTON_WEB_UPDATE +#define EXP_PI_VERSION EXP_INFORMATION_GRP "|" IOSN_PI_VERSION + +#define EXP_BUTTON_EDIT EXP_PLUGIN_GRP "|" IOSN_BUTTON_EDIT +#define EXP_BUTTON_OK EXP_PLUGIN_GRP "|" IOSN_BUTTON_OK +#define EXP_BUTTON_CANCEL EXP_PLUGIN_GRP "|" IOSN_BUTTON_CANCEL +#define EXP_MENU_EDIT_PRESET EXP_PLUGIN_GRP "|" IOSN_MENU_EDIT_PRESET +#define EXP_MENU_SAVE_PRESET EXP_PLUGIN_GRP "|" IOSN_MENU_SAVE_PRESET +// internal use +#define EXP_USETMPFILEPERIPHERAL EXP_PLUGIN_GRP "|" IOSN_USETMPFILEPERIPHERAL +#define EXP_CONSTRUCTIONHISTORY EXP_PLUGIN_GRP "|" IOSN_CONSTRUCTIONHISTORY + +#define EXP_COLLADA_TRIANGULATE EXP_COLLADA "|" IOSN_COLLADA_TRIANGULATE +#define EXP_COLLADA_SINGLEMATRIX EXP_COLLADA "|" IOSN_COLLADA_SINGLEMATRIX +#define EXP_COLLADA_FRAME_RATE EXP_COLLADA "|" IOSN_COLLADA_FRAME_RATE + +#define EXP_DXF_TRIANGULATE EXP_DXF "|" IOSN_DXF_TRIANGULATE +#define EXP_DXF_DEFORMATION EXP_DXF "|" IOSN_DXF_DEFORMATION + +#define EXP_OBJ_TRIANGULATE EXP_OBJ "|" IOSN_OBJ_TRIANGULATE +#define EXP_OBJ_DEFORMATION EXP_OBJ "|" IOSN_OBJ_DEFORMATION + +#define EXP_3DS_REFERENCENODE EXP_3DS "|" IOSN_3DS_REFERENCENODE +#define EXP_3DS_TEXTURE EXP_3DS "|" IOSN_3DS_TEXTURE +#define EXP_3DS_MATERIAL EXP_3DS "|" IOSN_3DS_MATERIAL +#define EXP_3DS_ANIMATION EXP_3DS "|" IOSN_3DS_ANIMATION +#define EXP_3DS_MESH EXP_3DS "|" IOSN_3DS_MESH +#define EXP_3DS_LIGHT EXP_3DS "|" IOSN_3DS_LIGHT +#define EXP_3DS_CAMERA EXP_3DS "|" IOSN_3DS_CAMERA +#define EXP_3DS_AMBIENT_LIGHT EXP_3DS "|" IOSN_3DS_AMBIENT_LIGHT +#define EXP_3DS_RESCALING EXP_3DS "|" IOSN_3DS_RESCALING +#define EXP_3DS_TEXUVBYPOLY EXP_3DS "|" IOSN_3DS_TEXUVBYPOLY + +#define EXP_FBX_TEMPLATE EXP_FBX "|" IOSN_TEMPLATE +#define EXP_FBX_PIVOT EXP_FBX "|" IOSN_PIVOT +#define EXP_FBX_GLOBAL_SETTINGS EXP_FBX "|" IOSN_GLOBAL_SETTINGS +#define EXP_FBX_CHARACTER EXP_FBX "|" IOSN_CHARACTER +#define EXP_FBX_CONSTRAINT EXP_FBX "|" IOSN_CONSTRAINT +#define EXP_FBX_GOBO EXP_FBX "|" IOSN_GOBO +#define EXP_FBX_SHAPE EXP_FBX "|" IOSN_SHAPE +#define EXP_FBX_MATERIAL EXP_FBX "|" IOSN_MATERIAL +#define EXP_FBX_TEXTURE EXP_FBX "|" IOSN_TEXTURE +#define EXP_FBX_MODEL EXP_FBX "|" IOSN_MODEL +#define EXP_FBX_AUDIO EXP_FBX "|" IOSN_AUDIO +#define EXP_FBX_ANIMATION EXP_FBX "|" IOSN_ANIMATION +#define EXP_FBX_EMBEDDED EXP_FBX "|" IOSN_EMBEDDED +#define EXP_FBX_PASSWORD EXP_FBX "|" IOSN_PASSWORD +#define EXP_FBX_PASSWORD_ENABLE EXP_FBX "|" IOSN_PASSWORD_ENABLE +#define EXP_FBX_COLLAPSE_EXTERNALS EXP_FBX "|" IOSN_COLLAPSE_EXTERNALS +#define EXP_FBX_COMPRESS_ARRAYS EXP_FBX "|" IOSN_COMPRESS_ARRAYS +#define EXP_FBX_COMPRESS_LEVEL EXP_FBX "|" IOSN_COMPRESS_LEVEL +#define EXP_FBX_COMPRESS_MINSIZE EXP_FBX "|" IOSN_COMPRESS_MINSIZE +#define EXP_FBX_EMBEDDED_PROPERTIES_SKIP EXP_FBX "|" IOSN_EMBEDDED_PROPERTIES_SKIP +#define EXP_FBX_EXPORT_FILE_VERSION EXP_FBX "|" IOSN_EXPORT_FILE_VERSION + + +// end of export defined path +//--------------------------- + +//--------------------------- +// Motion files related options +#define IOSN_MOTION_START "MotionStart" +#define IOSN_MOTION_FRAME_COUNT "MotionFrameCount" +#define IOSN_MOTION_FRAME_RATE "MotionFrameRate" +#define IOSN_MOTION_ACTOR_PREFIX "MotionActorPrefix" +#define IOSN_MOTION_RENAME_DUPLICATE_NAMES "MotionRenameDuplicateNames" +#define IOSN_MOTION_EXACT_ZERO_AS_OCCLUDED "MotionExactZeroAsOccluded" +#define IOSN_MOTION_SET_OCCLUDED_TO_LAST_VALID_POSITION "MotionSetOccludedToLastValidPos" +#define IOSN_MOTION_AS_OPTICAL_SEGMENTS "MotionAsOpticalSegments" +#define IOSN_MOTION_ASF_SCENE_OWNED "MotionASFSceneOwned" +#define IOSN_MOTION_MOTION_FROM_GLOBAL_POSITION "MotionFromGlobalPosition" +#define IOSN_MOTION_GAPS_AS_VALID_DATA "MotionGapsAsValidData" +#define IOSN_MOTION_C3D_REAL_FORMAT "MotionC3DRealFormat" +#define IOSN_MOTION_CREATE_REFERENCE_NODE "MotionCreateReferenceNode" +#define IOSN_MOTION_TRANSLATION "MotionTranslation" +#define IOSN_MOTION_BASE_T_IN_OFFSET "MotionBaseTInOffset" +#define IOSN_MOTION_BASE_R_IN_PREROTATION "MotionBaseRInPrerotation" +#define IOSN_MOTION_DUMMY_NODES "MotionDummyNodes" +#define IOSN_MOTION_LIMITS "MotionLimits" +#define IOSN_MOTION_FRAME_RATE_USED "MotionFrameRateUsed" +#define IOSN_MOTION_FRAME_RANGE "MotionFrameRange" +#define IOSN_MOTION_WRITE_DEFAULT_AS_BASE_TR "MotionWriteDefaultAsBaseTR" + +// Import + +//Motion Base options +#define IMP_MOB_START IMP_MOTION_BASE "|" IOSN_MOTION_START +#define IMP_MOB_FRAME_COUNT IMP_MOTION_BASE "|" IOSN_MOTION_FRAME_COUNT +#define IMP_MOB_FRAME_RATE IMP_MOTION_BASE "|" IOSN_MOTION_FRAME_RATE +#define IMP_MOB_ACTOR_PREFIX IMP_MOTION_BASE "|" IOSN_MOTION_ACTOR_PREFIX +#define IMP_MOB_RENAME_DUPLICATE_NAMES IMP_MOTION_BASE "|" IOSN_MOTION_RENAME_DUPLICATE_NAMES +#define IMP_MOB_EXACT_ZERO_AS_OCCLUDED IMP_MOTION_BASE "|" IOSN_MOTION_EXACT_ZERO_AS_OCCLUDED +#define IMP_MOB_SET_OCCLUDED_TO_LAST_VALID_POSITION IMP_MOTION_BASE "|" IOSN_MOTION_SET_OCCLUDED_TO_LAST_VALID_POSITION +#define IMP_MOB_AS_OPTICAL_SEGMENTS IMP_MOTION_BASE "|" IOSN_MOTION_AS_OPTICAL_SEGMENTS +#define IMP_MOB_ASF_SCENE_OWNED IMP_MOTION_BASE "|" IOSN_MOTION_ASF_SCENE_OWNED + +// Acclaim AMC options +#define IMP_ACCLAIM_AMC_CREATE_REFERENCE_NODE IMP_ACCLAIM_AMC "|" IOSN_MOTION_CREATE_REFERENCE_NODE +#define IMP_ACCLAIM_AMC_MOTION_BASE_T_IN_OFFSET IMP_ACCLAIM_AMC "|" IOSN_MOTION_BASE_T_IN_OFFSET +#define IMP_ACCLAIM_AMC_MOTION_BASE_R_IN_PREROTATION IMP_ACCLAIM_AMC "|" IOSN_MOTION_BASE_R_IN_PREROTATION +#define IMP_ACCLAIM_AMC_DUMMY_NODES IMP_ACCLAIM_AMC "|" IOSN_MOTION_DUMMY_NODES +#define IMP_ACCLAIM_AMC_MOTION_LIMITS IMP_ACCLAIM_AMC "|" IOSN_MOTION_LIMITS + +// Acclaim ASF options +#define IMP_ACCLAIM_ASF_CREATE_REFERENCE_NODE IMP_ACCLAIM_ASF "|" IOSN_MOTION_CREATE_REFERENCE_NODE +#define IMP_ACCLAIM_ASF_MOTION_BASE_T_IN_OFFSET IMP_ACCLAIM_ASF "|" IOSN_MOTION_BASE_T_IN_OFFSET +#define IMP_ACCLAIM_ASF_MOTION_BASE_R_IN_PREROTATION IMP_ACCLAIM_ASF "|" IOSN_MOTION_BASE_R_IN_PREROTATION +#define IMP_ACCLAIM_ASF_DUMMY_NODES IMP_ACCLAIM_ASF "|" IOSN_MOTION_DUMMY_NODES +#define IMP_ACCLAIM_ASF_MOTION_LIMITS IMP_ACCLAIM_ASF "|" IOSN_MOTION_LIMITS + +// Biovision BVH options +#define IMP_BIOVISION_BVH_CREATE_REFERENCE_NODE IMP_BIOVISION_BVH "|" IOSN_MOTION_CREATE_REFERENCE_NODE + +// Motion Analysis HTR options +#define IMP_MOTIONANALYSIS_HTR_CREATE_REFERENCE_NODE IMP_MOTIONANALYSIS_HTR "|" IOSN_MOTION_CREATE_REFERENCE_NODE +#define IMP_MOTIONANALYSIS_HTR_MOTION_BASE_T_IN_OFFSET IMP_MOTIONANALYSIS_HTR "|" IOSN_MOTION_BASE_T_IN_OFFSET +#define IMP_MOTIONANALYSIS_HTR_MOTION_BASE_R_IN_PREROTATION IMP_MOTIONANALYSIS_HTR "|" IOSN_MOTION_BASE_R_IN_PREROTATION + +// Export + +//Motion Base options +#define EXP_MOB_START EXP_MOTION_BASE "|" IOSN_MOTION_START +#define EXP_MOB_FRAME_COUNT EXP_MOTION_BASE "|" IOSN_MOTION_FRAME_COUNT +#define EXP_MOB_FROM_GLOBAL_POSITION EXP_MOTION_BASE "|" IOSN_MOTION_MOTION_FROM_GLOBAL_POSITION +#define EXP_MOB_FRAME_RATE EXP_MOTION_BASE "|" IOSN_MOTION_FRAME_RATE +#define EXP_MOB_GAPS_AS_VALID_DATA EXP_MOTION_BASE "|" IOSN_MOTION_GAPS_AS_VALID_DATA +#define EXP_MOB_C3D_REAL_FORMAT EXP_MOTION_BASE "|" IOSN_MOTION_C3D_REAL_FORMAT +#define EXP_MOB_ASF_SCENE_OWNED EXP_MOTION_BASE "|" IOSN_MOTION_ASF_SCENE_OWNED + +//Acclaim AMC options +#define EXP_ACCLAIM_AMC_MOTION_TRANSLATION EXP_ACCLAIM_AMC "|" IOSN_MOTION_TRANSLATION +#define EXP_ACCLAIM_AMC_FRAME_RATE_USED EXP_ACCLAIM_AMC "|" IOSN_MOTION_FRAME_RATE_USED +#define EXP_ACCLAIM_AMC_FRAME_RANGE EXP_ACCLAIM_AMC "|" IOSN_MOTION_FRAME_RANGE +#define EXP_ACCLAIM_AMC_WRITE_DEFAULT_AS_BASE_TR EXP_ACCLAIM_AMC "|" IOSN_MOTION_WRITE_DEFAULT_AS_BASE_TR + +//Acclaim ASF options +#define EXP_ACCLAIM_ASF_MOTION_TRANSLATION EXP_ACCLAIM_ASF "|" IOSN_MOTION_TRANSLATION +#define EXP_ACCLAIM_ASF_FRAME_RATE_USED EXP_ACCLAIM_ASF "|" IOSN_MOTION_FRAME_RATE_USED +#define EXP_ACCLAIM_ASF_FRAME_RANGE EXP_ACCLAIM_ASF "|" IOSN_MOTION_FRAME_RANGE +#define EXP_ACCLAIM_ASF_WRITE_DEFAULT_AS_BASE_TR EXP_ACCLAIM_ASF "|" IOSN_MOTION_WRITE_DEFAULT_AS_BASE_TR + +//Biovision BVH options +#define EXP_BIOVISION_BVH_MOTION_TRANSLATION EXP_BIOVISION_BVH "|" IOSN_MOTION_TRANSLATION + +#include + +#endif /* _FBXSDK_FILEIO_IO_SETTINGS_PATH_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxprogress.h b/libs/fbx/include/fbxsdk/fileio/fbxprogress.h new file mode 100644 index 00000000..38d9c67e --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxprogress.h @@ -0,0 +1,102 @@ +/**************************************************************************************** + + 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 fbxprogress.h +#ifndef _FBXSDK_FILEIO_PROGRESS_H_ +#define _FBXSDK_FILEIO_PROGRESS_H_ + +#include + +#include + +#include + +typedef bool (*FbxProgressCallback)(void* pArgs, float pPercentage, const char* pStatus); + +#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN) + class FbxSpinLock; +#endif + +/** Class for progress reporting +* \nosubgrouping +*/ +class FBXSDK_DLL FbxProgress +{ +public: + /** Register a callback function for progress reporting in single thread mode. + * \param pCallback Pointer of the callback function. + * \param pArgs Pointer to the optional arguments passed to the callback function. */ + void SetProgressCallback(FbxProgressCallback pCallback, void* pArgs=NULL); + + /** Set the total amount of workload needed to complete the progress. + * \param pTotal Total amount of workload. + * \remark The default total is 100.0. */ + void SetTotal(float pTotal); + + /** Set the threshold at which the progress callback should be called. + * \param pThreshold The threshold value, between 0.0 and 100.0, that triggers the callback. + * \remark The default threshold is 1.0, meaning that every 1% the callback is triggered. */ + void SetThreshold(float pThreshold); + + /** Update current progress with recent workload. + * \param pDelta Delta amount of workload progressed so far. + * \param pStatus Optional current progress status string. + * \remark If a callback is set, it will be called upon caling this function. */ + void Update(float pDelta, const char* pStatus=NULL); + + //! Reset the progress status percentage and status string. + void Reset(); + + /** Retrieve the progress status. + * \param pStatus Optional current progress status string. + * \return The current progress percentage. */ + float GetProgress(FbxString* pStatus=NULL); + + /** Set the progress status to completed. + * \param pStatus Optional current progress status string. */ + void Complete(const char* pStatus=NULL); + + //! Cancel this progress. + void Cancel(); + + //! Query whether user canceled this progress. + inline bool IsCanceled() const { return mCanceled; } + +/***************************************************************************************************************************** +** 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 + FbxProgress(); + ~FbxProgress(); + +private: + void Acquire(); + void Release(); + float GetPercent() const; + bool ExecuteCallback() const; + +#if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN) + FbxSpinLock* mLock; +#endif + float mCurrent; + float mPrevious; + float mTotal; + float mThreshold; + FbxString mStatus; + FbxProgressCallback mCallback; + void* mCallbackArgs; + bool mCanceled; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_FILEIO_PROGRESS_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxreader.h b/libs/fbx/include/fbxsdk/fileio/fbxreader.h new file mode 100644 index 00000000..81eec0e0 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxreader.h @@ -0,0 +1,270 @@ +/**************************************************************************************** + + 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 fbxreader.h +#ifndef _FBXSDK_FILEIO_READER_H_ +#define _FBXSDK_FILEIO_READER_H_ + +#include + +#include +#include +#include +#include + +#include + +class FbxManager; +class FbxFile; +class FbxStream; +class FbxObject; +class FbxDocument; +class FbxDocumentInfo; +class FbxScene; +class FbxImporter; +class FbxIOSettings; +class FbxAxisSystem; +class FbxStatistics; +class FbxSystemUnit; +class FbxNode; +class FbxProgress; +class FbxTakeInfo; + + /** Base class of other readers used internally. + * This class provides the interfaces for reading files. + * + * The role of the reader is to effectively "read" specific file data + * vs the role of the importer is to select a specific reader + * and launch the reading of a file through that reader. + * \see FbxImporter + * + * ex: + * - FbxReaderFbx5 can read FBX 5 format files + * - FbxReaderFbx6 can read FBX 6 format files + * - FbxReaderFbx7 can read FBX 7 format files + * - FbxReaderCollada can read Collada files + * - FbxReaderDxf can read Dxf files + * - ... etc. + * + * A SDK user should - normally - not use this class, + * except if a custom reader must be created for plug-in extension, + * then FbxReader must be the base class for + * the new custom reader in that particular situation. + * \nosubgrouping + */ + +class FBXSDK_DLL FbxReader +{ +public: + /** Constructor. + * \param pManager The FbxManager Object. + * \param pID Id for current reader. + * \param pStatus The FbxStatus object to hold error codes. + */ + FbxReader(FbxManager& pManager, int pID, FbxStatus& pStatus); + + /** Destructor. + */ + virtual ~FbxReader(); + + /** Information type to request. + * \remarks Used internally to get reader file information. + */ + enum EInfoRequest + { + eInfoExtension, //!< To get the file ext for a reader ex: "FBX". + eInfoDescriptions, //!< To get the file description for a reader ex: "Autodesk FBX (*.fbx)". + eReserved1 = 0xFBFB, + }; + + /** Flags for reading parts of file. + * \remarks Used internally when an importer is initialized to get some information very fast. + */ + enum EFileOpenSpecialFlags + { + eParseForGlobalSettings = 1, //!< Used for reading the Global settings section when an importer is initialized. + eParseForStatistics = 2 //!< Used for reading a group of statistics when an importer is initialized. + }; + + /** \internal Helper typedef for passing FbxReader creator function as argument (used internally) */ + typedef FbxReader* (*CreateFuncType)(FbxManager& pManager, FbxImporter& pImporter, int pSubID, int pPluginID); + + /** \internal Helper typedef for passing FbxIOSettings creator function as argument (used internally) */ + typedef void (*IOSettingsFillerFuncType)(FbxIOSettings& pIOS); + + /** \internal Helper typedef for passing EInfoRequest function as argument (used internally) */ + typedef void* (*GetInfoFuncType)(EInfoRequest pRequest, int pReaderTypeId); + + /** Returns the file version. + * \param pMajor Major version. + * \param pMinor Minor version. + * \param pRevision Revision version. + */ + virtual void GetVersion(int& pMajor, int& pMinor, int& pRevision){ pMajor = pMinor = pRevision = 0; } + + /** Opens the file with default flag + * \param pFileName Name of the File to open + * \return If the file opens successfully return \c true, otherwise return \c false. + */ + virtual bool FileOpen(char* pFileName) = 0; + + /** Opens the stream with default flag + * \param pStream stream to open + * \param pStreamData user-defined stream data + * \return If the stream opens successfully return \c true, otherwise return \c false. + */ + virtual bool FileOpen(FbxStream* pStream, void* pStreamData); + + /** Closes the file stream + * \return \c false + */ + virtual bool FileClose() = 0; + + /** Checks if the file stream is open. + * \return \c false. + */ + virtual bool IsFileOpen() = 0; + + /** Returns file stream options + * \param pParseFileAsNeeded Sets whether to parse file as read options + * \return true on success, otherwise return false. + */ + virtual bool GetReadOptions(bool pParseFileAsNeeded = true) = 0; + + /** Reads file with stream options + * \param pDocument FbxDocument to store the file data + * \return \c false. + */ + virtual bool Read(FbxDocument* pDocument) = 0; + +#ifndef FBXSDK_ENV_WINSTORE + /** 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. + * \remark This function has no implementation in this class. Only sub-class should implement it as needed. For example, + * FBX 6 and FBX 7 does implement it. + */ + virtual void PluginReadParameters(FbxObject& pParams); +#endif /* !FBXSDK_ENV_WINSTORE */ + + /** Opens the file with specific EFileOpenSpecialFlags + * \param pFileName Name of the File to open. + * \param pFlags The EFileOpenSpecialFlags to open with + * \return If the file opens successfully return true, otherwise return false. + */ + virtual bool FileOpen(char* pFileName, EFileOpenSpecialFlags /*pFlags*/){ return FileOpen(pFileName); } + + /** Returns the system axis information and file system units from the file + * \param pAxisSystem Axis system in file + * \param pSystemUnits System unit in file + * \return \c false. + */ + virtual bool GetAxisInfo(FbxAxisSystem* /*pAxisSystem*/, FbxSystemUnit* /*pSystemUnits*/){ return false; } + + /** Returns statistics from the file + * \param pStats Statistics in the file. + * \return \c false. + */ + virtual bool GetStatistics(FbxStatistics* /*pStats*/){ return false; } + + /** 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) { pTimeMode = FbxTime::eDefaultMode; return false; } + + + /** Returns the scene info from the file. + * \return NULL. + */ + virtual FbxDocumentInfo* GetSceneInfo(){return NULL;} + + /** Returns the list of take infos from the file. + * \return NULL + */ + virtual FbxArray* GetTakeInfo(){return NULL;} + + /** If default camera resolution is OK, returns information about the resolution of the render. + * \param pCamName Default camera name. + * \param pResolutionMode Default resolution mode. + * \param pW Default resolution width. + * \param pH Default resolution height. + * \return \c true If default camera resolution is OK, \c false Otherwise. + */ + virtual bool GetDefaultRenderResolution(FbxString& pCamName, FbxString& pResolutionMode, double& pW, double& pH); + + /** Judges if the format of the file is was created by an Autodesk plug-in. + * An internal (genuine) plug-in is one created by the Autodesk FBX product team. + * \return \c true If the file format is internal plug-in , \c false Otherwise. + */ + bool IsGenuine(); + + /** Access to a IOSettings object. + * \return A pointer to IOSettings used for this reader or NULL if the object + * has not been allocated. + */ + virtual FbxIOSettings * GetIOSettings(); + + /** Set the IOSettings pointer to be used for this reader instance. + * \param pIOSettings + */ + virtual void SetIOSettings(FbxIOSettings * pIOSettings); + + /** 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*/){} + + /** Returns true if this reader supports FbxStream I/O. Default value is false. */ + virtual bool SupportsStreams() 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 + virtual bool FileOpen(FbxFile * pFile); + + FbxStatus& GetStatus() { return mStatus; } + +protected: + void SetDefaultRenderResolution(const char* pCamName, const char* pResolutionMode, double pW, double pH); +#ifndef FBXSDK_ENV_WINSTORE + void PluginsReadBegin(FbxScene& pScene); + void PluginsRead(const char* pName, const char* pVersion); + void PluginsReadEnd(FbxScene& pScene); +#endif /* !FBXSDK_ENV_WINSTORE */ + FbxReader& operator=(FbxReader const&) { return *this; } + virtual bool CheckDuplicateNodeNames(FbxNode* pRootNode, FbxString& pDuplicateNodeNameList); + + FbxStatus& mStatus; + FbxManager& mManager; + FbxIODefaultRenderResolution* mData; + +private: + int mInternalID; + FbxIOSettings* mIOSettings; + + friend struct FbxReaderFbx7_Impl; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +//! Helper to access the IOSetting object pointer as a ref ex: IOS_REF.GetBoolProp( ... ); +#define IOS_REF (*GetIOSettings()) + +#include + +#endif /* _FBXSDK_FILEIO_READER_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxstatistics.h b/libs/fbx/include/fbxsdk/fileio/fbxstatistics.h new file mode 100644 index 00000000..b6d40345 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxstatistics.h @@ -0,0 +1,107 @@ +/**************************************************************************************** + + 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 fbxstatistics.h +#ifndef _FBXSDK_FILEIO_STATISTICS_H_ +#define _FBXSDK_FILEIO_STATISTICS_H_ + +#include + +#include +#include + +#include + +/** This class is a basic class to get the quantity of items. + * User processes the statistics raw data by deriving FbxStatistics class and overrides \c AddItem method. + * When overriding \c AddItem method, User must store item's name and item's count by pair which means + * The index of one item's name in array \c mItemName is the same as the index of this item's count in array \c mItemCount. + * + * \code Here is a code snippet to show how it used. + * //Define my own statistics class. + * class MyStatistics : public FbxStatistics + * { + * public: + virtual bool AddItem(FbxString& pItemName, int pItemCount) + { + mItemName.Add( FbxSdkNew< FbxString >(pItemName) ); + mItemCount.Add( pItemCount); + return true; + }; + * }; + * + * FbxManager* lSdkManager = FbxManager::Create(); + * FbxScene* lScene = FbxScene::Create( lSdkManager, "Scene"); + * FbxNode* lNode1 = FbxNode::Create(lScene, "Node1"); + * FbxNode* lNode2 = FbxNode::Create(lScene, "Node2"); + * FbxNode* lNode3 = FbxNode::Create(lScene, "Node3"); + * FbxNode* lNode4 = FbxNode::Create(lScene, "Node4"); + * lScene.AddNode(lNode1); + * lScene.AddNode(lNode2); + * lScene.AddNode(lNode3); + * MyStatistics lStatistics; + * lStatistics.AddItem("Node_Count", lScene.GetNodeCount() ); + * FbxString lItemName; + * int lItemCount; + * if( lStatistics.GetItemPair( 0, lItemName, lItemCount)) + * { + * //do something + * } + * \endcode + + * \nosubgrouping + */ +class FBXSDK_DLL FbxStatistics +{ +public: + /// \name Constructor and Destructor. + //@{ + FbxStatistics(); + virtual ~FbxStatistics(); + //@} + + //! Reset the statistics. + void Reset(); + + //! Get the number of items. + int GetNbItems() const; + + /** Get the statistics information by pair. + * \param pNum The index of statistics data to be got. + * \param pItemName Output the item's name. + * \param pItemCount Output the item's count. + * \return \c True if successful, \c False otherwise. + */ + bool GetItemPair(int pNum, FbxString& pItemName, int& pItemCount) const; + + /** Assignment operator. + * \param pStatistics FbxStatistics assigned to this one. + */ + FbxStatistics& operator=(const FbxStatistics& pStatistics); + +protected: + /** virtual function to define the process of the incoming statistics data. + * \param pItemName The item's name + * \param pItemCount The item's count. + * \return False. + */ + virtual bool AddItem(FbxString& /*pItemName*/, int /*pItemCount*/) { return false; }; + + //! An array to store item's name. + FbxArray mItemName; + + //! An array to store item's count. + FbxArray mItemCount; +}; + +#include + +#endif /* _FBXSDK_FILEIO_STATISTICS_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxstatisticsfbx.h b/libs/fbx/include/fbxsdk/fileio/fbxstatisticsfbx.h new file mode 100644 index 00000000..f85950a3 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxstatisticsfbx.h @@ -0,0 +1,42 @@ +/**************************************************************************************** + + 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 fbxstatisticsfbx.h +#ifndef _FBXSDK_FILEIO_STATISTICS_FBX_H_ +#define _FBXSDK_FILEIO_STATISTICS_FBX_H_ + +#include + +#include + +#include + +/***************************************************************************************************************************** +** 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 FbxStatisticsFbx : public FbxStatistics +{ +public: + virtual bool AddItem(FbxString& pItemName, int pItemCount) + { + mItemName.Add( FbxNew< FbxString >(pItemName) ); + mItemCount.Add( pItemCount); + return true; + }; +}; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +#include + +#endif /* _FBXSDK_FILEIO_STATISTICS_FBX_H_ */ diff --git a/libs/fbx/include/fbxsdk/fileio/fbxwriter.h b/libs/fbx/include/fbxsdk/fileio/fbxwriter.h new file mode 100644 index 00000000..41930ab2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/fileio/fbxwriter.h @@ -0,0 +1,244 @@ +/**************************************************************************************** + + 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 fbxwriter.h +#ifndef _FBXSDK_FILEIO_WRITER_H_ +#define _FBXSDK_FILEIO_WRITER_H_ + +#include + +#include + +#include + +class FbxStatus; +class FbxManager; +class FbxFile; +class FbxStream; +class FbxObject; +class FbxDocument; +class FbxScene; +class FbxExporter; +class FbxIO; +class FbxIOSettings; +class FbxProgress; + +#define IOSP GetIOSettings() + + /** Base class of other writers used internally. + * This class provides the interfaces for writing files. + * + * The role of the writer is to effectively "write" specific file data + * vs the role of the exporter is to select a specific writer + * and launch the writing of a file through that writer. + * \see FbxExporter + * + * ex: + * - FbxWriterFbx5 can write FBX 5 format files + * - FbxWriterFbx6 can write FBX 6 format files + * - FbxWriterFbx7 can write FBX 7 format files + * - FbxWriterCollada can write Collada files + * - FbxWriterDxf can write Dxf files + * - ... etc. + * + * A SDK user should - normally - not use this class, + * except if a custom writer must be created for plug-in extension, + * then FbxWriter must be the base class for + * the new custom writer in that particular situation. + * \nosubgrouping + */ +class FBXSDK_DLL FbxWriter +{ +public: + /** Constructor. + * \param pManager The FbxManager Object. + * \param pID Id for current writer. + * \param pStatus The FbxStatus object to hold error codes. + */ + FbxWriter(FbxManager& pManager, int pID, FbxStatus& pStatus); + + /** Destructor. */ + virtual ~FbxWriter(); + + /** Information type to request. + * \remarks Used internally to get writer file information. + */ + enum EInfoRequest + { + eInfoExtension, //!< To get the file ext for a writer ex: "FBX". + eInfoDescriptions, //!< To get the file description for a writer ex:"Autodesk FBX (*.fbx)". + eInfoVersions, //!< To get the file version for a writer ex: 7100. + eInfoCompatibleDesc, //!< To get the file compatible description for a writer. + eInfoUILabel, //!< To get the file UI label to show for a writer ex: file labels shown in "Open file dialog". + eReserved1 = 0xFBFB, + }; + + //! Helper typedef for passing FbxWriter creator function as argument (used internally). + typedef FbxWriter* (*CreateFuncType)(FbxManager& pManager, FbxExporter& pExporter, int pSubID, int pPluginID); + + //! Helper typedef for passing FbxIOSettings creator function as argument (used internally). + typedef void (*IOSettingsFillerFuncType)(FbxIOSettings& pIOS); + + //! Helper typedef for passing EInfoRequest function as argument (used internally). + typedef void* (*GetInfoFuncType)(EInfoRequest pRequest, int pWriterTypeId); + + /** Creates a new file. + * \param pFileName The name of the newly created file. + */ + virtual bool FileCreate(char* pFileName) = 0; + + /** Creates a new file via a stream. + * \param pStream The stream to write to. + * \param pStreamData the user-defined stream data to be written. + */ + virtual bool FileCreate(FbxStream* pStream, void* pStreamData); + + /** Closes the file. + */ + virtual bool FileClose() = 0; + + /** Test if the file is open. + */ + virtual bool IsFileOpen() = 0; + + /** Setup write options. + */ + virtual void GetWriteOptions() = 0; + + /** Writes content to the specified file with given stream options + * \param pDocument FbxDocument to write file data to. + */ + virtual bool Write(FbxDocument* pDocument) = 0; + + /** Pre-processes the scene. + * \param pScene The scene needs to be pre-processed. + */ + virtual bool PreprocessScene(FbxScene &pScene) = 0; + + /** Post-processes the scene. + * \param pScene The scene needs to be post-processed. + */ + virtual bool PostprocessScene(FbxScene &pScene) = 0; + +#ifndef FBXSDK_ENV_WINSTORE + /** Writes 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. + * \remark This function has no implementation in this class. Only sub-class should implement it as needed. For example, + * FBX 6 and FBX 7 does implement it. + */ + virtual void PluginWriteParameters(FbxObject& pParams); +#endif /* !FBXSDK_ENV_WINSTORE */ + + /** Finds the selected root node in the specified scene. + * \param pScene The scene in which the selected root node is found. + * \return The located root node.\c NULL if the selected root node cannot be found. + */ + virtual FbxNode* FindRootNode(FbxScene& pScene); + + /** Checks if there are spaces in the names of specified node (and its children nodes), + * and writes the returned node's name in the specified string list. + * \param pNode Specifies the node to check. + * \param pNodeNameList Specifies the string list where the node name that has spaces in it is recorded. + * \return \c true If there are no spaces in the name of specified node (and its children nodes), + * \c false If spaces are found. + */ + virtual bool CheckSpaceInNodeNameRecursive(FbxNode* pNode, FbxString& pNodeNameList); + + /** Sets the file export version as specified. + * \param pVersion The specified file export version. + */ + bool SetFileExportVersion(FbxString pVersion); + + /** Sets the renaming mode as specified. + * \param pRenamingMode The specified renaming mode. + */ + void SetRenamingMode(FbxSceneRenamer::ERenamingMode pRenamingMode){mRenamingMode = pRenamingMode;} + + /** Sets the resampling rate as specified. + * \param pResamplingRate The specified resampling rate. + */ + inline void SetResamplingRate(double pResamplingRate){mResamplingRate = pResamplingRate;} + + /** Test if file format is an internal plug-in . + * A non genuine plug-in is a plug-in made by someone external to Autodesk FBX SDK group. + * \return \c true If the file format is an internal plug-in ,\c false Otherwise . + */ + bool IsGenuine(); + + /** Access to a IOSettings object. + * \return The pointer to IOSettings or \c NULL \c if the object + * has not been allocated. + */ + virtual FbxIOSettings * GetIOSettings(); + + /** Set the IOSettings pointer to be used for this writer instance. + * \param pIOSettings + */ + virtual void SetIOSettings(FbxIOSettings * pIOSettings); + + /** Pass a progress handler to the writer. + * \param pProgress FbxProgress to store the progress information. + */ + virtual void SetProgressHandler(FbxProgress* /*pProgress*/){} + + /** Returns true if this writer supports FbxStream I/O. Default value is false. */ + virtual bool SupportsStreams() const; + +protected: +#ifndef FBXSDK_ENV_WINSTORE + //! Function called by FBX before writing out the scene (FbxScene). + void PluginsWriteBegin(FbxScene& pScene); + /** + * Function called by FBX before writing out any FBX object. + * \param pFbx File object. + * \param pWriteObjectId Flag to write out object id. + */ + void PluginsWrite(FbxIO& pFbx, bool pWriteObjectId); + //! Function called by FBX after writing out the scene (FbxScene). + void PluginsWriteEnd(FbxScene& pScene); +#endif /* !FBXSDK_ENV_WINSTORE */ + +/***************************************************************************************************************************** +** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** +*****************************************************************************************************************************/ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + FbxStatus& GetStatus() { return mStatus; } + +protected: + + FbxWriter& operator=(FbxWriter const&) { return *this; } + + FbxStatus& mStatus; + FbxManager& mManager; + FbxString mFileVersion; + //! Resample rate for animation. + double mResamplingRate; + //! The mode describing from which format to which format when write FBX file. + FbxSceneRenamer::ERenamingMode mRenamingMode; + +private: + int mInternalID; + FbxIOSettings * mIOSettings; + + friend struct FbxWriterFbx7_Impl; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +//! Helper to access the IOSetting object pointer as a ref ex: IOS_REF.GetBoolProp( ... ); +#define IOS_REF (*GetIOSettings()) + +#include + +#endif /* _FBXSDK_FILEIO_WRITER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurve.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurve.h new file mode 100644 index 00000000..52c5774e --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurve.h @@ -0,0 +1,1359 @@ +/**************************************************************************************** + + 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 fbxanimcurve.h +#ifndef _FBXSDK_SCENE_ANIMATION_CURVE_H_ +#define _FBXSDK_SCENE_ANIMATION_CURVE_H_ + +#include + +#include +#include + +#include + +class KFCurve; + +/** Definitions used for the FBX animation curves and keys. */ +class FBXSDK_DLL FbxAnimCurveDef +{ +public: + static const float sDEFAULT_WEIGHT; + static const float sMIN_WEIGHT; + static const float sMAX_WEIGHT; + static const float sDEFAULT_VELOCITY; + + //! Key tangent mode for cubic interpolation. + enum ETangentMode + { + eTangentAuto = 0x00000100, //!< Auto key (spline cardinal). + eTangentTCB = 0x00000200, //!< Spline TCB (Tension, Continuity, Bias) + eTangentUser = 0x00000400, //!< Next slope at the left equal to slope at the right. + eTangentGenericBreak = 0x00000800, //!< Independent left and right slopes. + eTangentBreak = eTangentGenericBreak|eTangentUser, //!< Independent left and right slopes, with next slope at the left equal to slope at the right. + eTangentAutoBreak = eTangentGenericBreak|eTangentAuto, //!< Independent left and right slopes, with auto key. + eTangentGenericClamp = 0x00001000, //!< Clamp: key should be flat if next or previous key has the same value (overrides tangent mode). + eTangentGenericTimeIndependent = 0x00002000, //!< Time independent tangent (overrides tangent mode). + eTangentGenericClampProgressive = 0x00004000|eTangentGenericTimeIndependent //!< Clamp progressive: key should be flat if tangent control point is outside [next-previous key] range (overrides tangent mode). + }; + + //! Key interpolation type. + enum EInterpolationType + { + eInterpolationConstant = 0x00000002, //!< Constant value until next key. + eInterpolationLinear = 0x00000004, //!< Linear progression to next key. + eInterpolationCubic = 0x00000008 //!< Cubic progression to next key. + }; + + //! Weighted mode. + enum EWeightedMode + { + eWeightedNone = 0x00000000, //!< Tangent has default weights of 0.333; we define this state as not weighted. + eWeightedRight = 0x01000000, //!< Right tangent is weighted. + eWeightedNextLeft = 0x02000000, //!< Left tangent is weighted. + eWeightedAll = eWeightedRight|eWeightedNextLeft //!< Both left and right tangents are weighted. + }; + + //! Key constant mode. + enum EConstantMode + { + eConstantStandard = 0x00000000, //!< Curve value is constant between this key and the next + eConstantNext = 0x00000100 //!< Curve value is constant, with next key's value + }; + + //! Velocity mode. Velocity settings speed up or slow down animation on either side of a key without changing the trajectory of the animation. Unlike Auto and Weight settings, Velocity changes the animation in time, but not in space. + enum EVelocityMode + { + eVelocityNone = 0x00000000, //!< No velocity (default). + eVelocityRight = 0x10000000, //!< Right tangent has velocity. + eVelocityNextLeft = 0x20000000, //!< Left tangent has velocity. + eVelocityAll = eVelocityRight|eVelocityNextLeft //!< Both left and right tangents have velocity. + }; + + //! Tangent visibility. + enum ETangentVisibility + { + eTangentShowNone = 0x00000000, //!< No tangent is visible. + eTangentShowLeft = 0x00100000, //!< Left tangent is visible. + eTangentShowRight = 0x00200000, //!< Right tangent is visible. + eTangentShowBoth = eTangentShowLeft|eTangentShowRight //!< Both left and right tangents are visible. + }; + + //! FbxAnimCurveKey data indices for cubic interpolation tangent information. + enum EDataIndex + { + eRightSlope = 0, //!< Index of the right derivative, User and Break tangent mode (data are float). + eNextLeftSlope = 1, //!< Index of the left derivative for the next key, User and Break tangent mode. + eWeights = 2, //!< Start index of weight values, User and Break tangent break mode (data are FbxInt16 tokens from weight and converted to float). + eRightWeight = 2, //!< Index of weight on right tangent, User and Break tangent break mode. + eNextLeftWeight = 3, //!< Index of weight on next key's left tangent, User and Break tangent break mode. + eVelocity = 4, //!< Start index of velocity values, Velocity mode + eRightVelocity = 4, //!< Index of velocity on right tangent, Velocity mode + eNextLeftVelocity = 5, //!< Index of velocity on next key's left tangent, Velocity mode + eTCBTension = 0, //!< Index of Tension, TCB tangent mode (data are floats). + eTCBContinuity = 1, //!< Index of Continuity, TCB tangent mode. + eTCBBias = 2 //!< Index of Bias, TCB tangent mode. + }; +}; + +struct FBXSDK_DLL FbxAnimCurveTangentInfo +{ + inline FbxAnimCurveTangentInfo() + { + mDerivative = 0; + mWeight = FbxAnimCurveDef::sDEFAULT_WEIGHT; + mWeighted = false; + mVelocity = FbxAnimCurveDef::sDEFAULT_VELOCITY; + mHasVelocity = false; + mAuto = 0; + } + + float mDerivative; + float mWeight; + float mVelocity; + float mAuto; + bool mWeighted; + bool mHasVelocity; +}; + +/** This is the interface for implementation of animation key objects. + * \nosubgrouping + * + * \remarks Users should not use this class directly, but always use FbxAnimCurveKey. + * A FbxAnimCurveKey has a FbxAnimCurveKey_Impl. + * But FbxAnimCurveKey_Impl is just an implementation interface, + */ +class FBXSDK_DLL FbxAnimCurveKey_Impl +{ +public: + /** Destructor. + */ + virtual ~FbxAnimCurveKey_Impl() {}; + + /** Assignment operator. + */ + virtual FbxAnimCurveKey_Impl& operator=(const FbxAnimCurveKey_Impl& pFKey) = 0; + + /** Set time and value of key. + * \param pTime New time of this key. + * \param pValue New value of this key. + */ + virtual void Set(FbxTime pTime, float pValue) = 0; + + /** Set a key with cubic interpolation, TCB tangent mode. + * The key is modified according to the other parameters. + * The TCB mode controls the tension, continuity, + * and bias of the curve. + * \param pTime Key time. + * \param pValue Key value. + * \param pData0 Tension. Controls the amount of curvature in the animation curve. The higher the tension is, the more linear + * the curve looks. When the tension is low, the curve looks rounder or wider. + * \param pData1 Continuity. Controls the smoothness or singularity of the curve on the key. + * \param pData2 Bias. Controls if the effect of tension and continuity affect the curve before or after the key. + */ + virtual void SetTCB(FbxTime pTime, float pValue, float pData0 = 0.0f, float pData1 = 0.0f, float pData2 = 0.0f) = 0; + + /** Get the key value. + * \return The value of the key. + */ + virtual float GetValue() const = 0; + + /** Set the key value. + * \param pValue The value to set. + */ + virtual void SetValue(float pValue) = 0; + + /** Get key's interpolation type. + * \return Interpolation type of the queried key. + */ + virtual FbxAnimCurveDef::EInterpolationType GetInterpolation() const = 0; + + /** Set key's interpolation type. + * \param pInterpolation Interpolation type of the key. + */ + virtual void SetInterpolation (FbxAnimCurveDef::EInterpolationType pInterpolation) = 0; + + /** Get key's tangent mode. + * \param pIncludeOverrides Include override flags: Break, Clamp, Time-Independent. + * \return Tangent mode of the key. + * \remarks This method is meaningful for cubic interpolation only. + * Using this method for non cubic interpolated key will return unpredictable value. + */ + virtual FbxAnimCurveDef::ETangentMode GetTangentMode(bool pIncludeOverrides = false) const = 0; + + /** Set tangent mode. + * \param pTangentMode Tangent mode to set. + */ + virtual void SetTangentMode (FbxAnimCurveDef::ETangentMode pTangentMode) = 0; + + /** Get key's tangent weight mode. + * \return Tangent weight mode of the key. + * \remarks This method is meaningful for cubic interpolation only. + */ + virtual FbxAnimCurveDef::EWeightedMode GetTangentWeightMode() const = 0; + + /** Set key's tangent weight mode as double value (cubic interpolation, non TCB tangent mode). + * \param pTangentWeightMode Weight mode. + * \param pMask Used to select the affected tangents. + * \remarks This method is meaningful for cubic interpolation only. + * The pMask will be used to cancel out the current tangent weight mode first, and then be used to + * define which tangent to select to affect. + * + * Sample01: + * \code + * FbxAnimCurveKey* lAnimCurveKey = FbxSdkNew(); + * lAnimCurveKey->SetTangentWeightMode(FbxAnimCurveDef::eWeightedNextLeft); + * lAnimCurveKey->SetTangentWeightMode(FbxAnimCurveDef::eWeightedRight, FbxAnimCurveDef::eWeightedRight); + * \endcode + * pMask is eWeightedRight, it will first be used to cancel out the current tangent weight mode eWeightedNextLeft, + * since they are not the same, it fails to cancel it out. + * Then the mask eWeightedRight will be used to define which tangent should be affected, + * since it is the same as pTangentWeightMode (eWeightedRight), so the eWeightedRight should be affected. + * In total, after above calls, both eWeightedNextLeft and eWeightedRight of this key are affected, so + * lAnimCurveKey->GetTangentWeightMode() will be FbxAnimCurveDef::eWeightedAll. + * + * Sample02: + * \code + * FbxAnimCurveKey* lAnimCurveKey = FbxSdkNew(); + * lAnimCurveKey->SetTangentWeightMode(FbxAnimCurveDef::eWeightedAll); + * lAnimCurveKey->SetTangentWeightMode(FbxAnimCurveDef::eWeightedRight, FbxAnimCurveDef::eWeightedNextLeft); + * \endcode + * pMask is eWeightedNextLeft, it will first be used to cancel out the current tangent weight mode eWeightedAll, + * it will cancel out affect on eWeightedNextLeft, but leave affect on eWeightedRight. + * Then the mask eWeightedNextLeft will be used to define which tangent should be affected, + * since it is not the same as pTangentWeightMode (eWeightedRight), so the pMask won't affect anything in this step. + * In total, after above calls, only eWeightedRight of this key is still affected, so + * lAnimCurveKey->GetTangentWeightMode() will be FbxAnimCurveDef::eWeightedRight. + */ + virtual void SetTangentWeightMode(FbxAnimCurveDef::EWeightedMode pTangentWeightMode, FbxAnimCurveDef::EWeightedMode pMask = FbxAnimCurveDef::eWeightedAll ) = 0; + + /** Adjust the actual tangent of the key so that the tangent control point (tangent extremity) + * stays closer to where it should be. This is required because the weight value gets imprecise + * when it is small (it is stored as a fixed point value). This method must be called when + * setting the weight coming from a source where the precision is the same. It must be called + * after the tangent value has been set. + * \remark Do not use this call repetitively (from an interactive editor for example) because + * this function will create imprecision on the tangent value. + * \param pIndex FbxAnimCurveDef::EDataIndex + * \param pWeight New tangent weight value. + */ + virtual void SetTangentWeightAndAdjustTangent(FbxAnimCurveDef::EDataIndex pIndex, double pWeight ) = 0; + + /** Get key's tangent velocity mode. + * \return Tangent velocity mode of the key. + * \remarks This method is meaningful for cubic interpolation only. + */ + virtual FbxAnimCurveDef::EVelocityMode GetTangentVelocityMode() const = 0; + + /** Set key's tangent velocity mode as double value (cubic interpolation, non TCB tangent mode). + * \param pTangentVelocityMode Velocity mode. + * \param pMask Used to select the affected tangents + * \remarks This method is meaningful for cubic interpolation only. + * The pMask will be used to cancel out the current tangent velocity mode first, and then be used to + * define which tangent to select to affect. + * + * \see The documentation of SetTangentWeightMode for more details and samples about how the pMask works. + */ + virtual void SetTangentVelocityMode(FbxAnimCurveDef::EVelocityMode pTangentVelocityMode, FbxAnimCurveDef::EVelocityMode pMask = FbxAnimCurveDef::eVelocityAll ) = 0; + + /** Get key constant mode. + * \return Key constant mode. + * \remarks This method is meaningful for constant interpolation only. + * Using this method for non constant interpolated key will return unpredicted value. + */ + virtual FbxAnimCurveDef::EConstantMode GetConstantMode() const = 0; + + /** Set key's constant mode. + * \param pMode Constant mode to set. + * \remarks This method is meaningful for constant interpolation only. + */ + virtual void SetConstantMode(FbxAnimCurveDef::EConstantMode pMode) = 0; + + /** Get the value of specified data of the key. + * \param pIndex Data index to specify which data to get value, the index is dependent on the key tangent mode. + * \return The value of the specified data. + * + * \code + * FbxAnimCurveKey* lKey; // we suppose this is a valid pointer + * if(lKey->GetTangentMode() == FbxAnimCurveDef::eTangentTCB) + * { + * lKey->GetDataFloat(FbxAnimCurveDef::eTCBTension); + * lKey->GetDataFloat(FbxAnimCurveDef::eTCBContinuity); + * lKey->GetDataFloat(FbxAnimCurveDef::eTCBBias); + * } + * \endcode + */ + virtual float GetDataFloat(FbxAnimCurveDef::EDataIndex pIndex) const = 0; + + /** Set the value of specified data of the key. + * \param pIndex Data index to specify which data to get value, the index is dependent on the key tangent mode. + * \param pValue The data value to set. + * + * \code + * FbxAnimCurveKey* lKey; // we suppose this is a valid pointer + * lKey->SetInterpolation(FbxAnimCurveDef::eInterpolationCubic); + * lKey->SetTangentMode(FbxAnimCurveDef::eTangentAuto); + * lKey->SetDataFloat(FbxAnimCurveDef::eRightSlope, 0.0); + * \endcode + */ + virtual void SetDataFloat(FbxAnimCurveDef::EDataIndex pIndex, float pValue) = 0; + + /** Set tangent visibility mode. This would indicate what part of the tangent is visible in a graphical interface. + * \param pVisibility Tangent visibility mode. + * \remarks This method is meaningful for cubic interpolation only. + */ + virtual void SetTangentVisibility (FbxAnimCurveDef::ETangentVisibility pVisibility) = 0; + + /** Return tangent visibility mode. + * \return Tangent visibility mode. + * \remarks This method is meaningful for cubic interpolation only. + */ + virtual FbxAnimCurveDef::ETangentVisibility GetTangentVisibility () const = 0; + + /** Turn on or turn off the tangent break. + * When this flag is on (FbxAnimCurveDef::eTANGEAT_BREAK will be set), the key's left and right slopes are independent. + * When this flag is off, the key's left and right slope are equal. + * \param pVal Break flag (\c true or \c false). + * \remarks This method is meaningful for User (FbxAnimCurveDef::eTangentUser) and Auto (FbxAnimCurveDef::eTangentAuto) tangent modes only. + */ + virtual void SetBreak(bool pVal) = 0; + + /** Get if the tangent has a break. + * When this flag is set (FbxAnimCurveDef::eTANGEAT_BREAK), the key's left and right slopes are independent. + * When this flag is off, the key's left and right slope are equal. + * \return Break flag (\c true or \c false). + * \remarks This method is meaningful for User (FbxAnimCurveDef::eTangentUser) and Auto (FbxAnimCurveDef::eTangentAuto) tangent modes only. + */ + virtual bool GetBreak() const = 0; +}; + +/** This is the interface for the FBX animation curve keys. + * A key is defined by a time and a value. It also has tangents that control how the animation curve enters and exits the key. + * \nosubgrouping + * + *\remarks This class is now the main animation key object of the SDK, + * Users should always use this class to handle animation curve key. + * This class has a FbxAnimCurveKey_Impl as its implementation interface, + * Default constructor does not initialize data members. + * If an instance has to be initialized, use function FbxAnimCurveKey::Set(). + */ +class FBXSDK_DLL FbxAnimCurveKey : public FbxAnimCurveKeyBase +{ +public: + /** Constructor with no argument + */ + FbxAnimCurveKey() : FbxAnimCurveKeyBase() + { + FBX_ASSERT(mAllocatorFct != NULL); + mImpl = (*mAllocatorFct)(); + } + + /** Constructor with time. + * \param pTime The time of key. + */ + FbxAnimCurveKey(FbxTime pTime) : FbxAnimCurveKeyBase() + { + FBX_ASSERT(mAllocatorFct != NULL); + mImpl = (*mAllocatorFct)(); + SetTime(pTime); + } + + /** Constructor with time and value. + * \param pTime The time of key. + * \param pVal The value of key. + */ + FbxAnimCurveKey(FbxTime pTime, float pVal) : FbxAnimCurveKeyBase() + { + FBX_ASSERT(mAllocatorFct != NULL); + mImpl = (*mAllocatorFct)(); + Set(pTime, pVal); + } + + /** Copy constructor + */ + FbxAnimCurveKey(FbxAnimCurveKey const& pFKey) : FbxAnimCurveKeyBase() + { + FBX_ASSERT(mCopyAllocatorFct != NULL); + SetTime(pFKey.GetTime()); + mImpl = mCopyAllocatorFct(pFKey.GetImpl()); + } + + /** Destructor + */ + ~FbxAnimCurveKey() + { + FBX_ASSERT(mDeallocatorFct != NULL); + (*mDeallocatorFct)(mImpl); + } + + /** Assignment operator + */ + FbxAnimCurveKey& operator=(const FbxAnimCurveKey& pFKey) + { + FBX_ASSERT(mImpl); + if (mImpl) + { + *mImpl = *(pFKey.GetImpl()); + } + SetTime(pFKey.GetTime()); + return *this; + } + + /** Get time value. + * \return Time value. + */ + FbxTime GetTime() const + { + return FbxAnimCurveKeyBase::GetTime(); + } + + /** Set time value. + * \param pTime Time value to set. + */ + void SetTime(const FbxTime& pTime) + { + FbxAnimCurveKeyBase::SetTime(pTime); + } + + /** Set time and value of key. + * \param pTime New time of this key. + * \param pValue New value of this key. + */ + void Set(FbxTime pTime, float pValue) + { + FbxAnimCurveKeyBase::SetTime(pTime); + mImpl->Set(pTime, pValue); + } + + /** Set a key with cubic interpolation, TCB tangent mode. + * The key is modified according to the other parameters. + * The TCB mode controls the tension, continuity, + * and bias of the curve. + * \param pTime Key time. + * \param pValue Key value. + * \param pData0 Tension. Controls the amount of curvature in the animation curve. The higher the tension is, the more linear + * the curve looks. When the tension is low, the curve looks rounder or wider. + * \param pData1 Continuity. Controls the smoothness or singularity of the curve on the key. + * \param pData2 Bias. Controls if the effect of tension and continuity affect the curve before or after the key. + */ + void SetTCB(FbxTime pTime, float pValue, float pData0 = 0.0f, float pData1 = 0.0f, float pData2 = 0.0f) + { + FbxAnimCurveKeyBase::SetTime(pTime); + mImpl->SetTCB(pTime, pValue, pData0, pData1, pData2); + } + + /** Get the key value. + * \return The value of the key. + */ + float GetValue() const + { + return mImpl->GetValue(); + } + + /** Set the key value. + * \param pValue The value to set. + */ + void SetValue(float pValue) + { + mImpl->SetValue(pValue); + } + + + /** Get key's interpolation type. + * \return Interpolation type of the queried key. + */ + FbxAnimCurveDef::EInterpolationType GetInterpolation() + { + return mImpl->GetInterpolation(); + } + + /** Set key's interpolation type. + * \param pInterpolation Interpolation type of the key. + */ + void SetInterpolation (FbxAnimCurveDef::EInterpolationType pInterpolation) + { + mImpl->SetInterpolation(pInterpolation); + } + + /** Get key's tangent mode. + * \param pIncludeOverrides Include override flags: Break, Clamp, Time-Independent. + * \return Tangent mode of the key. + * \remarks This method is meaningful for cubic interpolation only. + * Using this method for non cubic interpolated key will return unpredictable value. + */ + FbxAnimCurveDef::ETangentMode GetTangentMode(bool pIncludeOverrides = false) + { + return mImpl->GetTangentMode(pIncludeOverrides); + } + + /** Set tangent mode. + * \param pTangentMode Tangent mode to set. + */ + void SetTangentMode (FbxAnimCurveDef::ETangentMode pTangentMode) + { + mImpl->SetTangentMode(pTangentMode); + } + + /** Get key's tangent weight mode. + * \return Tangent weight mode of the key. + * \remarks This method is meaningful for cubic interpolation only. + */ + FbxAnimCurveDef::EWeightedMode GetTangentWeightMode() const + { + return mImpl->GetTangentWeightMode(); + } + + /** Set key's tangent weight mode as double value (cubic interpolation, non TCB tangent mode). + * \param pTangentWeightMode Weight mode. + * \param pMask Used to select the affected tangents. + * \remarks This method is meaningful for cubic interpolation only. + * The pMask will be used to cancel out the current tangent weight mode first, and then be used to + * define which tangent to select to affect. + * + * Sample01: + * \code + * FbxAnimCurveKey* lAnimCurveKey = FbxSdkNew(); + * lAnimCurveKey->SetTangentWeightMode(FbxAnimCurveDef::eWeightedNextLeft); + * lAnimCurveKey->SetTangentWeightMode(FbxAnimCurveDef::eWeightedRight, FbxAnimCurveDef::eWeightedRight); + * \endcode + * pMask is eWeightedRight, it will first be used to cancel out the current tangent weight mode eWeightedNextLeft, + * since they are not the same, it fails to cancel it out. + * Then the mask eWeightedRight will be used to define which tangent should be affected, + * since it is the same as pTangentWeightMode (eWeightedRight), so the eWeightedRight should be affected. + * In total, after above calls, both eWeightedNextLeft and eWeightedRight of this key are affected, so + * lAnimCurveKey->GetTangentWeightMode() will be FbxAnimCurveDef::eWeightedAll. + * + * Sample02: + * \code + * FbxAnimCurveKey* lAnimCurveKey = FbxSdkNew(); + * lAnimCurveKey->SetTangentWeightMode(FbxAnimCurveDef::eWeightedAll); + * lAnimCurveKey->SetTangentWeightMode(FbxAnimCurveDef::eWeightedRight, FbxAnimCurveDef::eWeightedNextLeft); + * \endcode + * pMask is eWeightedNextLeft, it will first be used to cancel out the current tangent weight mode eWeightedAll, + * it will cancel out affect on eWeightedNextLeft, but leave affect on eWeightedRight. + * Then the mask eWeightedNextLeft will be used to define which tangent should be affected, + * since it is not the same as pTangentWeightMode (eWeightedRight), so the pMask won't affect anything in this step. + * In total, after above calls, only eWeightedRight of this key is still affected, so + * lAnimCurveKey->GetTangentWeightMode() will be FbxAnimCurveDef::eWeightedRight. + */ + void SetTangentWeightMode(FbxAnimCurveDef::EWeightedMode pTangentWeightMode, FbxAnimCurveDef::EWeightedMode pMask = FbxAnimCurveDef::eWeightedAll ) + { + mImpl->SetTangentWeightMode(pTangentWeightMode, pMask); + } + + /** Adjust the actual tangent of the key so that the tangent control point (tangent extremity) + * stays closer to where it should be. This is required because the weight value gets imprecise + * when it is small (it is stored as a fixed point value). This method must be called when + * setting the weight coming from a source where the precision is the same. It must be called + * after the tangent value has been set. + * \remark Do not use this call repetitively (from an interactive editor for example) because + * this function will create imprecision on the tangent value. + * \param pIndex FbxAnimCurveDef::EDataIndex + * \param pWeight New tangent weight value. + */ + void SetTangentWeightAndAdjustTangent(FbxAnimCurveDef::EDataIndex pIndex, double pWeight ) + { + mImpl->SetTangentWeightAndAdjustTangent(pIndex, pWeight); + } + + /** Get key's tangent velocity mode. + * \return Tangent velocity mode of the key. + * \remarks This method is meaningful for cubic interpolation only. + */ + FbxAnimCurveDef::EVelocityMode GetTangentVelocityMode() const + { + return mImpl->GetTangentVelocityMode(); + } + + /** Set key's tangent velocity mode as double value (cubic interpolation, non TCB tangent mode). + * \param pTangentVelocityMode Velocity mode. + * \param pMask Used to select the affected tangents + * \remarks This method is meaningful for cubic interpolation only. + * The pMask will be used to cancel out the current tangent velocity mode first, and then be used to + * define which tangent to select to affect. + * + * \see The documentation of SetTangentWeightMode for more details and samples about how the pMask works. + */ + void SetTangentVelocityMode(FbxAnimCurveDef::EVelocityMode pTangentVelocityMode, FbxAnimCurveDef::EVelocityMode pMask = FbxAnimCurveDef::eVelocityAll ) + { + mImpl->SetTangentVelocityMode(pTangentVelocityMode, pMask); + } + + /** Get key constant mode. + * \return Key constant mode. + * \remarks This method is meaningful for constant interpolation only. + * Using this method for non constant interpolated key will return unpredicted value. + */ + FbxAnimCurveDef::EConstantMode GetConstantMode() const + { + return mImpl->GetConstantMode(); + } + + /** Set key's constant mode. + * \param pMode Constant mode to set. + * \remarks This method is meaningful for constant interpolation only. + */ + void SetConstantMode(FbxAnimCurveDef::EConstantMode pMode) + { + mImpl->SetConstantMode(pMode); + } + + /** Get the value of specified data of the key. + * \param pIndex Data index to specify which data to get value, the index is dependent on the key tangent mode. + * \return The value of the specified data. + * + * \code + * FbxAnimCurveKey* lKey; // we suppose this is a valid pointer + * if(lKey->GetTangentMode() == FbxAnimCurveDef::eTangentTCB) + * { + * lKey->GetDataFloat(FbxAnimCurveDef::eTCBTension); + * lKey->GetDataFloat(FbxAnimCurveDef::eTCBContinuity); + * lKey->GetDataFloat(FbxAnimCurveDef::eTCBBias); + * } + * \endcode + */ + float GetDataFloat(FbxAnimCurveDef::EDataIndex pIndex) const + { + return mImpl->GetDataFloat(pIndex); + } + + /** Set the value of specified data of the key. + * \param pIndex Data index to specify which data to get value, the index is dependent on the key tangent mode. + * \param pValue The data value to set. + * + * \code + * FbxAnimCurveKey* lKey; // we suppose this is a valid pointer + * lKey->SetInterpolation(FbxAnimCurveDef::eInterpolationCubic); + * lKey->SetTangentMode(FbxAnimCurveDef::eTangentAuto); + * lKey->SetDataFloat(FbxAnimCurveDef::eRightSlope, 0.0); + * \endcode + */ + void SetDataFloat(FbxAnimCurveDef::EDataIndex pIndex, float pValue) + { + mImpl->SetDataFloat(pIndex, pValue); + } + + /** Set tangent visibility mode. This would indicate what part of the tangent is visible in a graphical interface. + * \param pVisibility Tangent visibility mode. + * \remarks This method is meaningful for cubic interpolation only. + */ + void SetTangentVisibility (FbxAnimCurveDef::ETangentVisibility pVisibility) + { + mImpl->SetTangentVisibility(pVisibility); + } + + /** Return tangent visibility mode. + * \return Tangent visibility mode. + * \remarks This method is meaningful for cubic interpolation only. + */ + FbxAnimCurveDef::ETangentVisibility GetTangentVisibility () const + { + return mImpl->GetTangentVisibility(); + } + + /** Turn on or turn off the tangent break. + * When this flag is on (FbxAnimCurveDef::eTANGEAT_BREAK will be set), the key's left and right slopes are independent. + * When this flag is off, the key's left and right slope are equal. + * \param pVal Break flag (\c true or \c false). + * \remarks This method is meaningful for User (FbxAnimCurveDef::eTangentUser) and Auto (FbxAnimCurveDef::eTangentAuto) tangent modes only. + */ + void SetBreak(bool pVal) + { + mImpl->SetBreak(pVal); + } + + /** Get if the tangent has a break. + * When this flag is set (FbxAnimCurveDef::eTANGEAT_BREAK), the key's left and right slopes are independent. + * When this flag is off, the key's left and right slope are equal. + * \return Break flag (\c true or \c false). + * \remarks This method is meaningful for User (FbxAnimCurveDef::eTangentUser) and Auto (FbxAnimCurveDef::eTangentAuto) tangent modes only. + */ + bool GetBreak() const + { + return mImpl->GetBreak(); + } + + /** Get key implementation. + * \return Pointer to implemented instance. + */ + FbxAnimCurveKey_Impl* GetImpl() const + { + return mImpl; + } + + /** Set allocator function + * \param pAllocatorFct Allocator function + */ + static void SetAllocatorFct(FbxAnimCurveKey_Impl* (*pAllocatorFct)()); + + /** Set copy allocator function + * \param pCopyAllocatorFct Copy allocator function + */ + static void SetCopyAllocatorFct(FbxAnimCurveKey_Impl* (*pCopyAllocatorFct)(FbxAnimCurveKey_Impl*)); + + /** Set deallocator function + * \param pDeallocatorFct Deallocator function + */ + static void SetDeallocatorFct(void (*pDeallocatorFct)(FbxAnimCurveKey_Impl*)); + +private: + static FbxAnimCurveKey_Impl* (*mAllocatorFct)(); + static FbxAnimCurveKey_Impl* (*mCopyAllocatorFct)(FbxAnimCurveKey_Impl*); + static void (*mDeallocatorFct)(FbxAnimCurveKey_Impl*); + FbxAnimCurveKey_Impl* mImpl; +}; + +class FbxScene; + +/** An animation curve, defined by a collection of keys (FbxAnimCurveKey), and indicating how a value changes over time. +* Since an animation curve is a function, on a given animation curve, only one key per time is +* allowed. The keys are sorted +* in time order. They can be accessed by their index on the curve, from 0 to FbxAnimCurve::KeyGetCount-1. +* The time unit in FBX (FbxTime) is 1/46186158000 of one second. +* +* Each key defines tangents and interpolation that modify the animation curve. +* Tangents control the way the animation curve enters and exits the keys. +* Interpolation indicates the animation curve's behavior between keys. +* +* Interpolation modes are +* \li Constant - Curve value stays the same until next key +* \li Linear - Animation curve is a straight line +* \li Cubic - Animation curve is a Bezier spline +* +* Tangent modes are +* \li Auto (Spline cardinal) +* \li Spline TCB (Tension, Continuity, Bias) +* \li User (Next slope at the left equal to slope at the right) +* +* Tangent modes can be overridden by more tangent options: +* \li Break (Independent left and right slopes) +* \li Clamp (Key should be flat if next or previous key has the same value) +* \li Time independent +* +* Tangent can be modified some more by adding weights and velocity. +* By default, the weights are 0.333 on either side of the key, and there is +* no velocity. Velocity settings speed up or slow down animation on either side of +* a key without changing the trajectory of the animation. Unlike Auto and Weight settings, +* Velocity changes the animation in time, but not in space. +* +* \nosubgrouping +* \remarks FbxAnimCurve is now the main animation animation curve object of the SDK. +* Users should always use this class to handle animation curve. +* +* \note When adding keys to an animation curve, use FbxAnimCurve::KeyModifyBegin and FbxAnimCurve::KeyModifyEnd. +* please refer to the following sample code: +* \code +* FbxTime lTime; +* int lKeyIndex = 0; + +* // Create curve +* FbxAnimCurve* lAnimCurve = FbxAnimCurve::Create(pScene, "Cube Animation"); + +* // Add keys to the curve +* lAnimCurve->KeyModifyBegin(); + +* // First key: time 0, value 0 +* lTime.SetSecondDouble(0.0); +* lKeyIndex = lAnimCurve->KeyAdd(lTime); +* lAnimCurve->KeySet(lKeyIndex, lTime, 0.0, FbxAnimCurveDef::eInterpolationLinear); + +* // Second key: time 20s, value -3600 +* // Since this curve will describe rotation, each cube will rotate 10 times around itself during 20 seconds. +* lTime.SetSecondDouble(20.0); +* lKeyIndex = lAnimCurve->KeyAdd(lTime); +* lAnimCurve->KeySet(lKeyIndex, lTime, -3600, FbxAnimCurveDef::eInterpolationLinear); + +* // Done adding keys. +* lAnimCurve->KeyModifyEnd(); +* \endcode +* +*/ +class FBXSDK_DLL FbxAnimCurve : public FbxAnimCurveBase +{ + FBXSDK_ABSTRACT_OBJECT_DECLARE(FbxAnimCurve, FbxAnimCurveBase); + +public: + /** + * \name Animation curve creation. + * + */ + //@{ + /** Create a FbxAnimCurve. + * \param pContainer Scene to which the created animation curve belongs. + * \param pName Name of the animation curve. + * \return Newly created animation curve + */ + static FbxAnimCurve* Create(FbxScene* pContainer, const char* pName); + //@} + + /** + * \name Key management. + * + */ + //@{ + /** Resize animation curve buffer to hold a certain number of keys. + * \param pKeyCount Number of keys the animation curve will eventually hold. + */ + virtual void ResizeKeyBuffer(int pKeyCount) = 0; + + /** Call this function prior to adding, removing or editing keys of an animation curve. + * Call function FbxAnimCurve::KeyModifyEnd() after modification. + */ + virtual void KeyModifyBegin () = 0; + + /** Call this function after adding, removing or editing keys of an animation curve. + * Function FbxAnimCurve::KeyModifyBegin() must have been called prior to modify the keys. + */ + virtual void KeyModifyEnd () = 0; + + //! Remove all the keys of the animation curve and free buffer memory. + virtual void KeyClear () = 0; + + /** Get the number of keys. + * \return Key count. + */ + virtual int KeyGetCount () const = 0; + + /** Add a given key at given time. The new key is appended after all the other animation curve's keys. + * Function FbxAnimCurve::KeyInsert() should be used instead if the key + * is to be added in the curve and not at the end. This function does not + * respect the interpolation type and tangents of the neighboring keys. + * If there is already a key at the given time, the key is modified and no + * new key is added. + * + * \param pTime Time of the new key. + * \param pKey Key to add. + * \param pLast Index of the last processed key to speed up search. If this function is called in a loop, + * initialize this value to 0 and let it be updated by each call. + * \return Index of the key at given time, no matter if it was added + * or already present. + * + * \remark Key value, interpolation type and tangent mode must be set + * explicitly afterwards. + */ + virtual int KeyAdd (FbxTime pTime, FbxAnimCurveKeyBase& pKey, int* pLast = NULL) = 0; + + /** Add a key at given time. The new key is appended after all the other animation curve's keys. + * Function FbxAnimCurve::KeyInsert() should be used instead if the key + * is to be added in the curve and not at the end. This function does not + * respect of the interpolation type and tangents of the neighboring keys. + * If there is already a key a the given time, no key is added. + * + * \param pTime Time of the new key. + * \param pLast Index of the last processed key to speed up search. If this function is called in a loop, + * initialize this value to 0 and let it be updated by each call. + * \return Index of the key at given time, no matter if it was added + * or already present. + * \remark Key value, interpolation type and tangent mode must be set + * explicitly afterwards. + */ + virtual int KeyAdd (FbxTime pTime, int* pLast = NULL) = 0; + + /** Set (or replace) key at given index with given key. + * \param pIndex Index of the key to be set or replaced. + * \param pKey New key at this index. + * \return \c true if key time is superior to previous key time + * and inferior to next key time, \c false otherwise. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual bool KeySet(int pIndex, FbxAnimCurveKeyBase& pKey) = 0; + + /** Remove key at given index. Other key indices are updated automatically. + * \param pIndex Index of key to remove. + * \return \c true on success, \c false otherwise. + */ + virtual bool KeyRemove(int pIndex) = 0; + + /** Remove all the keys in the given range. + * \param pStartIndex Index of the first key to remove (inclusive). + * \param pEndIndex Index of the last key to remove (inclusive). + * \return true on success. + */ + virtual bool KeyRemove(int pStartIndex, int pEndIndex) = 0; + + /** Insert a key at given time. + * This function should be used instead of FbxAnimCurve::KeyAdd() if the key + * is to be added in the curve and not at the end. It inserts the key in + * respect to the interpolation type and tangents of the neighboring keys. + * If there is already a key a the given time, the key is modified and no + * new key is added. + * \param pTime Time of the new key. + * \param pLast Index of the last processed key to speed up search. If this + * function is called in a loop, initialize this value to 0 and let it + * be updated by each call. + * \return Index of the key at given time, no matter if it was inserted + * or already present. + * \remark Key value must be set explicitly afterwards. The + * interpolation type and tangent mode are copied from the previous key. + */ + virtual int KeyInsert ( FbxTime pTime, int* pLast = NULL ) = 0; + + /** Find key index for a given time. + * \param pTime Time of the key looked for. + * \param pLast Index of the last processed key to speed up search. If this + * function is called in a loop, initialize this value to 0 and let it + * be updated by each call. + * \return Key index. The integer part of the key index gives the + * index of the closest key with a smaller time. The decimals give + * the relative position of given time compared to previous and next + * key times. Returns -1 if animation curve has no key. + * + * For example (using seconds for clarity), if there is a key at time 10s with index 5, and a key at + * time 11s with index 6, KeyFind(10.3s) would return 5.3. + */ + virtual double KeyFind (FbxTime pTime, int* pLast = NULL) = 0; + + /** Scale value of all keys. + * \param pMultValue Scale applied on key values. + * \return \c true on success, \c false otherwise. + */ + virtual bool KeyScaleValue (float pMultValue) = 0; + + /** Scale value and tangent of all keys. + * \param pMultValue Scale applied on key values and tangents. + * \return \c true on success, \c false otherwise. + */ + virtual bool KeyScaleValueAndTangent (float pMultValue) = 0; + //@} + + /** + * \name Key Manipulation + */ + + //@{ + /** General function to set key properties. + * The key at index pKeyIndex is retrieved and modified according to the other parameters. + * The key must have been previously created, for example using KeyAdd. + * Use FbxAnimCurve::SetTCB() in the specific case of setting a key with cubic interpolation and TCB tangent mode. + * \param pKeyIndex Index of the key. + * \param pTime Key time. + * \param pValue Key value. + * \param pInterpolation Key interpolation type. + * \param pTangentMode Key tangent mode (meaningful for cubic interpolation only). + * \param pData0 Value of right slope. + * \param pData1 Value of next left slope. + * \param pTangentWeightMode Weight mode, if used. + * \param pWeight0 Weight for right slope, if tangent weight mode is eWeightedRight or eWeightedAll. + * \param pWeight1 Weight for next left slope, if tangent weight mode is eWeightedNextLeft or eWeightedAll. + * \param pVelocity0 Velocity for right slope, if tangent velocity mode is eVelocityRight or eVelocityAll. + * \param pVelocity1 Velocity for next left slope, if tangent velocity mode is eVelocityNextLeft or eVelocityAll. + */ + virtual void KeySet(int pKeyIndex,FbxTime pTime, float pValue, FbxAnimCurveDef::EInterpolationType pInterpolation = FbxAnimCurveDef::eInterpolationCubic, FbxAnimCurveDef::ETangentMode pTangentMode = FbxAnimCurveDef::eTangentAuto, float pData0 = 0.0,float pData1 = 0.0,FbxAnimCurveDef::EWeightedMode pTangentWeightMode = FbxAnimCurveDef::eWeightedNone, float pWeight0 = FbxAnimCurveDef::sDEFAULT_WEIGHT,float pWeight1 = FbxAnimCurveDef::sDEFAULT_WEIGHT,float pVelocity0 = FbxAnimCurveDef::sDEFAULT_VELOCITY,float pVelocity1 = FbxAnimCurveDef::sDEFAULT_VELOCITY) = 0; + + /** Set a key with cubic interpolation, TCB tangent mode. + * The key at index pKeyIndex is retrieved and modified according to the other parameters. + * The TCB mode controls the tension, continuity, + * and bias of the curve. + * \param pKeyIndex Index of the key. + * \param pTime Key time. + * \param pValue Key value. + * \param pData0 Tension. Controls the amount of curvature in the animation curve. The higher the tension is, the more linear + * the curve looks. When the tension is low, the curve looks rounder or wider. + * \param pData1 Continuity. Controls the smoothness or singularity of the curve on the key. + * \param pData2 Bias. Controls if the effect of tension and continuity affect the curve before or after the key. + */ + virtual void KeySetTCB(int pKeyIndex,FbxTime pTime, float pValue, float pData0 = 0.0f, float pData1 = 0.0f, float pData2 = 0.0f) = 0; + + /** Get key's interpolation type. + * \param pKeyIndex Index of the queried key. + * \return Interpolation type of the queried key. + */ + virtual FbxAnimCurveDef::EInterpolationType KeyGetInterpolation(int pKeyIndex) const = 0; + + /** Set key's interpolation type. + * \param pKeyIndex Index of the key. + * \param pInterpolation Key interpolation type. + */ + virtual void KeySetInterpolation(int pKeyIndex, FbxAnimCurveDef::EInterpolationType pInterpolation) = 0; + + /** Get key's constant mode. + * \note This method is only relevant if the key's interpolation type is constant (eInterpolationConstant). + * Using this method on a key with an other interpolation type will return unpredictable value. + * \param pKeyIndex Index of the queried key. + * \return Key constant mode. + */ + virtual FbxAnimCurveDef::EConstantMode KeyGetConstantMode(int pKeyIndex) const = 0; + + /** Get key's tangent mode. + * \param pKeyIndex Index of the key. + * \param pIncludeOverrides Include override flags: Break, Clamp, Time-Independent. + * This method is meaningful for cubic interpolation only. + * Using this method for non cubic interpolated key will return unpredictable value. + * \return Key tangent mode. + */ + virtual FbxAnimCurveDef::ETangentMode KeyGetTangentMode(int pKeyIndex, bool pIncludeOverrides = false ) const = 0; + + /** Set key's constant mode. + * This method is meaningful for constant interpolation only. + * \param pKeyIndex Index of the key. + * \param pMode Key constant mode. + */ + virtual void KeySetConstantMode(int pKeyIndex, FbxAnimCurveDef::EConstantMode pMode) = 0; + + /** Set key's tangent mode. + * This method is meaningful for cubic interpolation only. + * \param pKeyIndex Index of the key. + * \param pTangent Key tangent mode. + */ + virtual void KeySetTangentMode(int pKeyIndex, FbxAnimCurveDef::ETangentMode pTangent) = 0; + + /** Get key at given index. + * \param pIndex Index of the key on the animation curve. + * \return The key at the given index. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual FbxAnimCurveKey KeyGet(int pIndex) const = 0; + + /** Get key value. + * \param pKeyIndex Index of the queried key. + * \return Key value. + */ + virtual float KeyGetValue(int pKeyIndex) const = 0; + + /** Set key value. + * \param pKeyIndex Index of the key. + * \param pValue The value to set. + */ + virtual void KeySetValue(int pKeyIndex, float pValue) = 0; + + /** Increment key value. + * \param pKeyIndex Index of the key. + * \param pValue Term added to the key value. + */ + virtual void KeyIncValue(int pKeyIndex, float pValue) = 0; + + /** Multiply key value. + * \param pKeyIndex Index of the key. + * \param pValue Factor multiplying the key value. + * \see FbxAnimCurve::KeyMultTangent. + */ + virtual void KeyMultValue(int pKeyIndex, float pValue) = 0; + + /** Multiply key tangents. + * \remark When multiplying a key value, tangents must be + * multiplied to conserve the same topology. + * \param pKeyIndex Index of the key. + * \param pValue Factor multiplying the key tangents. + */ + virtual void KeyMultTangent(int pKeyIndex, float pValue) = 0; + + /** Get key time + * \param pKeyIndex Index of the queried key. + * \return Key time (time at which this key is occurring). + */ + virtual FbxTime KeyGetTime(int pKeyIndex) const = 0; + + /** Set key time. + * \param pKeyIndex Index of the key. + * \param pTime Key time (time at which this key is occurring). + * \remark The new key time might modify the key index. + */ + virtual void KeySetTime(int pKeyIndex, FbxTime pTime) = 0; + + /** Set or unset the tangent break. When this flag is set (FbxAnimCurveDef::eTangentBreak), the key's left and right slopes are independent. + * When this flag is off, the key's left and right slope are equal. + * This method is relevant for User (FbxAnimCurveDef::eTangentUser) and Auto (FbxAnimCurveDef::eTangentAuto) tangent modes only. + * \param pKeyIndex Index of the key. + * \param pVal Break flag (\c true or \c false). + */ + virtual void KeySetBreak(int pKeyIndex, bool pVal) = 0; + + /** Get if the tangent has a break. When this flag is set (FbxAnimCurveDef::eTangentBreak), the key's left and right slopes are independent. + * When this flag is off, the key's left and right slope are equal. + * This method is relevant for User (FbxAnimCurveDef::eTangentUser) and Auto (FbxAnimCurveDef::eTangentAuto) tangent modes only. + * \param pKeyIndex Index of the queried key. + * \return Break flag (\c true or \c false). + */ + virtual bool KeyGetBreak(int pKeyIndex) const = 0; + //@} + + /** + * \name Key Tangent Management + */ + //@{ + /** Get the left derivative of a key. + * \param pIndex Index of the queried key. + * \return Left derivative (Value over time (s)). + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual float KeyGetLeftDerivative(int pIndex) = 0; + + /** Set the left derivative of a key. + * \param pIndex Index of the key. + * \param pValue Left derivative. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + * This function is only relevant if previous key interpolation + * type is eInterpolationCubic and tangent mode is + * FbxAnimCurveDef::eTangentUser, FbxAnimCurveDef::eTangentBreak or FbxAnimCurveDef::eTangentAuto. + */ + virtual void KeySetLeftDerivative(int pIndex, float pValue) = 0; + + /** Get the left auto parametric of a key. This is used to compute the slope of Auto and User keys. + * \param pIndex Index of the key. + * \param pApplyOvershootProtection Clamp flag (eGENERIC_CLAMP) is taken into account. + * \return Left auto parametric. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual float KeyGetLeftAuto(int pIndex, bool pApplyOvershootProtection = false) = 0; + + /** Get the left derivative info (of type FbxAnimCurveTangentInfo) of a key. + * \param pIndex Index of the queried key. + * \return Left derivative info. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual FbxAnimCurveTangentInfo KeyGetLeftDerivativeInfo(int pIndex) = 0; + + /** Set the left derivative info (of type FbxAnimCurveTangentInfo) of a key. + * \param pIndex Index of the key. + * \param pValue Left derivative info. + * \param pForceDerivative If \c true, assign the tangent info's derivative value to the key derivative. + * If \c false, use the tangent info's auto parametric value to recompute the key derivative. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + * This function is only relevant if previous key interpolation + * type is eInterpolationCubic and tangent mode is + * FbxAnimCurveDef::eTangentUser or FbxAnimCurveDef::eTangentBreak. + */ + virtual void KeySetLeftDerivativeInfo(int pIndex, const FbxAnimCurveTangentInfo& pValue, bool pForceDerivative = false) = 0; + + /** Get the right derivative of a key. + * \param pIndex Index of the key. + * \return Right derivative (Value over time (s)). + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual float KeyGetRightDerivative(int pIndex) = 0; + + /** Set the right derivative of a key. + * \param pIndex Index of the key. + * \param pValue Right derivative. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + * This function is only relevant if previous key interpolation + * type is eInterpolationCubic and tangent mode is + * FbxAnimCurveDef::eTangentUser, FbxAnimCurveDef::eTangentBreak or FbxAnimCurveDef::eTangentAuto. + */ + virtual void KeySetRightDerivative(int pIndex, float pValue) = 0; + + /** Get the right auto parametric of a key. This is used to compute the slope of Auto and User keys. + * \param pIndex Index of the key. + * \param pApplyOvershootProtection Clamp flag (eGENERIC_CLAMP) is taken into account. + * \return Right auto parametric. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual float KeyGetRightAuto(int pIndex, bool pApplyOvershootProtection = false) = 0; + + /** Get the right derivative info (of type FbxAnimCurveTangentInfo) of a key. + * \param pIndex Index of the queried key. + * \return Right derivative info. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual FbxAnimCurveTangentInfo KeyGetRightDerivativeInfo(int pIndex) = 0; + + /** Set the right derivative info (of type FbxAnimCurveTangentInfo) of a key. + * \param pIndex Index of the key. + * \param pValue Right derivative info. + * \param pForceDerivative If \c true, assign the tangent info's derivative value to the key derivative. + * If \c false, use the tangent info's auto parametric value to recompute the key derivative. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + * This function is only relevant if previous key interpolation + * type is eInterpolationCubic and tangent mode is + * FbxAnimCurveDef::eTangentUser or FbxAnimCurveDef::eTangentBreak. + */ + virtual void KeySetRightDerivativeInfo(int pIndex, const FbxAnimCurveTangentInfo& pValue, bool pForceDerivative = false) = 0; + + /** Get the left tangent weight mode of a key. + * \param pIndex Index of queried key. + * \return \c true if the key is left weighted (Weight mode is eWEIGHT_WEIGHTED_RIGHT or eWeightedAll). \c false otherwise. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual bool KeyIsLeftTangentWeighted(int pIndex) const = 0; + + /** Get the right tangent weight mode of a key. + * \param pIndex Index of queried key. + * \return \c true if the key is right weighted (Weight mode is eWeightedRight or eWeightedAll). \c false otherwise. + * \remark Result is undetermined if animation curve has no key or if index + * is out of bounds. + */ + virtual bool KeyIsRightTangentWeighted(int pIndex) const = 0; + + /** Get the weight value component of the left tangent of a key. + * \param pIndex Index of the key. + * \return Left tangent weight, or eDEFAULT_WEIGHT (0.333...) if left tangent is not weighted. + * \remark This function is only relevant if key interpolation + * type is eInterpolationCubic. + */ + virtual float KeyGetLeftTangentWeight(int pIndex) const = 0; + + /** Get the weight value component of the right tangent of a key. + * \param pIndex Index of the key. + * \return Right tangent weight, or eDEFAULT_WEIGHT (0.333...) if right tangent is not weighted. + * \remark This function is only relevant if key interpolation + * type is eInterpolationCubic. + */ + virtual float KeyGetRightTangentWeight(int pIndex) const = 0; + + /** Set the left tangent weight of a key. + * \param pIndex Index of the key. + * \param pWeight Weight to set on the left tangent. + * \param pAdjustTan If true, recompute the tangent height to compensate for very small weights. + * \remarks This function is only relevant if previous key interpolation + * type is eInterpolationCubic and tangent mode is + * FbxAnimCurveDef::eTangentUser or FbxAnimCurveDef::eTangentBreak. The tangent is + * automatically set in weighted mode. + * The pAdjustTan option will only produce correct results provided that the tangent has already been + * set before calling this function. + */ + virtual void KeySetLeftTangentWeight( int pIndex, float pWeight, bool pAdjustTan = false ) = 0; + + /** Set the right tangent weight of a key. + * \param pIndex Index of the key. + * \param pWeight Weight to set on the right tangent. + * \param pAdjustTan If true, recompute the tangent height to compensate for very small weights. + * \remarks This function is only relevant if key interpolation + * type is eInterpolationCubic and tangent mode is + * FbxAnimCurveDef::eTangentUser or FbxAnimCurveDef::eTangentBreak. The tangent is + * automatically set in weighted mode. + * The pAdjustTan option will only produce correct results provided that the tangent has already been + * set before calling this function. + */ + virtual void KeySetRightTangentWeight( int pIndex, float pWeight, bool pAdjustTan = false ) = 0; + + /** Get the velocity value component of the left tangent of a key. + * \param pIndex Index of the key. + * \return Tangent velocity of the left tangent. + * \remarks This function is only relevant if key interpolation + * type is eInterpolationCubic + */ + virtual float KeyGetLeftTangentVelocity( int pIndex) const = 0; + + /** Get the velocity value component of the right tangent of a key. + * \param pIndex Index of the key. + * \return Tangent velocity of the right tangent. + * \remarks This function is only relevant if key interpolation + * type is eInterpolationCubic + */ + virtual float KeyGetRightTangentVelocity( int pIndex) const = 0; + //@} + + /** + * \name Evaluation and Analysis + */ + //@{ + /** Evaluate animation curve value at a given time. + * \param pTime Time of evaluation. + * If time falls between two keys, animation curve value is + * interpolated according to previous key interpolation type and + * tangent mode if relevant. + * \param pLast Index of the last processed key to speed up search. If this + * function is called in a loop, initialize this value to 0 and let it + * be updated by each call. + * \return Animation curve value on given time, or animation curve's default value if animation curve + * has no key. + * \remarks This function takes extrapolation into account. + */ + virtual float Evaluate (FbxTime pTime, int* pLast = NULL) = 0; + + /** Evaluate animation curve value at a given key index. + * \param pIndex Any value from 0 to FbxAnimCurve::KeyGetCount() - 1. + * \return Animation curve value, or default value if animation curve + * has no key. + * + * \remarks If key index is not an integer value, animation curve value is + * interpolated according to previous key interpolation type and + * tangent mode, if relevant. + * This function does not take extrapolation into account. + * Result is undetermined if index is out of bounds. + */ + virtual float EvaluateIndex( double pIndex) = 0; + + /** Evaluate function left derivative at given time. + * \param pTime Time of evaluation. + * \param pLast Index of the last processed key to speed up search. If this + * function is called in a loop, initialize this value to 0 and let it + * be updated by each call. + * \return Left derivative at given time. + * \remarks This function does not take extrapolation into account. + * Result is undetermined if index is out of bounds. + */ + virtual float EvaluateLeftDerivative (FbxTime pTime, int* pLast = NULL) = 0; + + /** Evaluate function right derivative at given time. + * \param pTime Time of evaluation. + * \param pLast Index of the last processed key to speed up search. If this + * function is called in a loop, initialize this value to 0 and let it + * be updated by each call. + * \return Right derivative at given time. + * \remarks This function does not take extrapolation into account. + * Result is undetermined if index is out of bounds. + */ + virtual float EvaluateRightDerivative (FbxTime pTime, int* pLast = NULL) = 0; + //@} + + /** + * \name Utility functions. + * + */ + //@{ + /** Find out start and end time of the animation animation curve. + * This function retrieves the animation curve's time span. + * \param pTimeInterval Reference to receive start and end time. + * \return \c true on success, \c false otherwise. + */ + virtual bool GetTimeInterval(FbxTimeSpan& pTimeInterval) = 0; + + /** Copy animation curve content into current animation curve. + * \param pSource Animation curve to be copied (which will not be modified). + * \param pWithKeys If \c true, clear keys in current animation curve and copy + * keys from source animation curve. If \c false, keys in current animation curve + * are left as is. + */ + virtual void CopyFrom(FbxAnimCurve& pSource, bool pWithKeys = true) = 0; + + /** Retrieve the value of the parent curve node channel. + * \param pCurveNodeIndex The index of the parent curve node, if more than one exist. + * \return The value of the parent curve node channel of this curve. + * \remark In most case, the curve will have a single curve node channel as destination. However, + * it is possible that more are connected, hence why we provide the curve node index parameter. */ + virtual float GetValue(int pCurveNodeIndex=0) = 0; + + /** Set the value to the parent curve node channel. + * \param pValue The value to set to the parent curve node channel of this curve. + * \param pCurveNodeIndex The index of the parent curve node, if more than one exist. + * \remark In most case, the curve will have a single curve node channel as destination. However, + * it is possible that more are connected, hence why we provide the curve node index parameter. */ + virtual void SetValue(float pValue, int pCurveNodeIndex=0) = 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 + virtual KFCurve* GetKFCurve() = 0; + virtual bool Store(FbxIO* pFileObject, bool pLegacyVersion=false) = 0; + virtual bool Retrieve(FbxIO* pFileObject) = 0; + virtual void ExtrapolationSyncCallback() = 0; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_ANIMATION_CURVE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurvebase.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurvebase.h new file mode 100644 index 00000000..1c4b7846 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurvebase.h @@ -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 fbxanimcurvebase.h +#ifndef _FBXSDK_SCENE_ANIMATION_CURVE_BASE_H_ +#define _FBXSDK_SCENE_ANIMATION_CURVE_BASE_H_ + +#include + +#include + +#include + +class FbxIO; + +/** This is the base class interface for the FBX animation curve keys. + * \nosubgrouping + * + * \remarks For an example of implemented class, please see FbxAnimCurveKey. + */ +class FBXSDK_DLL FbxAnimCurveKeyBase +{ +public: + /** Data member representing time value. + */ + FbxTime mTime; + + /** Constructor. + */ + FbxAnimCurveKeyBase() + { + mTime = FBXSDK_TIME_ZERO; + } + + /** Destructor. + */ + virtual ~FbxAnimCurveKeyBase() {}; + + /** Get time value. + * \return Time value. + */ + virtual FbxTime GetTime() const + { + return mTime; + } + + /** Set time value. + * \param pTime Time value to set. + */ + virtual void SetTime(const FbxTime& pTime) { + mTime = pTime; + } +}; + +/** This is the base class for implementing animation curves. + * \nosubgrouping + * It is a pure virtual class that defines the general interface to animation + * key management and manipulation. + * + * \see FbxAnimCurve for fully implemented class. + */ +class FBXSDK_DLL FbxAnimCurveBase : public FbxObject +{ + FBXSDK_ABSTRACT_OBJECT_DECLARE(FbxAnimCurveBase, FbxObject); + +public: + /** + * \name Key management. + * + */ + //@{ + //! Remove all the keys and free buffer memory. + virtual void KeyClear () = 0; + + //! Get the number of keys. + virtual int KeyGetCount () const = 0; + + /** Add a key at given time. + * \param pTime Time to add the key. + * \param pKey Key to add. + * \param pLast Index of the last processed key to speed up search. If this + * function is called in a loop, initialize this value to 0 and let it + * be updated by each call. + * \return Index of the key at given time, no matter if it was added + * or already present. + */ + virtual int KeyAdd (FbxTime pTime, FbxAnimCurveKeyBase& pKey, int* pLast = NULL) = 0; + + /** Set key at given index. + * \param pIndex Index of where the key should be set. + * \param pKey The key to set. + * \return \c true if key time is superior to previous key and inferior + * to next key, \c false otherwise. + * \remarks Result is undetermined if function curve has no key or index + * is out of bounds. + */ + virtual bool KeySet(int pIndex, FbxAnimCurveKeyBase& pKey) = 0; + + /** Remove key at given index. + * \param pIndex Index of key to remove. + * \return \c true on success, \c false otherwise. + */ + virtual bool KeyRemove(int pIndex) = 0; + + /** Remove all the keys in the given range. + * \param pStartIndex Index of the first key to remove (inclusive). + * \param pEndIndex Index of the last key to remove (inclusive). + * \return \c true on success, \c false otherwise. + */ + virtual bool KeyRemove(int pStartIndex, int pEndIndex) = 0; + + //@} + + /** + * \name Key Time Manipulation + */ + //@{ + /** Get key time. + * \param pKeyIndex Key index. + * \return Key time (time at which this key is occurring). + */ + virtual FbxTime KeyGetTime(int /*pKeyIndex*/) const { return FBXSDK_TIME_INFINITE; } + + /** Set key time. + * \param pKeyIndex Key index. + * \param pTime Key time (time at which this key is occurring). + */ + virtual void KeySetTime(int pKeyIndex, FbxTime pTime) = 0; + + //@} + + /** + * \name Extrapolation + * Extrapolation defines the function curve value before and after the keys. + * Pre-extrapolation defines the function curve value before first key. + * Post-extrapolation defines the function curve value after last key. + *
  • CONSTANT means a constant value matching the first/last key. + *
  • REPETITION means the entire function curve is looped. + *
  • MIRROR_REPETITION means the entire function curve is looped once backward, once forward and so on. + *
  • KEEP_SLOPE means a linear function with a slope matching the first/last key. + *
  • RELATIVE_REPETITION means entire function curve is looped and one loop is relative to the last loop in value.
+ */ + //@{ + enum EExtrapolationType + { + eConstant = 1, + eRepetition = 2, + eMirrorRepetition = 3, + eKeepSlope = 4, + eRelativeRepetition = 5 + } ; + + /** Set pre-extrapolation mode. + * \param pExtrapolation The pre-extrapolation mode to set. + */ + void SetPreExtrapolation(EExtrapolationType pExtrapolation); + + /** Get pre-extrapolation mode. + * \return The current pre-extrapolation mode. + */ + EExtrapolationType GetPreExtrapolation() const { return mPreExtrapolation; } + + /** Set pre-extrapolation count. + * \param pCount Number of repetitions if pre-extrapolation mode is + * REPETITION or MIRROR_REPETITION. + */ + void SetPreExtrapolationCount(unsigned long pCount); + + /** Get pre-extrapolation count. + * \return Number of repetitions if pre-extrapolation mode is + * REPETITION or MIRROR_REPETITION. + */ + unsigned long GetPreExtrapolationCount() const { return mPreExtrapolationCount; } + + /** Set post-extrapolation mode. + * \param pExtrapolation The post-extrapolation mode to set. + */ + void SetPostExtrapolation(EExtrapolationType pExtrapolation); + + /** Get post-extrapolation mode. + * \return The current post-extrapolation mode. + */ + EExtrapolationType GetPostExtrapolation() const { return mPostExtrapolation; } + + /** Set post-extrapolation count. + * \param pCount Number of repetitions if post-extrapolation mode is + * REPETITION or MIRROR_REPETITION. + */ + void SetPostExtrapolationCount(unsigned long pCount); + + /** Get post-extrapolation count. + * \return Number of repetitions if post-extrapolation mode is + * REPETITION or MIRROR_REPETITION. + */ + unsigned long GetPostExtrapolationCount() const { return mPostExtrapolationCount; } + //@} + + /** + * \name Evaluation and Analysis + */ + //@{ + /** Evaluate curve value at a given time. + * \param pTime Time of evaluation. + * \param pLast Index of the last processed key to speed up search. If this + * function is called in a loop, initialize this value to 0 and let it + * be updated by each call. + * \return Evaluated curve value. + * \remarks This function take extrapolation into account. + */ + virtual float Evaluate (FbxTime pTime, int* pLast = NULL) = 0; + + /** Evaluate curve value at the given key index. + * \param pIndex Any value from 0 to KeyGetCount() - 1. + * If this index falls between keys, the curve value will + * be interpolated based on the surrounding keys. + * \return Evaluated curve value. + */ + virtual float EvaluateIndex( double pIndex) = 0; + //@} + + /** + * \name Utility functions. + * + */ + //@{ + /** Find out start and end time of the animation curve. + * This function retrieves the Curve's time span. + * \param pTimeInterval Reference to receive start time and end time. + * \return \c true on success, \c false otherwise. + */ + virtual bool GetTimeInterval(FbxTimeSpan& pTimeInterval); + //@} + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual bool Store(FbxIO* pFileObject, bool pLegacyVersion=false) = 0; + virtual bool Retrieve(FbxIO* pFileObject) = 0; + virtual void ExtrapolationSyncCallback() = 0; + +protected: + virtual void Construct(const FbxObject* pFrom); + +private: + EExtrapolationType mPreExtrapolation; + unsigned long mPreExtrapolationCount; + EExtrapolationType mPostExtrapolation; + unsigned long mPostExtrapolationCount; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif // FBXFILESDK_KFBXPLUGINS_KFBXANIMCURVEBASE_H diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurvefilters.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurvefilters.h new file mode 100644 index 00000000..e536f827 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurvefilters.h @@ -0,0 +1,1546 @@ +/**************************************************************************************** + + 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 fbxanimcurvefilters.h +#ifndef _FBXSDK_SCENE_ANIMATION_CURVE_FILTERS_H_ +#define _FBXSDK_SCENE_ANIMATION_CURVE_FILTERS_H_ + +#include + +#include +#include +#include +#include +#include // for FbxLimits + +#include + +class FbxObject; +class FbxAnimStack; +class FbxRotationOrder; + +/** Base class for animation curve filters. +* Animation curves can be modified through filters. The filters act on +* the curve keys and values. They can move, add or remove keys, +* modify key values and key tangents, depending on the desired action +* of the filter. +* Some simple examples are: +* \li A scale filter, that would multiply all key +* values of a curve, and the curve default value, by a given scale. +* \li A constant key reducer filter, that would clean a curve by removing +* redundant keys that all have the same value. +* +* Filters can act on a single animation curve (FbxAnimCurve), but some +* filters need to work on many animation curves at the same time. For +* this reason, the input to a filter can be an animation stack (FbxAnimStack), an object (FbxObject) +* with animated properties, an animation curve node (FbxAnimCurveNode), or an array of animation +* curves (FbxAnimCurve). +* For example, an unroll filter acts on 3 Euler rotation curves (X, Y and Z) at the same time. +* +* A filter has a start time (that can be as low as TC_MINFINITY) and a stop time (that can be as high as TC_INFINITY). +* The filter is only applied to the parts of the animation curves that are between the start and stop time. +* +* The following are two code samples about how to use filter. +* Code sample to use sync filter: +* \code +* FbxAnimCurve* lWorkCurves[3]; //Put some keys in the lWorkCurves and they sync them up. +* FbxAnimCurveFilterKeySync lSyncFilter; +* FbxTime pStart, pStop; //Given start and stop time. +* lSyncFilter.SetStartTime( pStart ); +* lSyncFilter.SetStopTime ( pStop ); +* if( lSyncFilter.NeedApply( lWorkCurves, 3 ) ) +* { +* lSyncFilter.Apply( lWorkCurves, 3 ); +* } +* \endcode +* +* Code sample to use unroll filter: +* \code +* FbxAnimCurveNode* pCurveNode; //An Euler rotation animation curve node. +* FbxAnimCurveFilterUnroll lUnrollFilter; +* lUnrollFilter.SetForceAutoTangents(true); +* lUnrollFilter.Apply(*pCurveNode); +* \endcode +* +* \nosubgrouping +*/ +class FBXSDK_DLL FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilter(); + + //! Destructor. + virtual ~FbxAnimCurveFilter() {}; + + /** + * \name Member functions + */ + //@{ + /** Get the name of the filter. + * \return Pointer to the name. + */ + virtual const char* GetName() const {return NULL;} + + /** Get the start time for the application of the filter. + * The part of the animation curves before the start time will remain untouched. + * \return The time expressed as FbxTime. + */ + FbxTime& GetStartTime() {return mStart;} + + /** Set the start time for the application of the filter. + * The part of the animation curves before the start time will remain untouched. + * \param pTime The time to be set. + */ + void SetStartTime(FbxTime& pTime) { mStart = pTime; } + + /** Get the stop time for the application of the filter. + * The part of the animation curves after the stop time will remain untouched. + * \return The time expressed as FbxTime. + */ + FbxTime& GetStopTime() {return mStop;} + + /** Set the stop time for the application of the filter. + * The part of the animation curves after the stop time will remain untouched. + * \param pTime The time to be set. + */ + void SetStopTime(FbxTime& pTime) { mStop = pTime; } + + /** Get the index of start key on the given curve. This is the index of the first key + * after (or on) the filter's start time. + * \param pCurve Curve on which we want to retrieve the start key. + * \return Index of the start key. + */ + int GetStartKey(FbxAnimCurve& pCurve) const; + + /** Get the index of stop key on the given curve. This is the index of the last key + * before (or on) the filter's stop time. + * \param pCurve Curve on which we want to retrieve the stop key. + * \return Index of the stop key. + */ + int GetStopKey(FbxAnimCurve& pCurve) const; + + /** Check if any curve on the animation stack needs an application of the filter. + * \param pAnimStack Animation stack where to retrieve the animation curves + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if at least one animated property needs an application of the filter. + */ + virtual bool NeedApply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL); + + /** Check if all the animated properties of the object need an application of the filter. + * \param pObj Object containing the properties to test. + * \param pAnimStack Animation stack where to retrieve the animation curves + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if at least one animated property needs an application of the filter. + */ + virtual bool NeedApply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL); + + /** Check if the animation curve node needs an application of the filter. + * \param pCurveNode Curve node to test. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the animation curve node needs an application of the filter. + * \remarks This method collects all the FbxAnimCurve objects connected to the curve node + * and calls NeedApply(FbxAnimCurve**, int) + */ + virtual bool NeedApply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL); + + /** Check if the given animation curve need an application of the filter. + * \param pCurve Array of curves to test if they need the and application of the filter. + * \param pCount Number of curves in array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if at least one animation curve in the array needs an application of the filter. + */ + virtual bool NeedApply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL); + + /** Check if an animation curve need an application of the filter. + * \param pCurve Curve to test if it needs application of filter. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the animation curve needs an application of the filter. + */ + virtual bool NeedApply(FbxAnimCurve& pCurve, FbxStatus* pStatus=NULL); + + /** Apply filter to all the curves stored in the animation stack. + * \param pAnimStack Animation stack where to retrieve the animation curves + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimStack* pAnimStack, FbxStatus* pStatus = NULL); + + /** Apply filter to all the animated properties of the object. + * \param pObj Object containing the animated properties to which the filter is applied. + * \param pAnimStack Animation stack where to retrieve the animation curves + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus = NULL); + + /** Apply filter on all the curves of an animation curve node. + * \param pCurveNode Curve node to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks This method collects all the FbxAnimCurve objects connected to the curve node + * and calls Apply(FbxAnimCurve**, int) + */ + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus = NULL); + + /** Apply filter on an array of animation curves. + * \param pCurve Array of curves to which the filter is applied. + * \param pCount Number of curves in the array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus = NULL); + + /** Apply filter on an animation curve. + * \param pCurve Curve to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve& pCurve, FbxStatus* pStatus = NULL) = 0; + + /** Reset the filter to its default parameters. + */ + virtual void Reset() + { + mStart= FBXSDK_TIME_MINUS_INFINITE; + mStop = FBXSDK_TIME_INFINITE; + } + +/***************************************************************************************************************************** +** 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 bool GetContinuousOffset(FbxRotationOrder& pOrder, FbxVector4& pOffset, FbxVector4& pNew, FbxVector4& pOld); + +protected: + void GetKFCurvesFromAnimCurve(FbxAnimCurve** pSrc, int pSrcCount, KFCurve** pDst, int& pDstCount); + + // Called for progress bar update, indicating what portion of work is done. + virtual void UpdateProgressInformation(FbxTime /*pStart*/, FbxTime /*pStop*/) {}; + + // Time span for applying the filter. + FbxTime mStart, mStop; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** Constant key reducing filter. + * \nosubgrouping + * Filter to test if each key is really necessary to define the curve + * at a definite degree of precision. It filters recursively from the + * strongest difference first. All useless keys are eliminated. + */ +class FBXSDK_DLL FbxAnimCurveFilterConstantKeyReducer : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterConstantKeyReducer(); + + //! Destructor. + virtual ~FbxAnimCurveFilterConstantKeyReducer() {}; + + /** Get the name of the filter. + * \return Pointer to name. + */ + virtual const char* GetName() const; + + /** + * \name Exposed parent class methods. + */ + //@{ + virtual bool Apply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pAnimStack, pStatus); } + virtual bool Apply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pObj, pAnimStack, pStatus); } + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pCurve, pCount, pStatus); } + //@} + + /** Apply filter on all the curves of an animation curve node. + * \param pCurveNode Curve node to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks This method collects all the FbxAnimCurve objects connected to the curve node + * and calls Apply(FbxAnimCurve**, int) + */ + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL); + + /** Apply filter on an animation curve. + * \param pCurve Curve to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve& pCurve, FbxStatus* pStatus=NULL); + + /** Reset the filter to its default parameters. + */ + virtual void Reset(); + + /** Get the current derivative tolerance. + * \return The value of the current derivative tolerance. + */ + double GetDerivativeTolerance() const; + + /** Set the derivative tolerance. + * \param pValue Value derivative tolerance. + */ + void SetDerivativeTolerance(double pValue); + + /** Get the tolerance value. + * \return The tolerance value. + */ + double GetValueTolerance() const; + + /** Set the tolerance value. + * \param pValue Tolerance value. + */ + void SetValueTolerance(double pValue); + + /** Get the state of the KeepFirstAndLastKeys flag. + * \return \c true if the filter keeps the first and last keys. + */ + bool GetKeepFirstAndLastKeys() const; + + /** Set the state of the KeepFirstAndLastKeys flag. + * \param pKeepFirstAndLastKeys Set to \c true if you want the filter to keep the first and last keys. + */ + void SetKeepFirstAndLastKeys( bool pKeepFirstAndLastKeys ); + + /** Get the state of the KeepOneKey flag. + * If all the keys are constant and this flag is c\ true, the filter will keep the first key. + * If all the keys are constant and this flag is c\ false, the filter will delete all the keys. + * \return \c true if the filter keeps the first key when all keys are constant. + */ + bool GetKeepOneKey() const; + + /** Set the state of the KeepOneKey flag. + * If all the keys are constant and this flag is c\ true, the filter will keep the first key. + * If all the keys are constant and this flag is c\ false, the filter will delete all the keys. + * \param pKeepOneKey Set to \c true if you want the filter to keep the first key when all keys are constant. + */ + void SetKeepOneKey( bool pKeepOneKey ); + + /** Tell the filter to keep CUBIC curve keys which are not pure AUTO. + * \param pKeep KeepNotPureAutoKeys flag. + */ + void SetKeepNotPureAutoKeys(bool pKeep); + +/***************************************************************************************************************************** +** 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 + // + // If ValueTolerance is default, we use the thresholds here, otherwise + // it is the ValueTolerance that is used. (Mainly for backward compatibility) + // + void SetTranslationThreshold ( double pTranslationThreshold ); + void SetRotationThreshold ( double pRotationThreshold ); + void SetScalingThreshold ( double pScalingThreshold ); + void SetDefaultThreshold ( double pDefaultThreshold ); + + void SetModes(bool pExporting, FbxIOSettings& pIOS); + +private: + double mDerTol; + double mValTol; + + double mTranslationThreshold; + double mRotationThreshold; + double mScalingThreshold; + double mDefaultThreshold; + + bool mKeepFirstAndLastKeys; + bool mKeepOneKey; + bool mKeepNotPureAutoKeys; + + bool IsKeyConstant(FbxAnimCurve& pCurve, int pIndex, int pFirstIndex, int pLastIndex, double pMinValue, double pMaxValue, bool pOnlyCheckAutoKeys); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/**This filter tries to compensate parent's scale to children's scale. + * This filter is used to convert scale animation curves of nodes whose transform inherit type are eInheritRrs. + * In the eInheritRrs mode, child objects do not inherit scaling from parent objects at all. + * When a parent object is scaled, the child does not scale, but translates in order to keep proportional distance between models. + * If you want to change the inherit type of certain nodes from eInheritRrs to eInheritRrSs, + * you may call this filter to compensate scale. + */ +class FBXSDK_DLL FbxAnimCurveFilterScaleCompensate : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterScaleCompensate(); + //! Return name of the filter. + virtual const char* GetName() const; + + /** + * \name Exposed parent class methods. + */ + //@{ + virtual bool Apply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pAnimStack, pStatus); } + virtual bool Apply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pObj, pAnimStack, pStatus); } + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus = NULL) { return FbxAnimCurveFilter::Apply(pCurveNode, pStatus); } + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus = NULL) { return FbxAnimCurveFilter::Apply(pCurve, pCount, pStatus); } + //@} + + /**Compensate parent's scale to children's scale. + * \param pCurve In pCurve, index 0 is the curve to be filtered. index 1 is the parent curve. + * \param pCount Need to be 2. + * \param pIOS IO setting object. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks This filter will re-sample the animation curves. + */ + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxIOSettings& pIOS, FbxStatus* pStatus = NULL); + /** Always fail because this filter needs 2 curves. */ + virtual bool Apply(FbxAnimCurve& pCurve, FbxStatus* pStatus = NULL); +}; + +/**GimbleKiller filter. + *\nosubgrouping + * This filter try to minimize gimble locks on rotation curves. + * \remarks The current implementation of this filter expects to process 3 curves at the same time. + * \remarks This filter has been superseded by the Unroll filter. It is strongly advised to use + * the latter. + */ +class FBXSDK_DLL FbxAnimCurveFilterGimbleKiller : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterGimbleKiller(); + + //! Destructor. + virtual ~FbxAnimCurveFilterGimbleKiller(); + + /** Get the name of the filter. + * \return Pointer to name. + */ + virtual const char* GetName() const; + + /** This filter expects to work with 3 interdependent curves. Passing the animation stack makes no sense. + * since this object would not know which curves to handle. + * \param pAnimStack Animation stack + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false. + */ + virtual bool NeedApply(FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** This filter expects to work with 3 interdependent curves. Collecting all the animation curves from + * the properties defined in \e pObj could not guarantee that we are manipulating 3 interdependent curves. + * \param pObj Object containing the properties to test. + * \param pAnimStack Animation stack where to retrieve the animation curves + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false + */ + virtual bool NeedApply(FbxObject* /*pObj*/, FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** Check if the animation curve node needs an application of the filter. + * \param pCurveNode Curve node to test. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the animation curve node needs an application of the filter, \c false otherwise. + * \remarks This method checks that the \e pCurveNode is representing an Euler rotation. + * It will validate that 3 animation curves are defined. + * If the condition is not met, the method will return \c false. + */ + virtual bool NeedApply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL); + + /** Check if the given animation curve need an application of the filter. + * \param pCurve Array of curves to test if they need the and application of the filter. + * \param pCount Number of curves in array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if at least one animation curve in the array needs an application of the filter. + * \remarks Because this method only receives an array of interdependent curves, this filter assumes + * that they are all coming from an Euler rotation anim curve node. Therefore, it expects + * \e pCount to be equal to 3. + */ + virtual bool NeedApply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL); + + /** This filter expects to work with interdependent curves. Receiving one single curve is useless. + * \return \c false + */ + virtual bool NeedApply(FbxAnimCurve& /*pCurve*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** This filter expects to work with 3 interdependent curves. Passing the animation stack makes no sense + * since this object would not know which curves to handle. + * \param pAnimStack Animation stack + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false. + */ + virtual bool Apply(FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** This filter expects to work with 3 interdependent curves. Collecting all the animation curves from + * the properties defined in \e pObj could not guarantee that we are manipulating 3 interdependent curves. + * \param pObj Object containing the properties to test. + * \param pAnimStack Animation stack where to retrieve the animation curves + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false + */ + virtual bool Apply(FbxObject* /*pObj*/, FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** Apply filter on all the curves of an animation curve node. + * \param pCurveNode Curve node to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks This method collects all the FbxAnimCurve objects connected to the curve node + * and calls Apply(FbxAnimCurve**, int) + */ + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus = NULL); + + /** Apply filter on the given animation curve. + * \param pCurve Array of curve to which the filter is applied. + * \param pCount Number of curves in array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks Because this method only receives an array of interdependent curves, this filter assumes + * that they are all coming from an Euler rotation anim curve node. Therefore, it expects + * \e pCount to be equal to 3. + */ + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus = NULL); + + /** This filter expects to work with interdependent curves. Receiving one single curve is useless. + * \return \c false + */ + virtual bool Apply(FbxAnimCurve& /*pCurve*/, FbxStatus* pStatus = NULL) { FBX_UNUSED(pStatus); return false; } + + /** Reset the filter to its default parameters. + */ + virtual void Reset(); + + //! Return \c true if key sync filter is enabled. + bool GetApplyKeySyncFilter() const; + + /** Set to \c true to enable key sync filter. + * \param pFlag Key sync filter flag. + */ + void SetApplyKeySyncFilter(bool pFlag); + +/***************************************************************************************************************************** +** 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: + FbxRotationOrder* mRotationOrder; + bool mApplyKeySyncFilter; + int mRotationLayerType; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** Key reducing filter. + * \nosubgrouping + * Filter to test if each key is really necessary to define the curve + * at a definite degree of precision. It filters recursively from the + * strongest difference first. All useless keys are eliminated. + */ +class FBXSDK_DLL FbxAnimCurveFilterKeyReducer : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterKeyReducer(); + + //! Destructor. + virtual ~FbxAnimCurveFilterKeyReducer() {}; + + /** Get the name of the filter. + * \return Pointer to name. + */ + virtual const char* GetName() const; + + /** + * \name Exposed parent class methods. + */ + //@{ + virtual bool Apply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pAnimStack, pStatus); } + virtual bool Apply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pObj, pAnimStack, pStatus); } + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pCurveNode, pStatus); } + //@} + + /** Apply filter on the given animation curve. + * \param pCurve Array of curve to which the filter is applied. + * \param pCount Number of curves in array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL); + + /** Apply filter on an animation curve. + * \param pCurve Curve to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve& pCurve, FbxStatus* pStatus=NULL); + + /** Reset the filter to its default parameters. + */ + virtual void Reset(); + + //! Get precision. + double GetPrecision() const; + + /** Set precision. + * \param pPrecision The precision to set. + */ + void SetPrecision(double pPrecision); + + //! Return \c true key sync is applied at the end. + bool GetKeySync() const; + + /** Set to \c true to apply key sync at the end. + * \param pKeySync Key sync flag. + */ + void SetKeySync(bool pKeySync); + +/***************************************************************************************************************************** +** 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: + bool KeyReducer(FbxAnimCurve& pSCurve, FbxAnimCurve& pTCurve, FbxTime pStart, FbxTime pStop); + bool Subdivise(FbxAnimCurve& pSCurve, FbxAnimCurve& pTCurve, int pLeft, int pRight); + double FindMaxError(FbxAnimCurve& pSCurve, FbxAnimCurve& pTCurve, int pLeft, int pRight, int& pSplit); + + // User parameters. + double mPrecision; + int mProgressCurrentRecurseLevel; + bool mKeySync; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** Key sync filter. + * \nosubgrouping + * Filter to synchronize the keys of a set of animation curves. +*/ +class FBXSDK_DLL FbxAnimCurveFilterKeySync : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterKeySync(); + + //! Destructor. + virtual ~FbxAnimCurveFilterKeySync() {}; + + /** Get the name of the filter. + * \return Pointer to name. + */ + virtual const char* GetName() const; + + /** + * \name Exposed parent class methods. + */ + //@{ + virtual bool NeedApply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::NeedApply(pAnimStack, pStatus); } + virtual bool NeedApply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::NeedApply(pObj, pAnimStack, pStatus); } + virtual bool NeedApply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::NeedApply(pCurveNode, pStatus); } + virtual bool Apply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pAnimStack, pStatus); } + virtual bool Apply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pObj, pAnimStack, pStatus); } + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pCurveNode, pStatus); } + //@} + + /** Check if the given animation curve need an application of the filter. + * \param pCurve Array of curves to test if they need the and application of the filter. + * \param pCount Number of curves in array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if at least one animation curve in the array needs an application of the filter. + */ + virtual bool NeedApply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL); + + /** One single curve cannot be sync'ed. + * \param pCurve Curve to test if it needs application of filter. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false + */ + virtual bool NeedApply(FbxAnimCurve& /*pCurve*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** Apply filter on the given animation curve. + * \param pCurve Array of curve to which the filter is applied. + * \param pCount Number of curves in array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL); + + /** Apply filter on an animation curve. + * \param pCurve Curve to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true. + * \remarks Has no effect since there is only one curve. + */ + virtual bool Apply(FbxAnimCurve& /*pCurve*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return true; } +}; + + +/** Re-sampling filter. + * \nosubgrouping + * Filter to re-sample animation curves. + */ +class FBXSDK_DLL FbxAnimCurveFilterResample : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterResample(); + + //! Destructor. + virtual ~FbxAnimCurveFilterResample() {}; + + /** Get the name of the filter. + * \return Pointer to name. + */ + virtual const char* GetName() const; + + /** + * \name Exposed parent class methods. + */ + //@{ + virtual bool Apply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pAnimStack, pStatus); } + virtual bool Apply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pObj, pAnimStack, pStatus); } + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pCurveNode, pStatus); } + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pCurve, pCount, pStatus); } + //@} + + /** Apply the filter on an animation curve. + * \param pCurve Curve to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve& pCurve, FbxStatus* pStatus=NULL); + + /** Reset the filter to its default parameters. + */ + virtual void Reset(); + + /** Set if the keys are on frame. + * \param pKeysOnFrame value if keys are set on frame multiples. + */ + void SetKeysOnFrame(bool pKeysOnFrame); + + /** Get if the keys are on frame. + * \return Value if keys are on frame multiples. + */ + bool GetKeysOnFrame() const; + + /** Get the re-sampling period + * \return The re-sampling period. + */ + FbxTime GetPeriodTime() const; + + /** Set the re-sampling period + * \param pPeriod The re-sampling period to be set. + */ + void SetPeriodTime(FbxTime &pPeriod); + + + /**Get the mode that determines how the re-sample filter will set the interpolation and tangent of each key. + * \return \c true if the intelligent mode is on, \c false otherwise. + * \remarks If intelligent mode is on, interpolation type and tangent mode of each created curve key + * are set equal to the interpolation type and tangent mode of the closest curve key encountered. + * If intelligent mode is off, the interpolation type of each created curve key + * will always be set to CUBIC, and tangent mode will always be set to AUTO. + */ + bool GetIntelligentMode() const; + + /** Set the mode that determines how the re-sample filter will set the interpolation and tangent of each key. + * \param pIntelligent \c true, set interpolation type and tangent mode of each created curve key equal to + * the interpolation type and tangent mode of the closest curve key encountered. + * \c false, always set the interpolation type of each created curve key to CUBIC, + * and always set the tangent mode to AUTO. + */ + void SetIntelligentMode( bool pIntelligent ); + +/***************************************************************************************************************************** +** 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: + bool mKeysOnFrame; + FbxTime mPeriod; + bool mIntelligent; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** Key scale filter. + * \nosubgrouping + * Filter to scale the keys of a set of animation curves. +*/ +class FBXSDK_DLL FbxAnimCurveFilterScale : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterScale(); + + //! Destructor. + virtual ~FbxAnimCurveFilterScale() {}; + + /** Get the name of the filter. + * \return Pointer to name. + */ + virtual const char* GetName() const; + + /** + * \name Exposed parent class methods. + */ + //@{ + virtual bool Apply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pAnimStack, pStatus); } + virtual bool Apply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pObj, pAnimStack, pStatus); } + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pCurve, pCount, pStatus); } + //@} + + /** Apply filter on all the curves of an animation curve node. + * \param pCurveNode Curve node to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks This method collects all the FbxAnimCurve objects connected to the curve node + * and calls Apply(FbxAnimCurve**, int) + */ + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL); + + /** Apply filter on an animation curve. + * \param pCurve Curve to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve& pCurve, FbxStatus* pStatus=NULL); + + /** Reset the filter to its default parameters. + */ + virtual void Reset(); + + /** Get the scale factor. + * \return The current scale factor. + */ + double GetScale() const; + + /** Set the scale factor. + * \param pScale The new scale factor to set. + */ + void SetScale(double pScale); + +/***************************************************************************************************************************** +** 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: + double mScale; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** Key scale filter. Instead of scaling by a constant float value, we will scale by using another anim curve + * Use a single channel curve only to scale + * \nosubgrouping + * Filter to scale the keys of a set of animation curves. +*/ +class FBXSDK_DLL FbxAnimCurveFilterScaleByCurve : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterScaleByCurve(); + + //! Destructor. + virtual ~FbxAnimCurveFilterScaleByCurve() {}; + + /** Get the name of the filter. + * \return Pointer to name. + */ + virtual const char* GetName() const; + + /** + * \name Exposed parent class methods. + */ + //@{ + virtual bool Apply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pAnimStack, pStatus); } + virtual bool Apply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pObj, pAnimStack, pStatus); } + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::Apply(pCurve, pCount, pStatus); } + //@} + + /** Apply filter on all the curves of an animation curve node. + * \param pCurveNode Curve node to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks This method collects all the FbxAnimCurve objects connected to the curve node + * and calls Apply(FbxAnimCurve**, int) + */ + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL); + + /** Apply filter on an animation curve. + * \param pCurve Curve to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve& pCurve, FbxStatus* pStatus=NULL); + + /** Reset the filter to its default parameters. (null curve) + */ + virtual void Reset(); + + /** Get the scale factor. + * \return The current scale factor. + */ + FbxAnimCurve* GetScale() const; + + /** Set the scale factor. + * \param pScale The new scale factor to set. + */ + void SetScale(FbxAnimCurve* pScale); + +/***************************************************************************************************************************** +** 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: + FbxAnimCurve* mScale; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/**Time shift and scale filter. + *\nosubgrouping + * Filter to shift key times and scale key values on animation curves. + */ +class FBXSDK_DLL FbxAnimCurveFilterTSS : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterTSS(); + + //! Destructor. + virtual ~FbxAnimCurveFilterTSS() {}; + + /** Get the name of the filter. + * \return Pointer to name. + */ + virtual const char* GetName() const; + + /** + * \name Exposed parent class methods. + */ + //@{ + virtual bool Apply(FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return FbxAnimCurveFilter::Apply(pAnimStack); } + virtual bool Apply(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return FbxAnimCurveFilter::Apply(pObj, pAnimStack); } + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return FbxAnimCurveFilter::Apply(pCurveNode); } + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return FbxAnimCurveFilter::Apply(pCurve, pCount); } + //@} + + /** Apply filter on an animation curve. + * \param pCurve Curve to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + */ + virtual bool Apply(FbxAnimCurve& pCurve, FbxStatus* pStatus=NULL); + + /** Reset the filter to its default parameters. + */ + virtual void Reset(); + + /** Get the time shift value. + * \return The time value used for the shift. + */ + FbxTime GetShift() const; + + /** Set the time shift value. + * \param pShift The time value used for the shift. + */ + void SetShift(FbxTime& pShift); + + /** Get the scale factor. + * \return The current scale factor. + */ + double GetScale() const; + + /** Set the scale factor. + * \param pScale The new scale factor to set. + */ + void SetScale(double pScale); + +/***************************************************************************************************************************** +** 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 mShift; + double mScale; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** Unroll filter. + *\nosubgrouping + * Filter to apply continuous rotation values to animation curves. Due to Euler rotation + * properties, when a rotation angle cross over the 180 degree value, it becomes -179. This + * filter tries to keep a continuous rotation effectively by producing increasing values, to + * actually become 181 degrees, etc... + * \remarks The current implementation of this filter expects to process 3 curves at the same time. + * \remarks By default, this filter does not affect the tangent values of the modified keys. + * This means that, for CUBIC interpolation curves containing keys with USER or BREAK + * tangents, the unrolled curves will correctly match the original rotation exactly on + * the curve keys but not in-between them. The filter can be configured to automatically + * convert the USER and BREAK tangents to AUTO tangents by setting the ForceAutoTangents flag. + * Using the AUTO tangents mode can result in a more consistent interpolation between + * the curve keys. + */ +class FBXSDK_DLL FbxAnimCurveFilterUnroll : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterUnroll(); + + //! Destructor. + virtual ~FbxAnimCurveFilterUnroll() {}; + + /** Get the name of the filter. + * \return Pointer to the name. + */ + virtual const char* GetName() const; + + /** This filter expects to work with 3 interdependent curves. Passing the animation stack makes no sense + * since this object would not know which curves to handle. + * \param pAnimStack Animation stack + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false. + */ + virtual bool NeedApply(FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; }; + + /** This filter expects to work with 3 interdependent curves. Collecting all the animation curves from + * the properties defined in \e pObj could not guarantee that we are manipulating 3 interdependent curves. + * \param pObj Object containing the properties to test. + * \param pAnimStack Animation stack where to retrieve the animation curves + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false. + */ + virtual bool NeedApply(FbxObject* /*pObj*/, FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** Check if the animation curve node needs an application of the filter. + * \param pCurveNode Curve node to test. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the animation curve node needs an application of the filter, \c false otherwise. + * \remarks This method checks that the \e pCurveNode is representing an Euler rotation. + * It will validate that 3 animation curves are defined. + * If the condition is not met, the method will return \c false. + */ + virtual bool NeedApply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL); + + /** Check if the given animation curve needs an application of the filter. + * \param pCurve Array of curves to test if they need an application of the filter. + * \param pCount Number of curves in array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if at least one animation curve in the array needs an application of the filter, + * \c false otherwise. + * \remarks Because this method only receives an array of interdependent curves, this filter assumes + * that they are all coming from an Euler rotation anim curve node. Therefore, it expects + * \e pCount to be equal to 3. + */ + virtual bool NeedApply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL); + + /** This filter expects to work with interdependent curves. Receiving one single curve is useless. + * \return \c false. + */ + virtual bool NeedApply(FbxAnimCurve& /*pCurve*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; }; + + /** This filter expects to work with 3 interdependent curves. Passing the animation stack makes no sense + * since this object would not know which curves to handle. + * \param pAnimStack Animation stack where to retrieve the animation curves. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false. + */ + virtual bool Apply(FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; }; + + /** This filter expects to work with 3 interdependent curves. Collecting all the animation curves from + * the properties defined in \e pObj could not guarantee that we are manipulating 3 interdependent curves. + * \param pObj Object containing the properties to test. + * \param pAnimStack Animation stack where to retrieve the animation curves. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false. + */ + virtual bool Apply(FbxObject* /*pObj*/, FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** Apply filter on all the curves of an animation curve node. + * \param pCurveNode Curve node to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks This filter expects a Euler rotation curve node with three curves. + */ + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL); + + /** Apply filter on the given animation curve. + * \param pCurve Array of curve to which the filter is applied. + * \param pCount Number of curves in array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks Because this method only receives an array of interdependent curves, this filter assumes + * that they are all coming from an Euler rotation anim curve node. Therefore, it expects + * \e pCount to be equal to 3. + */ + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL); + + /** This filter expects to work with 3 interdependent curves. Receiving one single curve is useless. + * \return \c false. + */ + virtual bool Apply(FbxAnimCurve& /*pCurve*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** Reset the filter to its default parameters. + */ + virtual void Reset(); + + /** Get the unroll quality tolerance. + * \return The current unroll quality tolerance. + * \remarks This value is only used when SetTestForPath() is set to true. + */ + double GetQualityTolerance() const; + + /** Set the unroll quality tolerance. + * \param pQualityTolerance The unroll quality tolerance to set. + * \remarks This value is only used when SetTestForPath() is set to true. + */ + void SetQualityTolerance(double pQualityTolerance); + + /** Get if the test path is enabled. + * \return \c true if test for path is enabled. + * \remarks The unroll filter takes a key as a reference key and updates the following keys accordingly to try to keep + * the continuity between this reference key and its following keys. + * If the test path is enabled, the filter can use the same key as reference key to update the following keys + * until the difference of continuity between the newly updated key and the reference key exceeds the + * quality tolerance, then the reference key will be updated as the newly updated key. + * If the test path is not enabled, the filter will always use the newly updated key as reference to update the next key. + * The quality tolerance can be set and queried by SetQualityTolerance() and GetQualityTolerance(). + */ + bool GetTestForPath() const; + + /** Set if the test path is enabled. + * \param pTestForPath Value to set if test for path is to be enabled. + * \remarks The unroll filter takes a key as a reference key and updates the following keys accordingly to try to keep + * the continuity between this reference key and its following keys. + * If the test path is enabled, the filter can use the same key as reference key to update the following keys + * until the difference of continuity between the newly updated key and the reference key exceeds the + * quality tolerance, then the reference key will be updated as the newly updated key. + * If the test path is not enabled, the filter will always use the newly updated key as reference to update the next key. + * The quality tolerance can be set and queried by SetQualityTolerance() and GetQualityTolerance(). + */ + void SetTestForPath(bool pTestForPath); + + /** Get the current state of the ForceAutoTangents flag. + * \return \c true if forcing AUTO tangents is enabled. + * \remarks This flag is considered only on curves using the CUBIC interpolation and + * keys with the USER or BREAK tangents. For any other type of interpolations + * or tangents, this flag is ignored. + */ + bool GetForceAutoTangents() const; + + /** Set the new state of the ForceAutoTangents flag. + * \param pForceAutoTangents New value of the flag. + * \remarks This flag is considered only on curves using the CUBIC interpolation and + * keys with the USER or BREAK tangents. For any other type of interpolations + * or tangents, this flag is ignored. + */ + void SetForceAutoTangents(bool pForceAutoTangents); + +/***************************************************************************************************************************** +** 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 SetRotationOrder(FbxEuler::EOrder pOrder); + +private: + double InterpolationQualityFactor(FbxVector4& lV1, FbxVector4& lV2); + + double mQualityTolerance; + bool mTestForPath; + bool mForceAutoTangents; + FbxEuler::EOrder mRotationOrder; + int mRotationLayerType; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** Matrix conversion filter. + * \nosubgrouping + * \remarks The current implementation of this filter expects to process 9 curves. If the + * ApplyUnroll flag is enabled, set with a call to SetApplyUnroll(), the + * internal unroll filter will automatically be configured to convert USER and + * BREAK tangents to AUTO (refer to the FbxAnimCurveFilterUnroll documentation). + */ +class FBXSDK_DLL FbxAnimCurveFilterMatrixConverter : public FbxAnimCurveFilter +{ +public: + //! Constructor. + FbxAnimCurveFilterMatrixConverter(); + + //! Destructor. + virtual ~FbxAnimCurveFilterMatrixConverter(); + + /** Get the name of the filter. + * \return Pointer to name. + */ + virtual const char* GetName() const; + + /** + * \name Exposed parent class methods. + */ + //@{ + virtual bool NeedApply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::NeedApply(pCurve, pCount,pStatus); } + virtual bool NeedApply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus=NULL) { return FbxAnimCurveFilter::NeedApply(pCurveNode, pStatus); } + virtual bool Apply(FbxAnimCurveNode& pCurveNode, FbxStatus* pStatus = NULL) { return FbxAnimCurveFilter::Apply(pCurveNode, pStatus); } + //@} + + /** This filter expects to work with interdependent curves. Passing the animation stack makes no sense + * since this object would not know which curves to handle. + * \param pAnimStack Animation stack. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false + */ + virtual bool NeedApply(FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** This filter expects to work with 9 interdependent curves. Collecting all the animation curves from + * the properties defined in \e pObj could not guarantee that we are manipulating 9 interdependent curves. + * \param pObj Object containing the properties to test. + * \param pAnimStack Animation stack where to retrieve the animation curves + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false + */ + virtual bool NeedApply(FbxObject* /*pObj*/, FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** Check if the animation curve nodes need an application of the filter. + * \param pCurveNode Curves to test if they need an application of the filter. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the animation curve nodes need an application of the filter and + * \c false if they don't or an incompatible configuration is detected. + * \remarks This method assumes that \e pCurveNode[0] holds the translation curve, + * \e pCurveNode[1] holds the rotation curves and \e pCurveNode[2] holds the + * scaling curves. + */ + virtual bool NeedApply(FbxAnimCurveNode* pCurveNode[3], FbxStatus* pStatus=NULL); + + /** This filter expects to work with interdependent curves. Receiving one single curve is useless. + * \return \c false. + */ + virtual bool NeedApply(FbxAnimCurve& /*pCurve*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** This filter expects to work with interdependent curves. Passing the animation stack makes no sense + * since this object would not know which curves to handle. + * \param pAnimStack Animation stack where to retrieve the animation curves. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false. + */ + virtual bool Apply(FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** This filter expects to work with 9 interdependent curves. Collecting all the animation curves from + * the properties defined in \e pObj could not guarantee that we are manipulating 9 interdependent curves. + * \param pObj Object containing the properties to test. + * \param pAnimStack Animation stack where to retrieve the animation curves. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c false. + */ + virtual bool Apply(FbxObject* /*pObj*/, FbxAnimStack* /*pAnimStack*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; } + + /** Apply filter on all the curves of the animation curve nodes. + * \param pCurveNode Curve nodes to which the filter is applied. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks This method assumes that \e pCurveNode[0] holds the translation curve, + * \e pCurveNode[1] holds the rotation curves and \e pCurveNode[2] holds the + * scaling curves. + */ + virtual bool Apply(FbxAnimCurveNode* pCurveNode[3], FbxStatus* pStatus=NULL); + + /** Apply filter on the given animation curves. + * \param pCurve Array of curve to which the filter is applied. + * \param pCount Number of curves in array. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks \e pCount must be equal to 9 + * \remarks Because this method only manipulates FbxAnimCurve objects, it cannot set/get + * the channels value. If the calling application wishes to use this flavor of the + * Apply() method, it is strongly suggested to use the method: + * FbxAnimCurveFilterMatrixConverter::Apply(FbxAnimCurve** pCurve, double& pVals[9]); + * The Apply(FbxAnimCurveNode*) method is not affected by this limitation since + * the channel values can be accessed via the animation curve node. + */ + virtual bool Apply(FbxAnimCurve** pCurve, int pCount, FbxStatus* pStatus=NULL); + + /** Apply filter on the given animation curves. + * \param pCurve Array of curve to which the filter is applied. + * \param pVals Array of channel values (same size as \e pCurve). + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the curve filtering operation was successful, \c false otherwise. + * \remarks This method assumes that \e pCurve contains exactly 9 curves. + * \remarks \e pVals must be correctly initialized with the channels values and, if the + * method calculates new values, they will be returned in this array. + * \remarks The curves are assumed to represent: Translation X,Y and Z, Rotation X,Y and Z and + * Scaling X,Y and Z in this order. + */ + bool Apply(FbxAnimCurve** pCurve, double* pVals, FbxStatus* pStatus=NULL); + + /** This filter expects to work with interdependent curves. Receiving one single curve is useless. + * \return \c false. + */ + virtual bool Apply(FbxAnimCurve& /*pCurve*/, FbxStatus* pStatus=NULL) { FBX_UNUSED(pStatus); return false; }; + + /** Reset the filter to its default parameters. + */ + virtual void Reset(); + + /** \enum EMatrixIndex Matrix index type + * - \e ePreGlobal + * - \e ePreTranslate + * - \e ePostTranslate + * - \e ePreRotate + * - \e ePreScale + * - \e ePostGlobal + * - \e eScaleOffset + * - \e eInactivePre + * - \e eInactivePost + * - \e eRotationPivot + * - \e eScalingPivot + * - \e eMatrixIndexCount + */ + enum EMatrixIndex + { + ePreGlobal, + ePreTranslate, + ePostTranslate, + ePreRotate, + ePostRotate, + ePreScale, + ePostScale, + ePostGlobal, + eScaleOffset, + eInactivePre, + eInactivePost, + eRotationPivot, + eScalingPivot, + eMatrixIndexCount + }; + + /** Get the Translation Rotation Scaling source matrix + * \param pIndex The matrix ID. + * \param pMatrix The matrix used to receive the source matrix. + */ + void GetSourceMatrix(EMatrixIndex pIndex, FbxAMatrix& pMatrix) const; + + /** Set the Translation Rotation Scaling source matrix. + * \param pIndex The matrix ID. + * \param pMatrix The matrix used to set the source matrix. + */ + void SetSourceMatrix(EMatrixIndex pIndex, FbxAMatrix& pMatrix); + + /** Get the Translation Rotation Scaling destination matrix. + * \param pIndex The matrix ID. + * \param pMatrix The matrix used to receive the destination matrix. + */ + void GetDestMatrix(EMatrixIndex pIndex, FbxAMatrix& pMatrix) const; + + /** Set the Translation Rotation Scaling destination matrix. + * \param pIndex The matrix ID. + * \param pMatrix The matrix used to set the destination matrix. + */ + void SetDestMatrix(EMatrixIndex pIndex, FbxAMatrix& pMatrix); + + /** Get the re-sampling period. + * \return the re-sampling period. + */ + FbxTime GetResamplingPeriod () const; + + /** Set the re-sampling period. + * \param pResamplingPeriod The re-sampling period to be set. + */ + void SetResamplingPeriod (FbxTime& pResamplingPeriod); + + /** Get the current state of the flag which determines if the last key should be generated exactly at the end time or not. + * This filter handles 9 animation curves, each of them has a stop time, the latest one is defined as the end time. + * \return \c true if last key is set exactly at end time, \c false otherwise. + */ + bool GetGenerateLastKeyExactlyAtEndTime() const; + + /** Set the flag to determine if the last key will be generated exactly at the end time or not. + * This filter handles 9 animation curves, each of them has a stop time, the latest one is defined as the end time. + * \param pFlag Set to \c true to generate the last key exactly at the end time, \c false otherwise. + */ + void SetGenerateLastKeyExactlyAtEndTime(bool pFlag); + + /** Check if re-sampling is on frame rate multiple. + * \return \c true if re-sampling is on a frame rate multiple. + */ + bool GetResamplingOnFrameRateMultiple() const; + + /** Set the re-sample on a frame rate multiple. + * \param pFlag The value to be set. + * \remarks It might be necessary that the starting time of the converted + * animation starts at an multiple of frame period starting from time 0. + * Most softwares play their animation at a definite frame rate, starting + * from time 0. As re-sampling occurs when we can't guarantee interpolation, + * keys must match with the moment when the curve is evaluated. + */ + void SetResamplingOnFrameRateMultiple(bool pFlag); + + /** Get the current state of the ApplyUnroll flag. + * \return \c true if the internal unroll filter is applied, \c false otherwise. + * \remarks Enable the internal unroll filter to get continuous rotation animation curves. + * \see FbxAnimCurveFilterUnroll. + */ + bool GetApplyUnroll() const; + + /** Set the state of the ApplyUnroll flag. + * \param pFlag Set to \c true to apply an unroll filter to the rotation curves internally, + * \ set to \c false otherwise. + */ + void SetApplyUnroll(bool pFlag); + + /** Get the current state of the flag that determines if constant key reducer is used or not. + * \return \c true if constant key reducer is applied, \c false otherwise. + */ + bool GetApplyConstantKeyReducer() const; + + /** Set the state of the flag that determines if constant key reducer is used or not. + * \param pFlag Set to \c true to apply the constant key reducer, + * \ Set to \c false otherwise. + */ + void SetApplyConstantKeyReducer(bool pFlag); + + /** Get the current state of the flag that determines if the translation data should be re-sampled or not. + * \return \c true if translation data is re-sampled upon conversion, \c false otherwise. + * \remarks If this flag is \c false, translation data must be calculated + * after the conversion process, overriding the re-sampling process. + */ + bool GetResampleTranslation() const; + + /** Set the state of the flag that determines if the translation data should be re-sampled or not. + * \param pFlag Set to \c true to re-sample the translation data, set to \c false otherwise. + * \remarks If this flag is set to \c false, translation data must be calculated + * after the conversion process, overriding the re-sampling process. + */ + void SetResampleTranslation(bool pFlag); + + /** Set the rotation order of the source matrix. + * \param pOrder The rotation order to be set. + */ + void SetSrcRotateOrder(FbxEuler::EOrder pOrder); + + /** Set the rotation order of the destination matrix. + * \param pOrder The rotation order to be set. + */ + void SetDestRotateOrder(FbxEuler::EOrder pOrder); + + /** Set the state of the flag to force usage of the filter even if source and destination matrices are equivalent. + * \param pVal Set to \c true to force usage of the filter, set to \c false otherwise. + */ + void SetForceApply(bool pVal); + + /** Get the current state of the flag to force usage of the filter even if source and destination matrices are equivalent. + * \return \c true to force usage of the filter, \c false otherwise. + */ + bool GetForceApply() const; + + /** Set the Translation limits to be applied during conversion. Only active limits are applied. + * \param limit The rotation limit to be set. + */ + void SetTranslationLimits(FbxLimits &limit ); + + /** Set the rotation limits to be applied during conversion. Only active limits are applied. + * \param limit The rotation limit to be set. + */ + void SetRotationLimits(FbxLimits &limit ); + + /** Set the scaling limits to be applied during conversion. Only active limits are applied. + * \param limit The scaling limit to be set. + */ + void SetScalingLimits(FbxLimits &limit ); + +/***************************************************************************************************************************** +** 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: + // Nicer than referring to 0, 1, 2... + enum EAxisIndex {eX, eY, eZ, eAxisCount}; + + // Convert parameter cell. + class Cell; + + bool MatricesEquivalence(FbxAMatrix pMatArrayA [eMatrixIndexCount], FbxAMatrix pMatArrayB [eMatrixIndexCount]) const; + + bool DoConvert(FbxAnimCurve** pCurve, + double pT[eAxisCount], + double pR[eAxisCount], + double pS[eAxisCount]); + + void FindTimeInterval + ( + FbxTime& pStart, + FbxTime& pEnd, + FbxAnimCurve* pTFCurve [eAxisCount], + FbxAnimCurve* pRFCurve [eAxisCount], + FbxAnimCurve* pSFCurve [eAxisCount] + ); + + void ComputeTotalMatrix + ( + FbxAMatrix& pGlobal, + Cell& pCell, + FbxAMatrix& pTranslate, + FbxAMatrix& pRotate, + FbxAMatrix& pScale + ); + + void ExtractTransforms + ( + FbxVector4& pScaleVector, + FbxVector4& pRotateVector, + FbxVector4& pTranslateVector, + FbxAMatrix& pGlobal, + Cell& pDest + ); + + void SetDestFCurve(FbxAnimCurve* pCurve [eAxisCount], + int pIndex, + FbxTime pTime, + FbxVector4 pVector, + FbxAnimCurveDef::EInterpolationType pInterpMode[eAxisCount], + FbxAnimCurveDef::ETangentMode pTangentMode[eAxisCount]); + + void FillInterpAndTangeant(FbxTime& pTime, + FbxAnimCurve* pSourceCurve[eAxisCount], + FbxAnimCurveDef::EInterpolationType* pInterp, + FbxAnimCurveDef::ETangentMode* pTangeant); + + void SetDestFCurveTangeant(FbxAnimCurve* pCurve [eAxisCount], + int pIndex, + FbxAnimCurveDef::ETangentMode pTangentMode[eAxisCount], + FbxVector4 pKeyValue, + FbxVector4 pNextKeyValue); + + Cell* mSource; + Cell* mDest; + + FbxTime mResamplingPeriod; + bool mResamplingOnFrameRateMultiple; + + bool mApplyUnroll; + bool mApplyConstantKeyReducer; + + // PP : So that the concatenation of matrices takes into account the rotation order + FbxRotationOrder* mSrcRotationOrder; + FbxRotationOrder* mDestRotationOrder; + + // Set last key exactly at end time or a frame period later. + bool mGenerateLastKeyExactlyAtEndTime; + + // Translation re-sampling flag. + bool mResampleTranslation; + + // Force Apply + bool mForceApply; + + // Limits + FbxLimits mTranslationLimits; + FbxLimits mRotationLimits; + FbxLimits mScalingLimits; + + // internal usage + FbxAnimCurveNode* mRotationCurveNode; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_ANIMATION_CURVE_FILTERS_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurvenode.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurvenode.h new file mode 100644 index 00000000..d18df4c7 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimcurvenode.h @@ -0,0 +1,354 @@ +/**************************************************************************************** + + 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 fbxanimcurvenode.h +#ifndef _FBXSDK_SCENE_ANIMATION_CURVE_NODE_H_ +#define _FBXSDK_SCENE_ANIMATION_CURVE_NODE_H_ + +#include + +#include + +#include + +//Standard curve node names +#define FBXSDK_CURVENODE_TRANSFORM "Transform" +#define FBXSDK_CURVENODE_TRANSLATION "T" +#define FBXSDK_CURVENODE_ROTATION "R" +#define FBXSDK_CURVENODE_SCALING "S" +#define FBXSDK_CURVENODE_COMPONENT_X "X" +#define FBXSDK_CURVENODE_COMPONENT_Y "Y" +#define FBXSDK_CURVENODE_COMPONENT_Z "Z" +#define FBXSDK_CURVENODE_COLOR "Color" +#define FBXSDK_CURVENODE_COLOR_RED FBXSDK_CURVENODE_COMPONENT_X +#define FBXSDK_CURVENODE_COLOR_GREEN FBXSDK_CURVENODE_COMPONENT_Y +#define FBXSDK_CURVENODE_COLOR_BLUE FBXSDK_CURVENODE_COMPONENT_Z + +class FbxAnimStack; +class FbxAnimCurve; +class FbxMultiMap; +class KFCurveNode; + +/** This class is an composite of animation curves and is called as animation curve node. + * \nosubgrouping + * Animation curve node is used as the connection point for animation curves and other animation curve nodes + * associated to a property. FbxAnimCurveNode can be connected to other FbxAnimCurveNode, + * in this case, the destination animation curve node may be considered as "composite", \ref IsComposite(). + * remarks When created, the FbxAnimCurveNode has no valid channels unless it is created using the function CreateTypedCurveNode(). + * This function will add all the required channels to correctly match the number of values of the property. + * For instance, when CreateTypedCurveNode(pNode.LclTranslation, pScene) is called, the resulting + * FbxAnimCurveNode will automatically have 3 channels corresponding to the X,Y and Z components of the LclTranslation property. + * You can add and remove channels dynamically but can never remove the channels that have been added by the call to CreateTypedCurveNode(). + * + * However, the FBX SDK animation system's default implementation is to consider only the first curve connected to + * the channel. Therefore, if the caller connects multiple animation curves to the same channel, then it becomes + * the caller's responsibility to handle and manipulate these extra curves in a meaningful manner. + */ +class FBXSDK_DLL FbxAnimCurveNode : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxAnimCurveNode, FbxObject); + +public: + /** + * \name Utility functions. + * + */ + //@{ + /** Check if the animation curve node contains any animation key. + * \param pRecurse \c true to descend to the children if the animation curve node is composite. + * \return \c true if at least one animation curve that contains one or more animation keys is found, + * \c false otherwise. + * \remarks This method only considers the first animation curve connected to each channel. + * To check multiple animation curves that are connected to the same channel, it is the caller's + * responsibility to write a new version of this method, and GetCurveCount() will be useful in this case. + */ + bool IsAnimated(bool pRecurse=false) const; + + /** Find out start and end time of the animation. + * This function retrieves the including time span for all animation curves of this animation curve node. + * \param pTimeInterval Reference to receive start time and end time. + * \return \c true on success, \c false otherwise. + * \remarks \c false is also returned if this animation curve node has no animation. + * \remarks This method only considers the first animation curve connected to each channel. + * To find time interval of multiple animation curves that are connected to the same channel, it is the caller's + * responsibility to write a new version of this method, and GetCurveCount() will be useful in this case. + */ + bool GetAnimationInterval(FbxTimeSpan& pTimeInterval) const; + + /** Test this object to see if it is a composite FbxAnimCurveNode or a "leaf". + * A composite FbxAnimCurveNode is a FbxAnimCurveNode whose all source connections are FbxAnimCurveNode + * and its property channels is totally empty. It is just a container to take other FbxAnimCurveNode. + * \return \c true if this object is a composite, \c false otherwise. + */ + bool IsComposite() const; + + /** Recursively look for the FbxAnimCurveNode matching the passed named argument. + * \param pName Name of the FbxAnimCurveNode we are looking for. + * \return The found anim curve node or NULL. + * \remarks If pName is an empty string, this function automatically return NULL. + */ + FbxAnimCurveNode* Find(const char* pName); + + /** Create a FbxAnimCurveNode compatible with the specified property data type. + * \param pProperty The property that needs a FbxAnimCurveNode. + * \param pScene The scene the created FbxAnimCurveNode will belong to. + * \return The pointer to the newly created FbxAnimCurveNode. Returns NULL if an error occurred. + * \remarks This function does not connect the newly created FbxAnimCurveNode to the property. + * \remarks This function detects FbxDouble3, FbxDouble4 and FbxDouble4x4 properties DataTypes and + * automatically adds the required channels properties. Any other DataType is not + * specifically processed and the channels properties are left empty and need to be filled + * using the AddChannel() function. + */ + static FbxAnimCurveNode* CreateTypedCurveNode(FbxProperty& pProperty, FbxScene* pScene); + + /** Get the total number of property channels defined in this animation curve node. + * For composite animation curve nodes, since they do not contain any channels, this function will always return 0. + * \return The number of property channels. + */ + unsigned int GetChannelsCount() const; + + /** Get the index of the named channel. + * \param pChannelName Name of the channel for which we want the index. + * \return the index of the named channel or -1 if no channel with this name is found. + */ + int GetChannelIndex(const char* pChannelName) const; + + /** Get the name of the channel. + * \param pChannelId Index of the channel for which we want the name. + * \return the name of the indexed channel or "" if the index is invalid. + */ + FbxString GetChannelName(int pChannelId) const; + + /** Empties the property channels of this animation curve node. + * \remarks This function will remove all the channels added with the AddChannel() method + * regardless of their use and/or connections. + * But it can not remove the channels that are added by the call to CreateTypedCurveNode(). + */ + void ResetChannels(); + + /** Adds the specified channel property. + * \param pChnlName Channel name. + * \param pValue Default value of the channel. + * \return \c true if successful, \c false otherwise. + * \remarks It is an error to try to add a channel that already exists. + */ + template bool AddChannel(const char* pChnlName, T const &pValue) + { + if (!pChnlName || strlen(pChnlName)==0) return false; + FbxProperty c = GetChannel(pChnlName); + if (c.IsValid()) + { + return false; + } + + mChannels.BeginCreateOrFindProperty(); + FbxDataType dt = FbxGetDataTypeFromEnum(FbxTypeOf(pValue)); + c = FbxProperty::Create(mChannels, dt, pChnlName); + c.Set(pValue); + mChannels.EndCreateOrFindProperty(); + return true; + } + + /** Set the default value of the channel. + * \param pChnlName Channel name. + * \param pValue New default value of this channel. + */ + template void SetChannelValue(const char* pChnlName, T pValue) + { + FbxProperty c = GetChannel(pChnlName); + if( c.IsValid() ) c.Set(pValue); + } + + /** Set the default value of the channel. + * \param pChnlId Channel index. + * \param pValue New default value of this channel. + */ + template void SetChannelValue(unsigned int pChnlId, T pValue) + { + FbxProperty c = GetChannel(pChnlId); + if( c.IsValid() ) c.Set(pValue); + } + + /** Get the default value of the channel. + * \param pChnlName Channel name. + * \param pInitVal Value returned if the specified channel is invalid. + * \return The default value of this channel. + */ + template T GetChannelValue(const char* pChnlName, T pInitVal) + { + T v = pInitVal; + FbxProperty c = GetChannel(pChnlName); + if( c.IsValid() ) v = c.Get(); + return v; + } + + /** Get the default value of the channel. + * \param pChnlId Channel index. + * \param pInitVal Value returned if the specified channel is invalid. + * \return The default value of this channel. + */ + template T GetChannelValue(unsigned int pChnlId, T pInitVal) + { + T v = pInitVal; + FbxProperty c = GetChannel(pChnlId); + if( c.IsValid() ) v = c.Get(); + return v; + } + //@} + + /** + * \name FbxAnimCurve management. + * + */ + //@{ + /** Disconnect the animation curve from the channel. + * \param pCurve The curve to disconnect from the channel. + * \param pChnlId The channel index. + * \return \c true if the disconnection was made, \c false if an error occurred. + */ + bool DisconnectFromChannel(FbxAnimCurve* pCurve, unsigned int pChnlId); + + /** Connects the given animation curve to the specified channel. + * \param pCurve The curve to connect to the channel. + * \param pChnl The name of the channel the curve is to be connected to. + * \param pInFront When \c true, all the current connections are moved after this one, + * making this one the first. By default, the connection is the last one. + * \return \c true if the connection was made, \c false if an error occurred. + */ + bool ConnectToChannel(FbxAnimCurve* pCurve, const char* pChnl, bool pInFront = false); + + /** Connects the given animation curve to the specified channel. + * \param pCurve The curve to connect to the channel. + * \param pChnlId Index of the channel the curve is to be connected to. + * \param pInFront When \c true, all the current connections are moved after this one. + * making this one the first. By default, the connection is the last one. + * \return \c true if the connection was made, \c false if an error occurred. + * \remarks The index is 0 based. + */ + bool ConnectToChannel(FbxAnimCurve* pCurve, unsigned int pChnlId, bool pInFront = false); + + /** Creates a new curve and connects it to the specified channel of the animation curve node named pCurveNodeName. + * If this animation curve node is composite, this function will try to search all children animation curve nodes + * recursively for the one named pCurveNodeName. + * \param pCurveNodeName Name of the FbxAnimCurveNode we are looking for. + * \param pChannel Channel identifier. + * \return Pointer to the FbxAnimCurve or NULL if an error occurred. + * \remarks pCurveNodeName cannot be empty. + * \remarks If the pChannel identifier is left NULL, the first valid channel will be used to create curve. + */ + FbxAnimCurve* CreateCurve(const char* pCurveNodeName, const char* pChannel); + + /** Creates a new curve and connects it to the specified channel of the animation curve node named pCurveNodeName. + * If this animation curve node is composite, this function will try to search all children animation curve nodes + * recursively for the one named pCurveNodeName. + * \param pCurveNodeName Name of the FbxAnimCurveNode we are looking for. + * \param pChannelId Channel index. + * \return Pointer to the FbxAnimCurve or NULL if an error occurred. + * \remarks pCurveNodeName cannot be empty. + * If the pChannelId is not assigned, the first valid channel will be used to create curve. + */ + FbxAnimCurve* CreateCurve(const char* pCurveNodeName, unsigned int pChannelId = 0); + + /** Get the number of FbxAnimCurve connected to the specified channel. + * If this animation curve node is composite, this function will try to search all children animation curve nodes + * recursively for the one named pCurveNodeName. + * \param pChannelId Channel index. + * \param pCurveNodeName Name of the FbxAnimCurveNode we are looking for. + * \return The number of animation curves on the specified channel or 0 if an error occurred. + * \remarks This method fails if the FbxAnimCurveNode with name pCurveNodeName does not exist and return 0. + * If the specified channel cannot be found on the FbxAnimCurveNode with name pCurveNodeName, return 0. + * \remarks If this animation curve node is composite, this function will try to search all + * children animation curve nodes recursively for the one named pCurveNodeName. + * If the pCurveNodeName is left NULL, then only look for the curves on this animation curve node + * even if it is composite. + */ + int GetCurveCount(unsigned int pChannelId, const char* pCurveNodeName = NULL); + + /** Get the FbxAnimCurve of the specified channel. + * If this animation curve node is composite, this function will try to search all children animation curve nodes + * recursively for the one named pCurveNodeName. + * \param pChannelId Channel index. + * \param pId The index of the desired anim curve (in case there is more than one). + * \param pCurveNodeName Name of the FbxAnimCurveNode we are looking for (if this object is a composite). + * \return Pointer to the FbxAnimCurve that matches the criteria. + * \remarks This method fails if the FbxAnimCurveNode with name pCurveNodeName does not exist and return NULL. + * If the specified channel cannot be found in the FbxAnimCurveNode with name pCurveNodeName, return NULL. + * \remarks If the pCurveNodeName is left NULL, then only search in the curves on this animation curve node + * even if it is composite. + */ + FbxAnimCurve* GetCurve(unsigned int pChannelId, unsigned int pId = 0, const char* pCurveNodeName = NULL); + + //@} + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + + static const char* CurveNodeNameFrom(const char* pName); + static bool EvaluateChannels(FbxAnimCurveNode* pCurveNode, double* pData, unsigned int pCount, FbxTime pTime); + + void ReleaseKFCurveNode(); + void SyncChannelsWithKFCurve(); + + inline bool UseQuaternionInterpolation() {return mQuaternionInterpolation != 0;}; + bool SetQuaternionInterpolation(unsigned short pVal); + unsigned short GetQuaternionInterpolation() { return mQuaternionInterpolation; }; + void SetKFCurveNodeLayerType(FbxProperty& pProp); + KFCurveNode* GetKFCurveNode(bool pNoCreate=false); + +private: + friend class FbxAnimCurveFilterMatrixConverter; + friend class FbxAnimEvalClassic; + void Evaluate(double* pData, FbxTime pTime); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + virtual void ConstructProperties(bool pForceSet); + virtual bool ConnectNotify(const FbxConnectEvent& pEvent); + + FbxAnimCurveNode* Find(FbxAnimCurveNode* pRoot, const FbxString& pName); + +private: + FbxProperty GetChannel(const char* pChnl); + FbxProperty GetChannel(unsigned int pChnlId); + + friend void CollectAnimFromCurveNode(void **lSrc, void *fcn, unsigned int nbCrvs, FbxAnimCurveNode *cn, FbxMultiMap* pNickToAnimCurveTimeWarpsSet, FbxMultiMap& pNickToKFCurveNodeWarpSet); + + unsigned char mNonRemovableChannels; + FbxProperty mChannels; + FbxProperty* mCurrentlyProcessed; + KFCurveNode* mFCurveNode; + bool* mOwnedKFCurve; + int mKFCurveNodeLayerType; + unsigned short mQuaternionInterpolation; + int* mDirectIndexes; + int mDirectIndexesSize; + + FbxAnimCurve* GetCurve(unsigned int pChannelId, unsigned int pId, FbxAnimCurveNode* pCurveNode); + bool ConnectToChannel(FbxProperty& p, FbxAnimCurve* pCurve, bool pInFront); + void ResetKFCurveNode(); + void SyncKFCurveValue(FbxAnimCurve* pCurve, double pVal); + void ReleaseOwnershipOfKFCurve(int pIndex); + + template FbxAnimCurve* CreateCurveGeneral(const char* pCurveNodeName, T pChannel); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +FBXSDK_DLL void GetAllAnimCurves(FbxAnimStack* pAnimStack, FbxArray& pCurves); +FBXSDK_DLL void GetAllAnimCurves(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxArray& pCurves); + +#include + +#endif // FBXFILESDK_KFBXPLUGINS_KFBXANIMCURVENODE_H + diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimevalclassic.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimevalclassic.h new file mode 100644 index 00000000..64d994f5 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimevalclassic.h @@ -0,0 +1,175 @@ +/**************************************************************************************** + + 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 fbxanimevalclassic.h +#ifndef _FBXSDK_SCENE_ANIMATION_EVALUATOR_CLASSIC_H_ +#define _FBXSDK_SCENE_ANIMATION_EVALUATOR_CLASSIC_H_ + +#include + +#include +#include +#include + +#include + +/** An evaluator implementation that behaves like the original FBX SDK (2010 and previous) evaluation system. + * + * It works by implementing the abstract class FbxAnimEvaluator, which is used as the main interface for evaluators. + * \note While this class can be instanced at any time, it is preferable to access the evaluator via the function + * FbxScene::GetEvaluator(), which will automatically return the default evaluator used in the current FBX SDK. + * This is very useful because it will allow the user to use the very same evaluator used by the FBX SDK internally. + * \see FbxAnimEvaluator, FbxScene + */ +class FBXSDK_DLL FbxAnimEvalClassic : public FbxAnimEvaluator +{ + FBXSDK_OBJECT_DECLARE(FbxAnimEvalClassic, FbxAnimEvaluator); + + enum EBlendType {eSimple, eRotation, eScaling}; + + /** Calculate values of properties LclTranslation, LclRotation, LclScaling of a node at the specified time + * and update the mLT, mLR, mLT fields of the node's NodeEvalState. + * \param pResult The NodeEvalState to update. + * \param pNode The node to evaluate. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pStack The current animation stack used by the evaluator. + * \remarks Values of properties LclTranslation, LclRotation, LclScaling will be updated to pResult->mLT, pResult->mLR, pResult->mLS. + * The translation, rotation and scaling limits are taken into consideration. + * Only LclTranslation, LclRotation and LclScaling are taken into accounts, no other transform, such as pivot, offset are calculated here. + */ + void ComputeTRSLocal(FbxNodeEvalState* pResult, FbxNode* pNode, const FbxTime& pTime, FbxAnimStack* pStack); + + /** Calculate global transform of a node at the specified time and update the mGX field of the node's NodeEvalState. + * \param pResult The NodeEvalState to update. + * \param pNode The node to evaluate. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pStack The current animation stack used by the evaluator. + * \param pPivotSet The pivot set to take into account. + * \param pApplyTarget Applies the necessary transform to align into the target node + * \remarks Calculated global transform will be updated to pResult->mGX. + * ComputeGlobalTransform must be called after the call to ComputeTRSLocal, there is a dependency. + * All transforms are taken into account, including: + * Transform = Translation * RotationOffset* RotationPivot* PreRotation * LocalRotation* PostRotation * RotationPivotInverse* ScalingOffset* ScalingPivot* LocalScaling* ScalingPivotInverse + * Also,the translation, rotation and scaling limits are taken into consideration. + */ + void ComputeGlobalTransform(FbxNodeEvalState* pResult, FbxNode* pNode, const FbxTime& pTime, FbxAnimStack* pStack, FbxNode::EPivotSet pPivotSet, bool pApplyTarget); + + /** Calculate local transform of a node at the specified time and update the mLX field of the node's NodeEvalState. + * \param pResult The NodeEvalState to update. + * \param pNode The node to evaluate. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pStack The current animation stack used by the evaluator. + * \param pPivotSet The pivot set to take into account. + * \param pApplyTarget Applies the necessary transform to align into the target node + * \remarks Calculated local transform will be updated to pResult->mLX. + * ComputeLocalTransform must be called after the call to ComputeGlobalTransform, there is a dependency. + * The local transform matrix is calculated in this way: ParentGlobal.Inverse() * Global, all transforms such as pre/post rotation are taken into consideration. + * To get values of properties LclTranslation, LclRotaion and LclScaling at the specified time, please use ComputeTRSLocal. + * Also,the translation, rotation and scaling limits are taken into consideration. + */ + void ComputeLocalTransform(FbxNodeEvalState* pResult, FbxNode* pNode, const FbxTime& pTime, FbxAnimStack* pStack, FbxNode::EPivotSet pPivotSet, bool pApplyTarget); + + /** Check if the property has corresponding animation curve node on the specified animation layer. + * \param pProperty The property to check. + * \param pAnimLayer The animation layer to check on. + * \return \c true if pProperty has corresponding animation curve node on pAnimLayer, \c false otherwise. + */ + bool HasAnimationCurveNode(FbxProperty& pProperty, FbxAnimLayer* pAnimLayer); + + /** Calculate values of properties LclTranslation, LclRotation, LclScaling of a node at the specified time on certain animation layer. + * \param pResult The NodeEvalState to update. + * \param pNode The node to evaluate. + * \param pLT To take the calculated value of LclTranslation. + * \param pLR To take the calculated value of LclRotation. + * \param pLS To take the calculated value of LclScaling. + * \param pTime The time used for evaluate. + * \param pLayer The current animation layer used to do the calculation. + * \param pBlend if \c false, only animation on current layer will be taken into account, and pResult->mCurveNode will be updated accordingly. + if \c true, the value on this animation layer will be blended with current value of pLT, pLR and pLS. + * \remarks The usual usage of this function is to call it on the first animation layer with out blending, then call it repeatedly on other + * animation layers with blending to get the blended value of pLT, pLR and pLS of all animation layers. + */ + void ComputeTRSAnimationLayer(FbxNodeEvalState* pResult, FbxNode* pNode, FbxVector4& pLT, FbxVector4& pLR, FbxVector4& pLS, const FbxTime& pTime, FbxAnimLayer* pLayer, bool pBlend); + + /** Blend value of a property on certain animation layer to pResult. + * \param pResult The blended value of the property. + * \param pResultSize The elements number of the property value. + * \param pProperty The property to be blended. + * \param pEvalState An auxiliary parameter, the NodeEvalState to get rotation order for eRotation type blending. + * \param pTime The time used for evaluate. + * \param pLayer The current animation layer used to do the calculation. + * \param pType There are three blend types, eSimple, eRotation, eScaling + * \remarks The blended value will be kept in pResult. + */ + void BlendPropertyEvalWithLayer(double* pResult, int pResultSize, FbxProperty& pProperty, FbxNodeEvalState* pEvalState, const FbxTime& pTime, FbxAnimLayer* pLayer, EBlendType pType); + + /** Blends two arrays of values in a simple weighted linear blending way. + * \param pResult The first array of values to be blended. + * \param pResultSize The number of elements of the first value to be blended. + * \param pApply The second array of values to be blended. + * \param pApplySize The number of elements of the second value to be blended. + * \param pWeight The weight used to blend. + * \param pBlendMode The blend mode to use. + * \see BlendMode + * \remarks The blended value will be kept in pResult. + */ + void BlendSimple(double* pResult, int pResultSize, double* pApply, int pApplySize, double pWeight, FbxAnimLayer::EBlendMode pBlendMode); + + /** Blends two arrays of values representing rotations. + * \param pResult The first array of values to be blended. + * \param pResultSize The number of elements of the first value to be blended. + * \param pApply The second array of values to be blended. + * \param pApplySize The number of elements of the second value to be blended. + * \param pWeight The weight used to blend. + * \param pBlendMode The blend mode to use. + * \param pRotAccuMode The rotation accumulation mode. + * \param pRotationOrder The rotation order to be used for blending. + * \remarks The blended value will be kept in pResult. And this blend should not be used with anything other than rotations. + * \see BlendMode, RotationAccumulationMode + */ + void BlendRotation(double* pResult, int pResultSize, double* pApply, int pApplySize, double pWeight, FbxAnimLayer::EBlendMode pBlendMode, FbxAnimLayer::ERotationAccumulationMode pRotAccuMode, int pRotationOrder); + + /** Blends two arrays of values representing scaling transforms. + * \param pResult The first array of values to be blended. + * \param pResultSize The number of elements of the first value to be blended. + * \param pApply The second array of values to be blended. + * \param pApplySize The number of elements of the second value to be blended. + * \param pWeight The weight used to blend. + * \param pBlendMode The blend mode to use. + * \param pScaleAccuMode The scaling accumulation mode. + * \remarks The blended value will be kept in pResult.And this blend should not be used with anything other than scaling transform. + * \see BlendMode, ScaleAccumulationMode. + */ + void BlendScaling(double* pResult, int pResultSize, double* pApply, int pApplySize, double pWeight, FbxAnimLayer::EBlendMode pBlendMode, FbxAnimLayer::EScaleAccumulationMode pScaleAccuMode); + +/***************************************************************************************************************************** +** 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 void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + + virtual void EvaluateNodeTransform(FbxNodeEvalState* pResult, FbxNode* pNode, const FbxTime& pTime, FbxNode::EPivotSet pPivotSet, bool pApplyTarget); + virtual void EvaluatePropertyValue(FbxPropertyEvalState* pResult, FbxProperty& pProperty, const FbxTime& pTime); + +private: + double* mPropertyValues; + int mPropertySize; + + double* mCurveNodeEvalValues; + int mCurveNodeEvalSize; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_ANIMATION_EVALUATOR_CLASSIC_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimevalstate.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimevalstate.h new file mode 100644 index 00000000..8a048c69 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimevalstate.h @@ -0,0 +1,136 @@ +/**************************************************************************************** + + 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 fbxanimevalstate.h +#ifndef _FBXSDK_SCENE_ANIMATION_EVALUATION_STATE_H_ +#define _FBXSDK_SCENE_ANIMATION_EVALUATION_STATE_H_ + +#include + +#include +#include +#include + +#include + +class FbxTransform; +class FbxNodeEvalState; +class FbxPropertyEvalState; + +typedef FbxMap FbxNodeEvalStateMap; +typedef FbxMap FbxPropertyEvalStateMap; +typedef FbxMap FbxAnimLayerCurveNodeMap; +typedef FbxMap FbxPropertyCurveNodeMap; + +/** This class hold results from animation evaluations. To clear an evaluation state for re-use, it is possible to invalidate + * or to reset it. For the same scene with the same objects, invalidating an evaluation state is the quickest way to clear + * an evaluation state object for re-use because it only zeroes all the entries. A reset will delete all the entries. + * Unless the scene changes, for performance purposes it is recommended to invalidate evaluation states instead of resetting them. + * + * \internal + * \see FbxAnimEvaluator + */ +class FBXSDK_DLL FbxAnimEvalState +{ +public: + /** Get the time associated with this evaluation state. + * \return The time associated with this evaluation state. */ + FbxTime GetTime() const; + + /** Reset an evaluation state by deleting the cache it contains. This will remove all entries in the cache. */ + void Reset(); + + /** Start a new evaluation state frame by zeroing the cache it contains, and changing its associated time. All + * node and property entries will remain in the list, but their evaluation state will not be up-to-date. + * \param pTime The time at which the evaluation state should be set after the invalidation. */ + void Begin(const FbxTime& pTime); + + /** Invalidate a node evaluation state to force update on next evaluation. + * \param pNode The node that needs to be updated on next evaluation. */ + void Flush(FbxNode* pNode); + + /** Invalidate a property evaluation state to force update on next evaluation. + * \param pProperty The property that needs to be updated on next evaluation. */ + void Flush(FbxProperty& pProperty); + + /** Get node transform evaluation result from the evaluation state. + * \param pNode The node for which the value was stored. + * \return The global or local matrix transform for the specified node. */ + FbxNodeEvalState* GetNodeEvalState(FbxNode* pNode); + + /** Get a property evaluation result from the evaluation state. + * \param pProperty The property for which the value was stored. + * \return The result value that was stored. */ + FbxPropertyEvalState* GetPropertyEvalState(FbxProperty& pProperty); + + /** Get a property curve node from the evaluation state for quick access. + * \param pProperty The property to search for its animation curve node. + * \param pAnimLayer The animation layer on which the animation curve node must be searched. + * \remark This function uses a map to store animation curve node search results. If animation curve nodes are replaced, the evaluation state must be reset. */ + FbxAnimCurveNode* GetPropertyCurveNode(FbxProperty& pProperty, FbxAnimLayer* pAnimLayer); + +/***************************************************************************************************************************** +** 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 + FbxAnimEvalState(); + virtual ~FbxAnimEvalState(); + +private: + FbxTime mTime; + FbxNodeEvalStateMap mNodeMap; + FbxPropertyEvalStateMap mPropertyMap; + FbxPropertyCurveNodeMap mPropertyCurveNodeMap; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +//! This class serves as the base class for an evaluation state element. +class FBXSDK_DLL FbxEvalState +{ +public: + FbxEvalState() : mUpToDate(false){} + bool mUpToDate; //!< If \c true, the evaluation state element is up-to-date for the current evaluation time. +}; + +//! This class hold results for node evaluation. +class FBXSDK_DLL FbxNodeEvalState : public FbxEvalState +{ +public: + FbxNodeEvalState(FbxNode* pNode); + + FbxVector4 mLT; //!< Used to hold result value of LclTranslation property from node evaluation. + FbxVector4 mLR; //!< Used to hold result value of LclRotation property from node evaluation. + FbxVector4 mLS; //!< Used to hold result value of LclScaling property from node evaluation. + FbxAMatrix mLX; //!< Used to hold result local transform matrix from node evaluation. Pivots, offsets, pre/post rotation and all other transforms are taken into consideration. + FbxAMatrix mGX; //!< Used to hold result global transform matrix from node evaluation. Pivots, offsets, pre/post rotation and all other transforms are taken into consideration. + + /** mTransform is used to hold the corresponding FbxTransform of the node. + * This FbxTransform takes all transform-related info, including pivots, offsets, pre/post rotation, rotation order, limits, etc. + * The evaluation is actually done through the utility functions of FbxTransform. */ + FbxTransform* mTransform; +}; + +//! This class hold results for property evaluation. +class FBXSDK_DLL FbxPropertyEvalState : public FbxEvalState +{ +public: + FbxPropertyEvalState(FbxProperty& pProperty); + virtual ~FbxPropertyEvalState(); + + template inline T Get() const { T lValue; mValue->Get(&lValue, FbxTypeOf(lValue)); return lValue; } + template inline bool Set(const T& pValue){ return mValue->Set(&pValue, FbxTypeOf(pValue)); } + + FbxPropertyValue* mValue; +}; + +#include + +#endif /* _FBXSDK_SCENE_ANIMATION_EVALUATION_STATE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimevaluator.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimevaluator.h new file mode 100644 index 00000000..66edc163 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimevaluator.h @@ -0,0 +1,194 @@ +/**************************************************************************************** + + 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 fbxanimevaluator.h +#ifndef _FBXSDK_SCENE_ANIMATION_EVALUATOR_H_ +#define _FBXSDK_SCENE_ANIMATION_EVALUATOR_H_ + +#include + +#include +#include +#include + +#include + +/** The principal interface for animation evaluators. The animation evaluator is used to compute node transforms +* and property values at specific times during an animation. Evaluators simplify the process of computing transform +* matrices by taking into account all of the parameters, such as pre- and post-rotations. +* This class is abstract so that SDK users can implement their own evaluator if needed. The default evaluator used +* by the FBX SDK is a FbxAnimEvalClassic. The default evaluator can be queried with the function +* FbxScene::GetEvaluator(), and can be changed using FbxScene::SetEvaluator(). +* +* When working with scene nodes, the evaluator will always return an affine transform matrix that contains the +* translation, rotation and scale of that node. +* +* When working with object properties, the evaluator will always return a structure that can contain as many components +* as the property can have. For example, an RGB color property would return a structure containing 3 channels. The +* class FbxAnimCurveNode is used as a data container to store those values, because it can handle as many channels as +* needed, even if the property is not a real curve node . +* +* Below is a typical usage of the evaluator class to retrieve the global transform matrix of each node in a scene: +* \code +* //Here we assume the user already imported a scene... +* for( int i = 0, c = MyScene->GetMemberCount(FbxNode::ClassId); i < c; ++i ) +* { +* FbxNode* CurrentNode = MyScene->GetMember(FbxNode::ClassId, i); +* FbxAMatrix& NodeGlobalTransform = MyScene->GetEvaluator()->GetNodeGlobalTransform(CurrentNode); +* } +* +* //There is an equivalent call to retrieve a node's global transform, which is exactly the same as calling Scene->GetEvaluator() : +* FbxAMatrix& NodeGlobalTransform = CurrentNode->EvaluateGlobalTransform(); +* \endcode +* +* Another typical usage of the evaluator class, but this time to retrieve the value of an animated color property on a material: +* \code +* //Assuming the user imported a scene with objects and materials... +* FbxColor Color = MyMaterial->GetDiffuseColor()->EvaluateValue(); +* \endcode +* +* \note Note that all the methods to retrieve global/local matrices as well as property values returns references. +* This is important for performance purposes, to prevent an extra memory copy. +* \see FbxScene, FbxAnimEvalClassic, FbxAnimCurveNode */ +class FBXSDK_DLL FbxAnimEvaluator : public FbxObject +{ + FBXSDK_ABSTRACT_OBJECT_DECLARE(FbxAnimEvaluator, FbxObject); + +public: + /** Returns a node's global transformation matrix at the specified time. The node's translation, rotation and scaling limits are taken into consideration. + * \param pNode The node to evaluate. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting global transform of the specified node at the specified time. */ + FbxAMatrix& GetNodeGlobalTransform(FbxNode* pNode, const FbxTime& pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Returns a node's local transformation matrix at the specified time. The node's translation, rotation and scaling limits are taken into consideration. + * \param pNode The node to evaluate. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting local transform of the specified node for the specified time. + * \remarks The local transform matrix is calculated in this way: ParentGlobal.Inverse * Global, all transforms such as pre/post rotation are taken into consideration. + * This will return a different value than LclTranslation, LclRotation and LclScaling at the specified time. To evaluate these properties separately + * without taking pre/post rotation, pivots and offsets into consideration, please use GetNodeLocalTranslation(), GetNodeLocalRotation() and GetNodeLocalScaling(). */ + FbxAMatrix& GetNodeLocalTransform(FbxNode* pNode, const FbxTime& pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Returns the value of a node's LclTranslation property at the specified time. + * No pivot, offsets, or any other transform is taken into consideration. The translation limit is applied. + * \param pNode The transform node to evaluate. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting value of LclTranslation property of the specified node at the specified time. */ + FbxVector4& GetNodeLocalTranslation(FbxNode* pNode, const FbxTime& pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Returns the value of a node's LclRotation property at the specified time. + * No pre/post rotation, rotation pivot, rotation offset or any other transform is taken into consideration. The rotation limit is applied. + * \param pNode The transform node to evaluate. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting value of LclRotation property of the specified node at the specified time. */ + FbxVector4& GetNodeLocalRotation(FbxNode* pNode, const FbxTime& pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Returns the value of a node's LclScaling property at the specified time. + * No scaling pivot, scaling offset or any other transform is taken into consideration. The scaling limit is applied. + * \param pNode The transform node to evaluate. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting value of LclScaling property of the specified node at the specified time. */ + FbxVector4& GetNodeLocalScaling(FbxNode* pNode, const FbxTime& pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Get a property's value at the specified time using the template type provided. + * \param pProperty The property to evaluate. + * \param pTime The time used for evaluate. + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The property value at the specified time converted to the template type provided, if possible. + * \remark If the property type versus the template cannot be converted, the result is unknown. */ +#if defined(__GNUC__) && (__GNUC__ < 4) + template inline T GetPropertyValue(FbxProperty& pProperty, const FbxTime& pTime, bool pForceEval=false){ FbxPropertyEvalState* s = GetPropertyEvalState(pProperty, pTime, pForceEval); return s->Get(); } +#else + template inline T GetPropertyValue(FbxProperty& pProperty, const FbxTime& pTime, bool pForceEval=false){ return GetPropertyEvalState(pProperty, pTime, pForceEval)->Get(); } +#endif + + /** Get a property's value at the specified time. + * \param pProperty The property to evaluate. + * \param pTime The time used for evaluate. + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The property value at the specified time. Use FbxPropertyValue::Get() to retrieve the value into a pointer location of your choice. */ + FbxPropertyValue& GetPropertyValue(FbxProperty& pProperty, const FbxTime& pTime, bool pForceEval=false); + + /** Get a property curve node from the evaluation state for quick access. + * \param pProperty The property to search for its animation curve node. + * \param pAnimLayer The animation layer on which the animation curve node must be searched. + * \remark This function uses a map to store animation curve node search results. If animation curve nodes are replaced, the evaluation state must be reset. */ + FbxAnimCurveNode* GetPropertyCurveNode(FbxProperty& pProperty, FbxAnimLayer* pAnimLayer); + + /** Validate if the given time value is within animation stack time span range. + * \param pTime The time value to validate. + * \return The new validated time, clamped by the animation stack time span range. + * \remarks If no animation stack are found, time zero is returned. This function is not used by the evaluator itself. */ + FbxTime ValidateTime(const FbxTime& pTime); + + /** Completely reset the evaluation state cache by deleting all entries. This reset automatically happens when changing the current context. */ + void Reset(); + + /** Clears the specified node evaluation state cache, so the next time the evaluation is called for this node it get refreshed. + * \param pNode The node that needs to be re-evaluated in next evaluation. */ + void Flush(FbxNode* pNode); + + /** Clears the specified property evaluation state cache, so the next time the evaluation is called for this property it get refreshed. + * \param pProperty The property that needs to be re-evaluated in next evaluation. */ + void Flush(FbxProperty& pProperty); + + /** Compute node local TRS from global transform. Doesn't change cached state for current time. + * \param[out] pRetLT Computed local translation. + * \param[out] pRetLR Computed local rotation. + * \param[out] pRetLS Computed local scaling. + * \param pNode The transform node to evaluate. + * \param pGX Global transformation state. + * \param pTime The time used for evaluate.If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account. + * \param pApplyTarget Applies the necessary transform to align into the target node. + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. */ + void ComputeLocalTRSFromGlobal(FbxVector4& pRetLT, FbxVector4& pRetLR, FbxVector4& pRetLS, FbxNode* pNode, FbxAMatrix& pGX, const FbxTime& pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + +/***************************************************************************************************************************** +** 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 void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + + virtual void EvaluateNodeTransform(FbxNodeEvalState* pResult, FbxNode* pNode, const FbxTime& pTime, FbxNode::EPivotSet pPivotSet, bool pApplyTarget) = 0; + virtual void EvaluatePropertyValue(FbxPropertyEvalState* pResult, FbxProperty& pProperty, const FbxTime& pTime) = 0; + + FbxAnimEvalState* GetDefaultEvalState(); + FbxAnimEvalState* GetEvalState(const FbxTime& pTime); + FbxNodeEvalState* GetNodeEvalState(FbxNode* pNode, const FbxTime& pTime, FbxNode::EPivotSet pPivotSet, bool pApplyTarget, bool pForceEval); + FbxPropertyEvalState* GetPropertyEvalState(FbxProperty& pProperty, const FbxTime& pTime, bool pForceEval); + +private: + FbxAnimEvalState* mEvalState; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_ANIMATION_EVALUATOR_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimlayer.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimlayer.h new file mode 100644 index 00000000..fa81696e --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimlayer.h @@ -0,0 +1,197 @@ +/**************************************************************************************** + + 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 fbxanimlayer.h +#ifndef _FBXSDK_SCENE_ANIMATION_LAYER_H_ +#define _FBXSDK_SCENE_ANIMATION_LAYER_H_ + +#include + +#include + +#include + +class FbxAnimCurveNode; + +/** The animation layer is a collection of animation curve nodes. Its purpose is to store + * a variable number of FbxAnimCurveNode. The class provides different states flags (bool properties), + * an animatable weight, and the blending mode flag to indicate how the data on this layer is interacting + * with the data of the other layers during the evaluation. + * \nosubgrouping + */ +class FBXSDK_DLL FbxAnimLayer : public FbxCollection +{ + FBXSDK_OBJECT_DECLARE(FbxAnimLayer, FbxCollection); + +public: + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + + /** This property stores the weight factor. + * The weight factor is the percentage of influence this layer has during + * the evaluation. + * + * Default value is \c 100.0 + */ + FbxPropertyT Weight; + + /** This property stores the mute state. + * The mute state indicates that this layer should be excluded from the evaluation. + * + * Default value is \c false + */ + FbxPropertyT Mute; + + /** This property stores the solo state. + * The solo state indicates that this layer is the only one that should be + * processed during the evaluation. + * + * Default value is \c false + */ + FbxPropertyT Solo; + + /** This property stores the lock state. + * The lock state indicates that this layer has been "locked" from editing operations + * and should no longer receive keyframes. + * + * Default value is \c false + */ + FbxPropertyT Lock; + + /** This property stores the display color. + * This color can be used by applications if they display a graphical representation + * of the layer. The FBX SDK does not use it but guarantees that the value is saved to the FBX + * file and retrieved from it. + * + * Default value is \c (0.8, 0.8, 0.8) + */ + FbxPropertyT Color; + + /** This property stores the blend mode. + * The blend mode is used to specify how this layer influences the animation evaluation. See the + * BlendMode enumeration for the description of the modes. + * + * Default value is \c eModeAdditive + */ + FbxPropertyT BlendMode; + + /** This property stores the rotation accumulation mode. + * This option indicates how the rotation curves on this layer combine with any preceding layers + * that share the same attributes. See the RotationAccumulationMode enumeration for the description + * of the modes. + * + * Default value is \c eRotationByLayer + */ + FbxPropertyT RotationAccumulationMode; + + /** This property stores the scale accumulation mode. + * This option indicates how the scale curves on this layer combine with any preceding layers + * that share the same attributes. See the ScaleAccumulationMode enumeration for the description + * of the modes. + * + * Default value is \c eScaleMultiply + */ + FbxPropertyT ScaleAccumulationMode; + + //! Reset this object properties to their default value. + void Reset(); + + /** + * \name BlendMode bypass functions + * This section provides methods to bypass the current layer blend mode by data type. + * When the state is \c true, the evaluators that are processing the layer will + * need to consider that, for the given data type, the blend mode is forced to be Overwrite. + * If the state is left to its default \c false value, then the layer blend mode applies. + * \remarks This section only supports the basic types defined in the fbxtypes.h header file. + */ + //@{ + + /** Set the bypass flag for the given data type. + * \param pType The fbxType identifier. + * \param pState The new state of the bypass flag. + * \remarks If pType is eFbxTypeCount, then pState is applied to all the data types. + */ + void SetBlendModeBypass(EFbxType pType, bool pState); + + /** Get the current state of the bypass flag for the given data type. + * \param pType The fbxType identifier. + * \return The current state of the flag for a valid pType value and \c false in any other case. + */ + bool GetBlendModeBypass(EFbxType pType); + + //@} + + + /** Blend mode type between animation layers. + */ + enum EBlendMode + { + eBlendAdditive, //! The layer "adds" its animation to layers that precede it in the stack and affect the same attributes. + eBlendOverride, //! The layer "overrides" the animation of any layer that shares the same attributes and precedes it in the stack. + eBlendOverridePassthrough /*! mBlendModeBypass; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_ANIMATION_LAYER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimstack.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimstack.h new file mode 100644 index 00000000..c822bf98 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimstack.h @@ -0,0 +1,150 @@ +/**************************************************************************************** + + 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 fbxanimstack.h +#ifndef _FBXSDK_SCENE_ANIMATION_STACK_H_ +#define _FBXSDK_SCENE_ANIMATION_STACK_H_ + +#include + +#include +#include + +#include + +// these symbols are defined for backward compatibility +#define FBXSDK_TAKENODE_DEFAULT_NAME "Default" +#define FBXSDK_ROOTCURVE_DEFAULT_NAME "Defaults" + +class FbxTakeInfo; +class FbxThumbnail; +class FbxAnimEvaluator; + +/** The Animation stack is a collection of animation layers. The Fbx document can have one or + * more animation stacks. Each stack can be viewed as one "take" in the previous versions of the FBX SDK. + * The "stack" terminology comes from the fact that the object contains 1 to n animation layers that + * are evaluated according to their blending modes to produce a resulting animation for a given attribute. + * \nosubgrouping + */ +class FBXSDK_DLL FbxAnimStack : public FbxCollection +{ + FBXSDK_OBJECT_DECLARE(FbxAnimStack, FbxCollection); + +public: + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + /** This property stores a description string of this animation stack. + * This string can be used to display, in a human readable format, information + * relative to this animation stack object. + * Default value is "". + * \remarks The applications using the FBX SDK are not required to manipulate this information. + */ + FbxPropertyT Description; + + /** This property stores the local time span "Start" time. + * This "start" time should be seen as a time marker. Typically it would represent the whole animation + * starting time but its use (and update) is left to the calling application (with one exception occurring + * in the BakeLayers). The FBX SDK does not use this value internally and only guarantees that it will be stored + * to the FBX file and retrieved from it. + * + * Default value is 0. + */ + FbxPropertyT LocalStart; + + /** This property stores the local time span "Stop" time. + * This "stop" time should be seen as a time marker. Typically it would represent the whole animation + * ending time but its use (and update) is left to the calling application (with one exception occurring + * in the BakeLayers). The FBX SDK does not use this value internally and only guarantees that it will be stored + * to the FBX file and retrieved from it. + * + * Default value is 0 + */ + FbxPropertyT LocalStop; + + /** This property stores the reference time span "Start" time. + * This reference start time is another time marker that can be used by the calling application. The FBX SDK + * never uses it and only guarantees that this value is stored in the FBX file and retrieved from it. + * + * Default value is 0 + */ + FbxPropertyT ReferenceStart; + + /** This property stores the reference time span "Stop" time. + * This reference stop time is another time marker that can be used by the calling application. The FBX SDK + * never uses it and only guarantees that this value is stored in the FBX file and retrieved from it. + * + * Default value is 0 + */ + FbxPropertyT ReferenceStop; + + /** Reset the object time spans either to their default values or from the pTakeInfo structure, if provided. + * \param pTakeInfo The take info to be used during reset. + */ + void Reset(const FbxTakeInfo* pTakeInfo = NULL); + + /** + * \name Utility functions. + * + */ + //@{ + /** Get the LocalStart and LocalStop time properties as a FbxTimeSpan. + * \return The current local time span. + */ + FbxTimeSpan GetLocalTimeSpan() const; + + /** Set the LocalStart and LocalStop time properties from a FbxTimeSpan. + * \param pTimeSpan The new local time span. + */ + void SetLocalTimeSpan(FbxTimeSpan& pTimeSpan); + + /** Get the ReferenceStart and ReferenceStop time properties as a FbxTimeSpan. + * \return The current reference time span. + */ + FbxTimeSpan GetReferenceTimeSpan() const; + + /** Set the ReferenceStart and ReferenceStop time properties from a FbxTimeSpan. + * \param pTimeSpan The new reference time span. + */ + void SetReferenceTimeSpan(FbxTimeSpan& pTimeSpan); + + /** Bake all the animation layers on the base layer. + * This function will process all the properties on every animation layer and generate a re-sampled set of + * animation keys (representing the layers' evaluated result) on the base layer. Once this operation is completed + * successfully, all the layers (except the base one) are destroyed. Properties that are only defined on the base + * layer will remain unaffected by the re-sampling. The stack local timespan is updated with the overall animation range. + * + * \param pEvaluator The layer evaluator. This is the engine that evaluates the overall result of any given + * property according to the layers flags. + * \param pStart The start time of the re-sampling range. + * \param pStop The stop time of the re-sampling range. + * \param pPeriod The time increment for the re-sampling. + * \return \c true if the operation was successful and \c false in case of errors. + * \remarks If this AnimStack contains only one AnimLayer, the function will return false and do nothing. + */ + bool BakeLayers(FbxAnimEvaluator* pEvaluator, FbxTime pStart, FbxTime pStop, FbxTime pPeriod); + //@} + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_ANIMATION_STACK_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/animation/fbxanimutilities.h b/libs/fbx/include/fbxsdk/scene/animation/fbxanimutilities.h new file mode 100644 index 00000000..ceb008f2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/animation/fbxanimutilities.h @@ -0,0 +1,193 @@ +/**************************************************************************************** + + 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 fbxanimutilities.h +#ifndef _FBXSDK_SCENE_ANIMATION_UTILITIES_H_ +#define _FBXSDK_SCENE_ANIMATION_UTILITIES_H_ + +#include + +#include +#include +#include +#include + +#include + +class FbxMultiMap; +class FbxObject; +class FbxProperty; +class FbxScene; +class FbxIO; +class FbxAnimStack; +class FbxAnimLayer; +class FbxAnimCurveNode; +class FbxAnimCurve; + +class FBXSDK_DLL FbxAnimUtilities +{ +public: + /** Inspects all the properties of the given object for animation curves. + * \param pObj Pointer to the object to query. + * \return \c true if at least one property is animated and \c false otherwise. + * \remarks A property is animated if it contains at least one FbxAnimCurve with keys. + */ + static bool IsAnimated(FbxObject* pObj); + + /** Inspects the specified property of the given object for animation curves. + * \param pObj Pointer to the object to query. + * \param pPropertyName Name of the inspected property. + * \param pChannelName Name of the specific channel of the inspected property. + * \return \c true if the specified channel is animated and \c false otherwise. + * \remarks A property is animated if it contains at least one FbxAnimCurve with keys. + */ + static bool IsChannelAnimated(FbxObject* pObj, const char* pPropertyName, const char* pChannelName = NULL); + + class FBXSDK_DLL FbxAnimSplitDef + { + public: + FbxString mName; + FbxTime mStart; + FbxTime mEnd; + + FbxAnimSplitDef() + { + mName = "unnamed"; + mStart = 0; + mEnd = 0; + } + + FbxAnimSplitDef(const FbxString& pName, FbxTime& pStart, FbxTime& pEnd) + { + mName = pName; + mStart = pStart; + mEnd = pEnd; + } + + FbxAnimSplitDef& operator =(const FbxAnimSplitDef& pRhs) + { + mName = pRhs.mName; + mStart = pRhs.mStart; + mEnd = pRhs.mEnd; + return *this; + } + } ; + + class FBXSDK_DLL CurveNodeIntfce + { + public: + // pData is a pointer to the private KFCurveNode + CurveNodeIntfce(void* pData); + ~CurveNodeIntfce(); + + FbxHandle GetHandle(); + + char* GetTimeWarpName() const; + CurveNodeIntfce GetTimeWarp(); + + CurveNodeIntfce GetLayer(int pId); + + int GetCount(); + void* GetHandle(unsigned int pId); + void* GetCurveHandle(int pId = -1); + void SetCurveHandle(void* pCurveHandle, int pId = -1); + CurveNodeIntfce FindRecursive(const char* pName); + + bool IsValid() { return mImp != NULL; } + CurveNodeIntfce& operator=(CurveNodeIntfce& lRhs) + { + mImp = lRhs.mImp; + return *this; + } + + bool operator==(CurveNodeIntfce& lRhs) + { + return (mImp == lRhs.mImp); + } + + private: + friend class FbxAnimUtilities; + void* mImp; + }; + + class FBXSDK_DLL CurveIntfce + { + public: + // pData is a pointer to the private KFCurve + CurveIntfce(void* pData); + CurveIntfce(FbxAnimCurve* pAnimCurve); + ~CurveIntfce(); + + float GetValue(); + void SetValue(float pVal); + int KeyGetCount(); + + void* GetCurveHandle(); + void SetCurveHandle(void* pData); + + int GetPreExtrapolation(); + int GetPreExtrapolationCount(); + int GetPostExtrapolation(); + int GetPostExtrapolationCount(); + + + bool IsValid() { return mImp != NULL; } + CurveIntfce& operator=(CurveIntfce& lRhs) + { + mImp = lRhs.mImp; + mIsAnimCurveImp = lRhs.mIsAnimCurveImp; + return *this; + } + + bool operator==(CurveIntfce& lRhs) + { + return (mImp == lRhs.mImp); + } + + private: + friend class FbxAnimUtilities; + + void* mImp; + bool mIsAnimCurveImp; + }; + + static int SplitAnimationIntoMultipleStacks(FbxScene* pScene, const FbxArray& pAnimSplitDefinitions, const FbxAnimStack* pSrcAnimStack, FbxArray& pDstStacks); + static void ShareAnimCurves(FbxProperty& pDstProperty, FbxProperty& pSrcProperty, FbxScene* pScene); + + // Encapsulate use of private animation data + static void SetTimeWarpSet(FbxMultiMap* pTWset); + + static CurveNodeIntfce CreateCurveNode(const char* pName); + static CurveNodeIntfce CreateCurveNode(FbxIO* pFileObject); + static CurveNodeIntfce CreateCurveNode(FbxIO* pFileObject, CurveNodeIntfce& pParent, bool pOnlyDefaults = false); + static CurveNodeIntfce CreateTimeWarpNode(FbxAnimCurve* pAnimCurve, const char* pFalloffName); + + static CurveNodeIntfce GrabCurveNode(FbxAnimCurveNode* pCN); + static void RestrieveCurveNode(CurveNodeIntfce& pData, FbxIO* mFileObject); + static void StoreCurveNode(CurveNodeIntfce& pData, FbxIO* mFileObject); + static void ReleaseCurveNode(FbxAnimCurveNode* pCurveNode); + static void DestroyCurveNode(CurveNodeIntfce& pData); + static void DestroyCurve(CurveIntfce& pData); + + static void ConnectTimeWarp(FbxAnimCurveNode* pCurveNode, CurveNodeIntfce& pData, FbxMultiMap& pTimeWarpsKFCurveNodes); + static void MergeLayerAndTimeWarp(FbxObject* pObj, FbxAnimLayer* pAnimLayer); + + static void CopyFrom(FbxAnimCurve* pAC, CurveIntfce& pFC); + static bool CompareCurves(FbxAnimCurve* pAC1, FbxAnimCurve* pAC2); + + static void Resample(FbxAnimCurve &pSourceCurve, FbxAnimCurve &pTargetCurve, FbxTime &pStart, FbxTime &pStop, FbxTime &pPeriod, FbxAnimCurveDef::EInterpolationType pInterpolation, FbxAnimCurveDef::ETangentMode pTangentMode, bool pAddStopKey = false); + static void Resample(FbxAnimCurve &pSourceCurve, FbxAnimCurve &pTargetCurve, FbxTime &pStart, FbxTime &pStop, FbxTime &pPeriod, bool pAddStopKey = false); + static void Resample(FbxAnimCurve &pCurve, FbxTime pPeriod, FbxTime pStart = FBXSDK_TIME_MINUS_INFINITE, FbxTime pStop = FBXSDK_TIME_INFINITE, bool pKeysOnFrame = false); +}; + +#include + +#endif /* _FBXSDK_SCENE_ANIMATION_UTILITIES_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxcharacter.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxcharacter.h new file mode 100644 index 00000000..b67b5dd2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxcharacter.h @@ -0,0 +1,971 @@ +/**************************************************************************************** + + 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 fbxcharacter.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_CHARACTER_H_ +#define _FBXSDK_SCENE_CONSTRAINT_CHARACTER_H_ + +#include + +#include +#include + +#include + +class FbxControlSet; + +/** \class FbxCharacterLink + * + * \brief This class represents a link between a given FBX node and the associated node in the character hierarchy. It also contains + * the transform matrix (offset) for the linked character's node. + */ +class FBXSDK_DLL FbxCharacterLink +{ +public: + /** \enum EType Character link type */ + enum EType + { + eCharacterLink, + eControlSetLink, + eControlSetEffector, + eControlSetEffectorAux + }; + + /** Default Constructor. */ + FbxCharacterLink(); + + /** Copy Constructor. */ + FbxCharacterLink(const FbxCharacterLink& pCharacterLink); + + /** Assignment operation + * \param pCharacterLink Another FbxCharacterLink object assigned to this one. + */ + FbxCharacterLink& operator=(const FbxCharacterLink& pCharacterLink); + + /** Reset to default values. */ + void Reset(); + + FbxNode* mNode; //! The character's node in hierarchy linked to this character link. + FbxString mTemplateName; //! A template name is a naming convention that is used to automatically map the nodes of other skeletons that use the same naming convention. + FbxVector4 mOffsetT; //! Get offset position of this character link. + FbxVector4 mOffsetR; //! Get offset rotation of this character link. + FbxVector4 mOffsetS; //! Get offset scale of this character link. + FbxVector4 mParentROffset; //! Get the parent offset rotation of this character link + bool mHasRotSpace; //! \c true if this character link has a defined rotation space + FbxLimits mRLimits; //! Get the rotation limits of this character link + FbxVector4 mPreRotation; //! Get the PreRotation of this character link + FbxVector4 mPostRotation; //! Get the PostRotation of this character link + int mRotOrder; //! Get the rotation order of this character link + double mAxisLen; //! Get the axis length of this character link + +/***************************************************************************************************************************** +** 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 + FbxProperty mPropertyLink; + FbxProperty mPropertyOffsetT; + FbxProperty mPropertyOffsetR; + FbxProperty mPropertyOffsetS; + FbxProperty mPropertyParentOffsetR; + FbxProperty mPropertyTemplateName; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** A Character is a person or animal with pre-defined skeleton system. The skeleton system is composed of multiple named node (skeleton). + * This class contains all methods to setup an exported character or query information on an imported character. + * This class also contains some methods for manipulating the FbxCharacterLink, FbxControlSet + * + * The most important part of a FbxCharacter is the FbxCharacterLink. There is one FbxCharacterLink for each characterized node. + * For more information see FbxCharacterLink class documentation. + * + * \see FbxCharacterLink, FbxControlSet + */ +class FBXSDK_DLL FbxCharacter : public FbxConstraint +{ + FBXSDK_OBJECT_DECLARE(FbxCharacter, FbxConstraint); + +public: + /** \enum EInputType Character input type. + * - \e eInputActor Not supported. + * - \e eInputCharacter The character's input is another character. + * - \e eInputMarkerSet The character's input is a control rig. + * - \e eOutputMarkerSet Not supported. + * - \e eInputStancePose The character's input is the stance pose. + */ + enum EInputType + { + eInputActor, + eInputCharacter, + eInputMarkerSet, + eOutputMarkerSet, + eInputStancePose + }; + + /** \enum EGroupId Define ID for character groups that contains multiple character nodes. */ + enum EGroupId + { + eGroupBase, + eGroupAuxiliary, + eGroupSpine, + eGroupRoll, + eGroupSpecial, + eGroupLeftHand, + eGroupRightHand, + eGroupProps, + eGroupGameModeParent, + eGroupNeck, + eGroupLeftFoot, + eGroupRightFoot, + eGroupFloorContact, + eGroupIdCount + }; + + /** \enum ENodeId Define ID for each character node. + */ + enum ENodeId + { + eHips, + eLeftHip, + eLeftKnee, + eLeftAnkle, + eLeftFoot, + eRightHip, + eRightKnee, + eRightAnkle, + eRightFoot, + eWaist, + eChest, + eLeftCollar, + eLeftShoulder, + eLeftElbow, + eLeftWrist, + eRightCollar, + eRightShoulder, + eRightElbow, + eRightWrist, + eNeck, + eHead, + eLeftHipRoll, + eLeftKneeRoll, + eRightHipRoll, + eRightKneeRoll, + eLeftShoulderRoll, + eLeftElbowRoll, + eRightShoulderRoll, + eRightElbowRoll, + eSpine2, + eSpine3, + eSpine4, + eSpine5, + eSpine6, + eSpine7, + eSpine8, + eSpine9, + eLeftThumbA, + eLeftThumbB, + eLeftThumbC, + eLeftIndexA, + eLeftIndexB, + eLeftIndexC, + eLeftMiddleA, + eLeftMiddleB, + eLeftMiddleC, + eLeftRingA, + eLeftRingB, + eLeftRingC, + eLeftPinkyA, + eLeftPinkyB, + eLeftPinkyC, + eRightThumbA, + eRightThumbB, + eRightThumbC, + eRightIndexA, + eRightIndexB, + eRightIndexC, + eRightMiddleA, + eRightMiddleB, + eRightMiddleC, + eRightRingA, + eRightRingB, + eRightRingC, + eRightPinkyA, + eRightPinkyB, + eRightPinkyC, + eReference, + eLeftFloor, + eRightFloor, + eHipsTranslation, + eProps0, + eProps1, + eProps2, + eProps3, + eProps4, + eGameModeParentLeftHipRoll, + eGameModeParentLeftKnee, + eGameModeParentLeftKneeRoll, + eGameModeParentRightHipRoll, + eGameModeParentRightKnee, + eGameModeParentRightKneeRoll, + eGameModeParentLeftShoulderRoll, + eGameModeParentLeftElbow, + eGameModeParentLeftElbowRoll, + eGameModeParentRightShoulderRoll, + eGameModeParentRightElbow, + eGameModeParentRightElbowRoll, + eLeftUpLegRoll, + eLeftLegRoll, + eRightUpLegRoll, + eRightLegRoll, + eLeftArmRoll, + eLeftForeArmRoll, + eRightArmRoll, + eRightForeArmRoll, + eLeftHandFloor, + eRightHandFloor, + eLeftHand, + eRightHand, + eNeck1, + eNeck2, + eNeck3, + eNeck4, + eNeck5, + eNeck6, + eNeck7, + eNeck8, + eNeck9, + eLeftInHandThumb, + eLeftThumbD, + eLeftInHandIndex, + eLeftIndexD, + eLeftInHandMiddle, + eLeftMiddleD, + eLeftInHandRing, + eLeftRingD, + eLeftInHandPinky, + eLeftPinkyD, + eLeftInHandExtraFinger, + eLeftExtraFingerA, + eLeftExtraFingerB, + eLeftExtraFingerC, + eLeftExtraFingerD, + eRightInHandThumb, + eRightThumbD, + eRightInHandIndex, + eRightIndexD, + eRightInHandMiddle, + eRightMiddleD, + eRightInHandRing, + eRightRingD, + eRightInHandPinky, + eRightPinkyD, + eRightInHandExtraFinger, + eRightExtraFingerA, + eRightExtraFingerB, + eRightExtraFingerC, + eRightExtraFingerD, + eLeftInFootThumb, + eLeftFootThumbA, + eLeftFootThumbB, + eLeftFootThumbC, + eLeftFootThumbD, + eLeftInFootIndex, + eLeftFootIndexA, + eLeftFootIndexB, + eLeftFootIndexC, + eLeftFootIndexD, + eLeftInFootMiddle, + eLeftFootMiddleA, + eLeftFootMiddleB, + eLeftFootMiddleC, + eLeftFootMiddleD, + eLeftInFootRing, + eLeftFootRingA, + eLeftFootRingB, + eLeftFootRingC, + eLeftFootRingD, + eLeftInFootPinky, + eLeftFootPinkyA, + eLeftFootPinkyB, + eLeftFootPinkyC, + eLeftFootPinkyD, + eLeftInFootExtraFinger, + eLeftFootExtraFingerA, + eLeftFootExtraFingerB, + eLeftFootExtraFingerC, + eLeftFootExtraFingerD, + eRightInFootThumb, + eRightFootThumbA, + eRightFootThumbB, + eRightFootThumbC, + eRightFootThumbD, + eRightInFootIndex, + eRightFootIndexA, + eRightFootIndexB, + eRightFootIndexC, + eRightFootIndexD, + eRightInFootMiddle, + eRightFootMiddleA, + eRightFootMiddleB, + eRightFootMiddleC, + eRightFootMiddleD, + eRightInFootRing, + eRightFootRingA, + eRightFootRingB, + eRightFootRingC, + eRightFootRingD, + eRightInFootPinky, + eRightFootPinkyA, + eRightFootPinkyB, + eRightFootPinkyC, + eRightFootPinkyD, + eRightInFootExtraFinger, + eRightFootExtraFingerA, + eRightFootExtraFingerB, + eRightFootExtraFingerC, + eRightFootExtraFingerD, + eLeftCollarExtra, + eRightCollarExtra, + eLeafLeftHipRoll1, + eLeafLeftKneeRoll1, + eLeafRightHipRoll1, + eLeafRightKneeRoll1, + eLeafLeftShoulderRoll1, + eLeafLeftElbowRoll1, + eLeafRightShoulderRoll1, + eLeafRightElbowRoll1, + eLeafLeftHipRoll2, + eLeafLeftKneeRoll2, + eLeafRightHipRoll2, + eLeafRightKneeRoll2, + eLeafLeftShoulderRoll2, + eLeafLeftElbowRoll2, + eLeafRightShoulderRoll2, + eLeafRightElbowRoll2, + eLeafLeftHipRoll3, + eLeafLeftKneeRoll3, + eLeafRightHipRoll3, + eLeafRightKneeRoll3, + eLeafLeftShoulderRoll3, + eLeafLeftElbowRoll3, + eLeafRightShoulderRoll3, + eLeafRightElbowRoll3, + eLeafLeftHipRoll4, + eLeafLeftKneeRoll4, + eLeafRightHipRoll4, + eLeafRightKneeRoll4, + eLeafLeftShoulderRoll4, + eLeafLeftElbowRoll4, + eLeafRightShoulderRoll4, + eLeafRightElbowRoll4, + eLeafLeftHipRoll5, + eLeafLeftKneeRoll5, + eLeafRightHipRoll5, + eLeafRightKneeRoll5, + eLeafLeftShoulderRoll5, + eLeafLeftElbowRoll5, + eLeafRightShoulderRoll5, + eLeafRightElbowRoll5, + eNodeIdCount, + eNodeIdInvalid=-1 + }; + + enum EOffAutoUser + { + eParamModeOff, + eParamModeAuto, + eParamModeUser + }; + + enum EAutoUser + { + eParamModeAuto2, + eParamModeUser2 + }; + + enum EPostureMode + { + ePostureBiped, + ePostureQuadriped, + ePostureCount + }; + + enum EFloorPivot + { + eFloorPivotAuto, + eFloorPivotAnkle, + eFloorPivotToes, + eFloorPivotCount + }; + + enum ERollExtractionMode + { + eRelativeRollExtraction, + eAbsoluteRollExtraction, + eRollExtractionTypeCount + }; + + enum EHipsTranslationMode + { + eHipsTranslationWorldRigid, + eHipsTranslationBodyRigid, + eHipsTranslationTypeCount + }; + + enum EFootContactType + { + eFootTypeNormal, + eFootTypeAnkle, + eFootTypeToeBase, + eFootTypeHoof, + eFootContactModeCount + }; + + enum EHandContactType + { + eHandTypeNormal, + eHandTypeWrist, + eHandTypeFingerBase, + eHandTypeHoof, + eHandContactModeCount + }; + + enum EFingerContactMode + { + eFingerContactModeSticky, + eFingerContactModeSpread, + eFingerContactModeStickySpread, + eFingerContactModeCount + }; + + enum EContactBehaviour + { + eContactNeverSync, + eContactSyncOnKey, + eContactAlwaysSync, + eContactBehaviorCount + }; + + enum EPropertyUnit + { + ePropertyNoUnit, + ePropertyPercent, + ePropertySecond, + ePropertyCentimeter, + ePropertyDegree, + ePropertyEnum, + ePropertyReal + }; + + enum EErrorCode + { + eInternalError, + eErrorCount + }; + + /** Reset to default values. + * - Input type will be set to eInputStancePose. + * - Input object will be set to NULL. + * - Each Character link will be reset. + * - The control set will be reset. + */ + void Reset(); + + /** Set input type and index. + * \param pInputType Input type. + * \param pInputObject Pointer to input character if input type equals eInputCharacter, otherwise \c NULL. + */ + void SetInput(EInputType pInputType, FbxObject* pInputObject = NULL); + + //! Get input type. + EInputType GetInputType() const; + + /** Get input actor or character. + * \return Pointer or \c Null, depending on the input type. + * - If the input type is set to eInputCharacter. The returned pointer can be casted to a pointer of type FbxCharacter. + * - \c Null pointer if the input object has not been set, or if the input type is not set to eInputCharacter. + */ + FbxObject* GetInputObject() const; + + /** Associate a character link to a given character node ID. If a character link already exists for this character node ID, + * the character link will be removed. + * \param pCharacterNodeId Character node ID. + * \param pCharacterLink Character link. + * \param pUpdateObjectList Set to \c true to update the object list (default value). + * \return \c true if successful, \c false otherwise. + */ + bool SetCharacterLink(ENodeId pCharacterNodeId, const FbxCharacterLink& pCharacterLink, bool pUpdateObjectList = true); + + /** Get a character link associated with a given character node ID. + * \param pCharacterNodeId ID of character node requested. + * \param pCharacterLink Optional pointer to receive the character link if function succeeds. + * \return \c true if successful, \c false otherwise. + */ + bool GetCharacterLink(ENodeId pCharacterNodeId, FbxCharacterLink* pCharacterLink = NULL) const; + + /** Get control set associated with the character. + * \return Return the control set associated with the character. + */ + FbxControlSet& GetControlSet() const; + + /** Get number of elements in a given character group. + * \param pCharacterGroupId Character group ID. + * \return The number of elements in the pCharacterGroupId character group. + */ + static int GetCharacterGroupCount(EGroupId pCharacterGroupId); + + /** Get character node ID of an element in a given character group. + * \param pCharacterGroupId Character group ID. + * \param pIndex Character index ID. + * \return Character node ID. + */ + static ENodeId GetCharacterGroupElementByIndex(EGroupId pCharacterGroupId, int pIndex); + + + /** Get character node name of an element in a given character group. + * \param pCharacterGroupId Character group ID. + * \param pIndex Character index ID. + * \return Character node name. + */ + static char* GetCharacterGroupNameByIndex(EGroupId pCharacterGroupId, int pIndex); + + /** Get character node version of an element in a given character group. + * \param pCharacterGroupId Character group ID. + * \param pIndex Character index ID. + * \return Character node version. + */ + static int GetCharacterGroupVersionByIndex(EGroupId pCharacterGroupId, int pIndex); + + /** Find the character group index associated with a given character node name. + * \param pName Character node name. + * \param pForceGroupId Set to \c true to force the character group ID. + * \param pCharacterGroupId Receives character group ID. + * \param pIndex Receives character index ID. + * \return \c true if successful, otherwise \c false. + */ + static bool FindCharacterGroupIndexByName(const char* pName, bool pForceGroupId, EGroupId& pCharacterGroupId, int& pIndex); + + /** Get character node group and index of a given character node ID. + * \param pCharacterNodeId Character node ID. + * \param pCharacterGroupId if the Character node ID is found, the method returns the group ID through this parameter + * \param pIndex if the Character node ID is found, the method returns the index through this parameter + * \remarks Only works for a character node ID that is part of a group. + * \return \c true if successful, \c false otherwise. + */ + static bool GetCharacterGroupIndexByElement(ENodeId pCharacterNodeId, EGroupId& pCharacterGroupId, int& pIndex); + + /** Get character node version of a given character node ID. + * \param pCharacterNodeId Character node ID to get version. + * \param pVersion if the node ID is found, the method returns the version through this parameter + * \remarks Only works for a character node ID is part of a group. + * \return \c true if successful, \c false otherwise. + */ + static bool GetCharacterGroupVersionByElement(ENodeId pCharacterNodeId, int& pVersion); + + /** Get character node name associated with a given character node ID. + * \param pCharacterNodeId Character node ID to get name. + * \param pName if the node ID is found, the method returns the node name through this parameter + * Since the Pointer points to internal data, it is not necessary to allocate a string buffer + * before calling this function. + * \return \c true if a name exists for the given node ID. + */ + static bool GetCharacterNodeNameFromNodeId(ENodeId pCharacterNodeId, char*& pName); + + /** Get the character node ID associated with a given character node name. + * \param pName Character node name to get node ID. + * \param pCharacterNodeId if the node name is found, this method returns the node ID through this parameter + * \return \c true if a node ID exists for the given node name. + */ + static bool GetCharacterNodeIdFromNodeName(const char* pName, ENodeId& pCharacterNodeId); + + // FbxCharacter Properties + FbxPropertyT PullIterationCount; + FbxPropertyT Posture; + FbxPropertyT ForceActorSpace; + FbxPropertyT ScaleCompensation; + FbxPropertyT ScaleCompensationMode; + FbxPropertyT HipsHeightCompensation; + FbxPropertyT HipsHeightCompensationMode; + FbxPropertyT AnkleHeightCompensation; + FbxPropertyT AnkleHeightCompensationMode; + FbxPropertyT AnkleProximityCompensation; + FbxPropertyT AnkleProximityCompensationMode; + FbxPropertyT MassCenterCompensation; + FbxPropertyT ApplyLimits; + FbxPropertyT ChestReduction; + FbxPropertyT CollarReduction; + FbxPropertyT NeckReduction; + FbxPropertyT HeadReduction; + FbxPropertyT ReachActorLeftAnkle; + FbxPropertyT ReachActorRightAnkle; + FbxPropertyT ReachActorLeftKnee; + FbxPropertyT ReachActorRightKnee; + FbxPropertyT ReachActorChest; + FbxPropertyT ReachActorHead; + FbxPropertyT ReachActorLeftWrist; + FbxPropertyT ReachActorRightWrist; + FbxPropertyT ReachActorLeftElbow; + FbxPropertyT ReachActorRightElbow; + FbxPropertyT ReachActorLeftFingerBase; + FbxPropertyT ReachActorRightFingerBase; + FbxPropertyT ReachActorLeftToesBase; + FbxPropertyT ReachActorRightToesBase; + FbxPropertyT ReachActorLeftFingerBaseRotation; + FbxPropertyT ReachActorRightFingerBaseRotation; + FbxPropertyT ReachActorLeftToesBaseRotation; + FbxPropertyT ReachActorRightToesBaseRotation; + FbxPropertyT ReachActorLeftAnkleRotation; + FbxPropertyT ReachActorRightAnkleRotation; + FbxPropertyT ReachActorHeadRotation; + FbxPropertyT ReachActorLeftWristRotation; + FbxPropertyT ReachActorRightWristRotation; + FbxPropertyT ReachActorChestRotation; + FbxPropertyT ReachActorLowerChestRotation; + FbxPropertyT HipsTOffset; + FbxPropertyT ChestTOffset; + FbxPropertyT RollExtractionMode; + FbxPropertyT LeftUpLegRoll; + FbxPropertyT LeftUpLegRollMode; + FbxPropertyT LeftLegRoll; + FbxPropertyT LeftLegRollMode; + FbxPropertyT RightUpLegRoll; + FbxPropertyT RightUpLegRollMode; + FbxPropertyT RightLegRoll; + FbxPropertyT RightLegRollMode; + FbxPropertyT LeftArmRoll; + FbxPropertyT LeftArmRollMode; + FbxPropertyT LeftForeArmRoll; + FbxPropertyT LeftForeArmRollMode; + FbxPropertyT RightArmRoll; + FbxPropertyT RightArmRollMode; + FbxPropertyT RightForeArmRoll; + FbxPropertyT RightForeArmRollMode; + FbxPropertyT LeftUpLegRollEx; + FbxPropertyT LeftUpLegRollExMode; + FbxPropertyT LeftLegRollEx; + FbxPropertyT LeftLegRollExMode; + FbxPropertyT RightUpLegRollEx; + FbxPropertyT RightUpLegRollExMode; + FbxPropertyT RightLegRollEx; + FbxPropertyT RightLegRollExMode; + FbxPropertyT LeftArmRollEx; + FbxPropertyT LeftArmRollExMode; + FbxPropertyT LeftForeArmRollEx; + FbxPropertyT LeftForeArmRollExMode; + FbxPropertyT RightArmRollEx; + FbxPropertyT RightArmRollExMode; + FbxPropertyT RightForeArmExRoll; + FbxPropertyT RightForeArmRollExMode; + FbxPropertyT ContactBehaviour; + FbxPropertyT FootFloorContact; + FbxPropertyT FootAutomaticToes; + FbxPropertyT FootFloorPivot; + FbxPropertyT FootBottomToAnkle; + FbxPropertyT FootBackToAnkle; + FbxPropertyT FootMiddleToAnkle; + FbxPropertyT FootFrontToMiddle; + FbxPropertyT FootInToAnkle; + FbxPropertyT FootOutToAnkle; + FbxPropertyT FootContactSize; + FbxPropertyT FootFingerContact; + FbxPropertyT FootContactType; + FbxPropertyT FootFingerContactMode; + FbxPropertyT FootContactStiffness; + FbxPropertyT FootFingerContactRollStiffness; + FbxPropertyT HandFloorContact; + FbxPropertyT HandAutomaticFingers; + FbxPropertyT HandFloorPivot; + FbxPropertyT HandBottomToWrist; + FbxPropertyT HandBackToWrist; + FbxPropertyT HandMiddleToWrist; + FbxPropertyT HandFrontToMiddle; + FbxPropertyT HandInToWrist; + FbxPropertyT HandOutToWrist; + FbxPropertyT HandContactSize; + FbxPropertyT HandFingerContact; + FbxPropertyT HandContactType; + FbxPropertyT HandFingerContactMode; + FbxPropertyT HandContactStiffness; + FbxPropertyT HandFingerContactRollStiffness; + FbxPropertyT LeftHandThumbTip; + FbxPropertyT LeftHandIndexTip; + FbxPropertyT LeftHandMiddleTip; + FbxPropertyT LeftHandRingTip; + FbxPropertyT LeftHandPinkyTip; + FbxPropertyT LeftHandExtraFingerTip; + FbxPropertyT RightHandThumbTip; + FbxPropertyT RightHandIndexTip; + FbxPropertyT RightHandMiddleTip; + FbxPropertyT RightHandRingTip; + FbxPropertyT RightHandPinkyTip; + FbxPropertyT RightHandExtraFingerTip; + FbxPropertyT LeftFootThumbTip; + FbxPropertyT LeftFootIndexTip; + FbxPropertyT LeftFootMiddleTip; + FbxPropertyT LeftFootRingTip; + FbxPropertyT LeftFootPinkyTip; + FbxPropertyT LeftFootExtraFingerTip; + FbxPropertyT RightFootThumbTip; + FbxPropertyT RightFootIndexTip; + FbxPropertyT RightFootMiddleTip; + FbxPropertyT RightFootRingTip; + FbxPropertyT RightFootPinkyTip; + FbxPropertyT RightFootExtraFingerTip; + FbxPropertyT FingerSolving; + FbxPropertyT CtrlPullLeftToeBase; + FbxPropertyT CtrlPullLeftFoot; + FbxPropertyT CtrlPullLeftKnee; + FbxPropertyT CtrlPullRightToeBase; + FbxPropertyT CtrlPullRightFoot; + FbxPropertyT CtrlPullRightKnee; + FbxPropertyT CtrlPullLeftFingerBase; + FbxPropertyT CtrlPullLeftHand; + FbxPropertyT CtrlPullLeftElbow; + FbxPropertyT CtrlPullRightFingerBase; + FbxPropertyT CtrlPullRightHand; + FbxPropertyT CtrlPullRightElbow; + FbxPropertyT CtrlChestPullLeftHand; + FbxPropertyT CtrlChestPullRightHand; + FbxPropertyT CtrlPullHead; + FbxPropertyT CtrlResistHipsPosition; + FbxPropertyT CtrlEnforceGravity; + FbxPropertyT CtrlResistHipsOrientation; + FbxPropertyT CtrlResistChestPosition; + FbxPropertyT CtrlResistChestOrientation; + FbxPropertyT CtrlResistLeftCollar; + FbxPropertyT CtrlResistRightCollar; + FbxPropertyT CtrlResistLeftKnee; + FbxPropertyT CtrlResistMaximumExtensionLeftKnee; + FbxPropertyT CtrlResistCompressionFactorLeftKnee; + FbxPropertyT CtrlResistRightKnee; + FbxPropertyT CtrlResistMaximumExtensionRightKnee; + FbxPropertyT CtrlResistCompressionFactorRightKnee; + FbxPropertyT CtrlResistLeftElbow; + FbxPropertyT CtrlResistMaximumExtensionLeftElbow; + FbxPropertyT CtrlResistCompressionFactorLeftElbow; + FbxPropertyT CtrlResistRightElbow; + FbxPropertyT CtrlResistMaximumExtensionRightElbow; + FbxPropertyT CtrlResistCompressionFactorRightElbow; + FbxPropertyT CtrlSpineStiffness; + FbxPropertyT CtrlNeckStiffness; + FbxPropertyT MirrorMode; + FbxPropertyT ShoulderCorrection; + FbxPropertyT LeftKneeKillPitch; + FbxPropertyT RightKneeKillPitch; + FbxPropertyT LeftElbowKillPitch; + FbxPropertyT RightElbowKillPitch; + FbxPropertyT HipsTranslationMode; + FbxPropertyT WriteReference; + FbxPropertyT SyncMode; + FbxPropertyT Damping; + FbxPropertyT OrientationDamping; + FbxPropertyT OrientationDampingMode; + FbxPropertyT DisplacementDamping; + FbxPropertyT DisplacementDampingMode; + FbxPropertyT DisplacementMemory; + FbxPropertyT DisplacementMemoryMode; + FbxPropertyT HipsDisplacementDamping; + FbxPropertyT HipsDisplacementDampingMode; + FbxPropertyT AnkleDisplacementDamping; + FbxPropertyT AnkleDisplacementDampingMode; + FbxPropertyT WristDisplacementDamping; + FbxPropertyT WristDisplacementDampingMode; + FbxPropertyT Stabilization; + FbxPropertyT AnkleStabilizationTime; + FbxPropertyT AnkleStabilizationTimeMode; + FbxPropertyT AnkleStabilizationPerimeter; + FbxPropertyT AnkleStabilizationPerimeterMode; + FbxPropertyT AnkleStabilizationAngularPerimeter; + FbxPropertyT AnkleStabilizationAngularPerimeterMode; + FbxPropertyT AnkleStabilizationFloorProximity; + FbxPropertyT AnkleStabilizationFloorProximityMode; + FbxPropertyT AnkleStabilizationDamping; + FbxPropertyT AnkleStabilizationDampingMode; + FbxPropertyT AnkleStabilizationRecoveryTime; + FbxPropertyT AnkleStabilizationRecoveryTimeMode; + FbxPropertyT SourceObject; + FbxPropertyT DestinationObject; + FbxPropertyT Actor; + FbxPropertyT Character; + FbxPropertyT ControlSet; + FbxPropertyT HikVersion; + FbxPropertyT Characterize; + FbxPropertyT LockXForm; + FbxPropertyT LockPick; + + // HIK 4.6 new properties + FbxPropertyT RealisticShoulder; + FbxPropertyT CollarStiffnessX; + FbxPropertyT CollarStiffnessY; + FbxPropertyT CollarStiffnessZ; + FbxPropertyT ExtraCollarRatio; + + FbxPropertyT LeftLegMaxExtensionAngle; + FbxPropertyT RightLegMaxExtensionAngle; + FbxPropertyT LeftArmMaxExtensionAngle; + FbxPropertyT RightArmMaxExtensionAngle; + + FbxPropertyT StretchStartArmsAndLegs; + FbxPropertyT StretchStopArmsAndLegs; + FbxPropertyT SnSScaleArmsAndLegs; + FbxPropertyT SnSReachLeftWrist; + FbxPropertyT SnSReachRightWrist; + FbxPropertyT SnSReachLeftAnkle; + FbxPropertyT SnSReachRightAnkle; + FbxPropertyT SnSScaleSpine; + FbxPropertyT SnSScaleSpineChildren; + FbxPropertyT SnSSpineFreedom; + FbxPropertyT SnSReachChestEnd; + FbxPropertyT SnSScaleNeck; + FbxPropertyT SnSNeckFreedom; + FbxPropertyT SnSReachHead; + + // HIK 2016.5.0 roll properties + // Leaf roll properties + FbxPropertyT LeafLeftUpLegRoll1; + FbxPropertyT LeafLeftUpLegRoll1Mode; + FbxPropertyT LeafLeftLegRoll1; + FbxPropertyT LeafLeftLegRoll1Mode; + FbxPropertyT LeafRightUpLegRoll1; + FbxPropertyT LeafRightUpLegRoll1Mode; + FbxPropertyT LeafRightLegRoll1; + FbxPropertyT LeafRightLegRoll1Mode; + FbxPropertyT LeafLeftArmRoll1; + FbxPropertyT LeafLeftArmRoll1Mode; + FbxPropertyT LeafLeftForeArmRoll1; + FbxPropertyT LeafLeftForeArmRoll1Mode; + FbxPropertyT LeafRightArmRoll1; + FbxPropertyT LeafRightArmRoll1Mode; + FbxPropertyT LeafRightForeArmRoll1; + FbxPropertyT LeafRightForeArmRoll1Mode; + FbxPropertyT LeafLeftUpLegRoll2; + FbxPropertyT LeafLeftUpLegRoll2Mode; + FbxPropertyT LeafLeftLegRoll2; + FbxPropertyT LeafLeftLegRoll2Mode; + FbxPropertyT LeafRightUpLegRoll2; + FbxPropertyT LeafRightUpLegRoll2Mode; + FbxPropertyT LeafRightLegRoll2; + FbxPropertyT LeafRightLegRoll2Mode; + FbxPropertyT LeafLeftArmRoll2; + FbxPropertyT LeafLeftArmRoll2Mode; + FbxPropertyT LeafLeftForeArmRoll2; + FbxPropertyT LeafLeftForeArmRoll2Mode; + FbxPropertyT LeafRightArmRoll2; + FbxPropertyT LeafRightArmRoll2Mode; + FbxPropertyT LeafRightForeArmRoll2; + FbxPropertyT LeafRightForeArmRoll2Mode; + FbxPropertyT LeafLeftUpLegRoll3; + FbxPropertyT LeafLeftUpLegRoll3Mode; + FbxPropertyT LeafLeftLegRoll3; + FbxPropertyT LeafLeftLegRoll3Mode; + FbxPropertyT LeafRightUpLegRoll3; + FbxPropertyT LeafRightUpLegRoll3Mode; + FbxPropertyT LeafRightLegRoll3; + FbxPropertyT LeafRightLegRoll3Mode; + FbxPropertyT LeafLeftArmRoll3; + FbxPropertyT LeafLeftArmRoll3Mode; + FbxPropertyT LeafLeftForeArmRoll3; + FbxPropertyT LeafLeftForeArmRoll3Mode; + FbxPropertyT LeafRightArmRoll3; + FbxPropertyT LeafRightArmRoll3Mode; + FbxPropertyT LeafRightForeArmRoll3; + FbxPropertyT LeafRightForeArmRoll3Mode; + FbxPropertyT LeafLeftUpLegRoll4; + FbxPropertyT LeafLeftUpLegRoll4Mode; + FbxPropertyT LeafLeftLegRoll4; + FbxPropertyT LeafLeftLegRoll4Mode; + FbxPropertyT LeafRightUpLegRoll4; + FbxPropertyT LeafRightUpLegRoll4Mode; + FbxPropertyT LeafRightLegRoll4; + FbxPropertyT LeafRightLegRoll4Mode; + FbxPropertyT LeafLeftArmRoll4; + FbxPropertyT LeafLeftArmRoll4Mode; + FbxPropertyT LeafLeftForeArmRoll4; + FbxPropertyT LeafLeftForeArmRoll4Mode; + FbxPropertyT LeafRightArmRoll4; + FbxPropertyT LeafRightArmRoll4Mode; + FbxPropertyT LeafRightForeArmRoll4; + FbxPropertyT LeafRightForeArmRoll4Mode; + FbxPropertyT LeafLeftUpLegRoll5; + FbxPropertyT LeafLeftUpLegRoll5Mode; + FbxPropertyT LeafLeftLegRoll5; + FbxPropertyT LeafLeftLegRoll5Mode; + FbxPropertyT LeafRightUpLegRoll5; + FbxPropertyT LeafRightUpLegRoll5Mode; + FbxPropertyT LeafRightLegRoll5; + FbxPropertyT LeafRightLegRoll5Mode; + FbxPropertyT LeafLeftArmRoll5; + FbxPropertyT LeafLeftArmRoll5Mode; + FbxPropertyT LeafLeftForeArmRoll5; + FbxPropertyT LeafLeftForeArmRoll5Mode; + FbxPropertyT LeafRightArmRoll5; + FbxPropertyT LeafRightArmRoll5Mode; + FbxPropertyT LeafRightForeArmRoll5; + FbxPropertyT LeafRightForeArmRoll5Mode; + // Full limb roll extraction + FbxPropertyT LeftLegFullRollExtraction; + FbxPropertyT RightLegFullRollExtraction; + FbxPropertyT LeftArmFullRollExtraction; + FbxPropertyT RightArmFullRollExtraction; + +/***************************************************************************************************************************** +** 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 SetVersion(int pVersion){ mCharacterVersion = pVersion; } + int Version(){ return mCharacterVersion; } + void SetValuesFromLegacyLoad(); + void SetValuesForLegacySave(int pVersion); + void RestoreValuesFromLegacySave(); + bool IsLegacy(); + + int GetPropertyInfoCount(); + void GetPropertyInfo(char* &pCharacterPropertyName, char* &pCharacterPropertyModeName, EPropertyUnit &pUnit, int &pPropertyIndex, char* &pHIKPropertyName, char* &pHIKPropertyModeName, int pIndex) const; + void GetFbxCharacterPropertyFromHIKProperty(char* &pCharacterPropertyName, char* &pCharacterPropertyModeName, EPropertyUnit &pUnit, int &pPropertyIndex, const char* pHIKPropertyName) const; + + FbxCharacterLink* GetCharacterLinkPtr(ENodeId pCharacterNodeId); + + virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); + + virtual FbxObject& Copy(const FbxObject& pObject); + virtual EType GetConstraintType() const; + virtual FbxStringList GetTypeFlags() const; + virtual bool ConnectNotify (FbxConnectEvent const &pEvent); + +private: + bool InverseProperty(FbxProperty& pProp); + + int mCharacterVersion; + FbxCharacterLink mCharacterLink[eNodeIdCount]; + FbxControlSet* mControlSet; + + friend class FbxNode; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxCharacter::EOffAutoUser&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCharacter::EAutoUser&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCharacter::EPostureMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCharacter::EFloorPivot&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCharacter::ERollExtractionMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCharacter::EHipsTranslationMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCharacter::EFootContactType&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCharacter::EHandContactType&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCharacter::EFingerContactMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCharacter::EContactBehaviour&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_CHARACTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxcharacternodename.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxcharacternodename.h new file mode 100644 index 00000000..d8a55468 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxcharacternodename.h @@ -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 fbxcharacternodename.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_CHARACTER_NODE_NAME_H_ +#define _FBXSDK_SCENE_CONSTRAINT_CHARACTER_NODE_NAME_H_ + +#include + +#include + +#define Character_Hips "Hips" +#define Character_LeftUpLeg "LeftUpLeg" +#define Character_LeftLeg "LeftLeg" +#define Character_LeftFoot "LeftFoot" +#define Character_RightUpLeg "RightUpLeg" +#define Character_RightLeg "RightLeg" +#define Character_RightFoot "RightFoot" +#define Character_Spine "Spine" +#define Character_LeftArm "LeftArm" +#define Character_LeftForeArm "LeftForeArm" +#define Character_LeftHand "LeftHand" +#define Character_RightArm "RightArm" +#define Character_RightForeArm "RightForeArm" +#define Character_RightHand "RightHand" +#define Character_Head "Head" +#define Character_LeftToeBase "LeftToeBase" +#define Character_RightToeBase "RightToeBase" +#define Character_LeftShoulder "LeftShoulder" +#define Character_RightShoulder "RightShoulder" +#define Character_LeftShoulderExtra "LeftShoulderExtra" +#define Character_RightShoulderExtra "RightShoulderExtra" +#define Character_Neck "Neck" +#define Character_LeftFingerBase "LeftFingerBase" +#define Character_RightFingerBase "RightFingerBase" +#define Character_Spine1 "Spine1" +#define Character_Spine2 "Spine2" +#define Character_Spine3 "Spine3" +#define Character_Spine4 "Spine4" +#define Character_Spine5 "Spine5" +#define Character_Spine6 "Spine6" +#define Character_Spine7 "Spine7" +#define Character_Spine8 "Spine8" +#define Character_Spine9 "Spine9" +#define Character_Neck1 "Neck1" +#define Character_Neck2 "Neck2" +#define Character_Neck3 "Neck3" +#define Character_Neck4 "Neck4" +#define Character_Neck5 "Neck5" +#define Character_Neck6 "Neck6" +#define Character_Neck7 "Neck7" +#define Character_Neck8 "Neck8" +#define Character_Neck9 "Neck9" +#define Character_LeftUpLegRoll "LeftUpLegRoll" +#define Character_LeftLegRoll "LeftLegRoll" +#define Character_RightUpLegRoll "RightUpLegRoll" +#define Character_RightLegRoll "RightLegRoll" +#define Character_LeftArmRoll "LeftArmRoll" +#define Character_LeftForeArmRoll "LeftForeArmRoll" +#define Character_RightArmRoll "RightArmRoll" +#define Character_RightForeArmRoll "RightForeArmRoll" +#define Character_LeftUpLegRollEx "LeftUpLegRollEx" +#define Character_LeftLegRollEx "LeftLegRollEx" +#define Character_RightUpLegRollEx "RightUpLegRollEx" +#define Character_RightLegRollEx "RightLegRollEx" +#define Character_LeftArmRollEx "LeftArmRollEx" +#define Character_LeftForearmRollEx "LeftForeArmRollEx" +#define Character_RightArmRollEx "RightArmRollEx" +#define Character_RightForearmRollEx "RightForeArmRollEx" +#define Character_LeafLeftUpLegRoll1 "LeafLeftUpLegRoll1" +#define Character_LeafLeftLegRoll1 "LeafLeftLegRoll1" +#define Character_LeafRightUpLegRoll1 "LeafRightUpLegRoll1" +#define Character_LeafRightLegRoll1 "LeafRightLegRoll1" +#define Character_LeafLeftArmRoll1 "LeafLeftArmRoll1" +#define Character_LeafLeftForeArmRoll1 "LeafLeftForeArmRoll1" +#define Character_LeafRightArmRoll1 "LeafRightArmRoll1" +#define Character_LeafRightForeArmRoll1 "LeafRightForeArmRoll1" +#define Character_LeafLeftUpLegRoll2 "LeafLeftUpLegRoll2" +#define Character_LeafLeftLegRoll2 "LeafLeftLegRoll2" +#define Character_LeafRightUpLegRoll2 "LeafRightUpLegRoll2" +#define Character_LeafRightLegRoll2 "LeafRightLegRoll2" +#define Character_LeafLeftArmRoll2 "LeafLeftArmRoll2" +#define Character_LeafLeftForeArmRoll2 "LeafLeftForeArmRoll2" +#define Character_LeafRightArmRoll2 "LeafRightArmRoll2" +#define Character_LeafRightForeArmRoll2 "LeafRightForeArmRoll2" +#define Character_LeafLeftUpLegRoll3 "LeafLeftUpLegRoll3" +#define Character_LeafLeftLegRoll3 "LeafLeftLegRoll3" +#define Character_LeafRightUpLegRoll3 "LeafRightUpLegRoll3" +#define Character_LeafRightLegRoll3 "LeafRightLegRoll3" +#define Character_LeafLeftArmRoll3 "LeafLeftArmRoll3" +#define Character_LeafLeftForeArmRoll3 "LeafLeftForeArmRoll3" +#define Character_LeafRightArmRoll3 "LeafRightArmRoll3" +#define Character_LeafRightForeArmRoll3 "LeafRightForeArmRoll3" +#define Character_LeafLeftUpLegRoll4 "LeafLeftUpLegRoll4" +#define Character_LeafLeftLegRoll4 "LeafLeftLegRoll4" +#define Character_LeafRightUpLegRoll4 "LeafRightUpLegRoll4" +#define Character_LeafRightLegRoll4 "LeafRightLegRoll4" +#define Character_LeafLeftArmRoll4 "LeafLeftArmRoll4" +#define Character_LeafLeftForeArmRoll4 "LeafLeftForeArmRoll4" +#define Character_LeafRightArmRoll4 "LeafRightArmRoll4" +#define Character_LeafRightForeArmRoll4 "LeafRightForeArmRoll4" +#define Character_LeafLeftUpLegRoll5 "LeafLeftUpLegRoll5" +#define Character_LeafLeftLegRoll5 "LeafLeftLegRoll5" +#define Character_LeafRightUpLegRoll5 "LeafRightUpLegRoll5" +#define Character_LeafRightLegRoll5 "LeafRightLegRoll5" +#define Character_LeafLeftArmRoll5 "LeafLeftArmRoll5" +#define Character_LeafLeftForeArmRoll5 "LeafLeftForeArmRoll5" +#define Character_LeafRightArmRoll5 "LeafRightArmRoll5" +#define Character_LeafRightForeArmRoll5 "LeafRightForeArmRoll5" +#define Character_Props0 "Props0" +#define Character_Props1 "Props1" +#define Character_Props2 "Props2" +#define Character_Props3 "Props3" +#define Character_Props4 "Props4" +#define Character_LeftHandThumb1 "LeftHandThumb1" +#define Character_LeftHandThumb2 "LeftHandThumb2" +#define Character_LeftHandThumb3 "LeftHandThumb3" +#define Character_LeftHandThumb4 "LeftHandThumb4" +#define Character_LeftHandIndex1 "LeftHandIndex1" +#define Character_LeftHandIndex2 "LeftHandIndex2" +#define Character_LeftHandIndex3 "LeftHandIndex3" +#define Character_LeftHandIndex4 "LeftHandIndex4" +#define Character_LeftHandMiddle1 "LeftHandMiddle1" +#define Character_LeftHandMiddle2 "LeftHandMiddle2" +#define Character_LeftHandMiddle3 "LeftHandMiddle3" +#define Character_LeftHandMiddle4 "LeftHandMiddle4" +#define Character_LeftHandRing1 "LeftHandRing1" +#define Character_LeftHandRing2 "LeftHandRing2" +#define Character_LeftHandRing3 "LeftHandRing3" +#define Character_LeftHandRing4 "LeftHandRing4" +#define Character_LeftHandPinky1 "LeftHandPinky1" +#define Character_LeftHandPinky2 "LeftHandPinky2" +#define Character_LeftHandPinky3 "LeftHandPinky3" +#define Character_LeftHandPinky4 "LeftHandPinky4" +#define Character_LeftHandExtraFinger1 "LeftHandExtraFinger1" +#define Character_LeftHandExtraFinger2 "LeftHandExtraFinger2" +#define Character_LeftHandExtraFinger3 "LeftHandExtraFinger3" +#define Character_LeftHandExtraFinger4 "LeftHandExtraFinger4" +#define Character_RightHandThumb1 "RightHandThumb1" +#define Character_RightHandThumb2 "RightHandThumb2" +#define Character_RightHandThumb3 "RightHandThumb3" +#define Character_RightHandThumb4 "RightHandThumb4" +#define Character_RightHandIndex1 "RightHandIndex1" +#define Character_RightHandIndex2 "RightHandIndex2" +#define Character_RightHandIndex3 "RightHandIndex3" +#define Character_RightHandIndex4 "RightHandIndex4" +#define Character_RightHandMiddle1 "RightHandMiddle1" +#define Character_RightHandMiddle2 "RightHandMiddle2" +#define Character_RightHandMiddle3 "RightHandMiddle3" +#define Character_RightHandMiddle4 "RightHandMiddle4" +#define Character_RightHandRing1 "RightHandRing1" +#define Character_RightHandRing2 "RightHandRing2" +#define Character_RightHandRing3 "RightHandRing3" +#define Character_RightHandRing4 "RightHandRing4" +#define Character_RightHandPinky1 "RightHandPinky1" +#define Character_RightHandPinky2 "RightHandPinky2" +#define Character_RightHandPinky3 "RightHandPinky3" +#define Character_RightHandPinky4 "RightHandPinky4" +#define Character_RightHandExtraFinger1 "RightHandExtraFinger1" +#define Character_RightHandExtraFinger2 "RightHandExtraFinger2" +#define Character_RightHandExtraFinger3 "RightHandExtraFinger3" +#define Character_RightHandExtraFinger4 "RightHandExtraFinger4" +#define Character_LeftFootThumb1 "LeftFootThumb1" +#define Character_LeftFootThumb2 "LeftFootThumb2" +#define Character_LeftFootThumb3 "LeftFootThumb3" +#define Character_LeftFootThumb4 "LeftFootThumb4" +#define Character_LeftFootIndex1 "LeftFootIndex1" +#define Character_LeftFootIndex2 "LeftFootIndex2" +#define Character_LeftFootIndex3 "LeftFootIndex3" +#define Character_LeftFootIndex4 "LeftFootIndex4" +#define Character_LeftFootMiddle1 "LeftFootMiddle1" +#define Character_LeftFootMiddle2 "LeftFootMiddle2" +#define Character_LeftFootMiddle3 "LeftFootMiddle3" +#define Character_LeftFootMiddle4 "LeftFootMiddle4" +#define Character_LeftFootRing1 "LeftFootRing1" +#define Character_LeftFootRing2 "LeftFootRing2" +#define Character_LeftFootRing3 "LeftFootRing3" +#define Character_LeftFootRing4 "LeftFootRing4" +#define Character_LeftFootPinky1 "LeftFootPinky1" +#define Character_LeftFootPinky2 "LeftFootPinky2" +#define Character_LeftFootPinky3 "LeftFootPinky3" +#define Character_LeftFootPinky4 "LeftFootPinky4" +#define Character_LeftFootExtraFinger1 "LeftFootExtraFinger1" +#define Character_LeftFootExtraFinger2 "LeftFootExtraFinger2" +#define Character_LeftFootExtraFinger3 "LeftFootExtraFinger3" +#define Character_LeftFootExtraFinger4 "LeftFootExtraFinger4" +#define Character_RightFootThumb1 "RightFootThumb1" +#define Character_RightFootThumb2 "RightFootThumb2" +#define Character_RightFootThumb3 "RightFootThumb3" +#define Character_RightFootThumb4 "RightFootThumb4" +#define Character_RightFootIndex1 "RightFootIndex1" +#define Character_RightFootIndex2 "RightFootIndex2" +#define Character_RightFootIndex3 "RightFootIndex3" +#define Character_RightFootIndex4 "RightFootIndex4" +#define Character_RightFootMiddle1 "RightFootMiddle1" +#define Character_RightFootMiddle2 "RightFootMiddle2" +#define Character_RightFootMiddle3 "RightFootMiddle3" +#define Character_RightFootMiddle4 "RightFootMiddle4" +#define Character_RightFootRing1 "RightFootRing1" +#define Character_RightFootRing2 "RightFootRing2" +#define Character_RightFootRing3 "RightFootRing3" +#define Character_RightFootRing4 "RightFootRing4" +#define Character_RightFootPinky1 "RightFootPinky1" +#define Character_RightFootPinky2 "RightFootPinky2" +#define Character_RightFootPinky3 "RightFootPinky3" +#define Character_RightFootPinky4 "RightFootPinky4" +#define Character_RightFootExtraFinger1 "RightFootExtraFinger1" +#define Character_RightFootExtraFinger2 "RightFootExtraFinger2" +#define Character_RightFootExtraFinger3 "RightFootExtraFinger3" +#define Character_RightFootExtraFinger4 "RightFootExtraFinger4" +#define Character_LeftInHandThumb "LeftInHandThumb" +#define Character_LeftInHandIndex "LeftInHandIndex" +#define Character_LeftInHandMiddle "LeftInHandMiddle" +#define Character_LeftInHandRing "LeftInHandRing" +#define Character_LeftInHandPinky "LeftInHandPinky" +#define Character_LeftInHandExtraFinger "LeftInHandExtraFinger" +#define Character_RightInHandThumb "RightInHandThumb" +#define Character_RightInHandIndex "RightInHandIndex" +#define Character_RightInHandMiddle "RightInHandMiddle" +#define Character_RightInHandRing "RightInHandRing" +#define Character_RightInHandPinky "RightInHandPinky" +#define Character_RightInHandExtraFinger "RightInHandExtraFinger" +#define Character_LeftInFootThumb "LeftInFootThumb" +#define Character_LeftInFootIndex "LeftInFootIndex" +#define Character_LeftInFootMiddle "LeftInFootMiddle" +#define Character_LeftInFootRing "LeftInFootRing" +#define Character_LeftInFootPinky "LeftInFootPinky" +#define Character_LeftInFootExtraFinger "LeftInFootExtraFinger" +#define Character_RightInFootThumb "RightInFootThumb" +#define Character_RightInFootIndex "RightInFootIndex" +#define Character_RightInFootMiddle "RightInFootMiddle" +#define Character_RightInFootRing "RightInFootRing" +#define Character_RightInFootPinky "RightInFootPinky" +#define Character_RightInFootExtraFinger "RightInFootExtraFinger" + +#define Character_GameModeParentLeftHipRoll "GameModeParentLeftHipRoll" +#define Character_GameModeParentLeftKnee "GameModeParentLeftKnee" +#define Character_GameModeParentLeftKneeRoll "GameModeParentLeftKneeRoll" +#define Character_GameModeParentRightHipRoll "GameModeParentRightHipRoll" +#define Character_GameModeParentRightKnee "GameModeParentRightKnee" +#define Character_GameModeParentRightKneeRoll "GameModeParentRightKneeRoll" +#define Character_GameModeParentLeftShoulderRoll "GameModeParentLeftShoulderRoll" +#define Character_GameModeParentLeftElbow "GameModeParentLeftElbow" +#define Character_GameModeParentLeftElbowRoll "GameModeParentLeftElbowRoll" +#define Character_GameModeParentRightShoulderRoll "GameModeParentRightShoulderRoll" +#define Character_GameModeParentRightElbow "GameModeParentRightElbow" +#define Character_GameModeParentRightElbowRoll "GameModeParentRightElbowRoll" + +#define Character_LeftFloorContact "LeftFloorContact" +#define Character_RightFloorContact "RightFloorContact" +#define Character_LeftHandFloorContact "LeftHandFloorContact" +#define Character_RightHandFloorContact "RightHandFloorContact" + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_CHARACTER_NODE_NAME_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxcharacterpose.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxcharacterpose.h new file mode 100644 index 00000000..66c12252 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxcharacterpose.h @@ -0,0 +1,112 @@ +/**************************************************************************************** + + 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 fbxcharacterpose.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_CHARACTER_POSE_H_ +#define _FBXSDK_SCENE_CONSTRAINT_CHARACTER_POSE_H_ + +#include + +#include +#include +#include + +#include + +/** \class FbxCharacterPose + * \nosubgrouping + * \brief A character pose is a character and an associated hierarchy of nodes. + * + * Only the default position of the nodes is considered, the animation data is ignored. + * + * You can access the content of a character pose, using the functions FbxCharacterPose::GetOffset(), + * FbxCharacterPose::GetLocalPosition(), and FbxCharacterPose::GetGlobalPosition(). + * Their source code is provided inline as examples on how to access the character pose data. + * + * To create a character pose, You must first create a hierarchy of nodes under the root + * node provided by function FbxCharacterPose::GetRootNode(). Then, feed this hierarchy + * of nodes into the character returned by function FbxCharacterPose::GetCharacter(). + * Offsets are set in the character links. Local positions are set using + * FbxNode::SetDefaultT(), FbxNode::SetDefaultR(), and FbxNode::SetDefaultS(). + * + * To set local positions from global positions: + * -# Declare lCharacterPose as a valid pointer to a FbxCharacterPose; + * -# Call lCharacterPose->GetRootNode()->SetLocalStateId(0, true); + * -# Call lCharacterPose->GetRootNode()->SetGlobalStateId(1, true); + * -# Call FbxNode::SetGlobalState() for all nodes found in the hierarchy under lCharacterPose->GetRootNode(); + * -# Call lCharacterPose->GetRootNode()->ComputeLocalState(1, true); + * -# Call lCharacterPose->GetRootNode()->SetCurrentTakeFromLocalState(FBXSDK_TIME_ZERO, true). + */ +class FBXSDK_DLL FbxCharacterPose : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxCharacterPose,FbxObject); + +public: + //! Reset to an empty character pose. + void Reset(); + + /** Get the root node. + * \return Pointer to the root node. + */ + FbxNode* GetRootNode() const; + + /** Get the character. + * \return Pointer to the character. + */ + FbxCharacter* GetCharacter() const; + + /** Get offset matrix for a given character node. + * \param pCharacterNodeId Character Node ID. + * \param pOffset Receives offset matrix. + * \return \c true if successful, \c false otherwise. + */ + bool GetOffset(FbxCharacter::ENodeId pCharacterNodeId, FbxAMatrix& pOffset) const; + + /** Get local position for a given character node. + * \param pCharacterNodeId Character Node ID. + * \param pLocalT Receives local translation vector. + * \param pLocalR Receives local rotation vector. + * \param pLocalS Receives local scaling vector. + * \return \c true if successful, \c false otherwise. + */ + bool GetLocalPosition(FbxCharacter::ENodeId pCharacterNodeId, FbxVector4& pLocalT, FbxVector4& pLocalR, FbxVector4& pLocalS) const; + + /** Get global position for a given character node. + * \param pCharacterNodeId Character Node ID. + * \param pGlobalPosition Receives global position. + * \return \c true if successful, \c false otherwise. + */ + bool GetGlobalPosition(FbxCharacter::ENodeId pCharacterNodeId, FbxAMatrix& pGlobalPosition) const; + + /** Retrieve the pose scene used by this character pose + * \return The pose's scene (this is a different scene than the scene the character pose is in). */ + FbxScene* GetPoseScene() 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual FbxObject* Clone( FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; + void Clone(FbxScene* pPoseScene, FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + +private: + FbxScene* mPoseScene; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_CHARACTER_POSE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraint.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraint.h new file mode 100644 index 00000000..ae0b0cd8 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraint.h @@ -0,0 +1,123 @@ +/**************************************************************************************** + + 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 fbxconstraint.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_H_ +#define _FBXSDK_SCENE_CONSTRAINT_H_ + +#include + +#include +#include + +/** Base class for weighted animation constraints. + * Constraints are primarily used to impose limits on properties of objects (e.g. position, orientation, scale) + * and to automate animation processes. + * A constrained object is an object with properties constrained by one or more weighted constraint sources. + * \nosubgrouping + */ +class FBXSDK_DLL FbxConstraint : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxConstraint, FbxObject); + +public: + /** + * \name Properties + */ + //@{ + /** This property represents the degree of influence of a constraint from 0.0 (no influence) to 100.0 (full influence). + * + * Default value is 100.0. + */ + FbxPropertyT Weight; + + /** This property controls whether the constraint is applied or not. + * If the value is \c false the constraint will have no effect. The default value is \c true. + * + * Default value is true. + */ + FbxPropertyT Active; + + /** This property handles the lock state of the constraint. + * + * When enabled, the constrained object cannot be moved away from its constrained location when the constraint is active. + * + * Default value is false. + */ + FbxPropertyT Lock; + //@} + + /** \enum EType Constraint attribute types. + */ + enum EType + { + eUnknown, //! Invalid constraint. + ePosition, //! Position constraint (referred to as a point constraint in Maya). + eRotation, //! Rotation constraint (referred to as an orient constraint in Maya). + eScale, //! Scale constraint. + eParent, //! Parent constraint. + eSingleChainIK, //! Single chain IK constraint. + eAim, //! Aim constraint. + eCharacter, //! Character constraint. + eCustom //! User defined constraints. + }; + + /** Access the type of the constraint. + * \return This type of the constraint. + */ + virtual EType GetConstraintType() const { return eUnknown; } + + /** Retrieve the constrained object. + * \return The constrained object. + */ + virtual FbxObject* GetConstrainedObject() const { return NULL; } + + /** Retrieve the count of constraint source. + * \return The count of constraint source. + */ + virtual int GetConstraintSourceCount() const { return 0; } + + /** Retrieve a constraint source with the specified index. + * \param pIndex The specified index. + * \return The constraint source at the specified index. + */ + virtual FbxObject* GetConstraintSource(int /*pIndex*/) const { return NULL; } + + /** Get the weight associated with a constraint source. + * \param pObject The given constraint source. + * \return The weight of the constraint source. + */ + double GetSourceWeight(const FbxObject* pObject) 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 +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + +#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 + +const FbxString GetWeightPropertyName(const FbxObject * pObject); +void CreateWeightPropertyForSourceObject(FbxObject * pConstraint, const FbxObject * pSourceObject, double pWeightValue); + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintaim.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintaim.h new file mode 100644 index 00000000..07c51c27 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintaim.h @@ -0,0 +1,158 @@ +/**************************************************************************************** + + 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 fbxconstraintaim.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_AIM_H_ +#define _FBXSDK_SCENE_CONSTRAINT_AIM_H_ + +#include + +#include + +#include + +/** An aim constraint governs an object's orientation so that the object points to other objects. + * For example, you can use the aim constraint to point a light at an object or group of objects. + * \nosubgrouping + */ +class FBXSDK_DLL FbxConstraintAim : public FbxConstraint +{ + FBXSDK_OBJECT_DECLARE(FbxConstraintAim, FbxConstraint); + +public: + /** \enum EWorldUp Constraint world up type, which has the same meaning with Maya. + */ + enum EWorldUp + { + eAimAtSceneUp, //! Constraint scene up type. + eAimAtObjectUp, //! Constraint object up type. + eAimAtObjectRotationUp, //! Constraint object rotation up type. + eAimAtVector, //! Constraint vector type. + eAimAtNone, //! None constraint type. + eAimAtCount //! Constraint world up type count. + }; + + /** + * \name Properties + */ + //@{ + /** This property handles the rotation offset value. + * + * Default value is (0, 0, 0). + */ + FbxPropertyT RotationOffset; + + /** This property provides access to the object or objects which are the targets. + */ + FbxPropertyT AimAtObjects; + + /** This property provides access to the object being aimed. + */ + FbxPropertyT ConstrainedObject; + + /** This property handles world up type. + */ + FbxPropertyT WorldUpType; + + /** This property handles world up object. + */ + FbxPropertyT WorldUpObject; + + /** This property handles world up vector. + * + * Default value is (0, 1, 0). + */ + FbxPropertyT WorldUpVector; + + /** This property handles up vector. + * + * Default value is (0, 1, 0). + */ + FbxPropertyT UpVector; + + /** This property enables you set a specific axis for the constrained object to orient towards. + * + * Default value is (1, 0, 0). + */ + FbxPropertyT AimVector; + + /** This property handles whether to affect the rotation around X axis. + * + * Default value is true. + */ + FbxPropertyT AffectX; + + /** This property handles whether to affect the rotation around Y axis. + * + * Default value is true. + */ + FbxPropertyT AffectY; + + /** This property handles whether to affect the rotation around Z axis. + * + * Default value is true. + */ + FbxPropertyT AffectZ; + //@} + + /** Add a source to the constraint. + * \param pObject New source object. + * \param pWeight Weight of the source object. + */ + void AddConstraintSource(FbxObject* pObject, double pWeight = 100); + + /** Retrieve the constraint source count. + * \return Current constraint source count. + */ + int GetConstraintSourceCount() const; + + /** Retrieve a constraint source object. + * \param pIndex The specified index. + * \return Current source at the specified index. + */ + FbxObject* GetConstraintSource(int pIndex) const; + + /** Set the constrained object. + * \param pObject The constrained object. + */ + void SetConstrainedObject(FbxObject* pObject); + + /** Retrieve the constrained object. + * \return Current constrained object. + */ + FbxObject* GetConstrainedObject() const; + + /** Set the world up object. + * \param pObject The new world up object. + */ + void SetWorldUpObject(FbxObject* pObject); + + /** Retrieve the world up object. + * \return The current world up object. + */ + FbxObject* GetWorldUpObject() 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 +protected: + virtual void ConstructProperties(bool pForceSet); + + virtual EType GetConstraintType() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxConstraintAim::EWorldUp&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_AIM_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintcustom.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintcustom.h new file mode 100644 index 00000000..33200f3d --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintcustom.h @@ -0,0 +1,40 @@ +/**************************************************************************************** + + 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 fbxconstraintcustom.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_CUSTOM_H_ +#define _FBXSDK_SCENE_CONSTRAINT_CUSTOM_H_ + +#include + +#include + +#include + +/** \brief This constraint class contains methods for custom constraint. + * \nosubgrouping + */ +class FBXSDK_DLL FbxConstraintCustom : public FbxConstraint +{ + FBXSDK_OBJECT_DECLARE(FbxConstraintCustom, FbxConstraint); + +/***************************************************************************************************************************** +** 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 EType GetConstraintType() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_CUSTOM_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintparent.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintparent.h new file mode 100644 index 00000000..0dce881f --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintparent.h @@ -0,0 +1,164 @@ +/**************************************************************************************** + + 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 fbxconstraintparent.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_PARENT_H_ +#define _FBXSDK_SCENE_CONSTRAINT_PARENT_H_ + +#include + +#include + +#include + +/** The parent constraint creates a parent-to-child relationship between any two objects, from any two hierarchies. + * It creates the same relationship as the parent-to-child relationships found in hierarchies. + * You can use this constraint to connect objects without changing hierarchies. + * \nosubgrouping + */ +class FBXSDK_DLL FbxConstraintParent : public FbxConstraint +{ + FBXSDK_OBJECT_DECLARE(FbxConstraintParent, FbxConstraint); + +public: + /** + * \name Properties + */ + //@{ + /** This property handles whether to affect the translation of the constrained object along X axis. + * + * Default value is true. + */ + FbxPropertyT AffectTranslationX; + + /** This property handles whether to affect the translation of the constrained object along Y axis. + * + * Default value is true. + */ + FbxPropertyT AffectTranslationY; + + /** This property handles whether to affect the translation of the constrained object along Z axis. + * + * Default value is true. + */ + FbxPropertyT AffectTranslationZ; + + /** This property handles whether to affect the rotation of the constrained object around X axis. + * + * Default value is true. + */ + FbxPropertyT AffectRotationX; + + /** This property handles whether to affect the rotation of the constrained object around Y axis. + * + * Default value is true. + */ + FbxPropertyT AffectRotationY; + + /** This property handles whether to affect the rotation of the constrained object around Z axis. + * + * Default value is true. + */ + FbxPropertyT AffectRotationZ; + + /** This property handles whether to affect the scaling of the constrained object along X axis. + * + * Default value is true. + */ + FbxPropertyT AffectScalingX; + + /** This property handles whether to affect the scaling of the constrained object along Y axis. + * + * Default value is true. + */ + FbxPropertyT AffectScalingY; + + /** This property handles whether to affect the scaling of the constrained object along Z axis. + * + * Default value is true. + */ + FbxPropertyT AffectScalingZ; + + /** This property used to access constraint sources. + * A constrained object is an object whose position, orientation, and so on is driven by one or more constraint sources. + */ + FbxPropertyT ConstraintSources; + + /** This property used to access constrained object. + * A constrained object is an object whose position, orientation, and so on is driven by one or more constraint sources. + */ + FbxPropertyT ConstrainedObject; + //@} + + /** Set the translation offset of the specified constraint source. + * \param pObject The specified constraint source. + * \param pTranslation The new offset vector. + */ + void SetTranslationOffset(FbxObject* pObject, FbxVector4 pTranslation); + + /** Retrieve the translation offset of the specified constraint source. + * \param pObject The specified constraint source. + * \return The current translation offset. + */ + FbxVector4 GetTranslationOffset(const FbxObject* pObject) const; + + /** Set the rotation offset of the specified constraint source. + * \param pObject The specified constraint source. + * \param pRotation The new offset vector. + */ + virtual void SetRotationOffset(const FbxObject* pObject, FbxVector4 pRotation); + + /** Retrieve the rotation offset of the specified constraint source. + * \param pObject The specified constraint source. + * \return The current translation offset. + */ + FbxVector4 GetRotationOffset(const FbxObject* pObject) const; + + /** Add a constraint source to the constraint. + * \param pObject New constraint source. + * \param pWeight Weight of the constraint source. + */ + void AddConstraintSource(FbxObject* pObject, double pWeight = 100); + + /** Retrieve the constraint source count. + * \return Current constraint source count. + */ + int GetConstraintSourceCount() const; + + /** Retrieve a constraint source object. + * \param pIndex Index of the constraint source. + * \return The constraint source at the specified index. + */ + FbxObject* GetConstraintSource(int pIndex) const; + + /** Set the constrained object. + * \param pObject The constrained object. + */ + void SetConstrainedObject(FbxObject* pObject); + + /** Retrieve the constrained object. + * \return Current constrained object. + */ + FbxObject* GetConstrainedObject() 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 +protected: + virtual void ConstructProperties(bool pForceSet); + virtual EType GetConstraintType() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_PARENT_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintposition.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintposition.h new file mode 100644 index 00000000..962ad60e --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintposition.h @@ -0,0 +1,113 @@ +/**************************************************************************************** + + 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 fbxconstraintposition.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_POSITION_H_ +#define _FBXSDK_SCENE_CONSTRAINT_POSITION_H_ + +#include + +#include + +#include + +/** \brief This constraint class contains methods for accessing the properties of a position constraint. + * A position constraint lets you constrain the position of an object based on the position of one or more sources. + * \nosubgrouping + */ +class FBXSDK_DLL FbxConstraintPosition : public FbxConstraint +{ + FBXSDK_OBJECT_DECLARE(FbxConstraintPosition,FbxConstraint); + +public: + + /** + * \name Properties + */ + //@{ + /** This property handles whether to affect x axis. + * + * Default value is true. + */ + FbxPropertyT AffectX; + + /** This property handles whether to affect y axis. + * + * Default value is true. + */ + FbxPropertyT AffectY; + + /** This property handles whether to affect z axis. + * + * Default value is true. + */ + FbxPropertyT AffectZ; + + /** This property handles translation offset. + * + * Default value is (0, 0, 0). + */ + FbxPropertyT Translation; + + /** This property handles constraint source objects. + */ + FbxPropertyT ConstraintSources; + + /** This property handles constraint target objects. + */ + FbxPropertyT ConstrainedObject; + //@} + + /** Add a source to the constraint. + * \param pObject New source object. + * \param pWeight Weight of the source object. + */ + void AddConstraintSource(FbxObject* pObject, double pWeight = 100); + + /** Remove a source from the constraint. + * \param pObject Source object to remove. + */ + bool RemoveConstraintSource(FbxObject* pObject); + + /** Retrieve the constraint source count. + * \return Current constraint source count. + */ + int GetConstraintSourceCount() const; + + /** Retrieve a constraint source object. + * \param pIndex Index of the source + * \return Current source at the specified index. + */ + FbxObject* GetConstraintSource(int pIndex) const; + + /** Set the constrained object. + * \param pObject The constrained object. + */ + void SetConstrainedObject(FbxObject* pObject); + + /** Retrieve the constrained object. + * \return Current constrained object. + */ + FbxObject* GetConstrainedObject() 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 +protected: + virtual void ConstructProperties(bool pForceSet); + virtual EType GetConstraintType() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_POSITION_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintrotation.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintrotation.h new file mode 100644 index 00000000..ea2baa27 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintrotation.h @@ -0,0 +1,102 @@ +/**************************************************************************************** + + 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 fbxconstraintrotation.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_ROTATION_H_ +#define _FBXSDK_SCENE_CONSTRAINT_ROTATION_H_ + +#include + +#include + +#include + +/** \brief This constraint class contains methods for accessing the properties of a rotation constraint. + * A rotation constraint lets you constrain the rotation of an object based on the rotation of one or more sources. + * \nosubgrouping + */ +class FBXSDK_DLL FbxConstraintRotation : public FbxConstraint +{ + FBXSDK_OBJECT_DECLARE(FbxConstraintRotation, FbxConstraint); + +public: + /** + * \name Properties + */ + //@{ + /** This property handles whether to affect x axis. + * Default value is true. + */ + FbxPropertyT AffectX; + /** This property handles whether to affect y axis. + * Default value is true. + */ + FbxPropertyT AffectY; + + /** This property handles whether to affect z axis. + * Default value is true. + */ + FbxPropertyT AffectZ; + + /** This property handles rotation offset. + * Default value is (0, 0, 0). + */ + FbxPropertyT Rotation; + + /** This property handles constraint source objects. + */ + FbxPropertyT ConstraintSources; + + /** This property handles constraint target objects. + */ + FbxPropertyT ConstrainedObject; + //@} + + /** Add a source to the constraint. + * \param pObject New source object. + * \param pWeight Weight of the source object. + */ + void AddConstraintSource(FbxObject* pObject, double pWeight = 100); + + /** Retrieve the constraint source count. + * \return Current constraint source count. + */ + int GetConstraintSourceCount() const; + + /** Retrieve a constraint source object. + * \param pIndex Index of the source object + * \return Current source at the specified index. + */ + FbxObject* GetConstraintSource(int pIndex) const; + + /** Set the constrained object. + * \param pObject The constrained object. + */ + void SetConstrainedObject(FbxObject* pObject); + + /** Retrieve the constrained object. + * \return Current constrained object. + */ + FbxObject* GetConstrainedObject() 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 +protected: + virtual void ConstructProperties(bool pForceSet); + virtual EType GetConstraintType() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_ROTATION_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintscale.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintscale.h new file mode 100644 index 00000000..02a91c20 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintscale.h @@ -0,0 +1,103 @@ +/**************************************************************************************** + + 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 fbxconstraintscale.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_SCALE_H_ +#define _FBXSDK_SCENE_CONSTRAINT_SCALE_H_ + +#include + +#include + +#include + +/**\brief This constraint class contains methods for accessing the properties of a scale constraint. + * A scale constraint lets you constrain the scale of an object based on the scale of one or more sources. + * \nosubgrouping + */ +class FBXSDK_DLL FbxConstraintScale : public FbxConstraint +{ + FBXSDK_OBJECT_DECLARE(FbxConstraintScale,FbxConstraint); + +public: + /** + * \name Properties + */ + //@{ + /** This property handles whether to affect x axis. + * Default value is true. + */ + FbxPropertyT AffectX; + + /** This property handles whether to affect y axis. + * Default value is true. + */ + FbxPropertyT AffectY; + + /** This property handles whether to affect z axis. + * Default value is true. + */ + FbxPropertyT AffectZ; + + /** This property handles scaling offset. + * Default value is (0, 0, 0). + */ + FbxPropertyT Scaling; + + /** This property handles constraint source objects. + */ + FbxPropertyT ConstraintSources; + + /** This property handles constraint target objects. + */ + FbxPropertyT ConstrainedObject; + //@} + + /** Add a source to the constraint. + * \param pObject New source object. + * \param pWeight Weight of the source object. + */ + void AddConstraintSource(FbxObject* pObject, double pWeight = 100); + + /** Retrieve the constraint source count. + * \return Current constraint source count. + */ + int GetConstraintSourceCount() const; + + /** Retrieve a constraint source object. + * \param pIndex Index of the source + * \return Current source at the specified index. + */ + FbxObject* GetConstraintSource(int pIndex) const; + + /** Set the constrained object. + * \param pObject The constrained object. + */ + void SetConstrainedObject(FbxObject* pObject); + + /** Retrieve the constrained object. + * \return Current constrained object. + */ + FbxObject* GetConstrainedObject() 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 +protected: + virtual void ConstructProperties(bool pForceSet); + virtual EType GetConstraintType() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_SCALE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintsinglechainik.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintsinglechainik.h new file mode 100644 index 00000000..e50ccc91 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintsinglechainik.h @@ -0,0 +1,169 @@ +/**************************************************************************************** + + 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 fbxconstraintsinglechainik.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_SINGLE_CHAIN_IK_H_ +#define _FBXSDK_SCENE_CONSTRAINT_SINGLE_CHAIN_IK_H_ + +#include + +#include + +#include + +/** \brief This constraint class contains methods for accessing the properties of a single chain IK constraint. + * \nosubgrouping + */ +class FBXSDK_DLL FbxConstraintSingleChainIK : public FbxConstraint +{ + FBXSDK_OBJECT_DECLARE(FbxConstraintSingleChainIK, FbxConstraint); + +public: + /** Solver pole vector mode. + */ + enum ESolverMode + { + eRotatePlane, //! Rotate plane solver. + eSingleChain //! Single chain solver. + }; + + /** Pole vector mode. + */ + enum EPoleVectorMode + { + eVector, //! Pole vector type is vector. + eObject //! Pole vector type is object. + }; + + /** If the constraints read its animation on Translation and Scale for the nodes it constraints. + */ + enum EEvaluationMode + { + eNeverTS, //! The constraints never read its animation on translation and scale for the nodes. + eAutoDetect, //! The constraints read its animation on translation and scale for the nodes according to automatic detection. + eAlwaysTS //! The constraints always read its animation on translation and scale for the nodes. + }; + + /** + * \name Properties + */ + //@{ + /** This property handles pole vector type. + */ + FbxPropertyT PoleVectorType; + + /** This property handles solver type. + */ + FbxPropertyT SolverType; + + /** This property handles evaluate TS animation. + */ + FbxPropertyT EvaluateTSAnim; + + /** This property handles pole vector objects. + */ + FbxPropertyT PoleVectorObjects; + + /** This property handles pole vector. + * + * Default value is (0, 1, 0). + */ + FbxPropertyT PoleVector; + + /** This property handles twist value. + * + * Default value is 0. + */ + FbxPropertyT Twist; + + /** This property handles first joint object. + */ + FbxPropertyT FirstJointObject; + + /** This property handles end joint object. + */ + FbxPropertyT EndJointObject; + + /** This property handles effector object. + */ + FbxPropertyT EffectorObject; + //@} + + /** Get the weight of a source. + * \param pObject Source object that we want the weight. + */ + double GetPoleVectorObjectWeight(const FbxObject* pObject) const; + + /** Add a source to the constraint. + * \param pObject New source object. + * \param pWeight Weight value of the source object expressed as a percentage. + * \remarks pWeight value is 100 percent by default. + */ + void AddPoleVectorObject(FbxObject* pObject, double pWeight = 100); + + /** Retrieve the constraint source count. + * \return Current constraint source count. + */ + int GetConstraintPoleVectorCount() const; + + /** Retrieve a constraint source object. + * \param pIndex Index of constraint source object. + * \return Current source at the specified index. + */ + FbxObject* GetPoleVectorObject(int pIndex) const; + + /** Set the first joint object. + * \param pObject The first joint object. + */ + void SetFirstJointObject(FbxObject* pObject); + + /** Retrieve the first joint object. + * \return Current first joint object. + */ + FbxObject* GetFirstJointObject() const; + + /** Set the end joint object. + * \param pObject The end joint object. + */ + void SetEndJointObject(FbxObject* pObject); + + /** Retrieve the end joint object. + * \return Current end joint object. + */ + FbxObject* GetEndJointObject() const; + + /** Set the effector object. + * \param pObject The effector object. + */ + void SetEffectorObject(FbxObject* pObject); + + /** Retrieve the effector object. + * \return Current effector object. + */ + FbxObject* GetEffectorObject() 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 +protected: + virtual void ConstructProperties(bool pForceSet); + virtual EType GetConstraintType() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxConstraintSingleChainIK::EPoleVectorMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxConstraintSingleChainIK::ESolverMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxConstraintSingleChainIK::EEvaluationMode&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_SINGLE_CHAIN_IK_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintutils.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintutils.h new file mode 100644 index 00000000..e62baf24 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxconstraintutils.h @@ -0,0 +1,37 @@ +/**************************************************************************************** + + 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 fbxconstraintutils.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_UTILS_H_ +#define _FBXSDK_SCENE_CONSTRAINT_UTILS_H_ + +#include + +#include + +class FbxNode; + +/** Utility class for constraints + *\nosubgrouping + */ +class FBXSDK_DLL FbxConstraintUtils +{ +public: + /** Test if the given node is Single Chain IK Effector. + * \param pNode The given node + * \return \c true if it is, \c false otherwise. + */ + static bool IsNodeSingleChainIKEffector(FbxNode* pNode); +}; + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_UTILS_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxcontrolset.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxcontrolset.h new file mode 100644 index 00000000..af354bf2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxcontrolset.h @@ -0,0 +1,370 @@ +/**************************************************************************************** + + 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 fbxcontrolset.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_CONTROL_SET_H_ +#define _FBXSDK_SCENE_CONSTRAINT_CONTROL_SET_H_ + +#include + +#include + +#include + +class FbxControlSetPlug; + +/** \class FbxControlSetLink + * + * \brief This class represents a link between a given character's FK node and the associated node in the character hierarchy. + * + */ +class FBXSDK_DLL FbxControlSetLink +{ +public: + //! Default constructor. + FbxControlSetLink(); + + /** Copy constructor. + * \param pControlSetLink Given object. + */ + FbxControlSetLink(const FbxControlSetLink& pControlSetLink); + + /** Assignment operator. + * \param pControlSetLink Another FbxControlSetLink object assigned to this one. + */ + FbxControlSetLink& operator=(const FbxControlSetLink& pControlSetLink); + + /** Reset to default values. + * + * Member mNode is set to \c NULL and member mTemplateName is cleared. + */ + void Reset(); + + //! The character's node in a hierarchy linked to this control set link. + FbxNode* mNode; + + //! A template name is a naming convention that is used to automatically map + //! the nodes of other skeletons that use the same naming convention for automatic characterization. + FbxString mTemplateName; +}; + +/** + * An effector wraps a character node (FbxNode) used to animate its control rig (FbxControlSet) via inverse kinematics. + */ +class FBXSDK_DLL FbxEffector +{ +public: + enum ESetId + { + eDefaultSet, + eAux1Set, + eAux2Set, + eAux3Set, + eAux4Set, + eAux5Set, + eAux6Set, + eAux7Set, + eAux8Set, + eAux9Set, + eAux10Set, + eAux11Set, + eAux12Set, + eAux13Set, + eAux14Set, + eSetIdCount + }; + + enum ENodeId + { + eHips, + eLeftAnkle, + eRightAnkle, + eLeftWrist, + eRightWrist, + eLeftKnee, + eRightKnee, + eLeftElbow, + eRightElbow, + eChestOrigin, + eChestEnd, + eLeftFoot, + eRightFoot, + eLeftShoulder, + eRightShoulder, + eHead, + eLeftHip, + eRightHip, + eLeftHand, + eRightHand, + eLeftHandThumb, + eLeftHandIndex, + eLeftHandMiddle, + eLeftHandRing, + eLeftHandPinky, + eLeftHandExtraFinger, + eRightHandThumb, + eRightHandIndex, + eRightHandMiddle, + eRightHandRing, + eRightHandPinky, + eRightHandExtraFinger, + eLeftFootThumb, + eLeftFootIndex, + eLeftFootMiddle, + eLeftFootRing, + eLeftFootPinky, + eLeftFootExtraFinger, + eRightFootThumb, + eRightFootIndex, + eRightFootMiddle, + eRightFootRing, + eRightFootPinky, + eRightFootExtraFinger, + eNodeIdCount, + eNodeIdInvalid=-1 + }; + + //! Default constructor with uninitialized character node. + FbxEffector(); + + /** Assignment operator. + * \param pEffector Another FbxEffector assigned to this one. + */ + FbxEffector& operator=(const FbxEffector& pEffector); + + /** Reset to default values. + * - mNode is set to NULL. + * - mShow is set to true. + */ + void Reset(); + + //! The character's node in a hierarchy linked to this effector. + FbxNode* mNode; + + //! \c true if the effector is visible, \c false if hidden + bool mShow; + +/***************************************************************************************************************************** +** 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 + //These members are for backward compatibility and should not be used. + //These properties are now published through class FbxControlSetPlug. + bool mTActive; + bool mRActive; + bool mCandidateTActive; + bool mCandidateRActive; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** \class FbxControlSet + * + * This class contains all methods to either set-up an exported control rig or query information on an imported control rig. + * A Control rig is a character manipulation tool that lets you change the position and orientation + * of a character to create or alter animation. + * + * This class also contains some methods to manipulate the FbxEffector and FbxControlSetLink. + * + * The FbxControlSet class contains FK rig (Forward Kinematics) and IK rig (Inverse Kinematics) animation. The FK rig is represented + * by a list of nodes while the IK rig is represented by a list of effectors. + * + * You can access the FK rig with the FbxControlSetLink class, using the functions FbxControlSet::SetControlSetLink() and FbxControlSet::GetControlSetLink(). + * + * You can access the IK rig with the FbxEffector class, using the functions FbxControlSet::SetEffector() and FbxControlSet::GetEffector(). + * + * \see FbxEffector, FbxControlSetLink + */ +class FBXSDK_DLL FbxControlSet +{ +public: + /** Reset to default values. + * Reset all effector and control set links. + */ + void Reset(); + + /** \enum EType Control rig type. + * - \e eNone No Control rig. + * - \e eFkIk Both an FK rig and IK rig. + * - \e eIkOnly Only an IK rig. + */ + enum EType + { + eNone, + eFkIk, + eIkOnly + }; + + /** Set type as given. + * \param pType The given type. + */ + void SetType(EType pType); + + /** Get type. + * \return The gotten type. + */ + EType GetType() const; + + /** Set use axis flag as given. + * \param pUseAxis The given use axis flag. + */ + void SetUseAxis(bool pUseAxis); + + /** Get use axis flag. + * \return The gotten use axis flag. + */ + bool GetUseAxis() const; + + /** Set lock transform flag as given. + * \param pLockTransform The given lock transform flag. + */ + void SetLockTransform(bool pLockTransform); + + /** Get lock transform flag. + * \return The gotten lock transform flag. + */ + bool GetLockTransform()const; + + /** Set lock 3D pick flag as given. + * \param pLock3DPick The given lock 3D pick flag. + */ + void SetLock3DPick(bool pLock3DPick); + + /** Get lock 3D pick flag. + * \return The gotten lock 3D pick flag. + */ + bool GetLock3DPick() const; + + /** Set a control set link for a character node ID. + * \param pCharacterNodeId Character node ID. + * \param pControlSetLink Control set link to be associated with the Character node ID. + * \return \c true if successful, \c false otherwise. + * \remarks You should avoid setting a control set link for + * eCharacterLeftFloor, eCharacterRightFloor, eCharacterLeftHandFloor, eCharacterRightHandFloor, + * eCharacterProps0, eCharacterProps1, eCharacterProps2, eCharacterProps3 or eCharacterProps4. + * None of these nodes are part of a control set. + */ + bool SetControlSetLink(FbxCharacter::ENodeId pCharacterNodeId, const FbxControlSetLink& pControlSetLink); + + /** Get the control set link associated with a character node ID. + * \param pCharacterNodeId Requested character node ID. + * \param pControlSetLink Optional pointer that returns the control set link if the function succeeds. + * \return \c true if successful, \c false otherwise. + * \remarks You should avoid getting a control set link for + * eCharacterLeftFloor, eCharacterRightFloor, eCharacterLeftHandFloor, eCharacterRightHandFloor, + * eCharacterProps0, eCharacterProps1, eCharacterProps2, eCharacterProps3 or eCharacterProps4. + * None of these nodes are part of a control set. + */ + bool GetControlSetLink(FbxCharacter::ENodeId pCharacterNodeId, FbxControlSetLink* pControlSetLink = NULL) const; + + /** Set an effector node for an effector node ID. + * \param pEffectorNodeId Effector node ID. + * \param pEffector Effector to be associated with the effector node ID. + * \return \c true if successful, \c false otherwise. + */ + bool SetEffector(FbxEffector::ENodeId pEffectorNodeId, FbxEffector pEffector); + + /** Get the effector associated with an effector node ID. + * \param pEffectorNodeId ID of requested effector node. + * \param pEffector Optional pointer that returns the effector if the function succeeds. + * \return \c true if successful, \c false otherwise. + */ + bool GetEffector(FbxEffector::ENodeId pEffectorNodeId, FbxEffector* pEffector = NULL); + + /** Set an auxiliary effector node for an effector node ID. + * \param pEffectorNodeId Effector node ID. + * \param pNode Auxiliary effector node to be associated with the effector node ID. + * \param pEffectorSetId Effector set ID. Set to FbxEffector::eAux1Set by default. + * \return \c true if successful, \c false otherwise. + */ + bool SetEffectorAux(FbxEffector::ENodeId pEffectorNodeId, FbxNode* pNode, FbxEffector::ESetId pEffectorSetId=FbxEffector::eAux1Set); + + /** Get the auxiliary effector associated with an effector node ID. + * \param pEffectorNodeId ID of requested auxiliary effector node. + * \param pNode Optional pointer that returns the auxiliary effector node if the function succeeds. + * \param pEffectorSetId Effector set ID. Set to FbxEffector::eAux1Set by default. + * \return \c true if successful, \c false otherwise. + */ + bool GetEffectorAux(FbxEffector::ENodeId pEffectorNodeId, FbxNode** pNode=NULL, FbxEffector::ESetId pEffectorSetId=FbxEffector::eAux1Set) const; + + /** Get the name associated with an effector node ID. + * \param pEffectorNodeId Effector node ID. + * \return Name associated with the effector node ID. + */ + static char* GetEffectorNodeName(FbxEffector::ENodeId pEffectorNodeId); + + /** Get ID associated with an effector node name. + * \param pEffectorNodeName Effector node name. + * \return Effector node ID associated with the given effector node name, or FbxEffector::eNodeIdInvalid (-1) if + * no effector node with pEffectorNodeName exists. + */ + static FbxEffector::ENodeId GetEffectorNodeId(char* pEffectorNodeName); + +/***************************************************************************************************************************** +** 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 FromPlug(FbxControlSetPlug *pPlug); + void ToPlug(FbxControlSetPlug *pPlug); + +private: + FbxControlSet(); + ~FbxControlSet(); + + FbxCharacter* mCharacter; + EType mType; + bool mUseAxis; + bool mLockTransform; + bool mLock3DPick; + FbxControlSetLink mControlSetLink[FbxCharacter::eNodeIdCount]; // Except floor node IDs! + FbxEffector mEffector[FbxEffector::eNodeIdCount]; + FbxNode* mEffectorAux[FbxEffector::eNodeIdCount][FbxEffector::eSetIdCount-1]; + + FBXSDK_FRIEND_NEW(); + friend class FbxCharacter; + friend class FbxNode; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** Plug class for control set. + * \nosubgrouping + */ +class FBXSDK_DLL FbxControlSetPlug : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxControlSetPlug, FbxObject); + +public: + //! EType property of control set. + FbxPropertyT ControlSetType; + + //! Use axis flag. + FbxPropertyT UseAxis; + + //! Reference character. + FbxPropertyT Character; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + virtual FbxStringList GetTypeFlags() const; + +private: + FbxArray mFKBuf; + FbxArray mIKBuf; + + friend class FbxScene; + friend class FbxControlSet; +}; + +inline EFbxType FbxTypeOf(const FbxControlSet::EType&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_CONTROL_SET_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/constraint/fbxhik2fbxcharacter.h b/libs/fbx/include/fbxsdk/scene/constraint/fbxhik2fbxcharacter.h new file mode 100644 index 00000000..f06a9d6a --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/constraint/fbxhik2fbxcharacter.h @@ -0,0 +1,317 @@ +/**************************************************************************************** + + 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 fbxhik2fbxcharacter.h +#ifndef _FBXSDK_SCENE_CONSTRAINT_HIK_TO_FBXCHARACTER_H_ +#define _FBXSDK_SCENE_CONSTRAINT_HIK_TO_FBXCHARACTER_H_ + +#include + +#include + +#include + +class FbxCharacterPropertyInfo +{ +public: + const char* mHIKPropertyName; + const char* mFbxCharacterPropertyModeName; + const char* mFbxCharacterPropertyName; + int mIndex; + FbxCharacter::EPropertyUnit mUnit; +}; + +static const FbxCharacterPropertyInfo gHIK2FbxCharacterPropertyBridge[] = +{ + { "PullIterationCount" ,NULL,"PullIterationCount",0,FbxCharacter::ePropertyReal}, + { "Posture" ,NULL,"Posture",0,FbxCharacter::ePropertyEnum}, + { "ForceActorSpace" ,"ForceActorSpace",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "ScaleCompensation" ,"ScaleCompensationMode","ScaleCompensation",0,FbxCharacter::ePropertyReal}, + { "HipsHeightCompensation" ,"HipsHeightCompensationMode","HipsHeightCompensation",0,FbxCharacter::ePropertyCentimeter}, + { "AnkleHeightCompensation" ,"AnkleHeightCompensationMode","AnkleHeightCompensation",0,FbxCharacter::ePropertyCentimeter}, + { "AnkleProximityCompensation" ,"AnkleProximityCompensationMode","AnkleProximityCompensation",0,FbxCharacter::ePropertyCentimeter}, + { "MassCenterCompensation" ,NULL,"MassCenterCompensation",0,FbxCharacter::ePropertyReal}, + { "ApplyLimits" ,"ApplyLimits",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "ChestReduction" ,NULL,"ChestReduction",0,FbxCharacter::ePropertyPercent}, + { "CollarReduction" ,NULL,"CollarReduction",0,FbxCharacter::ePropertyPercent}, + { "NeckReduction" ,NULL,"NeckReduction",0,FbxCharacter::ePropertyPercent}, + { "HeadReduction" ,NULL,"HeadReduction",0,FbxCharacter::ePropertyPercent}, + { "ParamFootContactStiffness" ,NULL,"FootContactStiffness",0,FbxCharacter::ePropertyPercent}, + { "ParamHandContactStiffness" ,NULL,"HandContactStiffness",0,FbxCharacter::ePropertyPercent}, + { "ParamFootFingerContactRollStiffness" ,NULL,"FootFingerContactRollStiffness",0,FbxCharacter::ePropertyPercent}, + { "ParamHandFingerContactRollStiffness" ,NULL,"HandFingerContactRollStiffness",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftAnkle" ,NULL,"ReachActorLeftAnkle",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightAnkle" ,NULL,"ReachActorRightAnkle",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftKnee" ,NULL,"ReachActorLeftKnee",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightKnee" ,NULL,"ReachActorRightKnee",0,FbxCharacter::ePropertyPercent}, + { "ReachActorChest" ,NULL,"ReachActorChest",0,FbxCharacter::ePropertyPercent}, + { "ReachActorHead" ,NULL,"ReachActorHead",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftWrist" ,NULL,"ReachActorLeftWrist",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightWrist" ,NULL,"ReachActorRightWrist",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftElbow" ,NULL,"ReachActorLeftElbow",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightElbow" ,NULL,"ReachActorRightElbow",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightFingerBase" ,NULL,"ReachActorRightFingerBase",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftFingerBase" ,NULL,"ReachActorLeftFingerBase",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightToesBase" ,NULL,"ReachActorRightToesBase",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftToesBase" ,NULL,"ReachActorLeftToesBase",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightFingerBaseRotation" ,NULL,"ReachActorRightFingerBaseRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftFingerBaseRotation" ,NULL,"ReachActorLeftFingerBaseRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightToesBaseRotation" ,NULL,"ReachActorRightToesBaseRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftToesBaseRotation" ,NULL,"ReachActorLeftToesBaseRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftAnkleRotationRotation" ,NULL,"ReachActorLeftAnkleRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightAnkleRotation" ,NULL,"ReachActorRightAnkleRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorHeadRotation" ,NULL,"ReachActorHeadRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLeftWristRotation" ,NULL,"ReachActorLeftWristRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorRightWristRotation" ,NULL,"ReachActorRightWristRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorChestRotation" ,NULL,"ReachActorChestRotation",0,FbxCharacter::ePropertyPercent}, + { "ReachActorLowerChestRotation" ,NULL,"ReachActorLowerChestRotation",0,FbxCharacter::ePropertyPercent}, + { "HipsTOffsetX" ,NULL,"HipsTOffset",0,FbxCharacter::ePropertyCentimeter}, + { "HipsTOffsetY" ,NULL,"HipsTOffset",1,FbxCharacter::ePropertyCentimeter}, + { "HipsTOffsetZ" ,NULL,"HipsTOffset",2,FbxCharacter::ePropertyCentimeter}, + { "ChestTOffsetX" ,NULL,"ChestTOffset",0,FbxCharacter::ePropertyCentimeter}, + { "ChestTOffsetY" ,NULL,"ChestTOffset",1,FbxCharacter::ePropertyCentimeter}, + { "ChestTOffsetZ" ,NULL,"ChestTOffset",2,FbxCharacter::ePropertyCentimeter}, + { "LeftUpLegRollEx" ,"LeftUpLegRollExMode","LeftUpLegRollEx",0,FbxCharacter::ePropertyPercent}, + { "LeftLegRollEx" ,"LeftLegRollExMode","LeftLegRollEx",0,FbxCharacter::ePropertyPercent}, + { "RightUpLegRollEx" ,"RightUpLegRollExMode","RightUpLegRollEx",0,FbxCharacter::ePropertyPercent}, + { "RightLegRollEx" ,"RightLegRollExMode","RightLegRollEx",0,FbxCharacter::ePropertyPercent}, + { "LeftArmRollEx" ,"LeftArmRollExMode","LeftArmRollEx",0,FbxCharacter::ePropertyPercent}, + { "LeftForeArmRollEx" ,"LeftForeArmRollExMode","LeftForeArmRollEx",0,FbxCharacter::ePropertyPercent}, + { "RightArmRollEx" ,"RightArmRollExMode","RightArmRollEx",0,FbxCharacter::ePropertyPercent}, + { "RightForeArmRollEx" ,"RightForeArmRollExMode","RightForeArmRollEx",0,FbxCharacter::ePropertyPercent}, + { "LeftUpLegRoll" ,"LeftUpLegRollMode","LeftUpLegRoll",0,FbxCharacter::ePropertyPercent}, + { "LeftLegRoll" ,"LeftLegRollMode","LeftLegRoll",0,FbxCharacter::ePropertyPercent}, + { "RightUpLegRoll" ,"RightUpLegRollMode","RightUpLegRoll",0,FbxCharacter::ePropertyPercent}, + { "RightLegRoll" ,"RightLegRollMode","RightLegRoll",0,FbxCharacter::ePropertyPercent}, + { "LeftArmRoll" ,"LeftArmRollMode","LeftArmRoll",0,FbxCharacter::ePropertyPercent}, + { "LeftForeArmRoll" ,"LeftForeArmRollMode","LeftForeArmRoll",0,FbxCharacter::ePropertyPercent}, + { "RightArmRoll" ,"RightArmRollMode","RightArmRoll",0,FbxCharacter::ePropertyPercent}, + { "RightForeArmRoll" ,"RightForeArmRollMode","RightForeArmRoll",0,FbxCharacter::ePropertyPercent}, + { "FloorContact" ,"FootFloorContact","FootFloorContact",0,FbxCharacter::ePropertyNoUnit}, + { "AutomaticToes" ,"FootAutomaticToes",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "RollExtractionMode" ,NULL,"RollExtractionMode",0,FbxCharacter::ePropertyEnum}, + { "FloorPivot" ,NULL,"FootFloorPivot",0,FbxCharacter::ePropertyEnum}, + { "FootBottomToAnkle" ,NULL,"FootBottomToAnkle",0,FbxCharacter::ePropertyCentimeter}, + { "FootBackToAnkle" ,NULL,"FootBackToAnkle",0,FbxCharacter::ePropertyCentimeter}, + { "FootMiddleToAnkle" ,NULL,"FootMiddleToAnkle",0,FbxCharacter::ePropertyCentimeter}, + { "FootFrontToMiddle" ,NULL,"FootFrontToMiddle",0,FbxCharacter::ePropertyCentimeter}, + { "FootInToAnkle" ,NULL,"FootInToAnkle",0,FbxCharacter::ePropertyCentimeter}, + { "FootOutToAnkle" ,NULL,"FootOutToAnkle",0,FbxCharacter::ePropertyCentimeter}, + { "ContactSize" ,NULL,"FootContactSize",0,FbxCharacter::ePropertyReal}, + { "HandFloorContact" ,"HandFloorContact","HandFloorContact",0,FbxCharacter::ePropertyNoUnit}, + { "AutomaticFingers" ,"HandAutomaticFingers",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "HandFloorPivot" ,NULL,"HandFloorPivot",0,FbxCharacter::ePropertyEnum}, + { "HandBottomToWrist" ,NULL,"HandBottomToWrist",0,FbxCharacter::ePropertyCentimeter}, + { "HandBackToWrist" ,NULL,"HandBackToWrist",0,FbxCharacter::ePropertyCentimeter}, + { "HandMiddleToWrist" ,NULL,"HandMiddleToWrist",0,FbxCharacter::ePropertyCentimeter}, + { "HandFrontToMiddle" ,NULL,"HandFrontToMiddle",0,FbxCharacter::ePropertyCentimeter}, + { "HandInToWrist" ,NULL,"HandInToWrist",0,FbxCharacter::ePropertyCentimeter}, + { "HandOutToWrist" ,NULL,"HandOutToWrist",0,FbxCharacter::ePropertyCentimeter}, + { "HandContactSize" ,NULL,"HandContactSize",0,FbxCharacter::ePropertyCentimeter}, + { "LeftHandThumbTip" ,NULL,"LeftHandThumbTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftHandIndexTip" ,NULL,"LeftHandIndexTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftHandMiddleTip" ,NULL,"LeftHandMiddleTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftHandRingTip" ,NULL,"LeftHandRingTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftHandPinkyTip" ,NULL,"LeftHandPinkyTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftHandExtraFingerTip" ,NULL,"LeftHandExtraFingerTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightHandThumbTip" ,NULL,"RightHandThumbTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightHandIndexTip" ,NULL,"RightHandIndexTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightHandMiddleTip" ,NULL,"RightHandMiddleTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightHandRingTip" ,NULL,"RightHandRingTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightHandPinkyTip" ,NULL,"RightHandPinkyTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightHandExtraFingerTip" ,NULL,"RightHandExtraFingerTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftFootThumbTip" ,NULL,"LeftFootThumbTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftFootIndexTip" ,NULL,"LeftFootIndexTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftFootMiddleTip" ,NULL,"LeftFootMiddleTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftFootRingTip" ,NULL,"LeftFootRingTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftFootPinkyTip" ,NULL,"LeftFootPinkyTip",0,FbxCharacter::ePropertyCentimeter}, + { "LeftFootExtraFingerTip" ,NULL,"LeftFootExtraFingerTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightFootThumbTip" ,NULL,"RightFootThumbTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightFootIndexTip" ,NULL,"RightFootIndexTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightFootMiddleTip" ,NULL,"RightFootMiddleTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightFootRingTip" ,NULL,"RightFootRingTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightFootPinkyTip" ,NULL,"RightFootPinkyTip",0,FbxCharacter::ePropertyCentimeter}, + { "RightFootExtraFingerTip" ,NULL,"RightFootExtraFingerTip",0,FbxCharacter::ePropertyCentimeter}, + { "FingerSolving" ,"FingerSolving",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "FootFingerContact" ,"FootFingerContact","FootFingerContact",0,FbxCharacter::ePropertyNoUnit}, + { "FootContactType" ,NULL,"FootContactType",0,FbxCharacter::ePropertyEnum}, + { "FootFingerContactMode" ,NULL,"FootFingerContactMode",0,FbxCharacter::ePropertyEnum}, + { "HandFingerContact" ,"HandFingerContact","HandFingerContact",0,FbxCharacter::ePropertyNoUnit}, + { "HandContactType" ,NULL,"HandContactType",0,FbxCharacter::ePropertyEnum}, + { "HandFingerContactMode" ,NULL,"HandFingerContactMode",0,FbxCharacter::ePropertyEnum}, + { "CtrlPullLeftToeBase" ,NULL,"CtrlPullLeftToeBase",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullLeftFoot" ,NULL,"CtrlPullLeftFoot",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullLeftKnee" ,NULL,"CtrlPullLeftKnee",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullRightToeBase" ,NULL,"CtrlPullRightToeBase",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullRightFoot" ,NULL,"CtrlPullRightFoot",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullRightKnee" ,NULL,"CtrlPullRightKnee",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullLeftFingerBase" ,NULL,"CtrlPullLeftFingerBase",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullLeftHand" ,NULL,"CtrlPullLeftHand",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullLeftElbow" ,NULL,"CtrlPullLeftElbow",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullRightFingerBase" ,NULL,"CtrlPullRightFingerBase",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullRightHand" ,NULL,"CtrlPullRightHand",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullRightElbow" ,NULL,"CtrlPullRightElbow",0,FbxCharacter::ePropertyPercent}, + { "CtrlChestPullLeftHand" ,NULL,"CtrlChestPullLeftHand",0,FbxCharacter::ePropertyPercent}, + { "CtrlChestPullRightHand" ,NULL,"CtrlChestPullRightHand",0,FbxCharacter::ePropertyPercent}, + { "CtrlPullHead" ,NULL,"CtrlPullHead",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistHipsPosition" ,NULL,"CtrlResistHipsPosition",0,FbxCharacter::ePropertyPercent}, + { "CtrlEnforceGravity" ,NULL,"CtrlEnforceGravity",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistHipsOrientation" ,NULL,"CtrlResistHipsOrientation",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistChestPosition" ,NULL,"CtrlResistChestPosition",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistChestOrientation" ,NULL,"CtrlResistChestOrientation",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistLeftCollar" ,NULL,"CtrlResistLeftCollar",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistRightCollar" ,NULL,"CtrlResistRightCollar",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistLeftKnee" ,NULL,"CtrlResistLeftKnee",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistMaximumExtensionLeftKnee" ,NULL,"CtrlResistMaximumExtensionLeftKnee",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistCompressionFactorLeftKnee" ,NULL,"CtrlResistCompressionFactorLeftKnee",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistRightKnee" ,NULL,"CtrlResistRightKnee",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistMaximumExtensionRightKnee" ,NULL,"CtrlResistMaximumExtensionRightKnee",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistCompressionFactorRightKnee" ,NULL,"CtrlResistCompressionFactorRightKnee",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistLeftElbow" ,NULL,"CtrlResistLeftElbow",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistMaximumExtensionLeftElbow" ,NULL,"CtrlResistMaximumExtensionLeftElbow",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistCompressionFactorLeftElbow" ,NULL,"CtrlResistCompressionFactorLeftElbow",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistRightElbow" ,NULL,"CtrlResistRightElbow",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistMaximumExtensionRightElbow" ,NULL,"CtrlResistMaximumExtensionRightElbow",0,FbxCharacter::ePropertyPercent}, + { "CtrlResistCompressionFactorRightElbow" ,NULL,"CtrlResistCompressionFactorRightElbow",0,FbxCharacter::ePropertyPercent}, + { "ParamCtrlSpineStiffness" ,NULL,"CtrlSpineStiffness",0,FbxCharacter::ePropertyPercent}, + { "ParamCtrlNeckStiffness" ,NULL,"CtrlNeckStiffness",0,FbxCharacter::ePropertyPercent}, + { "Mirror" ,"MirrorMode",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "ShoulderCorrection" ,NULL,"ShoulderCorrection",0,FbxCharacter::ePropertyPercent}, + { "LeftKneeKillPitch" ,"LeftKneeKillPitch",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "RightKneeKillPitch" ,"RightKneeKillPitch",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "LeftElbowKillPitch" ,"LeftElbowKillPitch",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "RightElbowKillPitch" ,"RightElbowKillPitch",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "HipsTranslationMode" ,NULL,"HipsTranslationMode",0,FbxCharacter::ePropertyEnum}, + { "WriteReference" ,"WriteReference",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "SyncMode" ,"SyncMode",NULL,0,FbxCharacter::ePropertyNoUnit}, + { "Damping" ,NULL,"Damping",0,FbxCharacter::ePropertyReal}, + { "Orientation" ,"OrientationDampingMode","OrientationDamping",0,FbxCharacter::ePropertySecond}, + { "Displacement" ,"DisplacementDampingMode","DisplacementDamping",0,FbxCharacter::ePropertyReal}, + { "DisplacementMemory" ,"DisplacementMemoryMode","DisplacementMemory",0,FbxCharacter::ePropertySecond}, + { "HipsDisplacementDamping" ,"HipsDisplacementDampingMode","HipsDisplacementDamping",0,FbxCharacter::ePropertyReal}, + { "AnkleDisplacementDamping" ,"AnkleDisplacementDampingMode","AnkleDisplacementDamping",0,FbxCharacter::ePropertyReal}, + { "WristDisplacementDamping" ,"WristDisplacementDampingMode","WristDisplacementDamping",0,FbxCharacter::ePropertyReal}, + { "Stabilization" ,NULL,"Stabilization",0,FbxCharacter::ePropertyReal}, + { "AnkleStabilizationTime" ,"AnkleStabilizationTimeMode","AnkleStabilizationTime",0,FbxCharacter::ePropertySecond}, + { "AnkleStabilizationPerimeter" ,"AnkleStabilizationPerimeterMode","AnkleStabilizationPerimeter",0,FbxCharacter::ePropertyCentimeter}, + { "AnkleStabilizationAngularPerimeter" ,"AnkleStabilizationAngularPerimeterMode","AnkleStabilizationAngularPerimeter",0,FbxCharacter::ePropertyDegree}, + { "AnkleStabilizationFloorProximity" ,"AnkleStabilizationFloorProximityMode","AnkleStabilizationFloorProximity",0,FbxCharacter::ePropertyCentimeter}, + { "AnkleStabilizationDamping" ,"AnkleStabilizationDampingMode","AnkleStabilizationDamping",0,FbxCharacter::ePropertySecond}, + { "AnkleStabilizationRecoveryTime" ,"AnkleStabilizationRecoveryTimeMode","AnkleStabilizationRecoveryTime",0,FbxCharacter::ePropertySecond}, + { "ContactBehaviour" ,NULL,"ContactBehaviour",0}, + { "ShoulderCorrection", NULL, "RealisticShoulder",0,FbxCharacter::ePropertyReal}, + { "CollarStiffnessX", NULL, "CollarStiffnessX",0,FbxCharacter::ePropertyReal}, + { "CollarStiffnessY", NULL, "CollarStiffnessY",0,FbxCharacter::ePropertyReal}, + { "CollarStiffnessZ", NULL, "CollarStiffnessZ",0,FbxCharacter::ePropertyReal}, + { "ExtraCollarRatio", NULL, "ExtraCollarRatio",0,FbxCharacter::ePropertyPercent}, + { "LeftLegMaxExtensionAngle", NULL, "LeftLegMaxExtensionAngle",0,FbxCharacter::ePropertyReal}, + { "RightLegMaxExtensionAngle", NULL, "RightLegMaxExtensionAngle",0,FbxCharacter::ePropertyReal}, + { "LeftArmMaxExtensionAngle", NULL, "LeftArmMaxExtensionAngle",0,FbxCharacter::ePropertyReal}, + { "RightArmMaxExtensionAngle", NULL, "RightArmMaxExtensionAngle",0,FbxCharacter::ePropertyReal}, + { "StretchStartArmsAndLegs", NULL, "StretchStartArmsAndLegs",0,FbxCharacter::ePropertyReal}, + { "StretchStopArmsAndLegs", NULL, "StretchStopArmsAndLegs",0,FbxCharacter::ePropertyReal}, + { "SnSScaleArmsAndLegs", NULL, "SnSScaleArmsAndLegs",0,FbxCharacter::ePropertyPercent}, + { "SnSReachLeftWrist", NULL, "SnSReachLeftWrist",0,FbxCharacter::ePropertyPercent}, + { "SnSReachRightWrist", NULL, "SnSReachRightWrist",0,FbxCharacter::ePropertyPercent}, + { "SnSReachLeftAnkle", NULL, "SnSReachLeftAnkle",0,FbxCharacter::ePropertyPercent}, + { "SnSReachRightAnkle", NULL, "SnSReachRightAnkle",0,FbxCharacter::ePropertyPercent}, + { "SnSScaleSpine", NULL, "SnSScaleSpine",0,FbxCharacter::ePropertyPercent}, + { "SnSScaleSpineChildren", NULL, "SnSScaleSpineChildren",0,FbxCharacter::ePropertyPercent}, + { "SnSSpineFreedom", NULL, "SnSSpineFreedom",0,FbxCharacter::ePropertyPercent}, + { "SnSReachChestEnd", NULL, "SnSReachChestEnd",0,FbxCharacter::ePropertyPercent}, + { "SnSScaleNeck", NULL, "SnSScaleNeck",0,FbxCharacter::ePropertyPercent}, + { "SnSNeckFreedom", NULL, "SnSNeckFreedom",0,FbxCharacter::ePropertyPercent}, + { "SnSReachHead", NULL, "SnSReachHead",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftUpLegRoll1" ,"LeafLeftUpLegRoll1Mode","LeafLeftUpLegRoll1",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftLegRoll1" ,"LeafLeftLegRoll1Mode","LeafLeftLegRoll1",0,FbxCharacter::ePropertyPercent}, + { "LeafRightUpLegRoll1" ,"LeafRightUpLegRoll1Mode","LeafRightUpLegRoll1",0,FbxCharacter::ePropertyPercent}, + { "LeafRightLegRoll1" ,"LeafRightLegRoll1Mode","LeafRightLegRoll1",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftArmRoll1" ,"LeafLeftArmRoll1Mode","LeafLeftArmRoll1",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftForeArmRoll1" ,"LeafLeftForeArmRoll1Mode","LeafLeftForeArmRoll1",0,FbxCharacter::ePropertyPercent}, + { "LeafRightArmRoll1" ,"LeafRightArmRoll1Mode","LeafRightArmRoll1",0,FbxCharacter::ePropertyPercent}, + { "LeafRightForeArmRoll1" ,"LeafRightForeArmRoll1Mode","LeafRightForeArmRoll1",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftUpLegRoll2" ,"LeafLeftUpLegRoll2Mode","LeafLeftUpLegRoll2",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftLegRoll2" ,"LeafLeftLegRoll2Mode","LeafLeftLegRoll2",0,FbxCharacter::ePropertyPercent}, + { "LeafRightUpLegRoll2" ,"LeafRightUpLegRoll2Mode","LeafRightUpLegRoll2",0,FbxCharacter::ePropertyPercent}, + { "LeafRightLegRoll2" ,"LeafRightLegRoll2Mode","LeafRightLegRoll2",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftArmRoll2" ,"LeafLeftArmRoll2Mode","LeafLeftArmRoll2",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftForeArmRoll2" ,"LeafLeftForeArmRoll2Mode","LeafLeftForeArmRoll2",0,FbxCharacter::ePropertyPercent}, + { "LeafRightArmRoll2" ,"LeafRightArmRoll2Mode","LeafRightArmRoll2",0,FbxCharacter::ePropertyPercent}, + { "LeafRightForeArmRoll2" ,"LeafRightForeArmRoll2Mode","LeafRightForeArmRoll2",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftUpLegRoll3" ,"LeafLeftUpLegRoll3Mode","LeafLeftUpLegRoll3",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftLegRoll3" ,"LeafLeftLegRoll3Mode","LeafLeftLegRoll3",0,FbxCharacter::ePropertyPercent}, + { "LeafRightUpLegRoll3" ,"LeafRightUpLegRoll3Mode","LeafRightUpLegRoll3",0,FbxCharacter::ePropertyPercent}, + { "LeafRightLegRoll3" ,"LeafRightLegRoll3Mode","LeafRightLegRoll3",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftArmRoll3" ,"LeafLeftArmRoll3Mode","LeafLeftArmRoll3",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftForeArmRoll3" ,"LeafLeftForeArmRoll3Mode","LeafLeftForeArmRoll3",0,FbxCharacter::ePropertyPercent}, + { "LeafRightArmRoll3" ,"LeafRightArmRoll3Mode","LeafRightArmRoll3",0,FbxCharacter::ePropertyPercent}, + { "LeafRightForeArmRoll3" ,"LeafRightForeArmRoll3Mode","LeafRightForeArmRoll3",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftUpLegRoll4" ,"LeafLeftUpLegRoll4Mode","LeafLeftUpLegRoll4",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftLegRoll4" ,"LeafLeftLegRoll4Mode","LeafLeftLegRoll4",0,FbxCharacter::ePropertyPercent}, + { "LeafRightUpLegRoll4" ,"LeafRightUpLegRoll4Mode","LeafRightUpLegRoll4",0,FbxCharacter::ePropertyPercent}, + { "LeafRightLegRoll4" ,"LeafRightLegRoll4Mode","LeafRightLegRoll4",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftArmRoll4" ,"LeafLeftArmRoll4Mode","LeafLeftArmRoll4",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftForeArmRoll4" ,"LeafLeftForeArmRoll4Mode","LeafLeftForeArmRoll4",0,FbxCharacter::ePropertyPercent}, + { "LeafRightArmRoll4" ,"LeafRightArmRoll4Mode","LeafRightArmRoll4",0,FbxCharacter::ePropertyPercent}, + { "LeafRightForeArmRoll4" ,"LeafRightForeArmRoll4Mode","LeafRightForeArmRoll4",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftUpLegRoll5" ,"LeafLeftUpLegRoll5Mode","LeafLeftUpLegRoll5",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftLegRoll5" ,"LeafLeftLegRoll5Mode","LeafLeftLegRoll5",0,FbxCharacter::ePropertyPercent}, + { "LeafRightUpLegRoll5" ,"LeafRightUpLegRoll5Mode","LeafRightUpLegRoll5",0,FbxCharacter::ePropertyPercent}, + { "LeafRightLegRoll5" ,"LeafRightLegRoll5Mode","LeafRightLegRoll5",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftArmRoll5" ,"LeafLeftArmRoll5Mode","LeafLeftArmRoll5",0,FbxCharacter::ePropertyPercent}, + { "LeafLeftForeArmRoll5" ,"LeafLeftForeArmRoll5Mode","LeafLeftForeArmRoll5",0,FbxCharacter::ePropertyPercent}, + { "LeafRightArmRoll5" ,"LeafRightArmRoll5Mode","LeafRightArmRoll5",0,FbxCharacter::ePropertyPercent}, + { "LeafRightForeArmRoll5" ,"LeafRightForeArmRoll5Mode","LeafRightForeArmRoll5",0,FbxCharacter::ePropertyPercent}, + { "LeftLegFullRollExtraction" ,NULL,"LeftLegFullRollExtraction",0,FbxCharacter::ePropertyPercent}, + { "RightLegFullRollExtraction" ,NULL,"RightLegFullRollExtraction",0,FbxCharacter::ePropertyPercent}, + { "LeftArmFullRollExtraction" ,NULL,"LeftArmFullRollExtraction",0,FbxCharacter::ePropertyPercent}, + { "RightArmFullRollExtraction" ,NULL,"RightArmFullRollExtraction",0,FbxCharacter::ePropertyPercent} +}; + +class HIK2FbxCharacterPropertyBridge +{ +public: + enum + { + mParamCount = sizeof(gHIK2FbxCharacterPropertyBridge) / sizeof(FbxCharacterPropertyInfo) + }; + static inline const FbxCharacterPropertyInfo& GetAt(int i) { return gHIK2FbxCharacterPropertyBridge[i] ;} + + static inline const FbxCharacterPropertyInfo* GetPropertyInfoFromFbxCharacterProperty(const char* pCharacterPropertyName) + { + int lCounter = 0; + for( lCounter = 0 ; lCounter < mParamCount; lCounter++ ) + { + if(GetAt(lCounter).mFbxCharacterPropertyName && !strcmp(GetAt(lCounter).mFbxCharacterPropertyName, pCharacterPropertyName)) + { + return &GetAt(lCounter); + } + } + return NULL; + } + + static inline const FbxCharacterPropertyInfo* GetPropertyInfoFromHIKProperty(const char* pHIKPropertyName) + { + int lCounter = 0; + for( lCounter = 0 ; lCounter < mParamCount; lCounter++ ) + { + if(!strcmp(GetAt(lCounter).mHIKPropertyName, pHIKPropertyName)) + { + return &GetAt(lCounter); + } + } + return NULL; + } +}; + +#include + +#endif /* _FBXSDK_SCENE_CONSTRAINT_HIK_TO_FBXCHARACTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxaudio.h b/libs/fbx/include/fbxsdk/scene/fbxaudio.h new file mode 100644 index 00000000..8dfeea49 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxaudio.h @@ -0,0 +1,103 @@ +/**************************************************************************************** + + 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 fbxvideo.h +#ifndef _FBXSDK_SCENE_AUDIO_H_ +#define _FBXSDK_SCENE_AUDIO_H_ + +#include + +#include + +#include + +/** FBX SDK audio class. + * \nosubgrouping + */ +class FBXSDK_DLL FbxAudio : public FbxMediaClip +{ + FBXSDK_OBJECT_DECLARE(FbxAudio, FbxMediaClip); + +public: + /** + * \name Audio object creation. + * + */ + //@{ + /** Create a FbxAnimCurve. + * \param pContainer Scene to which the created audio clip belongs. + * \param pName Name of the audio clip. + * \return Newly created audio clip + */ + static FbxAudio* Create(FbxScene* pContainer, const char* pName); + //@} + /** + *\name Reset audio + */ + //@{ + //! Reset the audio to default values. + void Reset(); + //@} + + /** + * \name Audio attributes Management + */ + //@{ + + //! Audio file bit rate value (bit/s). + FbxPropertyT BitRate; + + //! Audio file sample rate value (Hz). + FbxPropertyT SampleRate; + + //! Audio file number of channels. + FbxPropertyT Channels; + + //! Audio file length. + FbxPropertyT Duration; + + /** Compound property to be used if animation data needs to be connected. + * In this case, specific properties should be added to this one with the Animatable flag set. + * \remarks By default, the Volume property is always created first and, unless explicitily + * removed by a "client", will always exist. + */ + FbxProperty AnimFX; + //@} + + /** + *\name Utility section + */ + //@{ + /** Access the Volume child property of the AnimFX. + * \return The volume property if it exists or an invalid property. + */ + FbxProperty Volume(); + //@} +/***************************************************************************************************************************** +** 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 InitializeAnimFX(); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + +public: + virtual FbxObject& Copy(const FbxObject& pObject); + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_AUDIO_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxaudiolayer.h b/libs/fbx/include/fbxsdk/scene/fbxaudiolayer.h new file mode 100644 index 00000000..f4fdbc88 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxaudiolayer.h @@ -0,0 +1,95 @@ +/**************************************************************************************** + + 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 fbxanimlayer.h +#ifndef _FBXSDK_SCENE_AUDIO_LAYER_H_ +#define _FBXSDK_SCENE_AUDIO_LAYER_H_ + +#include + +#include + +#include + +class FbxAudio; + +/** The audio layer is a collection of audio clips. Its purpose is to store + * a variable number of FbxAudio objects representing audio clips. The class provides + * a Mute, Solo and Lock states flags (bool properties), as well as a Clolor (double3 property). + * There is no evaluation system for audio layers inside the FBX SDK and an audio layer can be + * empty. + * \nosubgrouping + */ +class FBXSDK_DLL FbxAudioLayer : public FbxCollection +{ + FBXSDK_OBJECT_DECLARE(FbxAudioLayer, FbxCollection); + +public: + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + + /** This property stores the mute state. + * The mute state indicates that this layer should be excluded from the evaluation. + * + * Default value is \c false + */ + FbxPropertyT Mute; + + /** This property stores the solo state. + * The solo state indicates that this layer is the only one that should be + * processed during the evaluation. + * + * Default value is \c false + */ + FbxPropertyT Solo; + + /** This property stores the volume increment value. + * This property can be animated. + * Default value is \c 0.0 + */ + FbxPropertyT Volume; + + /** This property stores the lock state. + * The lock state indicates that this layer has been "locked" from editing operations + * and should no longer receive keyframes. + * + * Default value is \c false + */ + FbxPropertyT Lock; + + /** This property stores the display color. + * This color can be used by applications if they display a graphical representation + * of the layer. The FBX SDK does not use it but guarantees that the value is saved to the FBX + * file and retrieved from it. + * + * Default value is \c (0.8, 0.8, 0.8) + */ + FbxPropertyT Color; + + //! Reset this object properties to their default value. + void Reset(); + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_AUDIO_LAYER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxaxissystem.h b/libs/fbx/include/fbxsdk/scene/fbxaxissystem.h new file mode 100644 index 00000000..59a1d10b --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxaxissystem.h @@ -0,0 +1,305 @@ +/**************************************************************************************** + + 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 fbxaxissystem.h +#ifndef _FBXSDK_SCENE_AXIS_SYSTEM_H_ +#define _FBXSDK_SCENE_AXIS_SYSTEM_H_ + +#include + +#include +#include + +#include + +/** This class represents the coordinate system of the scene and can convert scenes + to other coordinate systems. By default the FbxScene uses a Y-Up axis + system. If the calling application wishes to change the default axis it will need to define the new + axis system and call the convert method with the scene as argument. The appropriate transforms will be + applied to the first level objects of the scene only (objects whose parent is the scene itself). Child + objects do not need to be transformed since they inherit from their parents. + The adjustment will affect the translation animation curves and the objects pivots values (the rotation + transformation is applied as a pre-rotation transform therefore the rotation animation curves do not need to + be transformed). Once converted, the scene will have its axis definition changed to the new system. + + For example: + \code + FbxScene* lScene = FbxScene::Create(sdkmanager, "MyScene"); + ... + // the scene is filled with objects + + int dir; + lScene->GetGlobalSettings().GetAxisSystem().GetUpVector(dir); // this returns the equivalent of FbxAxisSystem::eYAxis + + FbxAxisSystem max; // we desire to convert the scene from Y-Up to Z-Up + max.ConvertScene(lScene); + + lScene->GetGlobalSettings().GetAxisSystem().GetUpVector(dir); // this will now return the equivalent of FbxAxisSystem::eZAxis + \endcode + + No conversion will take place if the scene current axis system is equal to the new one. + + The EUpVector specifies which axis has the up and down direction in the system (typically this is the Y or Z axis). + The sign of the EUpVector is applied to represent the direction (1 is up and -1 is down relative to the observer). + + The EFrontVector specifies which axis has the front and back direction in the system. It is not an independent variable, + which means it depends on EUpVector. The enum values ParityEven and ParityOdd denote the first one and + the second one of the remain two axes in addition to the up axis. + + For example if the up axis is X, the remain two axes will be Y And Z, so the ParityEven is Y, and the ParityOdd is Z + ; If the up axis is Y, the remain two axes will X And Z, so the ParityEven is X, and the ParityOdd is Z; + If the up axis is Z, the remain two axes will X And Y, so the ParityEven is X, and the ParityOdd is Y. + + There still needs a parameter to denote the direction of the EFrontVector just as the EUpVector. And the sign of the + EFrontVector represents the direction (1 is front and -1 is back relative to observer). + + If the front axis and the up axis are determined, the third axis will be automatically determined as the left one. + The ECoordSystem enum is a parameter to determine the direction of the third axis just as the EUpVector sign. + It determines if the axis system is right-handed or left-handed just as the enum values. + + Some code for reconstructing a FbxAxisSystem object from reference scene. + \code + //the reference scene + FbxScene* lSceneReference = FbxScene::Create(sdkmanager, "ReferenceScene"); + ... + // the scene is filled with objects + + FbxAxisSystem lAxisSytemReference = lSceneReference->GetGlobalSettings().GetAxisSystem(); + + int lUpVectorSign = 1; + int lFrontVectorSign = 1; + + //get upVector and its sign. + EUpVector lUpVector = lAxisSsytemReference.getUpVector( lUpVectorSign ); + + //get FrontVector and its sign. + EFrontVector lFrontVector = lAxisSsytemReference.getFrontVector( lFrontVectorSign ); + + //get uCoorSystem. + ECoordSystem lCoorSystem = lAxisSsytemReference.GetCoorSystem(); + + //The FbxAxisSystem object to reconstruct back by saved parameter + FbxAxisSystem lAxisSytemReconstruct( lUpVectorSign * lUpVector, + lFrontVectorSign * lFrontVector, + lCoorSystem); + \endcode + + * \nosubgrouping + */ +class FBXSDK_DLL FbxAxisSystem +{ +public: + + /** \enum EUpVector Specifies which canonical axis represents up in the system (typically Y or Z). + */ + enum EUpVector + { + eXAxis = 1, + eYAxis = 2, + eZAxis = 3 + }; + + /** \enum EFrontVector Vector with origin at the screen pointing toward the camera. + * This is a subset of enum EUpVector because axis cannot be repeated. + * We use the system of "parity" to define this vector because its value (X,Y or Z axis) + * really depends on the up-vector. The EPreDefinedAxisSystem list the up-vector, parity and + * coordinate system values for the predefined systems. + * \see Detailed description of FbxAxisSystem. + */ + enum EFrontVector + { + eParityEven = 1, + eParityOdd = 2 + }; + + /** \enum ECoordSystem Specifies the third vector of the system. + * The FbxAxisSystem deduces the correct vector and direction based on this flag + * and the relationship with the up and front vectors. The EPreDefinedAxisSystem list the up-vector, parity and + * coordinate system values for the predefined systems. + */ + enum ECoordSystem + { + eRightHanded, + eLeftHanded + }; + + /** \enum EPreDefinedAxisSystem Enumeration that can be used to initialize a new instance of this class with + * predefined configurations (see the "Predefined axis systems" section). + */ + enum EPreDefinedAxisSystem + { + eMayaZUp, /*!< UpVector = ZAxis, FrontVector = -ParityOdd, CoordSystem = RightHanded */ + eMayaYUp, /*!< UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = RightHanded */ + eMax, /*!< UpVector = ZAxis, FrontVector = -ParityOdd, CoordSystem = RightHanded */ + eMotionBuilder, /*!< UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = RightHanded */ + eOpenGL, /*!< UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = RightHanded */ + eDirectX, /*!< UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = LeftHanded */ + eLightwave /*!< UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = LeftHanded */ + }; + + /** + * \name Constructor and Destructor + */ + //@{ + FbxAxisSystem(); + + /** Constructor! + * \param pUpVector Specify the up vector. + * \param pFrontVector Specify the front vector. + * \param pCoorSystem Specify RightHanded coordinate system or LeftHanded coordinate system. + */ + FbxAxisSystem(EUpVector pUpVector, EFrontVector pFrontVector, ECoordSystem pCoorSystem); + + /** Copy constructor! + * \param pAxisSystem Another FbxAxisSystem object copied to this one. + */ + FbxAxisSystem(const FbxAxisSystem& pAxisSystem); + + /** Constructor! + * \param pAxisSystem Specify which predefined axis system to copy. + */ + FbxAxisSystem(const EPreDefinedAxisSystem pAxisSystem); + + //! Destructor. + virtual ~FbxAxisSystem(); + //@} + + /** + * \name Boolean operation. + */ + //@{ + + /** Equivalence operator. + * \param pAxisSystem The axis system to compare against this one. + * \return \c true if these two axis systems are equal, \c false otherwise. + */ + bool operator==(const FbxAxisSystem& pAxisSystem)const; + + /** Non-equivalence operator. + * \param pAxisSystem The axis system to compare against this one. + * \return \c true if these two axis systems are unequal, \c false otherwise. + */ + bool operator!=(const FbxAxisSystem& pAxisSystem)const; + //@} + + /** Assignment operation. + * \param pAxisSystem Axis system assigned to this one. + */ + FbxAxisSystem& operator=(const FbxAxisSystem& pAxisSystem); + + /** + * \name Predefined axis systems. + * These static members define the axis system of the most popular applications. + */ + //@{ + + //! Predefined axis system: MayaZUp (UpVector = +Z, FrontVector = -Y, CoordSystem = +X (RightHanded)) + static const FbxAxisSystem MayaZUp; + + //! Predefined axis system: MayaYUp (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded)) + static const FbxAxisSystem MayaYUp; + + //! Predefined axis system: Max (UpVector = +Z, FrontVector = -Y, CoordSystem = +X (RightHanded)) + static const FbxAxisSystem Max; + + //! Predefined axis system: Motionbuilder (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded)) + static const FbxAxisSystem Motionbuilder; + + //! Predefined axis system: OpenGL (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded)) + static const FbxAxisSystem OpenGL; + + //! Predefined axis system: DirectX (UpVector = +Y, FrontVector = +Z, CoordSystem = -X (LeftHanded)) + static const FbxAxisSystem DirectX; + + //! Predefined axis system: Lightwave (UpVector = +Y, FrontVector = +Z, CoordSystem = -X (LeftHanded)) + static const FbxAxisSystem Lightwave; + //@} + + /** Convert a scene to this axis system. Sets the axis system of the scene to this system unit. + * \param pScene The scene to convert + */ + void ConvertScene(FbxScene* pScene) const; + + /** Convert a scene to this axis system by using the specified + * node as an Fbx_Root. This is provided for backwards compatibility + * only and ConvertScene(FbxScene* pScene) should be used instead when possible. + * \param pScene The scene to convert + * \param pFbxRoot The Fbx_Root node that will be transformed. + */ + void ConvertScene(FbxScene* pScene, FbxNode* pFbxRoot) const; + + /** Get the EFrontVector and its sign of this axis system. + * \param pSign The sign of the axis, 1 for front, -1 for back (relative to observer). + * \return The EFrontVector of this axis system. + */ + EFrontVector GetFrontVector( int & pSign ) const; + + /** Get the EUpVector and its sign of this axis system. + * \param pSign The sign of the axis, 1 for up, -1 for down (relative to observer). + * \return The EUpVector of this axis system. + */ + EUpVector GetUpVector( int & pSign ) const; + + /** Accessor to the ECoordSystem of this object. + * \return The current coordinate axis system of this object. + */ + ECoordSystem GetCoorSystem() const; + + /** Represents the axis system as a 4x4 matrix + * \return The equivalent matrix of this axis system + */ + void GetMatrix(FbxAMatrix& pMatrix); + + /** Converts the children of the given node to this axis system. + * Unlike the ConvertScene() method, this method does not set the axis system + * of the scene that the pRoot node belongs, nor does it adjust FbxPose + * as they are not stored under the scene, and not under a particular node. + * \param pRoot The node whose children are converted. + * \param pSrcSystem The source axis system. + */ + void ConvertChildren(FbxNode* pRoot, const FbxAxisSystem& pSrcSystem) 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 +protected: + class AxisDef + { + public: + enum EAxis {eXAxis, eYAxis, eZAxis}; + bool operator==(const AxisDef& pAxis) const { return (mAxis == pAxis.mAxis) && (mSign == pAxis.mSign); } + EAxis mAxis; + int mSign; + }; + + AxisDef mUpVector; + AxisDef mFrontVector; + AxisDef mCoorSystem; + + void ConvertTProperty(FbxArray& pNodes, const FbxAxisSystem& pFrom) const; + void ConvertCurveNodes(FbxArray& pCurveNodes, const FbxAxisSystem& pFrom) const; + void AdjustPreRotation(FbxNode* pNode, const FbxMatrix& pConversionRM) const; + void AdjustPivots(FbxNode* pNode, const FbxMatrix& pConversionRM) const; + void GetConversionMatrix(const FbxAxisSystem& pFrom, FbxMatrix& pConversionRM) const; + void AdjustLimits(FbxNode* pNode, const FbxMatrix& pConversionRM) const; + void AdjustPoses(FbxScene* pScene, const FbxMatrix& pConversionRM) const; + void AdjustCamera(FbxNode* pNode, const FbxMatrix& pConversionRM ) const; + void AdjustCluster(FbxNode* pNode, const FbxMatrix& pConversionRM) const; + void ConvertChildren(FbxNode* pRoot, const FbxAxisSystem& pSrcSystem, bool pSubChildrenOnly) const; + + friend class FbxGlobalSettings; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_AXIS_SYSTEM_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxcollection.h b/libs/fbx/include/fbxsdk/scene/fbxcollection.h new file mode 100644 index 00000000..9bdce271 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxcollection.h @@ -0,0 +1,124 @@ +/**************************************************************************************** + + 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 fbxcollection.h +#ifndef _FBXSDK_SCENE_COLLECTION_H_ +#define _FBXSDK_SCENE_COLLECTION_H_ + +#include + +#include + +#include + +class FbxCriteria; + +/** A FbxObject derived container for FbxObject. + * \nosubgrouping + * + */ +class FBXSDK_DLL FbxCollection : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxCollection, FbxObject); + +public: + /** + * \name Collection member management + */ + //@{ + //! Deletes all objects in the container. + virtual void Clear(); + + /** Adds a member. + * \param pMember Object to be added. + */ + virtual bool AddMember(FbxObject* pMember) { return ConnectSrcObject(pMember); } + + /** Removes a member. + * \param pMember Object to be removed. + */ + virtual bool RemoveMember(FbxObject* pMember) { return DisconnectSrcObject(pMember); } + + /** Returns the number of objects contained within the collection. + * \return The number of objects the collection contains. + */ + inline int GetMemberCount () const { return GetSrcObjectCount(); } + + /** Returns the member of the collection at the given index. + * \param pIndex The given index. + * \return The member of the collection at the given index. + */ + inline FbxObject* GetMember(int pIndex=0) const { return GetSrcObject(pIndex); } + + /** Judges whether an object is a part of the collection. + * \param pMember The member to be judged. + * \return \c True if it is a member of the collection, returns \c false if it is not a member. + */ + virtual bool IsMember(const FbxObject* pMember) const; + //@} + + /** + * \name Templated member management + */ + //@{ + /** Returns the number of class T objects contained within the collection. + * \return The number of objects of class T the collection contains. */ + template inline int GetMemberCount() const { return GetSrcObjectCount(); } + + /** Returns the member of class T at the given index in the collection. + * \param pIndex The given index. + * \return The member of class T at the given index. */ + template inline T* GetMember(int pIndex=0) const { return GetSrcObject(pIndex); } + + /** Searches for a member of class T. + * \param pName Member name. */ + template inline T* FindMember(const char* pName) const { return FindSrcObject(pName); } + //@} + + /** + * \name Criteria based member management + */ + //@{ + /** Returns the number of objects contained within the collection that meet the specified criteria. + * \param pCriteria Defines a set of criteria that each object must meet in order to be included in the results. + * \return The number of objects the collection contains that meet the specified criteria. + */ + inline int GetMemberCount(const FbxCriteria& pCriteria) const { return GetSrcObjectCount(pCriteria); } + + /** Returns the member at the given index in the collection if it meets the specified criteria. + * \param pCriteria Defines a set of criteria that the returned object must meet. + * \param pIndex The given index. + * \return The member at the given index if it meets the criteria; NULL otherwise. + */ + inline FbxObject* GetMember(const FbxCriteria& pCriteria, int pIndex=0) const { return GetSrcObject(pCriteria, pIndex); } + + /** Searches for a member with the given name that also meets the given criteria. + * \param pCriteria Defines a set of criteria that the returned object must meet. + * \param pName Member name. + * \return The member with the given name if it meets the criteria; NULL if no match could be found. + */ + inline FbxObject* FindMember(const FbxCriteria& pCriteria, const char* pName) const { return FindSrcObject(pCriteria, pName); } + //@} + + /** + * \name Selection management + */ + //@{ + /** Selects/Deselects all the contained objects. + * \param pSelection If \c true, all objects are selected, if \c false, all objects are deselected. + */ + virtual void SetSelectedAll(bool pSelection); + //@} +}; + +#include + +#endif /* _FBXSDK_SCENE_COLLECTION_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxcollectionexclusive.h b/libs/fbx/include/fbxsdk/scene/fbxcollectionexclusive.h new file mode 100644 index 00000000..4a4a7acd --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxcollectionexclusive.h @@ -0,0 +1,38 @@ +/**************************************************************************************** + + 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 fbxcollectionexclusive.h +#ifndef _FBXSDK_SCENE_COLLECTION_EXCLUSIVE_H_ +#define _FBXSDK_SCENE_COLLECTION_EXCLUSIVE_H_ + +#include + +#include + +#include + +/** Class for exclusive collections. An object (FbxObject) should belong to only one exclusive collection at most. + * \nosubgrouping + */ +class FBXSDK_DLL FbxCollectionExclusive : public FbxCollection +{ + FBXSDK_OBJECT_DECLARE(FbxCollectionExclusive, FbxCollection); + +public: + /** Add a member if it's not a member of any other FbxCollectionExclusive objects. + * \param pMember Object to be added + */ + bool AddMember(FbxObject* pMember); +}; + +#include + +#endif /* _FBXSDK_SCENE_COLLECTION_EXCLUSIVE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxcontainer.h b/libs/fbx/include/fbxsdk/scene/fbxcontainer.h new file mode 100644 index 00000000..ace13ff6 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxcontainer.h @@ -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 fbxcontainer.h +#ifndef _FBXSDK_SCENE_CONTAINER_H_ +#define _FBXSDK_SCENE_CONTAINER_H_ + +#include + +#include +#include + +#include + +/** Generic container for object grouping and encapsulation. + * \nosubgrouping + */ +class FBXSDK_DLL FbxContainer : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxContainer, FbxObject); + +public: + /** + * \name Container dynamic attributes + */ + //@{ + /** Create a new property. + * \param pName Name of the property + * \param pType Type of the property + * \param pLabel Label of the property + * \return the newly created property + */ + FbxProperty CreateProperty(FbxString pName, FbxDataType & pType, FbxString pLabel); + //@} + + /** + * \name Public and fast access Properties + */ + //@{ + /** This property contains the template name information of the container + * + * To access this property do: TemplateName.Get(). + * To set this property do: TemplateName.Set(FbxString). + * + * Default value is "". + */ + FbxPropertyT TemplateName; + + /** This property contains the template path information of the container + * + * To access this property do: TemplatePath.Get(). + * To set this property do: TemplatePath.Set(FbxString). + * + * Default value is "". + */ + FbxPropertyT TemplatePath; + + /** This property contains the template version information of the container + * + * To access this property do: TemplateVersion.Get(). + * To set this property do: TemplateVersion.Set(FbxString). + * + * Default value is "". + */ + FbxPropertyT TemplateVersion; + + /** This property contains the view name information of the container + * + * To access this property do: ViewName.Get(). + * To set this property do: ViewName.Set(FbxString). + * + * Default value is "". + */ + FbxPropertyT ViewName; + //@} + +/***************************************************************************************************************************** +** 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 + FbxContainerTemplate* mContainerTemplate; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_CONTAINER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxcontainertemplate.h b/libs/fbx/include/fbxsdk/scene/fbxcontainertemplate.h new file mode 100644 index 00000000..f5d811be --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxcontainertemplate.h @@ -0,0 +1,117 @@ +/**************************************************************************************** + + 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 fbxcontainertemplate.h +#ifndef _FBXSDK_SCENE_CONTAINER_TEMPLATE_H_ +#define _FBXSDK_SCENE_CONTAINER_TEMPLATE_H_ + +#include + +#include + +#include + +//Container Template tokens +#define FBXSDK_CONTAINER_TEMPLATE_STR "templates" +#define FBXSDK_TEMPLATE_STR "template" +#define FBXSDK_EXTENDS_TEMPLATE_STR "extends" + +struct FbxContainerTemplate_internal; + +/** Class for Container Template files. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxContainerTemplate : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxContainerTemplate, FbxObject); + +public: + /** Parse template file to get extend templates. + * \param pTemplateFilePath The template file to be parsed. + * \param pExtendTemplateNames Fill extend templates' names to this array. + * \remark Call this function to get extend templates' names. + */ + void ParseTemplateFile(const char* pTemplateFilePath, FbxArray& pExtendTemplateNames); + + /** Add extend template path. + * \param pExtendTemplatePath The template file path to be added. + */ + void AddExtendTemplatePath(const char* pExtendTemplatePath); + + /** Get the (pIndex)th extend template path. + * \param pIndex Index of the queried item. + * \return The (pIndex)th extend template path. + */ + char* GetExtendTemplatePathAt(FbxUInt pIndex) const; + + /** Get the count of extend template path. + * \return The count of extend template path. + */ + FbxUInt GetExtendTemplateCount() const; + + /** Clear the extend template path. + */ + void ClearExtendTemplatePath(); + + /** This property contains the template name. + * + * To access this property do: TemplateName.Get(). + * To set this property do: TemplateName.Set(FbxString). + * + * Default value is "". + */ + FbxPropertyT ContainerTemplateName; + + /** This property contains the template path. + * + * To access this property do: TemplatePath.Get(). + * To set this property do: TemplatePath.Set(FbxString). + * + * Default value is "". + */ + FbxPropertyT ContainerTemplatePath; + + /** This property contains the template package name. + * + * To access this property do: TemplatePackageName.Get(). + * To set this property do: TemplatePackageName.Set(FbxString). + * + * Default value is "". + */ + FbxPropertyT ContainerTemplatePackageName; + + /** This property contains the template version information of the container + * + * To access this property do: TemplateVersion.Get(). + * To set this property do: TemplateVersion.Set(FbxString). + * + * Default value is "". + */ + FbxPropertyT ContainerTemplateVersion; + +/***************************************************************************************************************************** +** 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 void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); + +private: + FbxContainerTemplate_internal* mData; + FbxArray mExtendTemplatePaths; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_CONTAINER_TEMPLATE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxdisplaylayer.h b/libs/fbx/include/fbxsdk/scene/fbxdisplaylayer.h new file mode 100644 index 00000000..6e043522 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxdisplaylayer.h @@ -0,0 +1,77 @@ +/**************************************************************************************** + + 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 fbxdisplaylayer.h +#ifndef _FBXSDK_SCENE_DISPLAY_LAYER_H_ +#define _FBXSDK_SCENE_DISPLAY_LAYER_H_ + +#include + +#include + +#include + +/** Class for display layers. +* \nosubgrouping +* Display layers are overlapping views of your scene that contain a list of members. +* The members are exclusive. Members cannot be part of multiple display layers. +* Display layers enables user to organize elements of scene and affect visibility and manipulation attributes of multiple objects at once. +*/ +class FBXSDK_DLL FbxDisplayLayer : public FbxCollectionExclusive +{ + FBXSDK_OBJECT_DECLARE(FbxDisplayLayer, FbxCollectionExclusive); + +public: + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + /** This property stores the color of this display layer. + * + * Default value is FbxDouble3(0.8,0.8,0.8). + */ + FbxPropertyT Color; + /** This property stores the visibility of this display layer. + * + * Default value is true. + */ + FbxPropertyT Show; + /** This property stores the manipulation state of this display layer. + * + * Default value is false. + */ + FbxPropertyT Freeze; + /** This property stores the level of detail mode of this display layer. + * + * Default value is false. + */ + FbxPropertyT LODBox; + + ////////////////////////////////////////////////////////////////////////// + // Static values + ////////////////////////////////////////////////////////////////////////// + + // Default property values + static const FbxDouble3 sColorDefault; + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_DISPLAY_LAYER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxdocument.h b/libs/fbx/include/fbxsdk/scene/fbxdocument.h new file mode 100644 index 00000000..15400552 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxdocument.h @@ -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 fbxdocument.h +#ifndef _FBXSDK_SCENE_DOCUMENT_H_ +#define _FBXSDK_SCENE_DOCUMENT_H_ + +#include + +#include + +#include + +class FbxStatus; +class FbxTakeInfo; +class FbxPeripheral; +class FbxDocumentInfo; + +/** FbxDocument is a base class for FbxScene and FbxLibrary classes. + * A document is a collection (FbxCollection) of objects (FbxObject), called the root member objects. + * This is because these objects each form the root of an object graph. The manager (FbxManager) has access to all + * documents, scenes and libraries. + * + * A document can be contained in another document, thus, a hierarchy of documents + * can be built. The root of all documents is simply called the root document. + * + * A document manages animation stacks (FbxAnimStack). It also provides access to animation stack information (FbxTakeInfo). + * + * A document carries information in its FbxDocumentInfo. + * + * Documents manage peripherals to load and unload objects (see class FbxPeripheral), + * as well as references to other objects or documents. + * + * Error management is also available. + * + * \nosubgrouping + */ +class FBXSDK_DLL FbxDocument : public FbxCollection +{ + FBXSDK_OBJECT_DECLARE(FbxDocument, FbxCollection); + +public: + /** + * \name Properties + */ + //@{ + FbxPropertyT Roots; + //@} + + /** + * \name Document Member Manager + */ + //@{ + //! Remove document members and restore default settings. + virtual void Clear(); + + /** Add a member object and connect it to Roots. + * \param pMember Object to add to the document. + */ + inline void AddRootMember(FbxObject* pMember){ AddMember(pMember); Roots.ConnectSrcObject(pMember); } + + /** Remove a member object from the document. + * \param pMember Object to remove from the document. + */ + inline void RootRootRemoveMember(FbxObject* pMember){ RemoveMember(pMember); Roots.DisconnectSrcObject(pMember); } + + /** Find a member object in the document, that has the given type and name. + * \param pName Member name. */ + template inline T* FindRootMember(char* pName){ return Roots.FindSrcObject(pName); } + + //! Return the number of objects in the document. + inline int GetRootMemberCount () const { return Roots.GetSrcObjectCount(); } + + /** Return the number of objects of class T in the document. + * \return The number of objects of class T in the document. */ + template inline int GetRootMemberCount() const { return Roots.GetSrcObjectCount(); } + + /** Return the number of objects of the document that satisfy the given criteria. + * \param pCriteria Criteria for selecting objects. + * \return The number of objects satisfying the given criteria. + */ + int GetRootMemberCount(FbxCriteria pCriteria) const; + + /** Return the member of the document at given index. + * \param pIndex Selection index. + */ + inline FbxObject* GetRootMember(int pIndex=0) const { return Roots.GetSrcObject(pIndex); } + + /** Return the member of class T of the document at given index. + * \param pIndex Selection index. */ + template inline T* GetRootMember(int pIndex=0) const { return Roots.GetSrcObject(pIndex); } + + /** Return the document member which satisfies given criteria, for given index. + * \param pCriteria Criteria for selecting objects. + * \param pIndex Selection index. + */ + FbxObject* GetRootMember(FbxCriteria pCriteria, int pIndex=0) const; + + /** Is an object part of the document. + * \param pMember Queried object. + * \return \c true if pMember is an object part of the document, \c false otherwise. + */ + virtual bool IsRootMember(FbxObject* pMember) const; + //@} + + + /** + * \name Document information + */ + //@{ + /** Get the document information. + * \return Pointer to the document information object. + */ + FbxDocumentInfo* GetDocumentInfo() const; + + /** Set the document information. + * \param pSceneInfo Pointer to the document information object. + */ + void SetDocumentInfo(FbxDocumentInfo* pSceneInfo); + //@} + + /** + * \name Offloading management + * + * Documents manage peripherals to load and unload objects (see + * class FbxPeripheral). A peripheral manipulates the content + * of an object. For instance, a peripheral can load the connections + * of an object on demand. + * + * The document does not own the peripheral therefore + * it will not attempt to delete it at destruction time. Cloning + * the document will share the pointer to the peripheral across + * the cloned objects. The assignment operator has a similar behavior. + */ + //@{ + /** Set the current peripheral to be used to load or unload objects from this document. + * \param pPeripheral The peripheral to be set. + */ + void SetPeripheral(FbxPeripheral* pPeripheral); + + /** Retrieve the current peripheral of the document. + * \return Current peripheral. + */ + virtual FbxPeripheral* GetPeripheral(); + + /** Unload all the unloadable objects contained in the document using the currently set peripheral. + * \param pStatus The FbxStatus object to hold error codes. + * \return The number of objects that the document has been able to unload. + */ + int UnloadContent(FbxStatus* pStatus = NULL); + + /** Load all the objects contained in the document with the data from the currently set peripheral. + * \param pStatus The FbxStatus object to hold error codes. + * \return The number of loaded objects. + */ + int LoadContent(FbxStatus* pStatus = NULL); + + //@} + + /** + * \name Referencing management + */ + //@{ + + /** + * Fills an array of pointers to documents that reference objects in this document. + * + * \param pReferencingDocuments Array of pointers to documents. + * \returns Number of documents that reference objects in this document. + */ + int GetReferencingDocuments(FbxArray& pReferencingDocuments) const; + + /** + * Fills an array of pointers to objects in a given document (pFromDoc) + * that reference objects in this document. + * + * \param pFromDoc Pointer to the document containing referencing objects. + * \param pReferencingObjects Array of pointers to referencing objects. + * \returns Number of objects that reference objects in this document. + */ + int GetReferencingObjects(const FbxDocument* pFromDoc, FbxArray& pReferencingObjects) const; + + /** + * Fills an array of pointers to documents that are referenced by objects in this document. + * + * \param pReferencedDocuments Array of pointers to documents. + * \returns Number of documents that are referenced by objects in this document. + */ + int GetReferencedDocuments(FbxArray& pReferencedDocuments) const; + + /** + * Fills an array of pointers to objects in a given document (pToDoc) + * that are referenced by objects in this document. + * + * \param pToDoc Pointer to the document containing referenced objects. + * \param pReferencedObjects Array of pointers to referenced objects. + * \returns Number of objects that are referenced by objects in this document. + */ + int GetReferencedObjects(const FbxDocument* pToDoc, FbxArray& pReferencedObjects) const; + + /** + * Gets the path string to the root document, if the current document is contained in another document. + \returns Path to the root document. + */ + FbxString GetPathToRootDocument(void) const; + /** + * Gets the document path to the root document as an array of documents, if the current document is contained in another document. + * \param pDocumentPath Array of FbxDocument to store the document path. + * \param pFirstCall Recursive flag: always use pFirstCall = \c true. + */ + void GetDocumentPathToRootDocument(FbxArray& pDocumentPath, bool pFirstCall = true) const; + + /** + * Tells if this document is a root document. + \return \c false if the current document is contained in another document, \c true otherwise. + */ + bool IsARootDocument(void) { return (NULL == GetDocument()); } + //@} + + /** + * \name Animation Stack Management + * \remarks Animation stacks replaces the deprecated takes. + */ + //@{ + /** Holds the name of the FbxAnimStack that the application uses for animation in this document. + */ + FbxPropertyT ActiveAnimStackName; + + /** Adds a new animation stack object to this document. + * In case of error, FbxDocument::GetLastErrorID() will return + * \c eTakeError. + * \param pName Animation stack name. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if a new FbxAnimStack has been successfully created, + * \c false if an error occurred or if the specified name defines + * a FbxAnimStack that already exists in the document. + */ + bool CreateAnimStack(const char* pName, FbxStatus* pStatus = NULL); + + /** Destroy the animation stack object identified by pName from this document. + * \param pName Name of the animation stack to be deleted. + * \return \c true if the FbxAnimStack has been destroyed and \c false otherwise. + */ + bool RemoveAnimStack(const char* pName); + + /** Fill a string array with all existing animation stack names. + * The array of string is cleared before it is used + * \param pNameArray An array of string objects. + */ + void FillAnimStackNameArray(FbxArray& pNameArray); + + //@} + + /** + * \name Animation Stack Information Management + * \remark Although takes are deprecated, class FbxTakeInfo is not deprecated and + * now contains animation stack information. + */ + //@{ + /** Set information about an animation stack. + * \param pTakeInfo Animation stack information. Field FbxTakeInfo::mName specifies + * the targeted animation stack. + * \return \c true if animation stack is found with this name, and if information is set. + */ + bool SetTakeInfo(const FbxTakeInfo& pTakeInfo); + + /** Get information about an animation stack. + * \param pTakeName Name of the targeted animation stack. + * \return Animation stack information, or \c NULL if animation stack isn't found or + * has no information set for this document. + */ + FbxTakeInfo* GetTakeInfo(const FbxString& pTakeName) 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual void Compact(); + void ConnectVideos(); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); + + virtual bool ConnectNotify(const FbxConnectEvent& pEvent); + virtual void SetDocument(FbxDocument* pDocument); + + bool FindTakeName(const FbxString& pTakeName); + + FbxArray mTakeInfoArray; + +private: + FbxPeripheral* mPeripheral; + FbxDocumentInfo* mDocumentInfo; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_DOCUMENT_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxdocumentinfo.h b/libs/fbx/include/fbxsdk/scene/fbxdocumentinfo.h new file mode 100644 index 00000000..af2e235d --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxdocumentinfo.h @@ -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 fbxdocumentinfo.h +#ifndef _FBXSDK_SCENE_DOCUMENT_INFO_H_ +#define _FBXSDK_SCENE_DOCUMENT_INFO_H_ + +#include + +#include + +#include + +class FbxThumbnail; + +/** This class contains scene thumbnails and user-defined summary data. + */ +class FBXSDK_DLL FbxDocumentInfo : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxDocumentInfo, FbxObject); + +public: + /** + * \name Public properties + */ + //@{ + /** This property contains the last saved URL. + * + * To retrieve the value of this property, use LastSavedUrl.Get(). + * To set the value of this property, use LastSavedUrl.Set(FbxString). + * + * The default value is empty. + */ + FbxPropertyT LastSavedUrl; + + /** This property contains the URL. + * + * To retrieve the value of this property, use Url.Get(). + * To set the value of this property, use Url.Set(FbxString). + * + * The default value is empty. + */ + FbxPropertyT Url; + + /** Parent property for all properties related to creation. These properties + * should be set once when the file is created, and you should not change them + * during subsequent save or reload operations. + * The default properties are listed below, but application vendors can add new + * properties under this parent property. + */ + FbxProperty Original; + + /** This property contains the name of the original application vendor. + * + * To retrieve the value of this property, use Original_ApplicationVendor.Get(). + * To set the value of this property, use Original_ApplicationVendor.Set(FbxString). + * + * The default value is empty. + */ + FbxPropertyT Original_ApplicationVendor; + + /** This property contains the original application name. + * + * To retrieve the value of this property, use Original_ApplicationName.Get(). + * To set the value of this property, use Original_ApplicationName.Set(FbxString). + * + * The default value is empty. + */ + FbxPropertyT Original_ApplicationName; + + /** This property contains the version of the original application. + * + * To retrieve the value of this property, use Original_ApplicationVersion.Get(). + * To set the value of this property, use Original_ApplicationVersion.Set(FbxString). + * + * The default value is empty. + */ + FbxPropertyT Original_ApplicationVersion; + + /** This property contains the original file name. + * + * To retrieve the value of this property, use Original_FileName.Get(). + * To set the value of this property, use Original_FileName.Set(FbxString). + * + * The default value is empty. + */ + FbxPropertyT Original_FileName; + + /** This property contains the original date and time. + * + * To retrieve the value of this property, use Original_DateTime_GMT.Get(). + * To set the value of this property, use Original_DateTime_GMT.Set(FbxString). + * + * The default value is 0. + * \remarks The date/time should use GMT time format. + */ + FbxPropertyT Original_DateTime_GMT; + + /** The parent property for all last saved-related properties. + * These properties update every time a file is saved. + * The default properties are below, but application vendors can add new + * properties under this parent property. + * The file creator must set both the original and last saved properties. + */ + FbxProperty LastSaved; + + /** This property contains the last saved application vendor. + * + * To retrieve the value of this property, use LastSaved_ApplicationVendor.Get(). + * To set the value of this property, use LastSaved_ApplicationVendor.Set(FbxString). + * + * The default value is empty. + */ + FbxPropertyT LastSaved_ApplicationVendor; + + /** This property contains the last saved application name. + * + * To retrieve the value of this property, use LastSaved_ApplicationName.Get(). + * To set the value of this property, use LastSaved_ApplicationName.Set(FbxString). + * + * The default value is empty. + */ + FbxPropertyT LastSaved_ApplicationName; + + /** This property contains the last saved application version. + * + * To retrieve the value of this property, use LastSaved_ApplicationVersion.Get(). + * To set the value of this property, use LastSaved_ApplicationVersion.Set(FbxString). + * + * The default value is empty. + */ + FbxPropertyT LastSaved_ApplicationVersion; + + /** This property contains the last saved date and time. + * + * To retrieve the value of this property, use LastSaved_DateTime_GMT.Get(). + * To set the value of this property, use LastSaved_DateTime_GMT.Set(FbxString). + * + * The default value is 0. + * + * \remarks The date/time should use GMT time format. + */ + FbxPropertyT LastSaved_DateTime_GMT; + + /** This property points at the ".fbm" folder that is created when + * reading a FBX file that has embedded data. The embedded data + * is not saved in the FBX file. + * + * The default value is empty. + */ + FbxPropertyT EmbeddedUrl; + //@} + + /** \name User-defined summary data. + * These are user-completed fields that identify or classify the files. + */ + //@{ + FbxString mTitle; //! Title. + FbxString mSubject; //! Subject. + FbxString mAuthor; //! Author + FbxString mKeywords; //! Keywords. + FbxString mRevision; //! Revision. + FbxString mComment; //! Comment. + //@} + + /** + * \name Scene Thumbnail. + */ + //@{ + /** Returns the thumbnail for the scene. + * \return Pointer to the thumbnail. + */ + FbxThumbnail* GetSceneThumbnail(); + + /** Sets the thumbnail for the scene. + * \param pSceneThumbnail Pointer to the thumbnail. + */ + void SetSceneThumbnail(FbxThumbnail* pSceneThumbnail); + //@} + + /** Clears the content. + * Resets all the strings to an empty string and clears + * the pointer to the thumbnail. + */ + 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void Destruct(bool pRecursive); + virtual void ConstructProperties(bool pForceSet); + + FbxPropertyT SceneThumbnail; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_DOCUMENT_INFO_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxenvironment.h b/libs/fbx/include/fbxsdk/scene/fbxenvironment.h new file mode 100644 index 00000000..08a3ac55 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxenvironment.h @@ -0,0 +1,42 @@ +/**************************************************************************************** + + 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 fbxenvironment.h +#ifndef _FBXSDK_SCENE_ENVIRONMENT_H_ +#define _FBXSDK_SCENE_ENVIRONMENT_H_ + +#include + +#include + +#include + +/** This class contains the description of a scene environment. It contains the properties of sun parameters, + * sky parameters, daylight controller parameters ,environment map parameters + * and cloud map parameters. + * \nosubgrouping + */ +class FBXSDK_DLL FbxEnvironment : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxEnvironment, FbxObject); + +public: +/***************************************************************************************************************************** +** 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 ProvidesLighting() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_ENVIRONMENT_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxgroupname.h b/libs/fbx/include/fbxsdk/scene/fbxgroupname.h new file mode 100644 index 00000000..27d16ee7 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxgroupname.h @@ -0,0 +1,74 @@ +/**************************************************************************************** + + 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 fbxgroupname.h +#ifndef _FBXSDK_SCENE_GROUP_NAME_H_ +#define _FBXSDK_SCENE_GROUP_NAME_H_ + +#include + +#include + +#define MODEL_PREFIX "Model::" +#define MATERIAL_PREFIX "Material::" +#define POSE_PREFIX "Pose::" +#define DEFORMER_PREFIX "Deformer::" +#define CONTAINER_PREFIX "Container::" +#define SUBDEFORMER_PREFIX "SubDeformer::" +#define CONSTRAINT_PREFIX "Constraint::" +#define CONTROLSET_PLUG_PREFIX "ControlSetPlug::" +#define AUDIO_PREFIX "Audio::" +#define AUDIO_LAYER_PREFIX "AudioLayer::" +#define VIDEO_PREFIX "Video::" +#define TEXTURE_PREFIX "Texture::" +#define THUMBNAIL_PREFIX "Thumbnail::" +#define MARKER_SET_PREFIX "MarkerSet::" +#define CONSTRAINT_PREFIX "Constraint::" +#define GEOMETRY_PREFIX "Geometry::" +#define GEOMETRY_WEIGHTED_MAP_PREFIX "GeometryWeightedMap::" +#define SCENE_PREFIX "Scene::" +#define CACHE_PREFIX "Cache::" +#define IMPLEMENTATION_PREFIX "Implementation::" +#define BINDINGTABLE_PREFIX "BindingTable::" +#define BINDINGOPERATOR_PREFIX "BindingOperator::" +#define LAYERED_TEXTURE_PREFIX "LayeredTexture::" +#define PROCEDURAL_TEXTURE_PREFIX "ProceduralTexture::" +#define DOCUMENT_PREFIX "Document::" +#define COLLECTION_PREFIX "Collection::" +#define COLLECTION_EXCLUSIVE_PREFIX "CollectionExclusive::" +#define NODE_ATTRIBUTE_PREFIX "NodeAttribute::" +#define ENVIRONMENT_PREFIX "KFbxEnvironment::" +#define OBJECTMETADATA_PREFIX "ObjectMetaData::" +#define EXPOSURECONTROL_PREFIX "ExposureControl::" + +#define ANIM_STACK_PREFIX "AnimStack::" +#define ANIM_LAYER_PREFIX "AnimLayer::" +#define ANIM_CURVENODE_PREFIX "AnimCurveNode::" +#define ANIM_CURVE_PREFIX "AnimCurve::" +#define ANIM_EVAL_PREFIX "AnimEvaluator::" + +#define SELECTION_SET_PREFIX "SelectionSet::" +#define SELECTION_SET_NODE_PREFIX "SelectionNode::" +#define DISPLAY_LAYER_PREFIX "DisplayLayer::" + +#define SCENEREFERENCE_PREFIX "SceneReference::" + +// Protein 2.0 +#define ADSK_ENVIRONMENT_PREFIX "ADSKEnvironmentDefinition::" +#define ADSK_LIGHT_PREFIX "ADSKLightDefinition::" +#define ADSK_PROCEDURALGEOMETRY_PREFIX "ADSKProceduralGeometryDefinition::" +#define ADSK_SURFACEMATERIAL_PREFIX "ADSKSurfaceMaterialDefinition::" +#define ADSK_TEXTURE_PREFIX "ADSKTextureDefinition::" +#define ADSK_SWATCHSCENE_PREFIX "ADSKSwatchSceneDefinition::" + +#include + +#endif /* _FBXSDK_SCENE_GROUP_NAME_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxlibrary.h b/libs/fbx/include/fbxsdk/scene/fbxlibrary.h new file mode 100644 index 00000000..3dcce1c8 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxlibrary.h @@ -0,0 +1,330 @@ +/**************************************************************************************** + + 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 fbxlibrary.h +#ifndef _FBXSDK_SCENE_LIBRARY_H_ +#define _FBXSDK_SCENE_LIBRARY_H_ + +#include + +#include +#include + +#include + +class FbxLocalizationManager; +class FbxCriteria; + +/** This library class represents libraries that store sub-libraries and shading objects. + * Shading objects are objects of class FbxTexture, FbxSurfaceMaterial, and FbxLight. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLibrary : public FbxDocument +{ + FBXSDK_OBJECT_DECLARE(FbxLibrary, FbxDocument); + +public: + //! Returns a pointer to the parent library if one exists. + FbxLibrary* GetParentLibrary(void) const; + + /** Sets whether not this library is a system library. + * \param pSystemLibrary A flag which indicates whether or not this library is a system library. + */ + void SystemLibrary(bool pSystemLibrary); + + //! Returns whether or not this library is a system library. + bool IsSystemLibrary() const; + + /** The prefix must not include the dash and language code, nor + * can it contain the extension. But if you want, it can contain + * a folder or sub-folder, such as: locales/mydocloc. + * This is resolved using the XRef Manager, with priority + * given to the library's ".fbm" folder, if one exists. + * \param pPrefix New prefix to be set. + */ + void LocalizationBaseNamePrefix(const char* pPrefix); + + //! Retrieves the localization prefix. + FbxString LocalizationBaseNamePrefix() const; + + // ======================================================================= + // + // sub-library + // + // ======================================================================= + + /** Adds a sub-library + * \param pSubLibrary The sub-library to be added. + * \return \c True if adding the sub-library is successful, returns \c false if not. + */ + bool AddSubLibrary(FbxLibrary* pSubLibrary); + + /** Removes a sub-library + * \param pSubLibrary The sub-library to be removed. + * \return \c True if the sub-library is removed, \c false if not. + */ + bool RemoveSubLibrary(FbxLibrary* pSubLibrary); + + //! Returns the total number of sub-libraries + int GetSubLibraryCount(void) const; + + /** Returns the sub-library at the specified index. + * \param pIndex The sub-library index. + */ + FbxLibrary* GetSubLibrary(int pIndex) const; + + /** Clones the specified asset. + * \param pToClone The asset to be cloned. + * \param pOptionalDestinationContainer The container for the asset copy. + * \remarks The asset and all its dependents are cloned. + */ + FbxObject* CloneAsset( FbxObject* pToClone, FbxObject* pOptionalDestinationContainer = NULL) const; + + + /** Returns a criteria filter which you can use to filter objects + * when iterating items in the library. Only real 'assets' are returned, + * rather than FBX support objects. This currently includes + * lights, environments, materials and textures (maps). + * This is typically used to IMPORT from a library. + */ + static FbxCriteria GetAssetCriteriaFilter(); + + /** Returns a filter which you should use when you clone / export objects. + * This filters out objects that should remain in the asset library. + * + * Use this to EXPORT from a library (or CLONE from a library). + */ + static FbxCriteria GetAssetDependentsFilter(); + + /** Transfers ownership from the source library to this library for any assets passing through the filter. + * It is assumed that name conflicts and other details have been resolved beforehand. + * + * External asset files required by the assets are copied (not moved). It's + * up to the owner of the source library to clean up the files if the files are + * not on a read-only transport. If this document hasn't been committed yet, + * the assets will not be copied. + * + * Returns true if no filtered assets were skipped. If no assets pass through + * the filter, it returns true, because nothing has been skipped. + * + * This may leave the source library in an invalid state. For example, the source library + * would be in an invalid state if you had decided to transfer texture objects to the library, + * but materials were kept in the source library. + * + * To safeguard against this, the transfer disconnects objects, and thus materials + * are left without textures. + * + * When you transfer an object, all its dependents come with it. If you move + * a material, it takes the associated textures as well. Although if you moved a texture, + * the material would not be transferred with it. + * \param pSrcLibrary The source library to be imported. + * \return \c True if no filtered assets are skipped. + **/ + bool ImportAssets(FbxLibrary* pSrcLibrary); + + /** Transfers ownership from the source library to this library for any assets passing through the filter. + * It is assumed that name conflicts and other details have been resolved beforehand. + * + * External asset files required by the assets are copied (not moved). It's + * up to the owner of the source library to clean up the files if the files are + * not on a read-only transport. If this document hasn't been committed yet, + * the assets will not be copied. + * + * Returns true if no filtered assets were skipped. If no assets pass through + * the filter, it returns true, because nothing has been skipped. + * + * This may leave the source library in an invalid state. For example, the source library + * would be in an invalid state if you had decided to transfer texture objects to the library, + * but materials were kept in the source library. + * + * To safeguard against this, the transfer disconnects objects, and thus materials + * are left without textures. + * + * When you transfer an object, all its dependents come with it. If you move + * a material, it takes the associated textures as well. Although if you moved a texture, + * the material would not be transferred with it. + * \param pSrcLibrary The source library to be imported. + * \param pAssetFilter The asset filter. + * \return \c True if no filtered assets are skipped. + **/ + bool ImportAssets(FbxLibrary* pSrcLibrary, const FbxCriteria& pAssetFilter); + + + /** Returns a new instance of a library member. + * This instantiates the first object found that matches the filter. + * \param pFBX_TYPE The type of member + * \param pFilter A user specified filter + * \param pRecurse A flag that indicates whether to check sub-libraries + * \param pOptContainer Optional container for the cloned asset + * \return A new instance of the member. Note that the new member is not included with this library. + */ + template < class T > T* InstantiateMember( const T* pFBX_TYPE, const FbxObjectFilter& pFilter, bool pRecurse = true, FbxObject* pOptContainer = NULL); + + + // ======================================================================= + // + // Localization + // + // ======================================================================= + /** Returns the localization manager for the library. + */ + + FbxLocalizationManager& GetLocalizationManager() const; + + /** Localization helper function. Calls the FBX SDK manager implementation. + * Sub-classes that manage their own localization can over-ride this function. + * \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. + */ + virtual const char* Localize( const char* pID, const char* pDefault = NULL ) const; + + // ======================================================================= + // + // Shading Object + // + // ======================================================================= + + /** Adds a shading object. + * \param pShadingObject The shading object to be added. + */ + bool AddShadingObject(FbxObject* pShadingObject); + + /** Removes a shading object. + * \param pShadingObject The shading object to be removed. + */ + bool RemoveShadingObject(FbxObject* pShadingObject); + + //! Returns the total number of shading objects + int GetShadingObjectCount(void) const; + + /** Returns the shading object at the specified index. + * \param pIndex Shading object index. + * \return The shading object located at the specified index. + */ + FbxObject* GetShadingObject(int pIndex) const; + + /** Returns the number of shading objects according to their implementations. + * \param pCriteria Filtering criteria that identifies what kind of + * implementations to consider. + * \returns The number of shading objects corresponding to the filtering parameters + */ + int GetShadingObjectCount(const FbxImplementationFilter& pCriteria) const; + + /** Returns a handle on the shading object at the specified index that corresponds to the given filtering parameters. + * \param pIndex Shading object index. + * \param pCriteria Filtering criteria that identifies what kind of + * implementations to consider. + * \returns A handle on the shading object at the specified index that corresponds to the given filtering parameters. + */ + FbxObject* GetShadingObject(int pIndex, const FbxImplementationFilter& pCriteria) 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 +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + + mutable FbxLocalizationManager* mLocalizationManager; +#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 T* FbxLibrary::InstantiateMember(const T* pFBX_TYPE, const FbxObjectFilter& pFilter, bool pRecurse, FbxObject* pOptContainer) +{ + //First check all materials in the library. + for( int i = 0; i < GetMemberCount(); ++i ) + { + T* lObject = GetMember(i); + if( pFilter.Match(lObject) ) + return FbxCast(CloneAsset(lObject,pOptContainer)); + } + + if( pRecurse ) + { + // then check all materials in each sub-library. + for( int i = 0; i < GetMemberCount(); ++i ) + { + FbxLibrary* lLibrary = GetMember(i); + T* lClonedObject = lLibrary->InstantiateMember(pFBX_TYPE, pFilter, pRecurse, pOptContainer); + if( lClonedObject ) + return lClonedObject; + } + } + + return NULL; +} + +class FBXSDK_DLL FbxEventPopulateSystemLibrary : public FbxEvent +{ + FBXSDK_EVENT_DECLARE(FbxEventPopulateSystemLibrary) + +public: + FbxEventPopulateSystemLibrary(FbxLibrary* pLibrary) { mLibrary = pLibrary; } + inline FbxLibrary* GetLibrary() const { return mLibrary; } + +private: + FbxLibrary* mLibrary; +}; + +class FBXSDK_DLL FbxEventUpdateSystemLibrary : public FbxEvent +{ + FBXSDK_EVENT_DECLARE(FbxEventUpdateSystemLibrary) + +public: + FbxEventUpdateSystemLibrary(FbxLibrary *pLibrary) { mLibrary = pLibrary; } + inline FbxLibrary* GetLibrary() const { return mLibrary; } + +private: + FbxLibrary* mLibrary; +}; + +class FBXSDK_DLL FbxEventWriteLocalization : public FbxEvent +{ + FBXSDK_EVENT_DECLARE(FbxEventWriteLocalization) + +public: + FbxEventWriteLocalization(FbxLibrary* pAssetLibrary) { mAssetLibrary = pAssetLibrary; } + inline FbxLibrary* GetLibrary() const { return mAssetLibrary; } + +private: + FbxLibrary* mAssetLibrary; +}; + +class FBXSDK_DLL FbxEventMapAssetFileToAssetObject : public FbxEvent +{ + FBXSDK_EVENT_DECLARE(FbxEventMapAssetFileToAssetObject) + +public: + FbxEventMapAssetFileToAssetObject(const char* pFile) : + mAsset(NULL), + mFilePath( pFile ) + { + } + + inline const char* GetFilePath() const { return mFilePath; } + mutable FbxObject* mAsset; + +private: + FbxString mFilePath; +}; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +#include + +#endif /* _FBXSDK_SCENE_LIBRARY_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxmediaclip.h b/libs/fbx/include/fbxsdk/scene/fbxmediaclip.h new file mode 100644 index 00000000..9bab3302 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxmediaclip.h @@ -0,0 +1,219 @@ +/**************************************************************************************** + + 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 fbxmediaclip.h +#ifndef _FBXSDK_SCENE_MEDIACLIP_H_ +#define _FBXSDK_SCENE_MEDIACLIP_H_ + +#include + +#include + +#include + +/** FBX SDK media clip class. + * \nosubgrouping + */ +class FBXSDK_DLL FbxMediaClip : public FbxObject +{ + FBXSDK_ABSTRACT_OBJECT_DECLARE(FbxMediaClip, FbxObject); + +public: + /** + *\name Media clip class Reset + */ + //@{ + //! Reset the clip to default values. + virtual void Reset(); + //@} + + /** + * \name Media clip attributes Management + */ + //@{ + /** Specify the media full filename. + * \param pName media full filename. + * \return \c True,if update successfully, \c false otherwise. + */ + virtual bool SetFileName(const char* pName); + + /** Retrieve the media full filename. + * \return Media full filename. + */ + FbxString GetFileName () const; + + /** Specify the media relative filename. + * \param pName Media relative filename. + * \return \c True, if update successfully, \c false otherwise. + */ + virtual bool SetRelativeFileName(const char* pName); + + /** Retrieve the media relative filename. + * \return Media relative filename. + */ + FbxString GetRelativeFileName() const; + + /** Set the clip color. + * The color property can be used to display media clips on the user interface. It has no + * impact on the data itself and only uses the RGB components. + * \param pColor New color of the clip. + */ + void SetColor(FbxColor pColor); + + /** Retrieve the clip color. + * return Clip color. + */ + FbxColor GetColor() const; + + /** Set the play speed of the media clip. + * \param pPlaySpeed Playback speed of the clip. + * \remarks The parameter value is not checked. It is the responsibility + * of the caller to deal with bad playback speed values. + */ + void SetPlaySpeed(double pPlaySpeed); + + /** Retrieve the play speed of the media clip. + * \return Playback speed. + */ + double GetPlaySpeed() const; + + /** Set the clip start time. + * \param pTime Start time of the media file. + */ + void SetClipIn(FbxTime pTime); + + /** Retrieve the clip start time. + * \return The current clip start time. + */ + FbxTime GetClipIn() const; + + /** Set the clip end time. + * \param pTime End time of the media file. + */ + void SetClipOut(FbxTime pTime); + + /** Retrieve the clip start time. + * \return The current clip start time. + */ + FbxTime GetClipOut() const; + + /** Set the time offset. + * The offset can be used to shift the playback start time of the clip. + * \param pTime Time offset of the clip. + */ + void SetOffset(FbxTime pTime); + + /* Retrieve the time offset. + * \return The current time shift. + */ + FbxTime GetOffset() const; + + /** Set the Free Running state of the media clip. + * The Free Running flag can be used by a client application to implement a + * playback scheme that is independent of the main timeline. + * \param pState State of the Free running flag. + */ + void SetFreeRunning(bool pState); + + /** Retrieve the Free Running state. + * \return Current free running flag. + */ + bool GetFreeRunning() const; + + + /** Set the Loop state of the media clip. + * The Loop flag can be used by a client application to implement the loop + * playback of the media clip. + * \param pLoop State of the loop flag. + */ + void SetLoop(bool pLoop); + + /** Retrieve the Loop state. + * \return Current loop flag. + */ + bool GetLoop() const; + + /** Set the Mute state of the media clip. + * The Mute flag can be used by a client application to implement the muting + * of the media clip. + * \param pMute State of the mute flag. + */ + void SetMute(bool pMute); + + /** Retrieve the Mute state. + * \return Current mute flag. + */ + bool GetMute() const; + + /** Media clip access mode. + */ + enum EAccessMode + { + eDisk, + eMemory, + eDiskAsync + }; + + /** Set the clip Access Mode. + * \param pAccessMode Clip access mode identifier. + */ + void SetAccessMode(EAccessMode pAccessMode); + + /** Retrieve the clip Access Mode. + * \return Clip access mode identifier. + */ + EAccessMode GetAccessMode() 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 +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + +public: + virtual FbxObject& Copy(const FbxObject& pObject); + + virtual FbxStringList GetTypeFlags() const; + + void SetOriginalFormat(bool pState); + bool GetOriginalFormat() const; + void SetOriginalFilename(const char* pOriginalFilename); + const char* GetOriginalFilename() const; + + FbxPropertyT Color; + FbxPropertyT ClipIn; + FbxPropertyT ClipOut; + FbxPropertyT Offset; + FbxPropertyT PlaySpeed; + FbxPropertyT FreeRunning; + FbxPropertyT Loop; + FbxPropertyT Mute; + FbxPropertyT AccessMode; + +protected: + void Init(); + FbxPropertyT Path; + FbxPropertyT RelPath; + + bool mOriginalFormat; + FbxString mOriginalFilename; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxMediaClip::EAccessMode&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_MEDIACLIP_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxobjectfilter.h b/libs/fbx/include/fbxsdk/scene/fbxobjectfilter.h new file mode 100644 index 00000000..dae9265d --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxobjectfilter.h @@ -0,0 +1,77 @@ +/**************************************************************************************** + + 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 fbxobjectfilter.h +#ifndef _FBXSDK_SCENE_OBJECT_FILTER_H_ +#define _FBXSDK_SCENE_OBJECT_FILTER_H_ + +#include + +#include + +#include + +/** \brief This object represents a filter criteria on an object. + * \nosubgrouping + */ +class FBXSDK_DLL FbxObjectFilter +{ +public: + //! Destructor. + virtual ~FbxObjectFilter() {} + + /** Tells if this filter match the given object + * \param pObjectPtr The given object. + */ + virtual bool Match(const FbxObject * pObjectPtr) const = 0; + + /** Tells if this filter does NOT match the given object + * \param pObjectPtr The given object. + */ + virtual bool NotMatch(const FbxObject * pObjectPtr) const { return !Match(pObjectPtr); }; +}; + +/**\brief This class represents a name filter on an object. + *\nosubgrouping + */ +class FBXSDK_DLL FbxNameFilter : public FbxObjectFilter +{ +public: + /** + * \name Constructor and Destructor + */ + //@{ + /** Constructor + * \param pTargetName The target name. + */ + inline FbxNameFilter( const char* pTargetName ) : mTargetName( pTargetName ) {}; + + //! Destructor. + virtual ~FbxNameFilter() {} + //@} + + /** Tells if this filter match the given object + * \param pObjectPtr The given object. + */ + virtual bool Match(const FbxObject * pObjectPtr) const { return pObjectPtr ? mTargetName == pObjectPtr->GetName() : false; } + +/***************************************************************************************************************************** +** 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: + FbxString mTargetName; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_OBJECT_FILTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxobjectmetadata.h b/libs/fbx/include/fbxsdk/scene/fbxobjectmetadata.h new file mode 100644 index 00000000..3ff19553 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxobjectmetadata.h @@ -0,0 +1,36 @@ +/**************************************************************************************** + + 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 fbxobjectmetadata.h +#ifndef _FBXSDK_SCENE_OBJECT_META_DATA_H_ +#define _FBXSDK_SCENE_OBJECT_META_DATA_H_ + +#include + +#include + +#include + +/** This class is used to hold meta-data information on nodes. + * \nosubgrouping + * + * This class does not offer any new functionality over a regular FbxObject; + * all meta-data information should be stored in properties. + * + */ +class FBXSDK_DLL FbxObjectMetaData : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxObjectMetaData, FbxObject); +}; + +#include + +#endif /* _FBXSDK_SCENE_OBJECT_META_DATA_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxobjectscontainer.h b/libs/fbx/include/fbxsdk/scene/fbxobjectscontainer.h new file mode 100644 index 00000000..cb8f8952 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxobjectscontainer.h @@ -0,0 +1,66 @@ +/**************************************************************************************** + + 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 fbxobjectscontainer.h +#ifndef _FBXSDK_SCENE_OBJECTS_CONTAINER_H_ +#define _FBXSDK_SCENE_OBJECTS_CONTAINER_H_ + +#include + +#include +#include + +#include + +typedef FbxArray FbxAttributeFilters; + +/* Internal helper class used to traverse scene in the FbxAxisSystem and FbxSystemUnit + */ +class FbxObjectsContainer +{ +public: + enum EDepth + { + eChildOnly, + eChildAndSubChild, + eSubChildWithNoScaleInherit + }; + + FbxObjectsContainer() : mStartNode(NULL) {} + virtual ~FbxObjectsContainer(){ Clear(); } + + // Store all anim curve nodes pointers that need to be converted + FbxArray mFCurvesT; + FbxArray mFCurvesR; + FbxArray mFCurvesS; + + // Store all node that need to be converted + FbxArray mNodes; + +public: + void ExtractSceneObjects(FbxScene* pScene, EDepth pDepth, const FbxAttributeFilters& pFilters); + + void ExtractSceneObjects(FbxNode* pRootNode, EDepth pDepth, const FbxAttributeFilters& pFilters); + + void Clear() { mFCurvesT.Clear(); mFCurvesR.Clear(); mFCurvesS.Clear(); mNodes.Clear(); mStartNode = NULL; } + +protected: + // Extract all node and fcurve from all take for this node. + void ExtractNodesAnimCurveNodes(FbxNode* pNode, EDepth pDepth, const FbxAttributeFilters& pFilters); + void ExtractAnimCurveNodes(FbxNode* pNode); + bool InheritsScale( FbxNode* pNode ) const; + + FbxNode* mStartNode; +}; + +#include + +#endif /* _FBXSDK_SCENE_OBJECTS_CONTAINER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxpose.h b/libs/fbx/include/fbxsdk/scene/fbxpose.h new file mode 100644 index 00000000..1e22e96f --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxpose.h @@ -0,0 +1,354 @@ +/**************************************************************************************** + + 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 fbxpose.h +#ifndef _FBXSDK_SCENE_POSE_H_ +#define _FBXSDK_SCENE_POSE_H_ + +#include + +#include +#include +#include + +#include + +class FbxStatus; +class FbxPose; +class FbxNode; +class FbxUserNotification; + +/** This structure contains the description of a named pose. + * FbxPose contains one FbxPoseInfo array to store all of FBX nodes and their transform matrix info. + */ +struct FbxPoseInfo +{ + FbxMatrix mMatrix; //!< Transform matrix of the node. + bool mMatrixIsLocal; //!< If true, the transform matrix above is defined in local coordinates. + FbxNode* mNode; //!< FBX node, which may be skeleton or geometry (skinned) node. +}; + +typedef FbxArray NodeList; +typedef FbxArray PoseList; +typedef FbxArray PoseInfoList; + +/** This class contains the description of a Pose and provide some methods to access Pose info in one FBX scene. + * \nosubgrouping + * The FbxPose object can be setup to hold "Bind Pose" data or "Rest Pose" data. + * + * The Bind Pose holds the transformation (translation, rotation and scaling) + * matrix of all the nodes implied in a link deformation. This includes the geometry + * being deformed, the links deforming the geometry, and recursively all the + * ancestors nodes of the link. The Bind Pose gives you the transformation of the nodes + * at the moment of the binding operation when no deformation occurs. + * + * The Rest Pose is a snapshot of a node transformation. A Rest Pose can be used + * to store the position of every node of a character at a certain point in + * time. This pose can then be used as a reference position for animation tasks, + * like editing walk cycles. + * + * One difference between the two modes is in the validation performed before + * adding an item and the kind of matrix stored. + * + * In "Bind Pose" mode, the matrix is assumed to be defined in the global space, + * while in "Rest Pose" the type of the matrix may be specified by the caller. So + * local system matrices can be used. Actually, because there is one such flag for + * each entry (FbxPoseInfo), it is possible to have mixed types in a FbxPose elements. + * It is therefore the responsibility of the caller to check for the type of the retrieved + * matrix and to do the appropriate conversions if required. + * + * The validation of the data to be added consists of the following steps: + * + * \li If this FbxPose object stores "Bind Poses", then + * add a FbxPoseInfo only if the node is not already + * associated to another "Bind Pose". This check is done + * by visiting ALL the FbxPose objects in the system. + * + * The above test is only performed for the "Bind Pose" type. While + * the next one is always performed, no matter what kind of poses this + * FbxPose object is setup to hold. + * + * \li If a node is already inserted in the FbxPose internal list, + * then the passed matrix MUST be equal to the one already stored. + * If this is not the case, the Add method will return -1, indicating + * that no new FbxPoseInfo has been created. + * + * If the Add method succeeds, it will return the index of the FbxPoseInfo + * structure that as been created and held by the FbxPose object. + * + * To ensure data integrity, the stored information can only be + * accessed using the provided methods (read-only). If an entry needs to be + * modified, the caller has to remove the FbxPoseInfo item by calling Remove(i) + * and then Add a new one. + * + * The internal list is not ordered and the search inside this list is linear + * (from the first element to ... the first match or the end of the list). + * + */ +class FBXSDK_DLL FbxPose : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxPose,FbxObject); + +public: + /** Set the type of pose. + * \param pIsBindPose If true, type will be bind pose, else rest pose. + */ + void SetIsBindPose(bool pIsBindPose); + + /** Pose identifier flag. + * \return \c true if this object holds BindPose data. + */ + bool IsBindPose() const { return mType == 'b'; } + + /** Pose identifier flag. + * \return \c true if this object holds RestPose data. + */ + bool IsRestPose() const { return mType == 'r'; } + + /** Get number of stored items. + * \return The number of items stored. + */ + int GetCount() const { return mPoseInfo.GetCount(); } + + /** Stores the pose transformation for the given node. + * \param pNode pointer to the node for which the pose is stored. + * \param pMatrix Pose transform of the node. + * \param pLocalMatrix Flag to indicate if pMatrix is defined in Local or Global space. + * \param pMultipleBindPose Flag to indicate if multiple bind pose exist. If this is false, all matrix for one node should be same in different bind pose. + * \return -1 if the function failed or the index of the stored item. + */ + int Add(FbxNode* pNode, const FbxMatrix& pMatrix, bool pLocalMatrix = false, bool pMultipleBindPose = true); + + /** Remove the pIndexth item from the Pose object. + * \param pIndex Index of the item to be removed. + */ + void Remove(int pIndex); + + /** Get the node name. + * \param pIndex Index of the queried item. + * \return The node initial and current names. + * \remarks If the index is invalid an empty FbxNameHandler is returned. + */ + FbxNameHandler GetNodeName(int pIndex) const; + + /** Get the node. + * \param pIndex Index of the queried item. + * \return A pointer to the node referenced. + * \remarks If the index is invalid or no pointer to a node is set, returns NULL. + * The returned pointer will become undefined if the FbxPose object is destroyed. + */ + FbxNode* GetNode(int pIndex) const; + + /** Get the transform matrix. + * \param pIndex Index of the queried item. + * \return A reference to the pose matrix. + * \remarks If the index is invalid a reference to an identity matrix is returned. + * The reference will become undefined if the FbxPose object is destroyed. + */ + const FbxMatrix& GetMatrix(int pIndex) const; + + /** Get the type of the matrix. + * \param pIndex Index of the queried item. + * \return \c true if the matrix is defined in the Local coordinate space and false otherwise. + * \remarks If the FbxPose object is configured to hold BindPose data, this method will always return \c false. + */ + bool IsLocalMatrix(int pIndex) const; + + /** + * \name Search Section + */ + //@{ + /** This structure defines the strategy of comparing FBX node name. + * FBX node has an initial name and a current name (refer to FbxNameHandler). The structure defines which name to use when compare two nodes. + */ + enum ENameComponent + { + eInitialNameComponent = 1, //! use initial name when compare two nodes + eCurrentNameComponent = 2, //! use current name when compare two nodes + eAllNameComponents = 3 //! use both initial and current name when compare two nodes, it's true if one or both matched + }; + + /** Look in the FbxPose object for the given node name. + * \param pNodeName Name of the node we are looking for. + * \param pCompareWhat Bitwise or of the following flags: INTIALNAME_COMPONENT, eCurrentNameComponent + * \return -1 if the node is not in the list. Otherwise, the index of the corresponding FbxPoseInfo element. + */ + int Find(const FbxNameHandler& pNodeName, char pCompareWhat = eAllNameComponents) const; + + /** Look in the FbxPose object for the given node. + * \param pNode the node we are looking for. + * \return -1 if the node is not in the list. Otherwise, the index of the corresponding FbxPoseInfo element. + */ + int Find(const FbxNode* pNode) const; + //@} + + /** + * \name Utility Section + */ + //@{ + /** Get the list of Poses objects that contain the node with name pNodeName. + * This method will look in all the poses of all the scenes. + * \param pManager The manager owning the poses and scenes. + * \param pNode The node being explored. + * \param pPoseList List of BindPoses/RestPoses that have the node. + * \param pIndex List of indices of the nodes in the corresponding poses lists. + * \return \c true if the node belongs to at least one Pose (either a BindPose or a RestPose). + * \remarks The pPoseList and pIndex are filled by this method. + * The elements of the returned list must not be deleted since they still belong to the scene. + */ + static bool GetPosesContaining(FbxManager& pManager, FbxNode* pNode, PoseList& pPoseList, FbxArray& pIndex); + + /** Get the list of Poses objects that contain the node with name pNodeName. + * \param pScene Scene owning the poses. + * \param pNode The node being explored. + * \param pPoseList List of BindPoses/RestPoses that have the node. + * \param pIndex List of indices of the nodes in the corresponding poses lists. + * \return \c true if the node belongs to at least one Pose (either a BindPose or a RestPose). + * \remarks The pPoseList and pIndex are filled by this method. + * The elements of the returned list must not be deleted since they still belong to the scene. + */ + static bool GetPosesContaining(FbxScene* pScene, FbxNode* pNode, PoseList& pPoseList, FbxArray& pIndex); + + /** Get the list of BindPose objects that contain the node with name pNodeName. + * This method will look in all the bind poses of all the scenes. + * \param pManager The manager owning the poses. + * \param pNode The node being explored. + * \param pPoseList List of BindPoses that have the node. + * \param pIndex List of indices of the nodes in the corresponding bind poses lists. + * \return \c true if the node belongs to at least one BindPose. + * \remarks The pPoseList and pIndex are filled by this method. + * The elements of the returned list must not be deleted since they still belong to the scene. + */ + static bool GetBindPoseContaining(FbxManager& pManager, FbxNode* pNode, PoseList& pPoseList, FbxArray& pIndex); + + /** Get the list of BindPose objects that contain the node with name pNodeName. + * \param pScene The scene owning the poses. + * \param pNode The node being explored. + * \param pPoseList List of BindPoses that have the node. + * \param pIndex List of indices of the nodes in the corresponding bind poses lists. + * \return \c true if the node belongs to at least one BindPose. + * \remarks The pPoseList and pIndex are filled by this method. + * The elements of the returned list must not be deleted since they still belong to the scene. + */ + static bool GetBindPoseContaining(FbxScene* pScene, FbxNode* pNode, PoseList& pPoseList, FbxArray& pIndex); + + /** Get the list of RestPose objects that contain the node with name pNodeName. + * This method will look in all the bind poses of all the scenes. + * \param pManager The manager owning the poses. + * \param pNode The node being explored. + * \param pPoseList List of RestPoses that have the node. + * \param pIndex List of indices of the nodes in the corresponding rest poses lists. + * \return \c true if the node belongs to at least one RestPose. + * \remarks The pPoseList and pIndex are filled by this method. + * The elements of the returned list must not be deleted since they still belong to the scene. + */ + static bool GetRestPoseContaining(FbxManager& pManager, FbxNode* pNode, PoseList& pPoseList, FbxArray& pIndex); + + /** Get the list of RestPose objects that contain the node with name pNodeName. + * \param pScene The scene owning the poses. + * \param pNode The node being explored. + * \param pPoseList List of RestPoses that have the node. + * \param pIndex List of indices of the nodes in the corresponding rest poses lists. + * \return \c true if the node belongs to at least one RestPose. + * \remarks The pPoseList and pIndex are filled by this method. + * The elements of the returned list must not be deleted since they still belong to the scene. + */ + static bool GetRestPoseContaining(FbxScene* pScene, FbxNode* pNode, PoseList& pPoseList, FbxArray& pIndex); + + /** Check this BindPose and report an error if all the conditions to a valid bind pose are not + * met. The conditions are: + * + * \li a) We are a BindPose. + * \li b) For every node in the bind pose, all their parent node are part of the bind pose. + * \li c) All the deforming nodes are part of the bind pose. + * \li d) All the parents of the deforming nodes are part of the bind pose. + * \li e) Each deformer relative matrix correspond to the deformer Inv(bindMatrix) * deformed Geometry bindMatrix. + * + * \param pRoot This node is used as the stop point when visiting the parents (cannot be NULL). + * \param pMatrixCmpTolerance Tolerance value when comparing the matrices. + * \param pStatus The FbxStatus object to hold error codes. + * \return true if all the above conditions are met and false otherwise. + * \remarks + * a) If pRoot node is not defined in the BindPose it must not have a Geometry or Skeleton attribute and its + * transform must be an Identity. + * \remarks + * b) If the returned value is false, querying for the error will return the reason of the failure. + * As soon as one of the above conditions is not met, this method return ignoring any subsequent errors. + * Run the IsBindPoseVerbose if more details are needed. + */ + bool IsValidBindPose(FbxNode* pRoot, double pMatrixCmpTolerance=0.0001, FbxStatus* pStatus = NULL); + + /** Same as IsValidBindPose() but slower because it will not stop as soon as a failure occurs. Instead, + * keeps running to accumulate the faulty nodes (stored in the appropriate array). It is then up to the + * caller to fill the UserNotification if desired. + * + * \param pRoot This node is used as the stop point when visiting the parents (cannot be NULL). + * \param pMissingAncestors Each ancestor missing from the BindPose is added to this list. + * \param pMissingDeformers Each deformer missing from the BindPose is added to this list. + * \param pMissingDeformersAncestors Each deformer ancestors missing from the BindPose is added to this list. + * \param pWrongMatrices Nodes that yield to a wrong matrix comparisons are added to this list. + * \param pMatrixCmpTolerance Tolerance value when comparing the matrices. + * \param pStatus The FbxStatus object to hold error codes. + * \remarks If pRoot node is not defined in the BindPose it must not have a Geometry or Skeleton attribute and its + * transform must be an Identity. + */ + bool IsValidBindPoseVerbose(FbxNode* pRoot, NodeList& pMissingAncestors, NodeList& pMissingDeformers, NodeList& pMissingDeformersAncestors, NodeList& pWrongMatrices, double pMatrixCmpTolerance=0.0001, FbxStatus* pStatus = NULL); + + /** Same as IsValidBindPose() but slower because it will not stop as soon as a failure occurs. Instead, + * keeps running to accumulate the faulty nodes and send them directly to the UserNotification. + * + * \param pRoot This node is used as the stop point when visiting the parents (cannot be NULL). + * \param pUserNotification Pointer to the user notification where the messages will be accumulated. + * \param pMatrixCmpTolerance Tolerance value when comparing the matrices. + * \param pStatus The FbxStatus object to hold error codes. + * \remarks If the pUserNotification parameter is NULL, this method will call IsValidBindPose(). + * \remarks If pRoot node is not defined in the BindPose it must not have a Geometry or Skeleton attribute and its + * transform must be an Identity. + */ + bool IsValidBindPoseVerbose(FbxNode* pRoot, FbxUserNotification* pUserNotification, double pMatrixCmpTolerance=0.0001, FbxStatus* pStatus = NULL); + + //@} + +/***************************************************************************************************************************** +** 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 void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + virtual void ConstructProperties(bool pForceSet); + + virtual FbxObject& Copy(const FbxObject& pObject); + virtual const char* GetTypeName() const; + + //Returns false if pNode is already inserted in the list and the current matrix is different from the stored one. Also, if this pose is a rest pose, check if + //pNode belongs to other BindPoses (accessed through the scene pointer). pPos will contains the index of the FbxPoseInfo if the parameters are already stored in this object. + bool ValidateParams(const FbxNode* pNode, const FbxMatrix& pMatrix, int& pPos); + + bool LocalValidateParams(const FbxNode* pNode, const FbxMatrix& pMatrix, int& pPos); + static bool GetSpecificPoseContaining(int poseType, FbxScene* pScene, FbxNode* pNode, PoseList& pPoseList, FbxArray& pIndex); + +private: + FbxPoseInfo* GetItem(int pIndex) const; + void UpdatePosInfoList(); + bool IsValidBindPoseCommon(FbxNode* pRoot, NodeList* pMissingAncestors, NodeList* pMissingDeformers, NodeList* pMissingDeformersAncestors, NodeList* pWrongMatrices, FbxStatus* pStatus, double pMatrixCmpTolerance=0.0001); + + char mType; + PoseInfoList mPoseInfo; + bool mPoseInfoIsDirty; + FbxPropertyT Nodes; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_POSE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxreference.h b/libs/fbx/include/fbxsdk/scene/fbxreference.h new file mode 100644 index 00000000..b7a0eea9 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxreference.h @@ -0,0 +1,73 @@ +/**************************************************************************************** + + 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 fbxreference.h +#ifndef _FBXSDK_SCENE_REFERENCE_H_ +#define _FBXSDK_SCENE_REFERENCE_H_ + +#include + +#include + +#include + +/** Contains information about a referenced file. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxSceneReference : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxSceneReference, FbxObject); + +public: + /// \name Basic properties + //@{ + //! Path to the referenced file. + FbxPropertyT< FbxString > ReferenceFilePath; + //! Referenced file's namespace. + FbxPropertyT< FbxString > ReferenceNameSpace; + //! Referenced file's node name. + FbxPropertyT< FbxString > ReferenceNodeName; + //! Referenced file's node depth. + FbxPropertyT< FbxInt> ReferenceDepth; + //! \c True if referenced file is loaded. + FbxPropertyT< FbxBool > IsLoaded; + //! \c True if referenced file is locked. + FbxPropertyT< FbxBool > IsLocked; + //@} + + /// \name Proxy related properties. + //@{ + //! \c True if referenced file is the original proxy. + FbxPropertyT< FbxBool > IsOriginalProxy; + + //! \c True if referenced file is active. + FbxPropertyT< FbxBool > IsActiveProxy; + + //! The name of proxy manager where the referenced file's proxy can be found. + FbxPropertyT< FbxString > ProxyManagerName; + /** Referenced file's proxy tag. + * \remarks Proxy tags are unique names assigned to proxy references to more easily manage those references in Maya. + */ + FbxPropertyT< FbxString > ProxyTag; + //@} + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_REFERENCE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxscene.h b/libs/fbx/include/fbxsdk/scene/fbxscene.h new file mode 100644 index 00000000..585160f8 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxscene.h @@ -0,0 +1,491 @@ +/**************************************************************************************** + + 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 fbxscene.h +#ifndef _FBXSDK_SCENE_H_ +#define _FBXSDK_SCENE_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class FbxGeometry; +class FbxTexture; +class FbxSurfaceMaterial; +class FbxCharacter; +class FbxControlSetPlug; +class FbxGenericNode; +class FbxPose; +class FbxCharacterPose; +class FbxVideo; +class FbxGlobalLightSettings; +class FbxGlobalCameraSettings; + +/** This class contains the description of a 3D scene. It contains the nodes (including the root node) (FbxNode), + * materials, textures, videos, gobos, + * poses, characters, character poses, control set plugs, + * generic nodes, + * scene information, global settings, + * and a global evaluator. + * The nodes are structured in a tree under the scene's root node. + * + * When an object is created using the FBX SDK, a scene is usually passed as argument to the + * object creation function to specify that the object belongs to this scene. + * At this point, a connection is made with the object as source and the scene as destination. + * + * All objects in the scene can be queried by connection index. In addition, + * generic nodes, materials, and textures can also be queried by name. In this latter case, the + * first object with the queried name will be returned. + * + * The global evaluator (FbxAnimEvaluator) is used to compute animation values + * for animated scenes. + * \nosubgrouping + */ +class FBXSDK_DLL FbxScene : public FbxDocument +{ + FBXSDK_OBJECT_DECLARE(FbxScene, FbxDocument); + +public: + //! \name Scene Management + //@{ + //! Clear the scene content by deleting the node tree below the root node and restoring default settings. + void Clear(); + + /** Get the root node of the scene. + * \return Pointer to the root node. + * \remarks This node is not saved. Do not use it to apply a global transformation to the node hierarchy. If a global transformation must be applied, insert a new node below this one. */ + FbxNode* GetRootNode() const; + //@} + + //! \name Texture Material and Video Access + //@{ + /** Clear, then fill, a texture array with all existing textures included in the scene. + * \param pTextureArray An array of texture pointers. */ + void FillTextureArray(FbxArray& pTextureArray); + + /** Clear, then fill, a material array with all existing materials included in the scene. + * \param pMaterialArray An array of material pointers. */ + void FillMaterialArray(FbxArray& pMaterialArray); + //@} + + //! \name Generic Node Access + //@{ + /** Get number of generic nodes in the scene. + * \return Number of Generic Nodes in this scene. */ + int GetGenericNodeCount() const; + + /** Get generic node at given index. + * \param pIndex Position in the list of the generic nodes. + * \return Pointer to the generic node or \c NULL if the index is out of bounds. + */ + FbxGenericNode* GetGenericNode(int pIndex); + + /** Access a generic node from its name. + * \param pName Name of the generic node. + * \return found generic node + */ + FbxGenericNode* GetGenericNode(char* pName); + + /** Add a generic node to this scene. + * \param pGenericNode Pointer to the generic node to be added. + * \return If the passed parameter is \c NULL, this method will return \c false, otherwise \c true. */ + bool AddGenericNode(FbxGenericNode* pGenericNode); + + /** Remove the generic node from this scene. + * \param pGenericNode Pointer to the generic node to be removed. + * \return If the passed parameter is \c NULL, this method will return \c false, otherwise \c true. + * \remarks The pointed object is not referenced by the scene anymore but is not deleted. */ + bool RemoveGenericNode(FbxGenericNode* pGenericNode); + //@} + + + //! \name Character Management + //@{ + /** Get number of characters. + * \return Number of characters in this scene. */ + int GetCharacterCount() const; + + /** Get character at given index. + * \param pIndex Position in the list of the characters. + * \return Pointer to the character or \c NULL if index is out of bounds. */ + FbxCharacter* GetCharacter(int pIndex); + + /** Create a new character. + * \param pName Name given to character. + * \return Index of the created character. */ + int CreateCharacter(const char* pName); + + /** Destroy character. + * \param pIndex Specify which character to destroy. */ + void DestroyCharacter(int pIndex); + //@} + + //! \name ControlSetPlug Management + //@{ + /** Get number of ControlSetPlugs. + * \return Number of ControlSet plugs in this scene. */ + int GetControlSetPlugCount() const; + + /** Get ControlSetPlug at given index. + * \param pIndex Position in the list of the ControlSetPlug + * \return Pointer to ControlSetPlug or \c NULL if index is out of bounds. */ + FbxControlSetPlug* GetControlSetPlug(int pIndex); + + /** Create a new ControlSetPlug. + * \param pName Name given to ControlSetPlug. + * \return Index of created ControlSetPlug. */ + int CreateControlSetPlug(char* pName); + + /** Destroy ControlSetPlug. + * \param pIndex Specify which ControlSetPlug to destroy. */ + void DestroyControlSetPlug(int pIndex); + //@} + + //! \name Character Pose Management + //@{ + /** Get number of character poses. + * \return Number of character poses in this scene. + * \remarks Character Poses and Poses are two distinct entities having their own lists. */ + int GetCharacterPoseCount() const; + + /** Get character pose at given index. + * \param pIndex Position in the list of character poses. + * \return Pointer to the character pose or \c NULL if index is out of bounds. */ + FbxCharacterPose* GetCharacterPose(int pIndex); + + /** Create a new character pose. + * \param pName Name given to character pose. + * \return Index of created character pose. */ + int CreateCharacterPose(char* pName); + + /** Destroy character pose. + * \param pIndex Specify which character pose to destroy. */ + void DestroyCharacterPose(int pIndex); + //@} + + //! \name Pose Management + //@{ + /** Get number of poses. + * \return Number of poses in the scene. + * \remarks Poses and Character Poses are two distinct entities having their own lists. */ + int GetPoseCount() const; + + /** Get pose at given index. + * \param pIndex Position in the list of poses. + * \return Pointer to the pose or \c NULL if index is out of bounds. */ + FbxPose* GetPose(int pIndex); + + /** Add a pose to this scene. + * \param pPose The pose (for example: bind pose, rest pose) to be added to the scene. + * \return If the pose is correctly added to the scene, return \c true. Otherwise, if the pose is already in the scene, return \c false. */ + bool AddPose(FbxPose* pPose); + + /** Remove the specified pose from the scene. + * \param pPose The pose (for example: bind pose, rest pose) to be removed from the scene. + * \return If the pose was successfully removed from the scene, return \c true. Otherwise, if the pose could not be found return \c false. */ + bool RemovePose(FbxPose* pPose); + + /** Remove the pose at the given index from the scene. + * \param pIndex Index of the pose to be removed. + * \return If the pose was successfully removed from the scene, return \c true. Otherwise, if the pose could not be found return \c false. */ + bool RemovePose(int pIndex); + //@} + + //! \name Scene information + //@{ + /** Get the scene information. + * \return Pointer to the scene information object. */ + FbxDocumentInfo* GetSceneInfo() { return GetDocumentInfo(); } + + /** Set the scene information. + * \param pSceneInfo Pointer to the scene information object. */ + void SetSceneInfo(FbxDocumentInfo* pSceneInfo) { SetDocumentInfo(pSceneInfo); } + //@} + + //! \name Global Settings + //@{ + /** Access global settings. + * \return Reference to the Global Settings. */ + FbxGlobalSettings& GetGlobalSettings(); + + /** Const access to global settings. + * \return Const reference to the Global Settings. */ + const FbxGlobalSettings& GetGlobalSettings() const; + //@} + + /** \name Scene Animation Evaluation + * The scene's animation evaluator is used to compute animation values for animated scenes. A typical + * usage would be to compute the global transform matrix of a node \c lNode at a given time \c lTime. + * \code + FbxAMatrix& lGlobalMatrix = lNode->GetScene()->GetAnimationEvaluator()->GetNodeGlobalTransform(lNode, lTime); + + or the exact equivalent: + + FbxAMatrix& lGlobalMatrix = lNode->EvaluateGlobalTransform(lTime); + * \endcode + * + * The user can create one or more evaluators in the scene. The default evaluator is set using SetEvaluator. When + * GetEvaluator is called, if the scene has no evaluator, an evaluator is created with default values. */ + //@{ + /** Set the current animation stack context used by the animation evaluator. + * \param pAnimStack The animation stack to set as current. + * \remark Changing the current animation stack will also cause the animation evaluator to reset its state. */ + void SetCurrentAnimationStack(FbxAnimStack* pAnimStack); + + /** Retrieve the current animation stack. + * \return the current animation stack. If none were set previously, the default one will be returned if it exists. */ + FbxAnimStack* GetCurrentAnimationStack(); + + /** Set the global evaluator used by this scene evaluation engine. + * \param pEvaluator The evaluator to be used for evaluation processing of this scene. */ + void SetAnimationEvaluator(FbxAnimEvaluator* pEvaluator); + + /** Get the global evaluator used by this scene evaluation engine. + * If no evaluator were previously set, this function will return either the first evaluator found attached to this scene, or a new default evaluator. + * \return The evaluator to be used for evaluation processing of this scene. */ + FbxAnimEvaluator* GetAnimationEvaluator(); + //@} + + /** Clear then fill a pose array with all existing pose included in the scene. + * \param pPoseArray An array of pose pointers. */ + void FillPoseArray(FbxArray& pPoseArray); + + //! \name Material Access + //@{ + /** Get number of materials. + * \return Number of materials in this scene. */ + int GetMaterialCount() const; + + /** Get the material at the given index. + * \param pIndex Position in the list of materials. + * \return Pointer to the material or \c NULL if the index is out of bounds. + * \remarks pIndex must be between 0 and GetMaterialCount(). */ + FbxSurfaceMaterial* GetMaterial(int pIndex); + + /** Get the material by its name. + * \param pName Name of the material. + * \return Pointer to the material or \c NULL if not found. */ + FbxSurfaceMaterial* GetMaterial(char* pName); + + /** Add the material to this scene. + * \param pMaterial Pointer to the material to be added. + * \return true on successful addition. */ + bool AddMaterial(FbxSurfaceMaterial* pMaterial); + + /** Remove the material from this scene. + * \param pMaterial Pointer to the material to be removed. + * \return true on successful removal. */ + bool RemoveMaterial(FbxSurfaceMaterial* pMaterial); + //@} + + //! \name Texture Access + //@{ + /** Get number of textures (type FbxTexture). + * \return Number of textures in this scene. Includes types FbxFileTexture, FbxLayeredTexture and FbxProceduralTexture. + * \remarks To get the number of textures of a specific type, use GetSrcCount(). For example: + * \code + * int lNbFileTextures = lScene->GetSrcObjectCount(); + * int lNbLayeredTextures = lScene->GetSrcObjectCount(); + * int lNbProceduralTextures = lScene->GetSrcObjectCount(); + * \endcode */ + int GetTextureCount() const; + + /** Get the texture at the given index. pIndex must be between 0 and GetTextureCount(). + * \param pIndex Position in the list of textures. + * \return Pointer to the texture or \c NULL if the index is out of bounds. + * \remarks To get the texture of a specific texture type, use GetSrcObject(). For example: + * \code + * FbxFileTexture* lFileTexture = lScene->GetSrcObject(i); + * FbxLayeredTexture* lLayeredTexture = lScene->GetSrcObject(i); + * FbxProceduralTexture* lProceduralTexture = lScene->GetSrcObject(i); + * \endcode */ + FbxTexture* GetTexture(int pIndex); + + /** Get the texture by its name. + * \param pName Name of the texture. + * \return Pointer to the texture or \c NULL if not found. */ + FbxTexture* GetTexture(char* pName); + + /** Add the texture to this scene. + * \param pTexture Pointer to the texture to be added. + * \return \c true on successful addition. */ + bool AddTexture(FbxTexture* pTexture); + + /** Remove the texture from this scene. + * \param pTexture Pointer to the texture to be removed. + * \return \c true on successful removal. */ + bool RemoveTexture(FbxTexture* pTexture); + //@} + + //! \name Node Access + //@{ + /** Get number of nodes. + * \return Number of nodes in this scene. */ + int GetNodeCount() const; + + /** Get the node at the given index. + * \param pIndex Position in the list of nodes. + * \return Pointer to the node or \c NULL if the index is out of bounds. + * \remarks pIndex must be between 0 and GetNodeCount(). */ + FbxNode* GetNode(int pIndex); + + /** Add the node to this scene. + * \param pNode Pointer to the node to be added. + * \return true on successful addition. */ + bool AddNode(FbxNode* pNode); + + /** Remove the node from this scene. + * \param pNode Pointer to the node to be removed. + * \return true on successful removal. */ + bool RemoveNode(FbxNode* pNode); + + /** Helper method for determining the number of nodes that have curves on surface attributes in the scene. Since the curve-on-surface + * nodes are connected to nurbs geometry and not any FbxNode in the scene, they won't normally be picked up in a graph traversal. + * \return The number of curve-on-surface nodes in the scene */ + int GetCurveOnSurfaceCount(); + + /** Get the first node with this name. + * \param pName Name of the node. + * \return Pointer to the node, or \c NULL if node is not found. */ + FbxNode* FindNodeByName(const FbxString& pName); + //@} + + //! \name Geometry Access + //@{ + /** Get number of geometries. + * \return Number of geometries in this scene. */ + int GetGeometryCount() const; + + /** Get the geometry at the given index. + * \param pIndex Position in the list of geometries. + * \return Pointer to the geometry or \c NULL if the index is out of bounds. + * \remarks pIndex must be between 0 and GetGeometryCount(). */ + FbxGeometry* GetGeometry(int pIndex); + + /** Add the geometry to this scene. + * \param pGeometry Pointer to the geometry to be added. + * \return true on successful addition. */ + bool AddGeometry(FbxGeometry* pGeometry); + + /** Remove the geometry from this scene. + * \param pGeometry Pointer to the geometry to be removed. + * \return true on successful removal. */ + bool RemoveGeometry(FbxGeometry* pGeometry); + //@} + + //! \name Video Access + //@{ + /** Get number of videos. + * \return Number of videos in this scene. */ + int GetVideoCount() const; + + /** Get the video at the given index. + * \param pIndex Position in the list of videos. + * \return Pointer to the video or \c NULL if the index is out of bounds. + * \remarks pIndex must be between 0 and GetVideoCount(). */ + FbxVideo* GetVideo(int pIndex); + + /** Add the video to this scene. + * \param pVideo Pointer to the video to be added. + * \return true on successful addition. */ + bool AddVideo(FbxVideo* pVideo); + + /** Remove the video from this scene. + * \param pVideo Pointer to the video to be removed. + * \return true on successful removal. */ + bool RemoveVideo(FbxVideo* pVideo); + //@} + + /** \name Utilities */ + //@{ + /** Synchronize all the Show properties of node instances. + * Walks all the node attributes defined in the scene and synchronize the Show property of all the nodes that reference the node attribute so that they all contain the same value. + * This method should be called after the FBX scene is completely created, typically right after the calls to the FbxImporter::Import() or just before the calls to the FbxExporter::Export(). + * \remarks Applications only need to call this method if their interpretation of the Show property implies that setting the Show state on one instance affect all of them. + * \see FbxNode::Visibility property, FbxNode::Show property */ + void SyncShowPropertyForInstance(); + + /** Compute the bounding box and its center for all (or selected) nodes. + * \param pBBoxMin The minimum value of the bounding box upon successful return. + * \param pBBoxMax The maximum value of the bounding box upon successful return. + * \param pBBoxCenter The center value of the bounding box upon successful return. + * \param pSelected If \c true, only take into account selected geometry, otherwise take all geometry into account. + * \param pTime If different from FBXSDK_TIME_INFINITE, time used to compute the bounding box for deformed geometry. + * \return \c true if successful, otherwise \c false. + * \remark If geometry have been unloaded from memory, their bounding box cannot be calculated and will use any value set previously. */ + bool ComputeBoundingBoxMinMaxCenter(FbxVector4& pBBoxMin, FbxVector4& pBBoxMax, FbxVector4& pBBoxCenter, bool pSelected=false, const FbxTime& pTime=FBXSDK_TIME_INFINITE); + //@} + +/***************************************************************************************************************************** +** 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 ConvertNurbsSurfaceToNurbs(); + void ConvertMeshNormals(); + void ConvertNurbsCurvesToNulls(); + void ConnectTextures(); + void BuildTextureLayersDirectArray(); + void FixInheritType(FbxNode *pNode); + + void UpdateScaleCompensate(FbxNode *pNode, FbxIOSettings& pIOS); + + FbxClassId ConvertAttributeTypeToClassID(FbxNodeAttribute::EType pAttributeType); + + // These data structures are only used for legacy FBX files (version 6.x and earlier). The + // validity of their content is not guaranteed with the most recent versions. + FbxGlobalLightSettings& GlobalLightSettings() { return *mGlobalLightSettings; } + FbxGlobalCameraSettings& GlobalCameraSettings() { return *mGlobalCameraSettings; } + + // Clone this scene object (and everything else it contains if clone type is eDeepClone) + virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; + virtual FbxObject& Copy(const FbxObject& pObject); + + void ConnectMaterials(); + + void BuildMaterialLayersDirectArray(); + void ReindexMaterialConnections(); // called to make sure that eIndex is remapped to eIndexToDirect + + FbxMultiMap* AddTakeTimeWarpSet(char *pTakeName); + FbxMultiMap* GetTakeTimeWarpSet(char *pTakeName); + + // This function will destroy the scene (and all the objects directly connected to it) without sending + // the Connect notifications nor trying to disconnect the objects first. This is a bypass of the intended + // workflow and should be used with care. + void ForceKill(); + +private: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + + void ConnectTextureLayerElement(FbxLayerContainer* pLayerContainer, FbxLayerElement::EType pLayerType, FbxNode* pParentNode); + void BuildTextureLayersDirectArrayForLayerType(FbxLayerContainer* pLayerContainer, FbxLayerElement::EType pLayerType); + + FbxNode* mRootNode; + FbxGlobalLightSettings* mGlobalLightSettings; + FbxGlobalCameraSettings* mGlobalCameraSettings; + FbxAnimEvaluator* mAnimationEvaluator; + FbxAnimStack* mCurrentAnimationStack; + FbxCharPtrSet mTakeTimeWarpSet; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxselectionnode.h b/libs/fbx/include/fbxsdk/scene/fbxselectionnode.h new file mode 100644 index 00000000..2d7236d0 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxselectionnode.h @@ -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 fbxselectionnode.h +#ifndef _FBXSDK_SCENE_SELECTION_NODE_H_ +#define _FBXSDK_SCENE_SELECTION_NODE_H_ + +#include + +#include + +#include + +/** FbxSelectionNode is an auxiliary class for Selection Set. +* \nosubgrouping +* Used to group objects with their components (e.g. vertex, edge, and face), when adding it to a selection set (FbxSelectionSet). +* \see FbxSelectionSet +*/ +class FBXSDK_DLL FbxSelectionNode : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxSelectionNode, FbxObject); + +public: + /** \enum ESelectType SelectionNode type identifier. + * - \e eVertexLevel Vertex level selection. + * - \e eEdgeLevel Edge level selection. + * - \e eFaceLevel Face level selection. + * - \e eObjectLevel Object level selection. + * - \e eSelectTypeCount Number of Select Types. + */ + enum ESelectType + { + eVertexLevel, + eEdgeLevel, + eFaceLevel, + eObjectLevel, + eSelectTypeCount + }; + + /** Set an object whose components or itself is contained in the SelectionNode. + * \param pObject The object whose components or itself is contained in the SelectionNode. + * \return \c true if the object is set successfully. \c false otherwise. + * \remarks It is possible a SDK user will try to set multiple objects to one SelectionNode, but only the last one will be kept. + */ + bool SetSelectionObject(FbxObject* pObject); + + /** Get the object whose components or itself or both are contained in the SelectionNode. + * \return The object whose components or itself or both are contained in the SelectionNode. + */ + FbxObject* GetSelectionObject() const; + + /** To detect if the SelectionNode is valid. + * \return \c true if this is a valid SelectionNode. \c false otherwise. + * \remarks SelectionNode is valid if selection object is set. + * SelectionNode is not valid if no selection object is set. + */ + bool IsValid() const; + + /** \c true means the object itself is also in the selection set; + * \c false means only the object's components are in the selection set, the object is not. + */ + bool mIsTheNodeInSet; + + /** Index array for selected vertices. + */ + FbxArray mVertexIndexArray; + + /** Index array for selected edges. + */ + FbxArray mEdgeIndexArray; + + /** Index array for selected faces. + */ + FbxArray mPolygonIndexArray; + +/***************************************************************************************************************************** +** 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 + FbxArray*> mSubTypeSelectArray; + static const char* SELECT_TYPE_NAMES[(int)eSelectTypeCount]; + +protected: + virtual void Construct(const FbxObject* pFrom); + bool ConnectNotify (FbxConnectEvent const &pEvent); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SELECTION_NODE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxselectionset.h b/libs/fbx/include/fbxsdk/scene/fbxselectionset.h new file mode 100644 index 00000000..822ef734 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxselectionset.h @@ -0,0 +1,87 @@ +/**************************************************************************************** + + 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 fbxselectionset.h +#ifndef _FBXSDK_SCENE_SELECTION_SET_H_ +#define _FBXSDK_SCENE_SELECTION_SET_H_ + +#include + +#include +#include + +#include + +/** FBX SDK selection set class. +* \nosubgrouping +* Represents a set of selected objects (FbxObject) and components. This is a non-exclusive (multiple membership) collection. +* Objects (FbxObject) can be added to a FbxSelectionSet directly, but to add components (vertexes, edges, or faces) +* you create a selection node (FbxSelectionNode) to group the object and its components together as a single item to be added. +* \see FbxSelectionNode +*/ +class FBXSDK_DLL FbxSelectionSet : public FbxCollection +{ + FBXSDK_OBJECT_DECLARE(FbxSelectionSet, FbxCollection); + +public: + /** This property stores annotation of the selection set. + * Default value is "". + */ + FbxPropertyT SelectionSetAnnotation; + + /** + * \name Utility functions + */ + //@{ + + /** Get the selected faces of a specified object. + * \param pObj The specified object. + * \param pPolygonIndexArray The array to take the indices of the selected faces. + * \remarks The indices of selected faces will be put in pPolygonIndexArray. + */ + void GetFaceSelection( FbxObject* pObj,FbxArray& pPolygonIndexArray ) const; + + /** Get the selected edges of a specified object. + * \param pObj The specified object. + * \param pEdgeIndexArray The array to take the indices of the selected edges. + * \remarks The indices of selected face will be put in pEdgeIndexArray. + */ + void GetEdgeSelection( FbxObject* pObj,FbxArray& pEdgeIndexArray ) const; + + /** Get the selected vertices of a specified object. + * \param pObj The specified object. + * \param pVertexIndexArray The array to take the indices of the selected vertices. + * \remarks The indices of selected face will be put in pVertexIndexArray. + */ + void GetVertexSelection( FbxObject* pObj,FbxArray& pVertexIndexArray ) const; + + /** Get list of two types of member in the selection set: SelectionNodes and Directly contained objects. + * \param pSelectionNodeList The array to take selection nodes of the selection set. + * \param pDirectObjectList The array to take directly contained objects of the selection set. + * \remarks There might be two types members for a selection set: selection node and directly contained object. + * They will be listed in pSelectionNodeList and pDirectObjectList separately. + */ + void GetSelectionNodesAndDirectObjects(FbxArray &pSelectionNodeList, FbxArray &pDirectObjectList) 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 +protected: + virtual void ConstructProperties(bool pForceSet); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SELECTION_SET_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxtakeinfo.h b/libs/fbx/include/fbxsdk/scene/fbxtakeinfo.h new file mode 100644 index 00000000..b1faad36 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxtakeinfo.h @@ -0,0 +1,141 @@ +/**************************************************************************************** + + 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 fbxtakeinfo.h +#ifndef _FBXSDK_SCENE_TAKEINFO_H_ +#define _FBXSDK_SCENE_TAKEINFO_H_ + +#include + +#include +#include +#include + +#include + +class FbxThumbnail; + +/** This FbxTakeLayerInfo structure is used to identify a layer by name and id number. + */ +struct FbxTakeLayerInfo +{ + FbxString mName; + int mId; +}; + +/** This class contains take information from an imported file + * or exported to an output file. + * + * A "take" is in fact a group of animation data grouped by name, so + * the FBX file format can support many "animation takes" in an FBX file to mimic + * how a movie is produced by making many takes of the same scene. + * + * The most used data is the "take name", other data are rarely used. + * Example of use: to get the list of all + * animation take names of FBX file without loading all the scene content. + * When a FbxImporter is initialized, the take information can be read and can be available + * before the long Import() step, this way, we can get the take info data very fast + * since we don't need to load all the animation scene data. + * \code + * // Ex: to get all take names in a FBX file + * for(int lAnimStackCount=0; lAnimStackCount < lImporter->GetAnimStackCount(); lAnimStackCount++) + * { + * FbxTakeInfo* lTakeInfo = lImporter->GetTakeInfo(lAnimStackCount); + * FbxString lTakeName = lTakeInfo->mName; + * } + * \endcode + */ +class FBXSDK_DLL FbxTakeInfo +{ +public: + + /** Default constructor. + */ + FbxTakeInfo(); + + /** Destructor. + */ + virtual ~FbxTakeInfo(); + + /** Copy Constructor. + * \param pTakeInfo The take information to be copied. + */ + FbxTakeInfo(const FbxTakeInfo& pTakeInfo); + + /** Assignment operator. + * \param pTakeInfo The take information to be assigned. . + */ + FbxTakeInfo& operator=(const FbxTakeInfo& pTakeInfo); + + //! Take name. + FbxString mName; + + /** The take name once it is imported in a scene. + * You can modify it if it must be different from the take name in the imported file. + * \remarks This field is only used when importing a scene. + */ + FbxString mImportName; + + //! Take description. + FbxString mDescription; + + /** Import/export flag. + * Set to \c true by default, set to \c false if the take must not be imported or exported. + */ + bool mSelect; + + //! Local time span, set to animation interval if it is left at the default value. + FbxTimeSpan mLocalTimeSpan; + + //! Reference time span, set to animation interval if it is left at the default value. + FbxTimeSpan mReferenceTimeSpan; + + /** Time value for offsetting the animation keys once they are imported in a scene. + * You can modify it if you need the animation of a take to be offset. + * The effect depends on the state of \c mImportOffsetType. + * \remarks This field is only used when importing a scene. + */ + FbxTime mImportOffset; + + /** \enum EImportOffsetType Import offset types. + * - \e eAbsolute + * - \e eRelative + */ + enum EImportOffsetType + { + eAbsolute, + eRelative + }; + + /** Import offset type. + * If set to \c eAbsolute, \c mImportOffset gives the absolute time of + * the first animation key and the appropriate time shift is applied + * to all of the other animation keys. + * If set to \c eRelative, \c mImportOffset gives the relative time + * shift applied to all animation keys. + */ + EImportOffsetType mImportOffsetType; + + /** Copies the layer information from the take information. + * \param pTakeInfo The take information to be copied. + */ + void CopyLayers(const FbxTakeInfo& pTakeInfo); + + //! List of each layer's information. + FbxArray mLayerInfoList; + + //! Current Layer. + int mCurrentLayer; +}; + +#include + +#endif /* _FBXSDK_SCENE_TAKEINFO_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxthumbnail.h b/libs/fbx/include/fbxsdk/scene/fbxthumbnail.h new file mode 100644 index 00000000..5024da41 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxthumbnail.h @@ -0,0 +1,142 @@ +/**************************************************************************************** + + 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 fbxthumbnail.h +#ifndef _FBXSDK_SCENE_THUMBNAIL_H_ +#define _FBXSDK_SCENE_THUMBNAIL_H_ + +#include + +#include + +#include + +class FbxThumbnailMembers; + +/** Simple class to hold RGBA values of a thumbnail image. + * \nosubgrouping + */ +class FBXSDK_DLL FbxThumbnail : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxThumbnail, FbxObject); + +public: + /** + * \name Thumbnail properties + */ + //@{ + + //! Pixel height of the thumbnail image + FbxPropertyT CustomHeight; + + //! Pixel width of the thumbnail image + FbxPropertyT CustomWidth; + + /** \enum EDataFormat Data format. + * - \e eRGB_24 + * - \e eRGBA_32 + */ + enum EDataFormat + { + eRGB_24, // 3 components + eRGBA_32 // 4 components + }; + + /** Set the data format. + * \param pDataFormat Data format identifier. + */ + void SetDataFormat(EDataFormat pDataFormat); + + /** Get the data format. + * \return Data format identifier for the thumbnail. + */ + EDataFormat GetDataFormat() const; + + + /** \enum EImageSize Image size. + * - \e eNotSet + * - \e e64x64 + * - \e e128x128 + * - \e eCustomSize + */ + enum EImageSize + { + eNotSet = 0, + e64x64 = 64, + e128x128 = 128, + eCustomSize = -1 + }; + + /** Set the thumbnail dimensions. + * \param pImageSize Image size identifier. + */ + void SetSize(EImageSize pImageSize); + + /** Get the thumbnail dimensions. + * \return Image size identifier. + */ + EImageSize GetSize() const; + + /** Get the thumbnail dimensions in bytes. + * \return Thumbnail size in bytes. + */ + unsigned long GetSizeInBytes() const; + + + //@} + + /** + * \name Thumbnail data access + */ + //@{ + + /** Fill the thumbnail image. + * \param pImage Pointer to the image data. A copy + * of the image data will be made. + * \remarks This pointer must point to a buffer region + * that is at least Width * Height * Component count + * bytes long. This pointer points to the upper left + * corner of the image. + * \remarks You must set the data format and the dimensions + * before calling this function. If the image size is set to eCustomSize + * the CustomHeight and CustomWidth properties must be set before calling + * this function. + * \return \c true if the thumbnail properties were set + * before calling this function. \c false otherwise. + */ + bool SetThumbnailImage(const FbxUChar* pImage); + + /** Get the thumbnail image. + * \return Pointer to the image data, or \c NULL if the + * thumbnail is empty. + */ + FbxUChar* GetThumbnailImage() 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); + + FbxThumbnailMembers* mMembers; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_THUMBNAIL_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/fbxvideo.h b/libs/fbx/include/fbxsdk/scene/fbxvideo.h new file mode 100644 index 00000000..f46b1235 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/fbxvideo.h @@ -0,0 +1,202 @@ +/**************************************************************************************** + + 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 fbxvideo.h +#ifndef _FBXSDK_SCENE_VIDEO_H_ +#define _FBXSDK_SCENE_VIDEO_H_ + +#include + +#include + +#include + +/** FBX SDK video class. + * \nosubgrouping + */ +class FBXSDK_DLL FbxVideo : public FbxMediaClip +{ + FBXSDK_OBJECT_DECLARE(FbxVideo, FbxMediaClip); + +public: + /** + *\name Reset video + */ + //@{ + //! Reset the video to default values. + virtual void Reset(); + //@} + + /** + * \name Video attributes Management + */ + //@{ + /** Set the use of MipMap on the video. + * \param pUseMipMap If \c true, use MipMap on the video. + */ + void ImageTextureSetMipMap(bool pUseMipMap); + + /** Retrieve use MipMap state. + * \return MipMap flag state. + */ + bool ImageTextureGetMipMap() const; + + /** Specify the Video full filename. + * \param pName Video full filename. + * \return \c True,if update successfully, \c false otherwise. + * \remarks Update the texture filename if the connection exists. + */ + virtual bool SetFileName(const char* pName); + + /** Specify the Video relative filename. + * \param pName Video relative filename. + * \return \c True, if update successfully, \c false otherwise. + * \remarks Update the texture filename if the connection exists. + */ + virtual bool SetRelativeFileName(const char* pName); + + /** + * \name Image sequence attributes Management + * Besides storing video clips, the FbxVideo object can also store image sequences. This section contains + * the manipulation methods used in this specialized mode. Note that, except for the GetFileName(), + * SetFileName(), GetRelativeFileName(), SetRelativeFileName() and the methods in this section, all the + * other ones are not mandatory therefore could contain uninitialized or default data values. + * + */ + //@{ + /** Specify if this video object is holding the starting point of an image sequence. + * \param pImageSequence If \c true, this object is holding an image sequence. + * \remarks When this object is used as image sequence, the FBX SDK + * will automatically exclude it from the embedding mechanism. + */ + void SetImageSequence(bool pImageSequence); + + /** Get the current state of the ImageSequence property. + * \return ImageSequence property value. + */ + bool GetImageSequence() const; + + /** Specify the frame offset to be applied to the image sequence. + * \param pOffset The frame offset value. + */ + void SetImageSequenceOffset(int pOffset); + + /** Get the current value of the ImageSequenceOffset property. + * \return ImageSequenceOffset property value. + */ + int GetImageSequenceOffset() const; + //@} + + /** Retrieve the Frame rate of the video clip. + * \return Frame rate. + */ + double GetFrameRate() const; + + /** Retrieve the last frame of the video clip. + * \return Last frame number. + */ + int GetLastFrame() const; + + /** Retrieve the clip width. + * \return Video image width. + */ + int GetWidth() const; + + /** Retrieve the clip height. + * \return Video image height. + */ + int GetHeight() const; + + /** Set the start frame of the video clip. + * \param pStartFrame Start frame number. + * \remarks The parameter value is not checked. It is the responsibility + * of the caller to deal with bad frame numbers. + */ + void SetStartFrame(int pStartFrame); + + /** Retrieve the start frame of the video clip. + * \return Start frame number. + */ + int GetStartFrame() const; + + /** Set the stop frame of the video clip. + * \param pStopFrame Stop frame number. + * \remarks The parameter value is not checked. It is the responsibility + * of the caller to deal with bad frame numbers. + */ + void SetStopFrame(int pStopFrame); + + /** Retrieve the stop frame of the video clip. + * \return Stop frame number. + */ + int GetStopFrame() const; + + /** Video interlace modes. + */ + enum EInterlaceMode + { + eNone, //!< Progressive frame (full frame). + eFields, //!< Alternate even/odd fields. + eHalfEven, //!< Half of a frame, even fields only. + eHalfOdd, //!< Half of a frame, odd fields only. + eFullEven, //!< Extract and use the even field of a full frame. + eFullOdd, //!< Extract and use the odd field of a full frame. + eFullEvenOdd, //!< Extract eFields and make full frame with each one beginning with Odd (60fps). + eFullOddEven //!< Extract eFields and make full frame with each one beginning with Even (60fps). + }; + + /** Set the Interlace mode. + * \param pInterlaceMode Interlace mode identifier. + */ + void SetInterlaceMode(EInterlaceMode pInterlaceMode); + + /** Retrieve the Interlace mode. + * \return Interlace mode identifier. + */ + EInterlaceMode GetInterlaceMode() 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 +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + virtual bool ConnectNotify(FbxConnectEvent const &pEvent); + +public: + virtual FbxObject& Copy(const FbxObject& pObject); + + FbxPropertyT ImageSequence; + FbxPropertyT ImageSequenceOffset; + FbxPropertyT FrameRate; + FbxPropertyT LastFrame; + FbxPropertyT Width; + FbxPropertyT Height; + FbxPropertyT StartFrame; + FbxPropertyT StopFrame; + FbxPropertyT InterlaceMode; + +protected: + void Init(); + + bool mUseMipMap; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxVideo::EInterlaceMode&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_VIDEO_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxblendshape.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxblendshape.h new file mode 100644 index 00000000..1453bf34 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxblendshape.h @@ -0,0 +1,113 @@ +/**************************************************************************************** + + 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 fbxblendshape.h +#ifndef _FBXSDK_SCENE_GEOMETRY_BLEND_SHAPE_H_ +#define _FBXSDK_SCENE_GEOMETRY_BLEND_SHAPE_H_ + +#include + +#include + +#include + +class FbxGeometry; +class FbxBlendShapeChannel; + +/** Class for blend shape deformer. + * A blend shape deformer takes a base shape (polygonal surface, curve, or surface) + * and blends it with other target shapes based on weight values. + * Blend shape deformer organize all target shapes via blend shape channel. + * One blend shape deformer can contains multiple blend shape channels, then each + * channel can organize multiple target shapes, \see FbxBlendShapeChannel, FbxShape. + * \remarks The blend effect of each blend shape channel is additive, so the final blend + * effect of a blend shape deformer is the sum of blend effect of all blend shape + * channels it contains, the blend effect of each blend shape channel is controlled + * by the property DeformPercent of blend shape channel. + * \see FbxGeometry, FbxGeometryBase. + * \nosubgrouping + */ + +class FBXSDK_DLL FbxBlendShape : public FbxDeformer +{ + FBXSDK_OBJECT_DECLARE(FbxBlendShape, FbxDeformer); + +public: + /** Set the geometry affected by this blend shape deformer. + * \param pGeometry Pointer to the geometry object to set. + * \return \c true on success, \c false otherwise. + * \remarks One blend shape deformer can only be used on one base geometry. + * So when SetGeometry is called, the pGeometry will replace the + * current base geometry connected to this blend shape deformer. + */ + bool SetGeometry(FbxGeometry* pGeometry); + + /** Get the geometry affected by this blend shape deformer. + * \return A pointer to the geometry if it is set or \c NULL if not set yet. + */ + FbxGeometry* GetGeometry(); + + /** Add a blend shape channel. + * \param pBlendShapeChannel Pointer to the blend shape channel object to add. + * \return \c true on success, \c false otherwise. + */ + bool AddBlendShapeChannel(FbxBlendShapeChannel* pBlendShapeChannel); + + /** Remove the given blend shape. + * \param pBlendShapeChannel Pointer to the blend shape channel to remove from this blend shape deformer. + * \return Pointer to the blend shape channel or \c NULL if pBlendShapeChannel is not owned by this blend shape deformer. + */ + FbxBlendShapeChannel* RemoveBlendShapeChannel(FbxBlendShapeChannel* pBlendShapeChannel); + + /** Get the number of blend shape channels. + * \return Number of blend shape channels that have been added to this object. + */ + int GetBlendShapeChannelCount() const; + + /** Get blend shape channel at given index. + * \param pIndex Index of the blend shape channel. + * \return Pointer to the blend shape channel or \c NULL if index is out of range. + */ + FbxBlendShapeChannel* GetBlendShapeChannel(int pIndex); + + /** Get the blend shape channel at given index. + * \param pIndex Index of the blend shape channel. + * \return Pointer to the blend shape channel or \c NULL if index is out of range. + */ + const FbxBlendShapeChannel* GetBlendShapeChannel(int pIndex) const; + + /** Get the type of the deformer. + * \return The deformer type identifier of blend shape deformer. + */ + EDeformerType GetDeformerType() const {return eBlendShape; }; + + /** Restore the blend shape deformer to the initial state. + * Calling this function will do the following: + * \li Clear the pointer to base geometry. + * \li Remove all the blend shape channels. + */ + void Reset(); + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; + +protected: + virtual FbxStringList GetTypeFlags() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_BLEND_SHAPE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxblendshapechannel.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxblendshapechannel.h new file mode 100644 index 00000000..49e99ec0 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxblendshapechannel.h @@ -0,0 +1,148 @@ +/**************************************************************************************** + + 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 fbxblendshapechannel.h +#ifndef _FBXSDK_SCENE_GEOMETRY_BLEND_SHAPE_CHANNEL_H_ +#define _FBXSDK_SCENE_GEOMETRY_BLEND_SHAPE_CHANNEL_H_ + +#include + +#include + +#include + +class FbxShape; +class FbxBlendShape; + +/** Class for blend shape channels. + * A blend shape channel is a sub-deformer to help blend shape deformer to organize the target shapes. + * One blend shape deformer can have multiple blend shape channels in parallel, and each of them can + * control one or multiple target shapes. If there are multiple target shapes connected to one channel, + * each target shape could have its own full deformation percentage. For example, given a channel that + * has 3 target shapes, whose full deform percentage are 30, to 80 to 100 separately, then when the percent + * changes from 0 to 100, the base geometry will deform from the first target shape to the last one. + * This is called in-between blend shapes or progressive morph. + * The property DeformPercent of blend shape channel will control the deform level of each target shape or + * in-between blend shape on it. + *\nosubgrouping + */ +class FBXSDK_DLL FbxBlendShapeChannel : public FbxSubDeformer +{ + FBXSDK_OBJECT_DECLARE(FbxBlendShapeChannel, FbxSubDeformer); + +public: + /** This property stores deform percent of this channel. + * The default value of this property is 0.0. + * + * \remark Although not enforced, it is strongly suggested to limit the value of this property + * in the range from 0.0 to 100.0 because graphic applications may handle values outside of this + * interval differently, therefore producing unexpected results. + */ + FbxPropertyT DeformPercent; + + /** Set the blend shape deformer that contains this blend shape channel. + * \param pBlendShape Pointer to the blend shape deformer to set. + * \return \c true on success, \c false otherwise. + */ + bool SetBlendShapeDeformer(FbxBlendShape* pBlendShape); + + /** Get the blend shape deformer that contains this blend shape channel. + * \return A pointer to the blend shape deformer if set or NULL. + */ + FbxBlendShape* GetBlendShapeDeformer(); + + /** Add a target shape. + * \param pShape Pointer to the target shape to add. + * \param pFullDeformPercent The full deform percentage for the target shape. + * \return \c true on success, \c false otherwise. + */ + bool AddTargetShape(FbxShape* pShape, double pFullDeformPercent = 100); + + /** Remove the given target shape. + * \param pShape Pointer to the target shape to remove from this blend shape channel. + * \return Pointer to the target shape or \c NULL if pShape is not owned by this blend shape channel. + */ + FbxShape* RemoveTargetShape(FbxShape* pShape); + + /** Get the number of target shapes. + * \return Number of target shapes that have been added to this blend shape channel. + */ + int GetTargetShapeCount() const; + + /** Get the target shape at given index. + * \param pIndex Index of the target shape. + * \return Pointer to the target shape or \c NULL if index is out of range. + */ + FbxShape* GetTargetShape(int pIndex); + + /** Get the target shape at given index. + * \param pIndex Index of the target shape. + * \return Pointer to the target shape or \c NULL if index is out of range. + */ + const FbxShape* GetTargetShape(int pIndex) const; + + /** Get the index of the given target shape. + * \param pShape The given target shape to find index. + * \return The index of the target shape. + */ + int GetTargetShapeIndex( FbxShape* pShape); + + /** Get the full weight values of target shape. + * To access each value iterate in the array up to GetTargetShapeCount(). + * \return The array of full weight values of target shape. + */ + double* GetTargetShapeFullWeights(); + + /** Set the array size for the fully deform weights. + * This functions pre-allocate the array to pCount size. + * \param pCount The new array size to set. + */ + void SetFullWeightsCount(int pCount); + + /** + * \name General Functions + */ + //@{ + /** Get the type of the sub deformer. + * \return The sub deformer type identifier of blend shape channel. + */ + EType GetSubDeformerType() const {return eBlendShapeChannel; }; + + /** Restore the blend shape channel to the initial state. + * Calling this function will do the following: + * \li Set the DeformPercent to 0. + * \li Remove all target shapes. + * \li Clear the array for fully deform weights of in-between target shapes. + */ + void Reset(); + + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + + virtual FbxStringList GetTypeFlags() const; + + //The full weights array of each shapes on this blend shape channel + FbxArray mShapeFullWeightArray; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_BLEND_SHAPE_CHANNEL_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxcache.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxcache.h new file mode 100644 index 00000000..503ddef2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxcache.h @@ -0,0 +1,461 @@ +/**************************************************************************************** + + 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 fbxcache.h +#ifndef _FBXSDK_SCENE_GEOMETRY_CACHE_H_ +#define _FBXSDK_SCENE_GEOMETRY_CACHE_H_ + +#include + +#include +#include + +#include + +class FbxCache_internal; + +/** This object contains methods for accessing point animation in a cache file. +* The FBX SDK supports three point cache file formats : +* - \e eMaxPointCacheV2: the 3ds Max Point Cache 2 file format. +* - \e eMayaCache: the Maya Cache file format. +* - \e eAlembic: Alembic Cache file format. +* +* Accessing cache data using these formats differs significantly. To address this difference, several sets of methods have been created. +* Use the GetCacheFileFormat() function to determine which set of methods to use. */ +class FBXSDK_DLL FbxCache : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxCache, FbxObject); + +public: + //! \name Format Independent Functions. + //@{ + /** Supported cache file formats. */ + enum EFileFormat + { + eUnknownFileFormat, //!< Unknown cache file format. + eMaxPointCacheV2, //!< 3ds Max Point Cache 2 file format. + eMayaCache, //!< Maya Cache file format. + eAlembic //!< Alembic Cache file format. + }; + + /** Set the cache file format. + * \param pFileFormat Valid values are \e eMaxPointCacheV2 or \e eMayaCache. + * \param pStatus The FbxStatus object to hold error codes. */ + void SetCacheFileFormat(EFileFormat pFileFormat, FbxStatus* pStatus=NULL); + + /** Get the cache file format. + * \return The current cache file format, or \e eUnknown if it is not set. */ + EFileFormat GetCacheFileFormat() const; + + /** Set the cache file name. + * \param pRelativeFileName_UTF8 The point cache file, relative to the FBX file name. + * \param pAbsoluteFileName_UTF8 The point cache file absolute path. + * \param pStatus The FbxStatus object to hold error codes. */ + void SetCacheFileName(const char* pRelativeFileName_UTF8, const char* pAbsoluteFileName_UTF8, FbxStatus* pStatus=NULL); + + /** Get the cache file name. + * \param pRelativeFileName_UTF8 Return the point cache file name, relative to the FBX File name. + * \param pAbsoluteFileName_UTF8 Return the point cache file absolute path. */ + void GetCacheFileName(FbxString& pRelativeFileName_UTF8, FbxString& pAbsoluteFileName_UTF8) const; + + /** Open the cache file for reading. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the file is successfully opened, \c false otherwise. */ + bool OpenFileForRead(FbxStatus* pStatus=NULL); + + /** Get the open state of the cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the cache file is currently open, \c false otherwise. */ + bool IsOpen(FbxStatus* pStatus=NULL) const; + + /** Read data from the cache file. + * \param pBuffer The buffer containing the data from the cache file. This parameter can be NULL if interested to get buffer length only. + * \param pBufferLength The length of the buffer (NOT in bytes). + * \param pTime The time at which the data should be read. + * \param pChannel The cache file channel to read, when multiple channels are available. + * \return \c True if the cache data was successfully read, \c false otherwise. + * \remark The buffer will be allocated by FbxCache and will be returned if read successful. The buffer will be freed by FbxCache upon its destruction. */ + bool Read(float** pBuffer, unsigned int& pBufferLength, const FbxTime& pTime, unsigned int pChannel=0); + + /** Close the cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the cache file is closed successfully, \c false otherwise. */ + bool CloseFile(FbxStatus* pStatus=NULL); + + /** Get the sampling frame rate of the cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return The sampling frame rate of the cache file, in frames per second. */ + double GetSamplingFrameRate(FbxStatus* pStatus=NULL); + + /** Get the sampling frame rate of the cache file, as a FbxTime object. + * \param pStatus The FbxStatus object to hold error codes. + * \return The sampling frame rate of the cache file. */ + FbxTime GetCacheTimePerFrame(FbxStatus* pStatus=NULL); + + /** Get the number of channels in the cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return The number of animation channels in the cache file. */ + int GetChannelCount(FbxStatus* pStatus=NULL); + + /** Get the channel name for a specific channel index. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pChannelName Returns the name of the requested channel. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetChannelName(int pChannelIndex, FbxString& pChannelName, FbxStatus* pStatus=NULL); + //@} + + //! \name eMayaCache Format Specific Functions. + //@{ + //! Number of files used to store the animation. + enum EMCFileCount + { + eMCOneFile, //!< One file is used for all the frames of animation. + eMCOneFilePerFrame //!< For every frame of animation, a cache file is used. The number of the frames is the number of the cache files. + }; + + //! Data types in the MC cache file. + enum EMCDataType + { + eUnknownData, //!< Unknown data. + eDouble, //!< No use but has to be defined for consistency reasons. + eDoubleArray, //!< double* + eDoubleVectorArray, //!< double* [3] + eInt32Array, //!< int* + eFloatArray, //!< float* + eFloatVectorArray //!< float* [3] + }; + + //! Binary cache format. + enum EMCBinaryFormat + { + eMCC, //!< MCC cache file format, 32bit (older format) + eMCX //!< MCX cache file format, 64bit (newer format) + }; + + //! Cache channel sampling types. + enum EMCSamplingType + { + eSamplingRegular, //!< Regular sampling. + eSamplingIrregular //!< Irregular sampling. + }; + + /** Open a cache file for writing. + * \param pFileCount Create one file for each frame of animation, or one file for all the frames. + * \param pSamplingFrameRate Number of frames per second. + * \param pChannelName The name of the channel of animation to create. + * \param pBinaryFormat Binary format type (32 bit=eMCC or 64bit=eMCX) + * \param pMCDataType The data type of the MC cache file. + * \param pInterpretation A piece of meta data to help users of the cache understand how to interpret the data. + * \param pStatus The FbxStatus object to hold error codes. */ + bool OpenFileForWrite(EMCFileCount pFileCount, double pSamplingFrameRate, const char* pChannelName, EMCBinaryFormat pBinaryFormat, EMCDataType pMCDataType=eDoubleVectorArray, const char* pInterpretation="Points", FbxStatus* pStatus=NULL); + + /** Creates a new channel in the cache. + * \param pChannelName The name of the channel of animation to create. + * \param pMCDataType The MC DataType of the cache. + * \param pInterpretation A piece of meta data to help users of the cache understand how to interpret the data. + * \param pChannelIndex The index of the new animation channel. + * \param pStatus The FbxStatus object to hold error codes. + * \remark \b pChannelName must be unique within the cache. + * \remark \b pChannelName and \b pInterpretation cannot be NULL pointers. + * \remark This method must be called before adding any data to the cache but after the OpenFileForWrite. */ + bool AddChannel(const char* pChannelName, EMCDataType pMCDataType, const char* pInterpretation, unsigned int& pChannelIndex, FbxStatus* pStatus=NULL); + + /** Get the data type of the specified channel. + * \param pChannelIndex The index of the channel. + * \param pChannelType The channel's data type. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetChannelDataType(int pChannelIndex, EMCDataType& pChannelType, FbxStatus* pStatus=NULL); + + /** Get the index of the specified channel. + * \param pChannelName The name of the channel. + * \param pStatus The FbxStatus object to hold error codes. + * \return The index of the channel in the cache file, or -1 if an error occurred. */ + int GetChannelIndex(const char* pChannelName, FbxStatus* pStatus=NULL); + + /** Read a sample at a given time. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pTime Time at which the point animation must be evaluated. + * \param pBuffer The place where the point value will be copied. If the channel's data type is DoubleVectorArray this buffer must be of size 3*pPointCount. + * \param pPointCount The number of points to read from the point cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool Read(int pChannelIndex, FbxTime& pTime, double* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL); + + /** Read a sample at a given time. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pTime Time at which the point animation must be evaluated. + * \param pBuffer The place where the point value will be copied. If the channel's data type is FloatVectorArray this buffer must be of size 3*pPointCount. + * \param pPointCount The number of points to read from the point cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool Read(int pChannelIndex, FbxTime& pTime, float* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL); + + /** Read a sample at a given time. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pTime Time at which the point animation must be evaluated. + * \param pBuffer The place where the point value will be copied. This buffer must be of size pPointCount. + * \param pPointCount The number of points to read from the point cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool Read(int pChannelIndex, FbxTime& pTime, int* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL); + + /** Instruct the cache system that data is about to be written to it. This call must appear before any calls to the Write() methods on any channel and terminated by a call to EndWriteAt(). + * \param pTime Time at which the point animation must be inserted. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool BeginWriteAt( FbxTime& pTime, FbxStatus* pStatus=NULL ); + + /** Write a sample at a given time. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pTime Time at which the point animation must be inserted. + * \param pBuffer Point to the values to be copied. If the channel's data type is DoubleVectorArray this buffer must be of size 3*pPointCount. + * \param pPointCount The number of points to write in the point cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. + * \remark This method will fail if the time \e pTime is different from the time set using the call BeginWriteAt(). + * \remark For backward compatibility reasons you can still call this method without the prior call to BeginWriteAt() + * only if this cachedsystem has been defined with one channel. Any other configuration will result in a failure. */ + bool Write(int pChannelIndex, FbxTime& pTime, double* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL); + + /** Write a sample at a given time. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pTime Time at which the point animation must be inserted. + * \param pBuffer Point to the values to be copied. If the channel's data type is FloatVectorArray this buffer must be of size 3*pPointCount. + * \param pPointCount The number of points to write in the point cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. + * \remark This method will fail if the time \e pTime is different from the time set using the call BeginWriteAt(). + * \remark For backward compatibility reasons you can still call this method without the prior call to BeginWriteAt() + * only if this cached system has been defined with one channel. Any other configuration will result in a failure. */ + bool Write(int pChannelIndex, FbxTime& pTime, float* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL); + + /** Write a sample at a given time. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pTime Time at which the point animation must be inserted. + * \param pBuffer Point to the values to be copied. This buffer must be of size pPointCount. + * \param pPointCount The number of points to write in the point cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. + * \remark This method will fail if the time \e pTime is different from the time set using the call BeginWriteAt(). + * \remark For backward compatibility reasons you can still call this method without the prior call to BeginWriteAt() + * only if this cached system has been defined with one channel. Any other configuration will result in a failure. */ + bool Write(int pChannelIndex, FbxTime& pTime, int* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL); + + /** Instruct the cache system that all the data on all the channels has been written to it for the given time (specified + * by the BeginWriteAt() call). The call to this method must be made after all the Write() for every channel defined. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool EndWriteAt(FbxStatus* pStatus=NULL); + + /** Get the Animation Range of the specified channel. + * \param pChannelIndex The index of the channel. + * \param pTimeStart The start time of the channel's animation. + * \param pTimeEnd The end time of the channel's animation. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetAnimationRange(int pChannelIndex, FbxTime &pTimeStart, FbxTime &pTimeEnd, FbxStatus* pStatus=NULL); + + /** Get the cache type. + * \param pFileCount The cache type. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetCacheType(EMCFileCount& pFileCount, FbxStatus* pStatus=NULL); + + /** Get the cache channel interpretation. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pInterpretation The channel interpretation, user-defined. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetChannelInterpretation(int pChannelIndex, FbxString& pInterpretation, FbxStatus* pStatus=NULL); + + /** Get the cache channel sampling type. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pSamplingType The sampling type of the channel. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetChannelSamplingType(int pChannelIndex, EMCSamplingType& pSamplingType, FbxStatus* pStatus=NULL); + + /** Get the cache channel sampling rate, in frames per second. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pSamplingRate The sampling rate of the channel. The channel must have a regular sampling type. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetChannelSamplingRate(int pChannelIndex, FbxTime& pSamplingRate, FbxStatus* pStatus=NULL); + + /** Get the number of data points for a channel. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pSampleCount Number of available samples. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetChannelSampleCount(int pChannelIndex, unsigned int& pSampleCount, FbxStatus* pStatus=NULL); + + /** Get the number of points animated in the cache file, for a channel, for a given time. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pTime Reference time; must be within the boundaries of the animation. + * \param pPointCount Number of available points. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetChannelPointCount(int pChannelIndex, FbxTime pTime, unsigned int& pPointCount, FbxStatus* pStatus=NULL); + + /** Returns the number of cache data files. + * \param pStatus The FbxStatus object to hold error codes. + * \return The count returned does not include the main cache file, and depends on the cache type. Will return -1 if point cache support is not enabled. */ + int GetCacheDataFileCount(FbxStatus* pStatus=NULL) const; + + /** Get the nth cache file name. + * \param pIndex Index of the cache file to return; index is zero-based, and must be less than GetCacheDataFileCount(). + * \param pRelativeFileName Return the point cache file name, relative to the FBX File name. + * \param pAbsoluteFileName Return the point cache file absolute path. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. See the error management functions for error details. */ + bool GetCacheDataFileName(int pIndex, FbxString& pRelativeFileName, FbxString& pAbsoluteFileName, FbxStatus* pStatus=NULL); + + /** Enable multi-channel fetching. + * \param pMultiChannelFetching Enable/disable multi-channel fetching. When multi-channel is enabled, any load of data on a channel at a specific + * time will pre-fetch data from all channels, for that specific time. This can reduce disk access, and increase performance (but requires more memory). + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool EnableMultiChannelFetching(bool pMultiChannelFetching, FbxStatus* pStatus=NULL); + + /** Get the next time where data is stored. + * \param pCurTime Current time; must be within the boundaries of the animation time. + * \param pNextTime Next time (filled if the function is successful). + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). If pChannel is left at -1, get the next time for any channel. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetNextTimeWithData(FbxTime pCurTime, FbxTime& pNextTime, int pChannelIndex = -1, FbxStatus* pStatus=NULL); + + /** Get the number of data points the channel contains. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pStatus The FbxStatus object to hold error codes. + * \return The number of the channel's data points. */ + int GetDataCount(int pChannelIndex, FbxStatus* pStatus=NULL); + + /** Get the time of the specified data point. + * \param pChannelIndex The index of the animation channel, between 0 and GetChannelCount(). + * \param pDataIndex Index of the data point. + * \param pTime Time of the data point (filled if the function is successful). + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool GetDataTime(int pChannelIndex, unsigned int pDataIndex, FbxTime& pTime, FbxStatus* pStatus=NULL); + //@} + + //! \name eMaxPointCacheV2 Format Specific Functions. + //@{ + /** Open a cache file for writing. + * \param pFrameStartOffset Start time of the animation, in frames. + * \param pSamplingFrameRate Number of frames per second. + * \param pSampleCount The number of samples to write to the file. + * \param pPointCount The number of points to write in the point cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. See the error management functions for error details. */ + bool OpenFileForWrite(double pFrameStartOffset, double pSamplingFrameRate, unsigned int pSampleCount, unsigned int pPointCount, FbxStatus* pStatus=NULL); + + /** Get the number of frames of animation found in the point cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return The number of frames of animation. + */ + unsigned int GetSampleCount(FbxStatus* pStatus=NULL); + + /** Get the number of points animated in the cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return The number of points. + */ + unsigned int GetPointCount(FbxStatus* pStatus=NULL); + + /** Get the start time of the animation + * \param pStatus The FbxStatus object to hold error codes. + * \return The start time of the animation, in frames. */ + double GetFrameStartOffset(FbxStatus* pStatus=NULL); + + /** Read a sample at a given frame index. + * \param pFrameIndex The index of the animation frame, between 0 and GetSampleCount(). + * \param pBuffer The place where the point value will be copied. This buffer must be of size 3 * pPointCount. + * \param pPointCount The number of points to read from the point cache file. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. */ + bool Read(unsigned int pFrameIndex, double* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL); + + /** Write a sample at a given frame index. + * \param pFrameIndex The index of the animation frame. + * \param pBuffer Point to the values to be copied. This buffer must be of size 3 * pPointCount, as passed to the function OpenFileForWrite(). + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. + * \remark Successive calls to Write() must use successive index. */ + bool Write(unsigned int pFrameIndex, double* pBuffer, FbxStatus* pStatus=NULL); + //@} + + //! \name File conversion Functions. + //@{ + /** Create an MC cache file from an PC2 cache file. + * \param pFileCount Create one file for each frame of animation, or one file for all the frames. + * \param pSamplingFrameRate Number of frames per second used to re-sample the point animation. + * \param pBinaryFormat Binary format type (32 bit=eMCC or 64bit=eMCX) + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. + * \remark The created point cache file will be located in the _fpc folder associate with the FBX file. */ + bool ConvertFromPC2ToMC(EMCFileCount pFileCount, double pSamplingFrameRate, EMCBinaryFormat pBinaryFormat, FbxStatus* pStatus=NULL); + + /** Create a PC2 cache file from an MC cache file. + * \param pSamplingFrameRate Number of frames per second to re-sample the point animation. + * \param pChannelIndex Index of the channel of animation to read from. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if successful, \c false otherwise. + * \remark The created point cache file will be located in the _fpc folder associate with the FBX file. */ + bool ConvertFromMCToPC2(double pSamplingFrameRate, unsigned int pChannelIndex, FbxStatus* pStatus=NULL); + //@} + +/***************************************************************************************************************************** +** 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 + enum EOpenFlag + { + eReadOnly, + eWriteOnly + }; + +protected: + bool OpenFile(EOpenFlag pFlag, EMCFileCount pFileCount, double pSamplingFrameRate, const char* pChannelName, const char* pInterpretation, unsigned int pSampleCount, unsigned int pPointCount, double pFrameStartOffset, FbxStatus* pStatus, EMCDataType pMCDataType = eDoubleVectorArray, EMCBinaryFormat pBinaryFormat = eMCX); + + virtual void Construct( const FbxObject* pFrom ); + virtual void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); + + FbxCache_internal* mData; + +private: + bool AllocateReadBuffer(unsigned int pTypeSize, unsigned int pTypeLength, unsigned int pLength, bool pAllocateConvertBuffer); + bool ReadMayaCache(float** pBuffer, unsigned int& pBufferLength, const FbxTime& pTime, unsigned int pChannel); + bool ReadMaxCache(float** pBuffer, unsigned int& pBufferLength, const FbxTime& pTime); + bool ReadAlembicCache(float** pBuffer, unsigned int& pBufferLength, const FbxTime& pTime, unsigned int pChannel); + + FbxPropertyT CacheFile; + FbxPropertyT CacheFileAbsolutePath; + FbxPropertyT CacheFileType; + + void* mReadBuffer; + unsigned int mReadBufferLength; + unsigned int mReadBufferSize; + unsigned int mReadTypeSize; + unsigned int mReadTypeLength; + unsigned int mReadLength; + void* mConvertBuffer; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxCache::EFileFormat&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_CACHE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxcachedeffect.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxcachedeffect.h new file mode 100644 index 00000000..bb179955 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxcachedeffect.h @@ -0,0 +1,100 @@ +/**************************************************************************************** + + 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 fbxcachedeffect.h +#ifndef _FBXSDK_SCENE_GEOMETRY_CACHED_EFFECT_H_ +#define _FBXSDK_SCENE_GEOMETRY_CACHED_EFFECT_H_ + +#include + +#include +#include + +#include + +/** A cached effect is a type of node attribute to represent certain type of effect + * by an cache object. Categories are particle cache, fluid cache, hair cache and general cache. + * \see ECategory for the effect types that are supported. + * \nosubgrouping + */ +class FBXSDK_DLL FbxCachedEffect : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxCachedEffect, FbxNodeAttribute); + +public: + //! Returns the FbxNodeAttribute::EType::eCachedEffect attribute type. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** Effect attribute category. This is for identification purpose and has + * no influence inside the FBX SDK. However, applications may use this to filter FbxCachedEffect + * objects. + * \remarks Vertex caches for deforming geometries are not handled by the FbxCachedEffect object. These + * caches are connected with the FbxVertexCacheDeformer object. + * \remarks If an object of this class is used as the default NodeAttribute for a FbxNode and the scene is + * saved to an FBX v6 and earlier versions, the CachedEffect attribute is not saved and the FbxNode will + * be processed as a FbxNull node with default values for the attribute. + */ + enum ECategory + { + eParticles, //!< This effect handles a particle cache. + eFluids, //!< This effect handles a fluid cache. + eHair, //!< This effect handles an hair cache. + eGeneric //!< This effect handles a cache other than particles, fluids or hair. + }; + + //! Return the specialization category of this effect attribute. + ECategory GetCategory() const; + + /** Assign a cache object to be used by this attribute. + * \param pCache The cache object. + * \param pCategory The type of this cached effect. + * \remarks The cache referenced by the \b pCache pointer can be freely shared among + * multiple FbxCachedEffect (and even the FbxVertexCacheDeformer) therefore + * \b pCategory identifier should really only used as a hint of what this FbxCachedEffect + * represents but it should not be taken for granted that the content of the cache really + * matches the category. Applications should always check the cache files to ensure that + * they are manipulating the desired information. + * + */ + void SetCache( FbxCache* pCache, ECategory pCategory = eGeneric); + + /** Get the cache object used by this node attribute. + * \return A pointer to the cache object used by this node attribute, or \c NULL if no cache object is assigned. + */ + FbxCache* GetCache() const; + +protected: + + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void ConstructProperties(bool pForceSet); + +public: + virtual const char* GetTypeName() const; + virtual FbxStringList GetTypeFlags() const; + +private: + void ClearCacheConnections(); + FbxPropertyT Category; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxCachedEffect::ECategory&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_CACHED_EFFECT_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxcamera.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxcamera.h new file mode 100644 index 00000000..ee2e6b51 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxcamera.h @@ -0,0 +1,1898 @@ +/**************************************************************************************** + + 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 fbxcamera.h +#ifndef _FBXSDK_SCENE_GEOMETRY_CAMERA_H_ +#define _FBXSDK_SCENE_GEOMETRY_CAMERA_H_ + +#include + +#include +#include +#include + +#include + +class FbxTexture; + +/** This node attribute contains methods for accessing the properties of a camera. + * \nosubgrouping + * A camera can be set to automatically point at and follow + * another node in the hierarchy. To do this, the focus source + * must be set to EFocusDistanceSource::eFocusSrcCameraInterest and the + * followed node associated with function FbxNode::SetTarget(). + * \see FbxCameraStereo and FbxCameraSwitcher. + */ +class FBXSDK_DLL FbxCamera : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxCamera,FbxNodeAttribute); + +public: + //! Return the type of node attribute which is EType::eCamera. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + //! Reset the camera to default values. + void Reset(); + + /** Camera projection types. + * \remarks By default, the camera projection type is set to ePerspective. + * If the camera projection type is set to eOrthogonal, the following options + * are not relevant: + * - aperture format + * - aperture mode + * - aperture width and height + * - angle of view/focal length + * - squeeze ratio + */ + enum EProjectionType + { + ePerspective, //!< Perspective projection. + eOrthogonal //!< Orthogonal projection. + }; + + /** + * \name Functions to handle the viewing area. + */ + //@{ + /** Camera formats identifiers. + * \remarks This is designed as the same as in MotionBuilder. + * \see SetFormat, GetFormat and CameraFormat. + */ + enum EFormat + { + eCustomFormat, //!< The format's width, height, or pixel ratio has been user-specified, and matches none of the other picture formats. + eD1NTSC, //!< Standard format for D1 NTSC (720 by 486). + eNTSC, //!< NTSC standard for North American television broadcast (640 by 480). + ePAL, //!< PAL standard for European television broadcast (570 by 486). + eD1PAL, //!< Standard format for D1 PAL (720 by 576). + eHD, //!< HD format(1920 by 1080). + e640x480, //!< Recommended computer screen format (640 by 480). + e320x200, //!< Recommended format for World Wide Web production(320 by 200). + e320x240, //!< Alternate World Wide Web format(320 by 240). + e128x128, //!< Format(128 by 128) + eFullscreen //!< Full computer screen format (1280 by 1024 pixels). + }; + + /** Set the camera format. + * \param pFormat The camera format identifier. + * \remarks Changing the camera format sets the camera aspect + * ratio mode to eFixedResolution and modifies the aspect width + * size, height size, and pixel ratio accordingly. + */ + void SetFormat(EFormat pFormat); + + /** Get the camera format. + * \return The current camera format identifier. + */ + EFormat GetFormat() const; + + /** Camera's aspect ratio modes. + * \see SetAspect, GetAspectRatioMode, AspectWidth, AspectHeight and AspectRatioMode. + */ + enum EAspectRatioMode + { + eWindowSize, //!< Both width and height values aren't relevant. + eFixedRatio, //!< The height value is set to 1.0 and the width value is relative to the height value. + eFixedResolution, //!< Both width and height values are in pixels. + eFixedWidth, //!< The width value is in pixels and the height value is relative to the width value. + eFixedHeight //!< The height value is in pixels and the width value is relative to the height value. + }; + + /** Set the camera's aspect ratio mode. + * \param pRatioMode Camera's aspect ratio mode. + * \param pWidth Camera's aspect width, must be a positive value. + * \param pHeight Camera's aspect height, must be a positive value. + * \remarks Changing the camera aspect sets the camera format to eCustomFormat. + * \see EAspectRatioMode. + */ + void SetAspect(EAspectRatioMode pRatioMode, double pWidth, double pHeight); + + /** Get the camera aspect ratio mode. + * \return The current aspect ratio mode. + */ + EAspectRatioMode GetAspectRatioMode() const; + + /** Set the pixel ratio. + * \param pRatio The pixel ratio value. + * \remarks The value must be a positive number. Comprised between 0.05 and 20.0. Values + * outside these limits will be clamped. Changing the pixel ratio sets the camera format to eCustomFormat. + */ + void SetPixelRatio(double pRatio); + + /** Get the pixel ratio. + * \return The current camera's pixel ratio value. + */ + double GetPixelRatio() const; + + /** Set the near plane distance from the camera. + * The near plane is the minimum distance to render a scene on the camera display. + * A synonym for the near plane is "front clipping plane". + * \param pDistance The near plane distance value. + * \remarks The near plane value is limited to the range [0.001, 600000.0] and + * must be inferior to the far plane value. + */ + void SetNearPlane(double pDistance); + + /** Get the near plane distance from the camera. + * The near plane is the minimum distance to render a scene on the camera display. + * A synonym for the near plane is "front clipping plane". + * \return The near plane value. + */ + double GetNearPlane() const; + + /** Set the far plane distance from camera. + * The far plane is the maximum distance to render a scene on the camera display. + * A synonym for the far plane is "back clipping plane". + * \param pDistance The far plane distance value. + * \remarks The far plane value is limited to the range [0.001, 600000.0] and + * must be superior to the near plane value. + */ + void SetFarPlane(double pDistance); + + /** Get the far plane distance from camera. + * The far plane is the maximum distance to render a scene on the camera display. + * A synonym for the far plane is "back clipping plane". + * \return The far plane value. + */ + double GetFarPlane() const; + + //@} + + /** + * \name Aperture and Film Functions. + * In photography, the aperture is the size of hole allowing light from the lens to get through to the film. + * The aperture mode determines which values drive the camera aperture. When the aperture mode is \e eHorizAndVert, + * \e eHorizontal or \e eVertical, the field of view is used. When the aperture mode is \e eFocalLength, the focal length is used. + * + * It is possible to convert the aperture mode into field of view or vice versa using functions ComputeFieldOfView and + * ComputeFocalLength. These functions use the camera aperture width and height for their computation. + */ + //@{ + + /** Camera's aperture formats. + * \remarks This is designed as the same as in MotionBuilder. + * \see SetApertureFormat, GetApertureFormat, FilmFormat, FilmWidth, FilmHeight, FilmSqueezeRatio and FilmAspectRatio. + */ + enum EApertureFormat + { + eCustomAperture, //!< The film size, squeeze ratio and aspect ratio has been user-specified, and matches none of the other aperture formats. + e16mmTheatrical, //!< Film Size: 0.404, 0.295 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 1.369. + eSuper16mm, //!< Film Size: 0.493, 0.292 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 1.688. + e35mmAcademy, //!< Film Size: 0.864, 0.630 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 1.371. + e35mmTVProjection, //!< Film Size: 0.816, 0.612 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 1.333. + e35mmFullAperture, //!< Film Size: 0.980, 0.735 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 1.333. + e35mm185Projection, //!< Film Size: 0.825, 0.446 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 1.850. + e35mmAnamorphic, //!< Film Size: 0.864, 0.732 inches. Film Squeeze Ratio: 2.0. Film Aspect Ratio:1.180. + e70mmProjection, //!< Film Size: 2.066, 0.906 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 2.280. + eVistaVision, //!< Film Size: 1.485, 0.991 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 1.498. + eDynaVision, //!< Film Size: 2.080, 1.480 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 1.405. + eIMAX //!< Film Size: 2.772, 2.072 inches. Film Squeeze Ratio: 1.0. Film Aspect Ratio: 1.338. + }; + + /** Set the camera aperture format. + * \param pFormat The camera aperture format identifier. + * \remarks Changing the aperture format modifies the aperture width, height, and squeeze ratio accordingly. + */ + void SetApertureFormat(EApertureFormat pFormat); + + /** Get the camera aperture format. + * \return The camera's current aperture format identifier. + */ + EApertureFormat GetApertureFormat() const; + + /** Camera aperture modes. + * The aperture mode determines which values drive the camera aperture. + * If the aperture mode is \e eHorizAndVert, \e eHorizontal, or \e eVertical, then the field of view is used. + * If the aperture mode is \e eFocalLength, then the focal length is used. + */ + enum EApertureMode + { + eHorizAndVert, //!< Set the angle values for both the horizontal and vertical settings. + eHorizontal, //!< Set only the horizontal angle. + eVertical, //!< Set only the vertical angle. + eFocalLength //!< Use focal length directly. + }; + + /** Set the camera aperture mode. + * \param pMode The camera aperture mode identifier. + */ + void SetApertureMode(EApertureMode pMode); + + /** Get the camera aperture mode. + * \return The camera's current aperture mode identifier. + */ + EApertureMode GetApertureMode() const; + + /** Set the camera aperture width in inches. + * \param pWidth The aperture width value. + * \remarks Must be a positive value. The minimum accepted value is 0.0001. + * Changing the aperture width sets the camera aperture format to eCustomFormat. + */ + void SetApertureWidth(double pWidth); + + /** Get the camera aperture width in inches. + * \return The camera's current aperture width value in inches. + */ + double GetApertureWidth() const; + + /** Set the camera aperture height in inches. + * \param pHeight The aperture height value. + * \remarks Must be a positive value. The minimum accepted value is 0.0001. + * Changing the aperture height sets the camera aperture format to eCustomFormat. + */ + void SetApertureHeight(double pHeight); + + /** Get the camera aperture height in inches. + * \return The camera's current aperture height value in inches. + */ + double GetApertureHeight() const; + + /** Set the squeeze ratio. + * \param pRatio The squeeze ratio value. + * \remarks Must be a positive value. The minimum accepted value is 0.0001. + * Changing the squeeze ratio sets the camera aperture format to eCustomFormat. + */ + void SetSqueezeRatio(double pRatio); + + /** Get the camera squeeze ratio. + * \return The camera's current squeeze ratio value. + */ + double GetSqueezeRatio() const; + + /** Camera's gate fit modes. + * There are two gates for a camera, film gate and resolution gate. + * Film gate is a border indicating the area of the camera's view as a real-world camera records on film. + * The dimensions of the film gate represent the dimensions of the camera aperture. + * But the film gate does not represent the render region. + * It is the resolution gate that represents the rendering resolution. + * The gate fit mode controls the size of the resolution gate relative to the film gate. + */ + enum EGateFit + { + eFitNone, //!< No resolution gate fit. + eFitVertical, //!< Fit the resolution gate vertically within the film gate. + eFitHorizontal, //!< Fit the resolution gate horizontally within the film gate. + eFitFill, //!< Fit the resolution gate within the film gate. + eFitOverscan, //!< Fit the film gate within the resolution gate. + eFitStretch //!< Fit the resolution gate to the film gate. + }; + + /** Compute the angle of view based on the given focal length, the aperture width, and aperture height. + * \param pFocalLength The focal length in millimeters. + * \return The computed angle of view in degrees. + * \remark If aperture mode is not vertical, horizontal is assumed. + */ + double ComputeFieldOfView(double pFocalLength) const; + + /** Compute the focal length based on the given angle of view, the aperture width, and aperture height. + * \param pAngleOfView The angle of view in degrees. + * \return The computed focal length in millimeters. + * \remark If aperture mode is not vertical, horizontal is assumed. + */ + double ComputeFocalLength(double pAngleOfView) const; + + /** Specifies how the roll is applied with respect to the pivot value. + */ + enum EFilmRollOrder + { + eRotateFirst, //!< The film back is first rotated then translated by the pivot point value. + eTranslateFirst //!< The film back is first translated then rotated by the film roll value. + }; + + //@} + + /** + * \name Functions to handle BackPlane/FrontPlane and Plate. + * + * In the FbxSdk terminology, the Back/Front plane is the support of the plate. And the plate is + * the support of the texture used for backgrounds/foregrounds. Functions and properties + * identified by the "Plate" name are affecting the display of the texture on the plate. + * The functions and properties identified with the "Back/FrontPlane" are affecting the plate. + * + * Typically a client application would place the BackPlate a small distance in front of the + * FarPlane and the FrontPlate just behind the NearPlane to avoid them to be hidden by the clipping. + * Unless otherwise noted, there are no restrictions on the values stored by the camera object + * therefore it is the responsibility of the client application to process the information in a + * meaningful way and to maintain consistency between the different properties relationships. + */ + //@{ + + /** Set the associated background image file. + * \param pFileName The path of the background image file. + * \remarks The background image file name must be valid. + * \remarks This method is still provided just for legacy files (Fbx version 5.0 and earlier) + * and must not be used in any other cases. + */ + void SetBackgroundFileName(const char* pFileName); + + /** Get the background image file name. + * \return Pointer to the background filename string or \c NULL if not set. + * \remarks This method is still provided just for legacy files (Fbx version 5.0 and earlier) + * and must not be used in any other cases. + */ + const char* GetBackgroundFileName() const; + + /** Set the media name associated to the background image file. + * \param pFileName The media name of the background image file. + * \remarks The media name is a unique name used to identify the background image file. + * \remarks This method is still provided just for legacy files (Fbx version 5.0 and earlier) + * and must not be used in any other cases. + */ + void SetBackgroundMediaName(const char* pFileName); + + /** Get the media name associated to the background image file. + * \return Pointer to the media name string or \c NULL if not set. + * \remarks This method is still provided just for legacy files (Fbx version 5.0 and earlier) + * and must not be used in any other cases. + */ + const char* GetBackgroundMediaName() const; + + /** Set the associated foreground image file. + * \param pFileName The path of the foreground image file. + * \remarks The foreground image file name must be valid. + * \remarks This method is still provided just for legacy files (Fbx version 5.0 and earlier) + * and must not be used in any other cases. + */ + void SetForegroundFileName(const char* pFileName); + + /** Get the foreground image file name. + * \return Pointer to the foreground filename string or \c NULL if not set. + * \remarks This method is still provided just for legacy files (Fbx version 5.0 and earlier) + * and must not be used in any other cases. + */ + const char* GetForegroundFileName() const; + + /** Set the media name associated to the foreground image file. + * \param pFileName The media name of the foreground image file. + * \remarks The media name is a unique name used to identify the foreground image file. + * \remarks This method is still provided just for legacy files (Fbx version 5.0 and earlier) + * and must not be used in any other cases. + */ + void SetForegroundMediaName(const char* pFileName); + + /** Get the media name associated to the foreground image file. + * \return Pointer to the media name string or \c NULL if not set. + * \remarks This method is still provided just for legacy files (Fbx version 5.0 and earlier) + * and must not be used in any other cases. + */ + const char* GetForegroundMediaName() const; + + + /** Image plate drawing modes. + */ + enum EPlateDrawingMode + { + ePlateBackground, //!< Image is drawn behind models. + ePlateForeground, //!< Image is drawn in front of models based on alpha channel. + ePlateBackAndFront //!< Image is drawn behind and in front of models depending on alpha channel. + }; + + /** Set front plate matte threshold. + * \param pThreshold Threshold value on a range from 0.0 to 1.0. + * \remarks This option is only relevant if the image plate drawing mode is set to ePlateForeground or ePlateBackAndFront. + */ + void SetBackgroundAlphaTreshold(double pThreshold); + + /** Get front plate matte threshold. + * \return Threshold value on a range from 0.0 to 1.0. + * \remarks This option is only relevant if the image plate drawing mode is set to ePlateForeground or ePlateBackAndFront. + */ + double GetBackgroundAlphaTreshold() const; + + /** Change the back plate fit image flag. + * If this flag is on, scale the back plate image to fit on the back plane. + * \param pFitImage New value for the BackPlateFitImage property. + */ + void SetBackPlateFitImage(bool pFitImage); + + /** Get the current back plate image flag. + * If this flag is on, scale the back plate image to fit on the back plane. + * \return The value of the BackPlateFitImage property. + */ + bool GetBackPlateFitImage() const; + + /** Change the back plate crop flag. + * If this flag is on, crop the back plate image to fit on the back plane. + * If the image is smaller than the plane, this flag has no effect. + * \param pCrop New value for the BackPlateCrop property. + */ + void SetBackPlateCrop(bool pCrop); + + /** Get the current back plate crop flag. + * If this flag is on, crop the back plate image to fit on the back plane. + * If the image is smaller than the plane, this flag has no effect. + * \return The value of the BackPlateCrop property. + */ + bool GetBackPlateCrop() const; + + /** Change the back plate center flag. + * If this flag is on, center the back plate image on the back plane. + * \param pCenter New value for the BackPlateCenter property. + */ + void SetBackPlateCenter(bool pCenter); + + /** Get the current back plate center flag. + * If this flag is on, center the back plate image on the back plane. + * \return The value of the BackPlateCenter property. + */ + bool GetBackPlateCenter() const; + + /** Change the back plate keep ratio flag. + * If this flag is on, keep the aspect ratio of the back plate image. + * Turn on both the keep ration flag and the fit image flag to scale the back plate image proportionately. + * \param pKeepRatio New value for the BackPlateKeepRatio property. + */ + void SetBackPlateKeepRatio(bool pKeepRatio); + + /** Get the current back plate keep ratio flag. + * If this flag is on, keep the aspect ratio of the back plate image. + * Turn on both the keep ration flag and the fit image flag to scale the back plate image proportionately. + * \return The value of the BackPlateKeepRatio property. + */ + bool GetBackPlateKeepRatio() const; + + /** Enable or disable the display of the texture without the need to disconnect it from its plate. + * \param pEnable If \c true the texture is displayed, \c false otherwise. + * \remarks It is the responsibility of the client application to perform the required tasks according to the state + * of this flag. + */ + void SetShowFrontPlate(bool pEnable); + + /** Get the current state of the flag to display the front plate or not. + * \return \c true if show front plate is enabled, otherwise \c false. + * \remarks It is the responsibility of the client application to perform the required tasks according to the state + * of this flag. + */ + bool GetShowFrontPlate() const; + + /** Change the front plate fit image flag. + * If this flag is on, scale the front plate image to fit on the front plane. + * \param pFrontPlateFitImage New value for the FrontPlateFitImage property. + */ + void SetFrontPlateFitImage(bool pFrontPlateFitImage); + + /** Get the current front plate fit image flag. + * If this flag is on, scale the front plate image to fit on the front plane. + * \return The value of the BackPlateFitImage property. + */ + bool GetFrontPlateFitImage() const; + + /** Change the front plate crop flag. + * If this flag is on, crop the front plate image to fit on the front plane. + * If the image is smaller than the plane, this flag has no effect. + * \param pFrontPlateCrop New value for the FrontPlateCrop property. + */ + void SetFrontPlateCrop(bool pFrontPlateCrop); + + /** Get the current front plate crop flag. + * If this flag is on, crop the front plate image to fit on the front plane. + * If the image is smaller than the plane, this flag has no effect. + * \return The value of the FrontPlateCrop property. + */ + bool GetFrontPlateCrop() const; + + /** Change the front plate center flag. + * If this flag is on, center the front plate image on the front plane. + * \param pFrontPlateCenter New value for the FrontPlateCenter property. + */ + void SetFrontPlateCenter(bool pFrontPlateCenter); + + /** Get the current front plate center flag. + * If this flag is on, center the front plate image on the front plane. + * \return The value of the FrontPlateCenter property. + */ + bool GetFrontPlateCenter() const; + + /** Change the front plate keep ratio flag. + * If this flag is on, keep the aspect ratio of the front plate image. + * Turn on both the keep ration flag and the fit image flag to scale the front plate image proportionately. + * \param pFrontPlateKeepRatio New value for the FrontPlateKeepRatio property. + */ + void SetFrontPlateKeepRatio(bool pFrontPlateKeepRatio); + + /** Get the current front plate keep ratio flag. + * If this flag is on, keep the aspect ratio of the front plate image. + * Turn on both the keep ration flag and the fit image flag to scale the front plate image proportionately. + * \return The value of the FrontPlateKeepRatio property. + */ + bool GetFrontPlateKeepRatio() const; + + /** Set the front plate opacity value. + * \param pOpacity New value for the ForegroundOpacity property. + */ + void SetForegroundOpacity(double pOpacity); + + /** Get the front plate opacity value. + * \return The value of the ForegroundOpacity property. + */ + double GetForegroundOpacity() const; + + /** Attach the texture to the front plate. + * \param pTexture The pointer to the texture to attach. + */ + void SetForegroundTexture(FbxTexture* pTexture); + + /** Get the texture connected to the front plate. + * \return A pointer to the texture attached to front plate. + */ + FbxTexture* GetForegroundTexture() const; + + /** Front and BackPlane distance modes. + * \see SetBackPlaneDistanceMode and GetBackPlaneDistanceMode. + */ + enum EFrontBackPlaneDistanceMode + { + eRelativeToInterest, //!< The back plane distance is measured in relation to the camera interest. + eRelativeToCamera //!< The back plane distance is measured in relation to the camera. + }; + + /** Set the back plane distance mode. + * \param pMode The back plane distance mode to set. + */ + void SetBackPlaneDistanceMode(EFrontBackPlaneDistanceMode pMode); + + /** Get the back plane distance mode. + * \return Return the back plane distance mode. + */ + EFrontBackPlaneDistanceMode GetBackPlaneDistanceMode() const; + + /** Set the front plane distance from the camera. The the absolute position of the plane must be calculated + * by taking into consideration of the FrontPlaneDistanceMode. + * \param pDistance The front plane distance value. + * \remarks It is the responsibility of the client application to ensure that this plane position is + * within the frustum boundaries. + */ + void SetFrontPlaneDistance(double pDistance); + + /** Get the front plane distance value. + * \return double The front plane distance value. + */ + double GetFrontPlaneDistance() const; + + /** Set the front plane distance mode. + * \param pMode The front plane distance mode to set. + */ + void SetFrontPlaneDistanceMode(EFrontBackPlaneDistanceMode pMode); + + /** Get the front plane distance mode flag. + * \return The front plane distance mode. + */ + EFrontBackPlaneDistanceMode GetFrontPlaneDistanceMode() const; + + /** Front/back plane display modes. + */ + enum EFrontBackPlaneDisplayMode + { + ePlanesDisabled, //!< Disables the front/back plane whether a texture is being projected or not. + ePlanesAlways, //!< Always shows the front/back plane, even if no texture has been added. + ePlanesWhenMedia //!< Shows the front/back plane only if a texture has been added. + }; + + /** Set the front plane display mode. This mode can be used by the client application to + * decide under which circumstance the front plane should be drawn in the viewport. + * \param pMode The front/back plane display mode. + */ + void SetViewFrustumFrontPlaneMode(EFrontBackPlaneDisplayMode pMode); + + /** Get the front plane display mode. + * \return The front/back plane display mode. + */ + EFrontBackPlaneDisplayMode GetViewFrustumFrontPlaneMode() const; + + /** Set the back plane display mode. This mode can be used by the client application to + * decide under which circumstance the back plane should be drawn in the viewport. + * \param pMode The front/back plane display mode. + */ + void SetViewFrustumBackPlaneMode(EFrontBackPlaneDisplayMode pMode); + + /** Get the back plane display mode. + * \return The front/back plane display mode. + */ + EFrontBackPlaneDisplayMode GetViewFrustumBackPlaneMode() const; + + //@} + + /** + * \name Camera View Functions + * It is the responsibility of the client application to perform the required tasks according to the state + * of the options that are either set or returned by these methods. + */ + //@{ + + /** Change the camera interest visibility flag. + * \param pEnable Set to \c true if the camera interest is shown, \c false otherwise. + */ + void SetViewCameraInterest(bool pEnable); + + /** Get current visibility state of the camera interest. + * \return \c true if the camera interest is shown, or \c false if hidden. + */ + bool GetViewCameraInterest() const; + + /** Change the camera near and far planes visibility flag. + * \param pEnable Set to \c true if the near and far planes are shown, \c false otherwise. + */ + void SetViewNearFarPlanes(bool pEnable); + + /** Get current visibility state of the camera near and far planes. + * \return \c true if the near and far planes are shown, \c false otherwise. + */ + bool GetViewNearFarPlanes() const; + + /** Camera safe area display styles. + */ + enum ESafeAreaStyle + { + eSafeAreaRound, //!< Rounded safe area. + eSafeAreaSquare //!< Square safe area. + }; + + //@} + + /** + * \name Render Functions + * It is the responsibility of the client application to perform the required tasks according to the state + * of the options that are either set or returned by these methods. + */ + //@{ + + /** Render options usage time. + */ + enum ERenderOptionsUsageTime + { + eInteractive, //!< To render in real time. + eOnDemand //!< Only render when it is asked. + }; + + /** Anti-aliasing methods. + */ + enum EAntialiasingMethod + { + eAAOversampling, //!< To do anti-aliasing by oversampling. + eAAHardware //!< To do anti-aliasing by hardware. + }; + + /** Oversampling types for anti-aliasing. + */ + enum ESamplingType + { + eSamplingUniform, /*!< The Uniform method samples each pixel at the same location. + The pixel is divided into equal parts, and each part is sampled. + The number of samples determines the number of times the pixel is divided. */ + eSamplingStochastic /*!< The Stochastic method randomly samples each pixel. + This produces an accurate color using a small number of samples. */ + }; + + /** Camera focus sources, that is the focal point for the depth of field. + * \see FocusDistance. + */ + enum EFocusDistanceSource + { + eFocusSrcCameraInterest, /*!< Base the depth of field on the camera interest. Models at the camera interest are in focus. + As you move toward or away from the camera interest, models become increasingly blurred. */ + eFocusSpecificDistance //!< Base the depth of field on a point defined by a specific distance from the camera interest. + }; + + //@} + + //! \name Utility Functions. + //@{ + /** Evaluate the camera position (eye). + * \param pTime The time at which the camera should be evaluated. + * \return The camera position evaluated from property value and animation. */ + FbxVector4 EvaluatePosition(const FbxTime& pTime=FBXSDK_TIME_ZERO) const; + + /** Evaluate the camera target position (look at). + * \param pTime The time at which the camera should be evaluated. + * \return The camera target position evaluated from property value and animation. */ + FbxVector4 EvaluateLookAtPosition(const FbxTime& pTime=FBXSDK_TIME_ZERO) const; + + /** Evaluate the camera up direction, taking target up objects into consideration. + * \param pCameraPosition The camera current position. You can retrieve this with FbxCamera::EvaluatePosition(). + * \param pLookAtPosition The camera target position. you can retrieve this with FbxCamera::EvaluateLookAtPosition(). + * \param pTime The time at which the camera should be evaluated. + * \return The camera up direction vector based on provided information. */ + FbxVector4 EvaluateUpDirection(const FbxVector4& pCameraPosition, const FbxVector4& pLookAtPosition, const FbxTime& pTime=FBXSDK_TIME_ZERO) const; + + /** Compute the camera projection matrix. + * \param pWidth The width of the output frame. + * \param pHeight The height of the output frame. + * \param pVerticalFOV Calculate FOV vertically (based on height) if true or horizontally (based on width) if false (Note: Only applicable in perspective proj). + * \return The camera projection matrix, or the default identity matrix in case of wrong camera parameters. */ + FbxMatrix ComputeProjectionMatrix(const int pWidth, const int pHeight, const bool pVerticalFOV = true) const; + + /** Determine if the given bounding box is in the camera's view. The input points do not need to be ordered in any particular way. + * \param pWorldToScreen The world to screen transformation. Please refer to FbxCamera::ComputeWorldToScreen. + * \param pWorldToCamera The world to camera transformation. Inverse of the matrix returned from FbxAnimEvaluator::GetNodeGlobalTransform is suitable. + * Please refer to FbxScene::GetEvaluator and FbxAnimEvaluator::GetNodeGlobalTransform. + * \param pPoints 8 corners of the bounding box. + * \return \c true if any of the given points are in the camera's view, \c false otherwise. */ + bool IsBoundingBoxInView(const FbxMatrix& pWorldToScreen, const FbxMatrix& pWorldToCamera, const FbxVector4 pPoints[8]) const; + + /** Determine if the given 3d point is in the camera's view. + * \param pWorldToScreen The world to screen transformation. Please refer to FbxCamera::ComputeWorldToScreen. + * \param pWorldToCamera The world to camera transformation. Inverse of the matrix returned from FbxAnimEvaluator::GetNodeGlobalTransform is suitable. + * Please refer to FbxScene::GetEvaluator and FbxAnimEvaluator::GetNodeGlobalTransform. + * \param pPoint World-space point to test. + * \return \c true if the given point is in the camera's view, \c false otherwise. */ + bool IsPointInView(const FbxMatrix& pWorldToScreen, const FbxMatrix& pWorldToCamera, const FbxVector4& pPoint) const; + + /** Compute world space to screen space transformation matrix. + * \param pPixelHeight The pixel height of the output image. + * \param pPixelWidth The pixel height of the output image. + * \param pWorldToCamera The world to camera affine transformation matrix. + * \return The world to screen space matrix, or the identity matrix on error. */ + FbxMatrix ComputeWorldToScreen(int pPixelWidth, int pPixelHeight, const FbxAMatrix& pWorldToCamera) const; + + /** Compute screen space to world space ray direction. + * \param pX The horizontal screen coordinate. + * \param pY The vertical screen coordinate. + * \param pWidth The width of the viewport in pixels. + * \param pHeight The height of the viewport in pixels. + * \param pTime The time to use to evaluate the camera's view matrix. + * \return a normalized vector corresponding to the ray direction. */ + FbxVector4 ComputeScreenToWorld(float pX, float pY, float pWidth, float pHeight, const FbxTime& pTime=FBXSDK_TIME_INFINITE) const; + //@} + + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + + // ----------------------------------------------------------------------- + // Geometrical + // ----------------------------------------------------------------------- + + /** This property handles the camera's position (XYZ coordinates). + * + * To access this property do: Position.Get(). + * To set this property do: Position.Set(FbxDouble3). + * + * \remarks Default Value is (0.0, 0.0, 0.0). + */ + FbxPropertyT Position; + + /** This property handles the camera's Up Vector (XYZ coordinates). + * + * To access this property do: UpVector.Get(). + * To set this property do: UpVector.Set(FbxDouble3). + * + * \remarks Default Value is (0.0, 1.0, 0.0). + */ + FbxPropertyT UpVector; + + /** This property handles the default point (XYZ coordinates) the camera is looking at. + * + * To access this property do: InterestPosition.Get(). + * To set this property do: InterestPosition.Set(FbxDouble3). + * + * \remarks During the computations of the camera position + * and orientation, this property is overridden by the + * position of a valid target in the parent node. + * + * \remarks Default Value is (0.0, 0.0, 0.0). + */ + FbxPropertyT InterestPosition; + + /** This property handles the camera roll angle in degrees. + * + * To access this property do: Roll.Get(). + * To set this property do: Roll.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT Roll; + + /** This property handles the camera optical center X, in pixels. + * It sets horizontal offset of the optical center. + * When the camera's aperture mode is set to \e eVertical, this property has no effect. + * + * To access this property do: OpticalCenterX.Get(). + * To set this property do: OpticalCenterX.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT OpticalCenterX; + + /** This property handles the camera optical center Y, in pixels. + * It sets the vertical offset of the optical center. + * When the camera's aperture mode is set to \e eHorizontal, this property has no effect. + * + * To access this property do: OpticalCenterY.Get(). + * To set this property do: OpticalCenterY.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT OpticalCenterY; + + /** This property handles the RGB values of the camera's background color. + * + * To access this property do: BackgroundColor.Get(). + * To set this property do: BackgroundColor.Set(FbxDouble3). + * + * Default value is black (0, 0, 0) + */ + FbxPropertyT BackgroundColor; + + /** When modeling 3D objects, you often need to review or evaluate your models during the creation process. + * You may create a camera with turn table animation to view your models in 360 or certain degrees. + * This property handles the camera's turn table angle in degrees. + * + * To access this property do: TurnTable.Get(). + * To set this property do: TurnTable.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT TurnTable; + + /** This property handles a flag that indicates if the camera displays the + * Turn Table icon or not. + * + * To access this property do: DisplayTurnTableIcon.Get(). + * To set this property do: DisplayTurnTableIcon.Set(FbxBool). + * + * Default value is false (no display). + */ + FbxPropertyT DisplayTurnTableIcon; + + // ----------------------------------------------------------------------- + // Motion Blur + // ----------------------------------------------------------------------- + + /** This property handles a flag that indicates if the camera uses + * motion blur or not. + * + * To access this property do: UseMotionBlur.Get(). + * To set this property do: UseMotionBlur.Set(FbxBool). + * + * Default value is false (do not use motion blur). + */ + FbxPropertyT UseMotionBlur; + + /** This property handles a flag that indicates if the camera uses + * real time motion blur or not. + * + * To access this property do: UseRealTimeMotionBlur.Get(). + * To set this property do: UseRealTimeMotionBlur.Set(FbxBool). + * + * Default value is false (use real time motion blur). + */ + FbxPropertyT UseRealTimeMotionBlur; + + /** This property handles the camera's motion blur intensity (in pixels). + * + * To access this property do: MotionBlurIntensity.Get(). + * To set this property do: MotionBlurIntensity.Set(FbxDouble). + * + * Default value is 1.0. + */ + FbxPropertyT MotionBlurIntensity; + + // ----------------------------------------------------------------------- + // Optical + // ----------------------------------------------------------------------- + + /** This property handles the camera's aspect ratio mode. + * + * \remarks This property is read-only. + * \remarks Please use function SetAspect() if you want to change its value. + * + * Default value is eWindowSize. + * + */ + FbxPropertyT AspectRatioMode; + + /** This property handles the camera's aspect width. + * + * \remarks This property is read-only. + * \remarks Please use function SetAspect() if you want to change its value. + * + * Default value is 320. + */ + FbxPropertyT AspectWidth; + + /** This property handles the camera's aspect height. + * + * \remarks This property is read-only. + * \remarks Please use function SetAspect() if you want to change its value. + * + * Default value is 200. + */ + FbxPropertyT AspectHeight; + + /** This property handles the pixel aspect ratio. + * + * \remarks This property is read-only. + * \remarks Please use function SetPixelRatio() if you want to change its value. + * + * Default value is 1. + * \remarks Value range is [0.050, 20.0]. + */ + FbxPropertyT PixelAspectRatio; + + /** This property handles the aperture mode. + * + * To access this property do: ApertureMode.Get(). + * To set this property do: ApertureMode.Set(EApertureMode). + * + * Default value is eVertical. + */ + FbxPropertyT ApertureMode; + + /** This property handles the gate fit mode. + * To control the size of the resolution gate relative to the film gate. + * If the resolution gate and the film gate have the same aspect ratio, then the property has no effect. + * + * To access this property do: GateFit.Get(). + * To set this property do: GateFit.Set(EGateFit). + * + * Default value is eFitNone. + */ + FbxPropertyT GateFit; + + /** This property handles the field of view in degrees. + * + * To access this property do: FieldOfView.Get(). + * To set this property do: FieldOfView.Set(FbxDouble). + * + * \remarks This property has meaning only when + * property ApertureMode equals eHorizontal or eVertical. + * + * \remarks Default value is 40. + * \remarks Value range is [1.0, 179.0]. + */ + FbxPropertyT FieldOfView; + + /** This property handles the X (horizontal) field of view in degrees. + * + * To access this property do: FieldOfViewX.Get(). + * To set this property do: FieldOfViewX.Set(FbxDouble). + * + * \remarks This property has meaning only when + * property ApertureMode equals eHorizAndVert. + * + * Default value is 1. + * \remarks Value range is [1.0, 179.0]. + */ + FbxPropertyT FieldOfViewX; + + /** This property handles the Y (vertical) field of view in degrees. + * + * To access this property do: FieldOfViewY.Get(). + * To set this property do: FieldOfViewY.Set(FbxDouble). + * + * \remarks This property has meaning only when + * property ApertureMode equals eHorizAndVert. + * + * \remarks Default value is 1. + * \remarks Value range is [1.0, 179.0]. + */ + FbxPropertyT FieldOfViewY; + + /** This property handles the focal length (in millimeters). + * + * To access this property do: FocalLength.Get(). + * To set this property do: FocalLength.Set(FbxDouble). + * + * Default value is the result of ComputeFocalLength(40.0). + */ + FbxPropertyT FocalLength; + + /** This property handles the camera's format. + * + * To access this property do: CameraFormat.Get(). + * To set this property do: CameraFormat.Set(EFormat). + * + * \remarks This property is read-only. + * \remarks Please use function SetFormat() if you want to change its value. + * + * Default value is eCustomFormat. + */ + FbxPropertyT CameraFormat; + + // ----------------------------------------------------------------------- + // Frame + // ----------------------------------------------------------------------- + + /** This property stores a flag that indicates to draw a border with color around the camera's viewable area or not. + * To access this property do: UseFrameColor.Get(). + * To set this property do: UseFrameColor.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT UseFrameColor; + + /** This property is used to define the color of the border around the camera view. + * + * To access this property do: FrameColor.Get(). + * To set this property do: FrameColor.Set(FbxDouble3). + * + * Default value is (0.3, 0.3, 0.3). + */ + FbxPropertyT FrameColor; + + // ----------------------------------------------------------------------- + // On Screen Display + // ----------------------------------------------------------------------- + + /** This property handles the flag to show the camera's name or not. + * + * To access this property do: ShowName.Get(). + * To set this property do: ShowName.Set(FbxBool). + * + * Default value is true. + */ + FbxPropertyT ShowName; + + /** This property handles the flag to show info on moving or not. + * + * To access this property do: ShowInfoOnMoving.Get(). + * To set this property do: ShowInfoOnMoving.Set(FbxBool). + * + * Default value is true. + */ + FbxPropertyT ShowInfoOnMoving; + + /** This property handles the flag to draw floor grid or not. + * + * To access this property do: ShowGrid.Get(). + * To set this property do: ShowGrid.Set(FbxBool). + * + * Default value is true. + */ + FbxPropertyT ShowGrid; + + /** This property handles the flag to show optical center or not. + * + * To access this property do: ShowOpticalCenter.Get(). + * To set this property do: ShowOpticalCenter.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ShowOpticalCenter; + + /** This property handles the flag to show the camera's sight line or not. + * When the camera is revolved about the center of interest in the perspective view, + * the angle of a camera's sight line relative to a plane perpendicular to the ground plane is referred to as its azimuth; + * and the angle of a camera's sight line relative to the ground plane is referred to as its elevation; + * + * To access this property do: ShowAzimut.Get(). + * To set this property do: ShowAzimut.Set(FbxBool). + * + * Default value is true. + */ + FbxPropertyT ShowAzimut; + + /** This property handles the flag to show time code or not. + * + * To access this property do: ShowTimeCode.Get(). + * To set this property do: ShowTimeCode.Set(FbxBool). + * + * Default value is true. + */ + FbxPropertyT ShowTimeCode; + + /** This property handles the flag to show audio or not. + * + * To access this property do: ShowAudio.Get(). + * To set this property do: ShowAudio.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ShowAudio; + + /** This property handles audio color. + * + * To access this property do: AudioColor.Get(). + * To set this property do: AudioColor.Set(FbxDouble3). + * + * Default value is (0.0, 1.0, 0.0). + */ + FbxPropertyT AudioColor; + + // ----------------------------------------------------------------------- + // Clipping Planes + // ----------------------------------------------------------------------- + + /** This property handles the near plane distance. + * + * \remarks This property is read-only. + * \remarks Please use function SetNearPlane() if you want to change its value. + * + * Default value is 10. + * \remarks Value range is [0.001, 600000.0]. + */ + FbxPropertyT NearPlane; + + /** This property handles the far plane distance. + * + * \remarks This property is read-only. + * \remarks Please use function SetFarPlane() if you want to change its value. + * + * Default value is 4000. + * \remarks Value range is [0.001, 600000.0]. + */ + FbxPropertyT FarPlane; + + /** This property indicates that the clip planes should be automatically computed or not. + * + * To access this property do: AutoComputeClipPlanes.Get(). + * To set this property do: AutoComputeClipPlanes.Set(FbxBool). + * + * When this property is set to true, the NearPlane and FarPlane values are + * ignored. Note that not all applications support this flag. + */ + FbxPropertyT AutoComputeClipPlanes; + + + // ----------------------------------------------------------------------- + // Camera Film Setting + // ----------------------------------------------------------------------- + + /** This property handles the film aperture width (in inches). + * + * \remarks This property is read-only. + * \remarks Please use function SetApertureWidth() + * or SetApertureFormat() if you want to change its value. + * + * Default value is 0.8160. + * \remarks Value range is [0.0001, +inf). + */ + FbxPropertyT FilmWidth; + + /** This property handles the film aperture height (in inches). + * + * \remarks This property is read-only. + * \remarks Please use function SetApertureHeight() + * or SetApertureFormat() if you want to change its value. + * + * Default value is 0.6120. + * \remarks Value range is [0.0001, +inf). + */ + FbxPropertyT FilmHeight; + + /** This property handles the film aperture aspect ratio. + * + * \remarks This property is read-only. + * \remarks Please use function SetApertureFormat() if you want to change its value. + * + * Default value is (FilmWidth / FilmHeight). + * \remarks Value range is [0.0001, +inf). + */ + FbxPropertyT FilmAspectRatio; + + /** This property handles the film aperture squeeze ratio. + * + * \remarks This property is read-only. + * \remarks Please use function SetSqueezeRatio() + * or SetApertureFormat() if you want to change its value. + * + * Default value is 1.0. + * \remarks Value range is [0.0001, +inf). + */ + FbxPropertyT FilmSqueezeRatio; + + /** This property handles the film aperture format. + * + * \remarks This property is read-only. + * \remarks Please use function SetApertureFormat() + * if you want to change its value. + * + * Default value is eCustomAperture. + */ + FbxPropertyT FilmFormat; + + /** This property handles the horizontal offset from the center of the film aperture, + * defined by the film height and film width. The offset is measured in inches. + * + * To access this property do: FilmOffsetX.Get(). + * To set this property do: FilmOffsetX.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT FilmOffsetX; + + /** This property handles the vertical offset from the center of the film aperture, + * defined by the film height and film width. The offset is measured + * in inches. + * + * To access this property do: FilmOffsetY.Get(). + * To set this property do: FilmOffsetY.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT FilmOffsetY; + + /** This property handles the pre-scale value. + * The value is multiplied against the computed projection matrix. + * It is applied before the film roll. + * + * To access this property do: PreScale.Get(). + * To set this property do: PreScale.Set(FbxDouble). + * + * Default value is 1.0. + */ + FbxPropertyT PreScale; + + /** This property handles the horizontal film horizontal translation. + * To access this property do: FilmTranslateX.Get(). + * To set this property do: FilmTranslateX.Set(FbxDouble). + * Default value is 0.0 + */ + FbxPropertyT FilmTranslateX; + + /** This property handles the vertical film translation. + * + * To access this property do: FilmTranslateY.Get(). + * To set this property do: FilmTranslateY.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT FilmTranslateY; + + /** This property handles the horizontal pivot point used for rotating the film back. + * + * To access this property do: FilmRollPivotX.Get(). + * To set this property do: FilmRollPivotX.Set(FbxDouble). + * + * Default value is 0.0. + * \remarks FilmRollPivot value is used to compute the film roll matrix, which is a component of the post projection matrix. + */ + FbxPropertyT FilmRollPivotX; + + /** This property handles the vertical pivot point used for rotating the film back. + * + * To access this property do: FilmRollPivotY.Get(). + * To set this property do: FilmRollPivotY.Set(FbxDouble). + * + * Default value is 0.0. + * \remarks FilmRollPivot value is used to compute the film roll matrix, which is a component of the post projection matrix. + */ + FbxPropertyT FilmRollPivotY; + + /** This property handles the amount of rotation around the film back. + * The roll value is specified in degrees. + * + * To access this property do: FilmRollValue.Get(). + * To set this property do: FilmRollValue.Set(FbxDouble). + * + * Default value is 0.0. + * \remarks The rotation occurs around the specified pivot point, + * this value is used to compute a film roll matrix, which is a component of the post-projection matrix. + */ + FbxPropertyT FilmRollValue; + + /** This property handles how the roll is applied with respect to the pivot value. + * eRotateFirst The film back is first rotated then translated by the pivot point value. + * eTranslateFirst The film back is first translated then rotated by the film roll value. + * + * To access this property do: FilmRollOrder.Get(). + * To set this property do: FilmRollOrder.Set(EFilmRollOrder). + * + * Default value is eRotateFirst. + */ + FbxPropertyT FilmRollOrder ; + + // ----------------------------------------------------------------------- + // Camera View Widget Option + // ----------------------------------------------------------------------- + + /** This property handles the camera's look-at flag. + * If this flag is on, the camera will look at the camera interest. + * + * To access this property do: ViewCameraToLookAt.Get(). + * To set this property do: ViewCameraToLookAt.Set(FbxBool). + * + * Default value is true. + */ + FbxPropertyT ViewCameraToLookAt; + + /** This property handles to display the near and far plane or not. + * + * To access this property do: ViewFrustumNearFarPlane.Get(). + * To set this property do: ViewFrustumNearFarPlane.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ViewFrustumNearFarPlane; + + /** This property handles the back plane display mode. + * + * To access this property do: ViewFrustumBackPlaneMode.Get(). + * To set this property do: ViewFrustumBackPlaneMode.Set(EFrontBackPlaneDisplayMode). + * + * Default value is ePlanesWhenMedia. + */ + FbxPropertyT ViewFrustumBackPlaneMode; + + /** This property handles the back plane distance. + * + * To access this property do: BackPlaneDistance.Get(). + * To set this property do: BackPlaneDistance.Set(FbxDouble). + * + * Default value is 100.0. + */ + FbxPropertyT BackPlaneDistance; + + /** This property handles the back plane distance mode. + * + * To access this property do: BackPlaneDistanceMode.Get(). + * To set this property do: BackPlaneDistanceMode.Set(EFrontBackPlaneDistanceMode). + * + * Default value is eRelativeToInterest. + */ + FbxPropertyT BackPlaneDistanceMode; + + /** This property handles the front plane mode. + * + * To access this property do: ViewFrustumFrontPlaneMode.Get(). + * To set this property do: ViewFrustumFrontPlaneMode.Set(EFrontBackPlaneDisplayMode). + * + * Default value is ePlanesWhenMedia. + */ + FbxPropertyT ViewFrustumFrontPlaneMode; + + /** This property handles the front plane distance. + * + * To access this property do: FrontPlaneDistance.Get(). + * To set this property do: FrontPlaneDistance.Set(FbxDouble). + * + * Default value is 100.0. + */ + FbxPropertyT FrontPlaneDistance; + + /** This property handles the front plane distance mode. + * + * To access this property do: FrontPlaneDistanceMode.Get(). + * To set this property do: FrontPlaneDistanceMode.Set(EFrontBackPlaneDistanceMode). + * + * Default value is eRelativeToInterest. + */ + FbxPropertyT FrontPlaneDistanceMode; + + // ----------------------------------------------------------------------- + // Camera Lock Mode + // ----------------------------------------------------------------------- + + /** This property handles the flag to lock the camera's navigation. + * When this flag is on, the camera's view can not be changed anymore. + * To access this property do: LockMode.Get(). + * To set this property do: LockMode.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT LockMode; + + /** This property handles the flag to lock the camera interest's navigation. + * When this flag is one, the position of the camera interest is locked. + * To access this property do: LockInterestNavigation.Get(). + * To set this property do: LockInterestNavigation.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT LockInterestNavigation; + + // ----------------------------------------------------------------------- + // Background Image Display Options + // ----------------------------------------------------------------------- + + /** This property handles the fit image flag of back plane. + * + * To access this property do: BackPlateFitImage.Get(). + * To set this property do: BackPlateFitImage.Set(FbxBool). + * + * Default value is false. + * \see SetFitImage and GetFitImage. + */ + FbxPropertyT BackPlateFitImage; + + /** This property handles the crop flag of back plane. + * + * To access this property do: BackPlateCrop.Get(). + * To set this property do: BackPlateCrop.Set(FbxBool). + * + * Default value is false. + * \see SetCrop and GetCrop. + */ + FbxPropertyT BackPlateCrop; + + /** This property handles the center flag of back plane. + * + * To access this property do: BackPlateCenter.Get(). + * To set this property do: BackPlateCenter.Set(FbxBool). + * + * Default value is true. + * see SetCenter and GetCenter. + */ + FbxPropertyT BackPlateCenter; + + /** This property handles the keep ratio flag of back plane. + * + * To access this property do: BackPlateKeepRatio.Get(). + * To set this property do: BackPlateKeepRatio.Set(FbxBool). + * + * Default value is true. + * \see SetKeepRatio and GetKeepRatio. + */ + FbxPropertyT BackPlateKeepRatio; + + /** This property handles the background alpha threshold value. + * + * To access this property do: BackgroundAlphaTreshold.Get(). + * To set this property do: BackgroundAlphaTreshold.Set(FbxDouble). + * + * Default value is 0.5. + */ + FbxPropertyT BackgroundAlphaTreshold; + + /** This property handles the back plane offset X. + * + * To access this property do: BackPlaneOffsetX.Get(). + * To set this property do: BackPlaneOffsetX.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT BackPlaneOffsetX; + + /** This property handles the back plane offset Y. + * + * To access this property do: BackPlaneOffsetY.Get(). + * To set this property do: BackPlaneOffsetY.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT BackPlaneOffsetY; + + /** This property handles the back plane rotation. + * + * To access this property do: BackPlaneRotation.Get(). + * To set this property do: BackPlaneRotation.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT BackPlaneRotation; + + /** This property handles the back plane scaling X. + * + * To access this property do: BackPlaneScaleX.Get(). + * To set this property do: BackPlaneScaleX.Set(FbxDouble). + * + * Default value is 1.0. + * \remarks The application manipulating the camera has to take into consideration of + * the BackPlateKeepRatio value too. + */ + FbxPropertyT BackPlaneScaleX; + + /** This property handles the back plane scaling Y. + * + * To access this property do: BackPlaneScaleY.Get(). + * To set this property do: BackPlaneScaleY.Set(FbxDouble). + * + * Default value is 1.0. + * \remarks The application manipulating the camera has to take into consideration of + * the BackPlateKeepRatio value too. + */ + FbxPropertyT BackPlaneScaleY; + + /** This property handles the flag to show back plane or not. + * + * To access this property do: ShowBackPlate.Get(). + * To set this property do: ShowBackPlate.Set(FbxBool). + * + * Default value is false. + * \remarks This replaces ForegroundTransparent. + */ + FbxPropertyT ShowBackplate; + + /** This property has the background texture connected to it. + * + * To access this property do: BackgroundTexture.Get(). + * To set this property do: BackgroundTexture.Set(). + * + * \remarks The background texture is connected as source object. + */ + FbxPropertyT BackgroundTexture; + + + // ----------------------------------------------------------------------- + // Foreground Image Display Options + // ----------------------------------------------------------------------- + + /** This property handles the fit image flag of front plate. + * + * To access this property do: FrontPlateFitImage.Get(). + * To set this property do: FrontPlateFitImage.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT FrontPlateFitImage; + + /** This property handles the crop flag of front plane. + * + * To access this property do: FrontPlateCrop.Get(). + * To set this property do: FrontPlateCrop.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT FrontPlateCrop; + + /** This property handles the center flag of front plane. + * + * To access this property do: FrontPlateCenter.Get(). + * To set this property do: FrontPlateCenter.Set(FbxBool). + * + * Default value is true. + */ + FbxPropertyT FrontPlateCenter; + + /** This property handles the keep ratio flag of front plane. + * + * To access this property do: FrontPlateKeepRatio.Get(). + * To set this property do: FrontPlateKeepRatio.Set(FbxBool). + * + * Default value is true. + */ + FbxPropertyT FrontPlateKeepRatio; + + + /** This property handles the flag to show front plane or not. + * + * To access this property do: ShowFrontplate.Get(). + * To set this property do: ShowFrontplate.Set(FbxBool). + * + * Default value is false. + * \remarks This replaces ForegroundTransparent. + */ + FbxPropertyT ShowFrontplate; + + /** This property handles the front plane offset X. + * + * To access this property do: FrontPlaneOffsetX.Get(). + * To set this property do: FrontPlaneOffsetX.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT FrontPlaneOffsetX; + + /** This property handles the front plane offset Y. + * + * To access this property do: FrontPlaneOffsetY.Get(). + * To set this property do: FrontPlaneOffsetY.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT FrontPlaneOffsetY; + + /** This property handles the front plane rotation. + * + * To access this property do: FrontPlaneRotation.Get(). + * To set this property do: FrontPlaneRotation.Set(FbxDouble). + * + * Default value is 0.0. + */ + FbxPropertyT FrontPlaneRotation; + + /** This property handles the front plane scaling X. + * + * To access this property do: FrontPlaneScaleX.Get(). + * To set this property do: FrontPlaneScaleX.Set(FbxDouble). + * + * Default value is 1.0. + */ + FbxPropertyT FrontPlaneScaleX; + + /** This property handles the front plane scaling Y. + * + * To access this property do: FrontPlaneScaleY.Get(). + * To set this property do: FrontPlaneScaleY.Set(FbxDouble). + * + * Default value is 1.0. + */ + FbxPropertyT FrontPlaneScaleY; + + /** This property has the foreground texture connected to it. + * + * To access this property do: ForegroundTexture.Get(). + * To set this property do: ForegroundTexture.Set(). + * + * \remarks The foreground texture is connected as source object. + */ + FbxPropertyT ForegroundTexture; + + /** This property handles the foreground image opacity value. + * + * To access this property do: ForegroundOpacity.Get(). + * To set this property do: ForegroundOpacity.Set(FbxDouble). + * + * Default value is 1.0. + */ + FbxPropertyT ForegroundOpacity; + + // ----------------------------------------------------------------------- + // Safe Area + // ----------------------------------------------------------------------- + + /** This property handles the flag to display safe area or not. + * + * To access this property do: DisplaySafeArea.Get(). + * To set this property do: DisplaySafeArea.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT DisplaySafeArea; + + /** This property handles the flag display safe area on render or not. + * + * To access this property do: DisplaySafeAreaOnRender.Get(). + * To set this property do: DisplaySafeAreaOnRender.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT DisplaySafeAreaOnRender; + + /** This property handles the style to display safe area. + * + * To access this property do: SafeAreaDisplayStyle.Get(). + * To set this property do: SafeAreaDisplayStyle.Set(ESafeAreaStyle). + * + * Default value is eSafeAreaSquare. + */ + FbxPropertyT SafeAreaDisplayStyle; + + /** This property handles the display aspect ratio of safe area. + * + * To access this property do: SafeAreaDisplayStyle.Get(). + * To set this property do: SafeAreaAspectRatio.Set(FbxDouble). + * + * Default value is 1.33333333333333. + */ + FbxPropertyT SafeAreaAspectRatio; + + // ----------------------------------------------------------------------- + // 2D Magnifier + // ----------------------------------------------------------------------- + + /** This property handles the flag to use 2d magnifier zoom or not. + * The 2D Magnifier lets you perform a 2D enlargement of the scene using the + * current camera without changing any camera settings. + * + * To access this property do: Use2DMagnifierZoom.Get(). + * To set this property do: Use2DMagnifierZoom.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT Use2DMagnifierZoom; + + /** This property handles the 2d magnifier zoom value. + * + * To access this property do: _2DMagnifierZoom.Get(). + * To set this property do: _2DMagnifierZoom.Set(FbxDouble). + * + * Default value is 100.0. + */ + FbxPropertyT _2DMagnifierZoom; + + /** This property handles the 2d magnifier X value. + * + * To access this property do: _2DMagnifierX.Get(). + * To set this property do: _2DMagnifierX.Set(FbxDouble). + * + * Default value is 50.0. + */ + FbxPropertyT _2DMagnifierX; + + /** This property handles the 2d magnifier Y value. + * + * To access this property do: _2DMagnifierY.Get(). + * To set this property do: _2DMagnifierY.Set(FbxDouble). + * + * Default value is 50.0. + */ + FbxPropertyT _2DMagnifierY; + + // ----------------------------------------------------------------------- + // Projection Type: Ortho, Perspective + // ----------------------------------------------------------------------- + + /** This property handles the projection type. + * + * To access this property do: ProjectionType.Get(). + * To set this property do: ProjectionType.Set(EProjectionType). + * + * Default value is ePerspective. + */ + FbxPropertyT ProjectionType; + + /** This property handles the orthographic zoom value. + * + * To access this property do: OrthoZoom.Get(). + * To set this property do: OrthoZoom.Set(FbxDouble). + * + * Default value is 1.0. + */ + FbxPropertyT OrthoZoom; + + // ----------------------------------------------------------------------- + // Depth Of Field & Anti Aliasing + // ----------------------------------------------------------------------- + + /** This property handles the flag to use real time Depth of Field and Anti-Aliasing or not. + * + * To access this property do: UseRealTimeDOFAndAA.Get(). + * To set this property do: UseRealTimeDOFAndAA.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT UseRealTimeDOFAndAA; + + /** This property handles the flag to use depth of field or not. + * + * To access this property do: UseDepthOfField.Get(). + * To set this property do: UseDepthOfField.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT UseDepthOfField; + + /** This property handles the focus source. + * + * To access this property do: FocusSource.Get(). + * To set this property do: FocusSource.Set(EFocusDistanceSource). + * + * Default value is eFocusSrcCameraInterest. + * \see FocusDistance. + */ + FbxPropertyT FocusSource; + + /** This property handles the focus angle (in degrees). + * + * To access this property do: FocusAngle.Get(). + * To set this property do: FocusAngle.Set(FbxDouble). + * + * Default value is 3.5. + */ + FbxPropertyT FocusAngle; + + /** This property handles the focus distance. + * Focus distance is the distance between the camera and the object on which the camera is focused. + * There are two possible sources for this distance. + * \see EFocusDistanceSource + * + * To access this property do: FocusDistance.Get(). + * To set this property do: FocusDistance.Set(FbxDouble). + * + * Default value is 200.0. + */ + FbxPropertyT FocusDistance; + + /** This property handles the flag to use anti aliasing or not. + * + * To access this property do: UseAntialiasing.Get(). + * To set this property do: UseAntialiasing.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT UseAntialiasing; + + /** This property handles the anti aliasing intensity. + * + * To access this property do: AntialiasingIntensity.Get(). + * To set this property do: AntialiasingIntensity.Set(FbxDouble). + * + * Default value is 0.77777. + */ + FbxPropertyT AntialiasingIntensity; + + /** This property handles the anti aliasing method. + * + * To access this property do: AntialiasingMethod.Get(). + * To set this property do: AntialiasingMethod.Set(EAntialiasingMethod). + * + * Default value is eAAOversampling. + */ + FbxPropertyT AntialiasingMethod; + + // ----------------------------------------------------------------------- + // Accumulation Buffer + // ----------------------------------------------------------------------- + + /** This property handles the flag to use accumulation buffer or not. + * + * To access this property do: UseAccumulationBuffer.Get(). + * To set this property do: UseAccumulationBuffer.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT UseAccumulationBuffer; + + /** This property handles the frame sampling count. + * + * To access this property do: FrameSamplingCount.Get(). + * To set this property do: FrameSamplingCount.Set(FbxInt). + * + * Default value is 7. + */ + FbxPropertyT FrameSamplingCount; + + /** This property handles the frame sampling type. + * + * To access this property do: FrameSamplingType.Get(). + * To set this property do: FrameSamplingType.Set(ESamplingType). + * + * Default value is eSamplingStochastic. + */ + FbxPropertyT FrameSamplingType; + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void ConstructProperties(bool pForceSet); + virtual FbxStringList GetTypeFlags() const; + +private: + double ComputePixelRatio(FbxUInt pWidth, FbxUInt pHeight, double pScreenRatio = 1.3333333333); + + // Background Properties + FbxString mBackgroundMediaName; + FbxString mBackgroundFileName; + + // Foreground Properties + FbxString mForegroundMediaName; + FbxString mForegroundFileName; + + FbxVector4 mLastUp; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxCamera::EAntialiasingMethod&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EApertureFormat&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EApertureMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EAspectRatioMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EFrontBackPlaneDisplayMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EFrontBackPlaneDistanceMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EPlateDrawingMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EFocusDistanceSource&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EFormat&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EGateFit&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EProjectionType&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::ERenderOptionsUsageTime&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::ESafeAreaStyle&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::ESamplingType&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxCamera::EFilmRollOrder&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_CAMERA_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxcamerastereo.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxcamerastereo.h new file mode 100644 index 00000000..171b273d --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxcamerastereo.h @@ -0,0 +1,245 @@ +/**************************************************************************************** + + 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 fbxcamerastereo.h +#ifndef _FBXSDK_SCENE_GEOMETRY_CAMERA_STEREO_H_ +#define _FBXSDK_SCENE_GEOMETRY_CAMERA_STEREO_H_ + +#include + +#include + +#include + +/** This node attribute contains methods for accessing the properties of a stereo camera. + * \nosubgrouping + * Generally, a set of stereoRig contains the center camera, the left camera and the right camera. + * FbxCameraStereo is used to represent the center camera. The left and right camera could be FbxCamera. + * FbxCameraStereo contains stereo properties. + * The left and right camera can also be get and set via related methods in FbxCameraStereo class. + * \see FbxCamera and FbxCameraSwitcher. + */ +class FBXSDK_DLL FbxCameraStereo : public FbxCamera +{ + FBXSDK_OBJECT_DECLARE(FbxCameraStereo, FbxCamera); + +public: + //! Return the type of node attribute which is EType::eCameraStereo. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + //! Reset the stereo camera to default values. + void Reset(); + + /** Types of Stereo camera. + */ + enum EStereoType + { + eNone, //!< Disable the stereo effect.(Default value) + eConverged, //!< Computes the zero parallax plane by toeing in the cameras. + eOffAxis, //!< Computes the convergence plane by shifting the frustum using camera film back. + eParallel //!< A parallel camera setup where there is effectively no convergence plane. + }; + + /** Get the left camera which connect to property LeftCamera. + * \return A pointer to FbxCamera. + * \remarks Current FbxCameraStereo should work with two FbxCamera, left camera and right camera. + * Use this method to get the left camera. + */ + FbxCamera* GetLeftCamera() const; + + /** Get the right camera which connect to property RightCamera. + * \return A pointer to FbxCamera. + * \remarks Current FbxCameraStereo should work with two FbxCamera, left camera and right camera. + * Use this method to get the right camera. + */ + FbxCamera* GetRightCamera() const; + + /** Set the left camera, connect property LeftCamera to pCamera. + * \param pCamera The camera to set. + * \return \c true if it's successful, \c false otherwise. + * \remarks Current FbxCameraStereo should work with two FbxCamera, left camera and right camera. + * Use this method to set the left camera. + */ + bool SetLeftCamera(FbxCamera* pCamera); + + /** Set the right camera, connect property RightCamera to pCamera. + * \param pCamera The camera to set. + * \return \c true if it's successful, \c false otherwise. + * \remarks Current FbxCameraStereo should work with two FbxCamera, left camera and right camera. + * Use this method to set the right camera. + */ + bool SetRightCamera(FbxCamera* pCamera); + + /** Get the local transformation matrix of left camera. + * \return The local transformation matrix of left camera. + * \remarks Use this method to reevaluate the local transformation of left camera. + */ + FbxAMatrix GetLeftCameraLocalMatrix() const; + + /** Get the global matrix of left camera. + * \return The global transformation matrix of left camera. + * \remarks Use this method to reevaluate the global transformation of left camera. + */ + FbxAMatrix GetLeftCameraGlobalMatrix() const; + + /** Get the local transformation matrix of right camera. + * \return The local transformation matrix of right camera.. + * \remarks Use this method to reevaluate the local transformation of right camera. + */ + FbxAMatrix GetRightCameraLocalMatrix() const; + + /** Get the global transformation matrix of right camera. + * \return The global transformation matrix of right camera. + * \remarks Use this method to reevaluate the global transformation of right camera. + */ + FbxAMatrix GetRightCameraGlobalMatrix() const; + + /** Reevaluate the FilmOffsetX of left camera. + * It's computed through stereo camera properties. + * \return Current FilmOffsetX value. + * \remarks This method does not set the FilmOffsetX of left camera. + */ + double ReevaluateLeftCameraFilmOffsetX() const; + + /** Reevaluate the FilmOffsetX of right camera. + * It's computed through stereo camera properties. + * \return Current FilmOffsetX value. + * \remarks this method does not set the FilmOffsetX of right camera + */ + double ReevaluateRightCameraFilmOffsetX() const; + + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + + // ----------------------------------------------------------------------- + // Stereo and Stereo Adjustments + // ----------------------------------------------------------------------- + + /** This property handles the types of Stereo camera. + * + * To access this property do: Stereo.Get(). + * To set this property do: Stereo.Set(EStereoType). + * + * \remarks Default Value is eNone. + */ + FbxPropertyT Stereo; + + /** This property handles the distance between left and right cameras. + * + * To access this property do: InteraxialSeparation.Get(). + * To set this property do: InteraxialSeparation.Set(FbxDouble). + * + * \remarks Default Value is 0.0. + */ + FbxPropertyT InteraxialSeparation; + + /** This property handles the distance on the camera view axis where the zero parallax plane occurs. + * + * To access this property do: ZeroParallax.Get(). + * To set this property do: ZeroParallax.Set(FbxDouble). + * + * \remarks Default Value is 0.0. + */ + FbxPropertyT ZeroParallax; + + /** This property is to offset the computed toe-in effect when it's in Converged mode. + * + * To access this property do: ToeInAdjust.Get(). + * To set this property do: ToeInAdjust.Set(FbxDouble). + * + * \remarks Default Value is 0.0. + * This value is specified in degrees and acts as an offset to the computed toe-in. + * \see EStereoType. + */ + FbxPropertyT ToeInAdjust; + + /** This property handles the film offset for the right camera. + * + * To access this property do: FilmOffsetRightCam.Get(). + * To set this property do: FilmOffsetRightCam.Set(FbxDouble). + * + * \remarks Default Value is 0.0. + */ + FbxPropertyT FilmOffsetRightCam; + + /** This property handles the film offset for the left camera. + * + * To access this property do: FilmOffsetLeftCam.Get(). + * To set this property do: FilmOffsetLeftCam.Set(FbxDouble). + * + * \remarks Default Value is 0.0. + */ + FbxPropertyT FilmOffsetLeftCam; + + /** This property has the right camera connected to it. + * + * To access this property do: GetRightCamera(). + * To set this property do: SetRightCamera(FbxCamera* pCamera). + * + * \remarks The right camera is connected as source object. + */ + FbxPropertyT RightCamera; + + /** This property has the left camera connected to it. + * + * To access this property do: GetLeftCamera(). + * To set this property do: SetLeftCamera(FbxCamera* pCamera). + * + * \remarks The left camera is connected as source object. + */ + FbxPropertyT LeftCamera; + + /** This property handles the precomp file name + * + * To access this property do: PrecompFileName.Get(). + * To set this property do: PrecompFileName.Set(FbxString). + * + * Default value is "" + */ + FbxPropertyT PrecompFileName; + + /** This property handles the relative precomp file name + * + * To access this property do: RelativePrecompFileName.Get(). + * To set this property do: RelativePrecompFileName.Set(FbxString). + * + * Default value is "" + */ + FbxPropertyT RelativePrecompFileName; + + /** connect left and right camera property to stereo camera. + * \return true if it's successful, otherwise return false. + * \remarks It's used to connect the left/right camera property [FocalLength, FarPlane, NearPlane, FilmWidth, + * FilmHeight, FilmSqueezeRatio] to stereo camera. + * During FBX SDK reevaluating, if ConnectProperties is called, + * to get the newest FocalLength property of left camera, please use lLeft_Camera->FocalLength.GetSrcProperty(); + */ + bool ConnectProperties(); + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); + + virtual FbxStringList GetTypeFlags() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxCameraStereo::EStereoType&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_CAMERA_STEREO_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxcameraswitcher.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxcameraswitcher.h new file mode 100644 index 00000000..698b0378 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxcameraswitcher.h @@ -0,0 +1,101 @@ +/**************************************************************************************** + + 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 fbxcameraswitcher.h +#ifndef _FBXSDK_SCENE_GEOMETRY_CAMERA_SWITCHER_H_ +#define _FBXSDK_SCENE_GEOMETRY_CAMERA_SWITCHER_H_ + +#include + +#include +#include + +#include + +/** This node attribute contains methods for accessing the properties of a camera switcher. + * The camera switcher is a concept of Motion Builder. + * The camera switcher lets you switch between the custom cameras placed in your scene so you can create an animation using multiple camera angles. + * Custom cameras are cameras which created by users, while the default cameras are top, bottom, left, right, front, back and perspective camera. + * The Camera switcher contains the custom cameras you have created. If you have no custom cameras created in your scene, the Camera switcher is empty. + * Please read Motion Builder documentation for more details. + * \nosubgrouping + * \see FbxCamera and FbxCameraStereo. + */ +class FBXSDK_DLL FbxCameraSwitcher : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxCameraSwitcher,FbxNodeAttribute); + + public: + /** + * \name Properties + */ + //@{ + /** This property handles the index of camera. + * + * Default value is 1. + */ + FbxPropertyT CameraIndex; + //@} + + //! Return the type of node attribute which is EType::eCameraSwitcher. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** + * \name Default Animation Values. + * These functions provides direct access to default animation values specific to a camera switcher. The default animation + * values are found in the default take node of the associated node. These functions only work if the camera switcher has been + * associated with a node. + * + * 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. + */ + //@{ + + /** Get default camera index. + * \return Camera index. The return value is an integer between 1 and the number + * of cameras in the scene, or 0 if there are no default camera set in the camera switcher. + */ + int GetDefaultCameraIndex() const; + + /** Set default camera index. + * \param pIndex The index of the camera to set as default. This parameter has an integer + * scale from 1 to the number of cameras in the scene. Its default value is 1 if + * there is at least one camera in the camera switcher, 0 if there are none. + * No validation checks are made. + */ + void SetDefaultCameraIndex(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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void Destruct(bool pRecursive); + virtual void ConstructProperties(bool pForceSet); + +public: + void AddCameraName(char* pCameraName); + char* GetCameraName(FbxUInt pIndex) const; + FbxUInt GetCameraNameCount() const; + void ClearCameraNames(); + +protected: + FbxArray mCameraNameList; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_CAMERA_SWITCHER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxcluster.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxcluster.h new file mode 100644 index 00000000..be63c2f2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxcluster.h @@ -0,0 +1,295 @@ +/**************************************************************************************** + + 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 fbxcluster.h +#ifndef _FBXSDK_SCENE_GEOMETRY_CLUSTER_H_ +#define _FBXSDK_SCENE_GEOMETRY_CLUSTER_H_ + +#include + +#include + +#include + +/** Class for clusters (links). + * A cluster, or link, is an entity acting on a geometry (FbxGeometry). + * More precisely, the cluster acts on a subset of the geometry's control points. + * For each control point that the cluster acts on, the intensity of the cluster's + * action is modulated by a weight. The link mode (ELinkMode) specifies how + * the weights are taken into account. + * + * The cluster's link node specifies the node (FbxNode) that influences the + * control points of the cluster. If the node is animated, the control points + * will move accordingly. + * + * A cluster is usually part of a skin (\see FbxDeformer, FbxSkin). For example, + * imagine a mesh representing a humanoid, and imagine a skeleton made of bones. + * Each bone is represented by a node in FBX. + * To bind the geometry to the nodes, + * we create a skin (FbxSkin). The skin has many clusters, each one corresponding + * to a bone. + * Each node influences some control + * points of the mesh. A node has a high influence on some of the points (high weight) + * and lower influence on some other points (low weight). Some points of the mesh + * are not affected at all by the bone, so they would not be part of the corresponding + * cluster. + * + *\nosubgrouping + */ +class FBXSDK_DLL FbxCluster : public FbxSubDeformer +{ + FBXSDK_OBJECT_DECLARE(FbxCluster,FbxSubDeformer); + +public: + /** + * \name General Functions + */ + //@{ + /** Get the type of the sub deformer. + * \return SubDeformer type identifier: eCluster. + */ + EType GetSubDeformerType() const {return eCluster; }; + + /** Restore the cluster to its initial state. + * Calling this function will clear the following: + * \li Pointer to linked node. + * \li Pointer to associate model. + * \li Control point indices and weights. + * \li Transformation matrices. + */ + void Reset(); + //@} + /** + * \name Link Mode, Link Node, Associate Model + */ + //@{ + /** Link modes. + * The link mode sets how the link influences the position of a control + * point and the relationship between the weights assigned to a control + * point. The weights assigned to a control point are distributed among + * the set of links associated with an instance of class FbxGeometry. + */ + enum ELinkMode + { + eNormalize, /*!< In mode eNormalize, the sum of the weights assigned to a control point + is normalized to 1.0. Setting the associate model in this mode is not + relevant. The influence of the link is a function of the displacement of the + link node relative to the node containing the control points.*/ + eAdditive, + /*!< In mode eAdditive, the sum of the weights assigned to a control point + is kept as is. It is the only mode where setting the associate model is + relevant. The influence of the link is a function of the displacement of + the link node relative to the node containing the control points or, + if set, the associate model. The weight gives the proportional displacement + of a control point. For example, if the weight of a link over a control + point is set to 2.0, a displacement of the link node of 1 unit in the X + direction relative to the node containing the control points or, if set, + the associate model, triggers a displacement of the control point of 2 + units in the same direction.*/ + eTotalOne + /*!< Mode eTotalOne is identical to mode eNormalize except that the sum of the + weights assigned to a control point is not normalized and must equal 1.0.*/ + }; + + /** Set the link mode. + * \param pMode The link mode. + * \remarks All the links associated to an instance of class FbxGeometry must have the same link mode. + */ + void SetLinkMode(ELinkMode pMode); + + /** Get the link mode. + * \return The link mode. + */ + ELinkMode GetLinkMode() const; + + /** Set the link node. The link node is the node which influences the displacement + * of the control points. Typically, the link node is the bone a skin is attached to. + * \param pNode The link node. + */ + void SetLink(const FbxNode* pNode); + + /** Get the link node. The link node is the node which influences the displacement + * of the control points. Typically, the link node is the bone a skin is attached to. + * \return The link node or \c NULL if FbxCluster::SetLink() has not been called before. + */ + FbxNode* GetLink(); + + /** Get the link node (as const). The link node is the node which influences the displacement + * of the control points. Typically, the link node is the bone a skin is attached to. + * \return The link node or \c NULL if FbxCluster::SetLink() has not been called before. + */ + const FbxNode* GetLink() const; + + /** Set the associate model. + * The associate model is optional. It is only relevant if the link mode + * is of type eAdditive. If set, the associate model is the node used as a reference to + * measure the relative displacement of the link node. Otherwise, the displacement of + * the link node is measured relative to the node containing the control points. + * Typically, the associate model node is the parent of the bone a skin is attached to. + * \param pNode The associate model node. + */ + void SetAssociateModel(FbxNode* pNode); + + /** Get the associate model. + * The associate model is optional. It is only relevant if the link mode is of type + * eAdditive. If set, the associate model is the node used as a reference to + * measure the relative displacement of the link node. Otherwise, the displacement of + * the link node is measured relative the the node containing the control points. + * Typically, the associate model node is the parent of the bone a skin is attached to. + * \return The associate model node or \c NULL if FbxCluster::SetAssociateModel() has not been called before. + */ + FbxNode* GetAssociateModel() const; + //@} + /** + * \name Control Points + * A link has an array of indices to control points and associated weights. + * The indices refer to the control points in the instance of class FbxGeometry + * owning the link. The weights are the influence of the link node over the + * displacement of the indexed control points. + */ + //@{ + + /** Add an element in both arrays of control point indices and weights. + * \param pIndex The index of the control point. + * \param pWeight The link weight for this control point. + */ + void AddControlPointIndex(int pIndex, double pWeight); + + /** Get the length of the arrays of control point indices and weights. + * \return Length of the arrays of control point indices and weights. + * Returns 0 if no control point indices have been added or the arrays have been reset. + */ + int GetControlPointIndicesCount() const; + + /** Get the array of control point indices. + * \return Pointer to the array of control point indices. + * \c NULL if no control point indices have been added or the array has been reset. + */ + int* GetControlPointIndices() const; + + /** Get the array of control point weights. + * \return Pointer to the array of control point weights. + * \c NULL if no control point indices have been added or the array has been reset. + */ + double* GetControlPointWeights() const; + + //@} + + /** Set the array size for the three arrays: the array of control point indices, the array of weights + * and the array of blend weights. + * \param pCount The new count. + */ + void SetControlPointIWCount(int pCount); + + /** + * \name Transformation matrices + * A link has three transformation matrices: + * \li Transform refers to the global initial transform of the geometry node that contains the link node. + * \li TransformLink refers to global initial transform of the link node. + * \li TransformAssociateModel refers to the global initial transform of the associate model. + * + * For example, given a mesh binding with several bones(links), Transform is the global transform + * of the mesh at the binding moment, TransformLink is the global transform of the bone(link) + * at the binding moment, TransformAssociateModel is the global transform of the associate model + * at the binding moment. + */ + //@{ + + /** Set matrix associated with the node containing the link. + * \param pMatrix Transformation matrix. + */ + void SetTransformMatrix(const FbxAMatrix& pMatrix); + + /** Get matrix associated with the node containing the link. + * \param pMatrix Transformation matrix to be filled with appropriate data. + * \return Input parameter matrix filled with appropriate data. + */ + FbxAMatrix& GetTransformMatrix(FbxAMatrix& pMatrix) const; + + /** Set matrix associated with the link node. + * \param pMatrix Transformation matrix. + */ + void SetTransformLinkMatrix(const FbxAMatrix& pMatrix); + + /** Get matrix associated with the link node. + * \param pMatrix Transformation matrix to be filled with appropriate data.. + * \return Input parameter matrix filled with appropriate data. + */ + FbxAMatrix& GetTransformLinkMatrix(FbxAMatrix& pMatrix) const; + + /** Set matrix associated with the associate model. + * \param pMatrix Transformation matrix. + */ + void SetTransformAssociateModelMatrix(const FbxAMatrix& pMatrix); + + /** Get matrix associated with the associate model. + * \param pMatrix Transformation matrix to be filled with appropriate data.. + * \return Input parameter matrix filled with appropriate data. + */ + FbxAMatrix& GetTransformAssociateModelMatrix(FbxAMatrix& pMatrix) const; + + /** Set matrix associated with the parent node. + * \param pMatrix Transformation matrix. + */ + void SetTransformParentMatrix(const FbxAMatrix& pMatrix); + + /** Get matrix associated with the parent node. + * \param pMatrix Transformation matrix to be filled with appropriate data.. + * \return Input parameter matrix filled with appropriate data. + */ + FbxAMatrix& GetTransformParentMatrix(FbxAMatrix& pMatrix) const; + + /** Get the Transform Parent set flag value. + * \return \c true if transform matrix associated with parent node is set. + */ + bool IsTransformParentSet() const { return mIsTransformParentSet; } + + //@} + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + void SetUserData(const char* pUserDataID, const char* pUserData); + const char* GetUserDataID () const; + const char* GetUserData () const; + const char* GetUserData (const char* pUserDataID) const; + + // For pre version 6 support + FbxString mBeforeVersion6LinkName; + FbxString mBeforeVersion6AssociateModelName; + + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + + virtual FbxStringList GetTypeFlags() const; + + ELinkMode mLinkMode; + FbxString mUserDataID; + FbxString mUserData; + FbxArray mControlPointIndices; + FbxArray mControlPointWeights; + FbxMatrix mTransform; + FbxMatrix mTransformLink; + FbxMatrix mTransformAssociate; + FbxMatrix mTransformParent; + bool mIsTransformParentSet; + + FbxPropertyT SrcModelReference; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_CLUSTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxdeformer.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxdeformer.h new file mode 100644 index 00000000..ab443294 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxdeformer.h @@ -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 fbxdeformer.h +#ifndef _FBXSDK_SCENE_GEOMETRY_DEFORMER_H_ +#define _FBXSDK_SCENE_GEOMETRY_DEFORMER_H_ + +#include + +#include +#include + +/** Base class for skin deformer (FbxSkin) and vertex cache deformer (FbxVertexCacheDeformer). + * The corresponding deformer types are FbxDeformer::eSkin and FbxDeformer::eVertexCache. + * A deformer can be binded to a geometry (FbxGeometry) to act on its shape. Typically, + * some objects under the deformer are animated, and via the deformer, the geometry + * is animated too. + * + * A skin deformer contains clusters (FbxCluster). Each cluster acts on a subset of the geometry's + * control points, with different weights. For example, a mesh of humanoid shape + * can have a skin attached, that describes the way the humanoid mesh is deformed + * by bones. When the bones are animated, the clusters act on the geometry to + * animate it too. + * + * A vertex cache deformer contains a cache (FbxCache). The cache contains animation + * information for every control point of the geometry. + * + *\nosubgrouping + */ +class FBXSDK_DLL FbxDeformer : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxDeformer, FbxObject); + +public: + /** + * \name Multi-Layer Flag + * This flag is available for backward compatibility with older + * version of FBX files and should not be used anymore. All the animation layering + * system has been moved to the FbxAnimLayer and FbxAnimStack classes. + */ + //@{ + /** Set multi-layer state flag. + * \param pMultiLayer Set to \c true to enable multi-layering. + */ + void SetMultiLayer(bool pMultiLayer); + + /** Get multi-layer state. + * \return The current state of the multi-layer flag. + */ + bool GetMultiLayer() const; + //@} + + /** + * \name Deformer types + */ + //@{ + /** \enum EDeformerType Deformer types. + */ + enum EDeformerType + { + eUnknown, //!< Unknown deformer type + eSkin, //!< Type FbxSkin + eBlendShape, //!< Type FbxBlendShape + eVertexCache //!< Type FbxVertexCacheDeformer + }; + + /** Get the deformer type. + * \return Deformer type identifier. Default value is eUnknown. + */ + virtual EDeformerType GetDeformerType() const { return eUnknown; } + //@} + +/***************************************************************************************************************************** +** 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 void Construct(const FbxObject* pFrom); + virtual FbxStringList GetTypeFlags() const { return FbxStringList(); } + + bool mMultiLayer; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_DEFORMER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxgenericnode.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxgenericnode.h new file mode 100644 index 00000000..1383bd61 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxgenericnode.h @@ -0,0 +1,41 @@ +/**************************************************************************************** + + 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 fbxgenericnode.h +#ifndef _FBXSDK_SCENE_GEOMETRY_GENERIC_NODE_H_ +#define _FBXSDK_SCENE_GEOMETRY_GENERIC_NODE_H_ + +#include +#include + +#include + +/** Empty node containing properties. + * \nosubgrouping + */ +class FBXSDK_DLL FbxGenericNode : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxGenericNode, FbxObject); + +/***************************************************************************************************************************** +** 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 void Construct(const FbxObject* pFrom); + virtual FbxStringList GetTypeFlags() const; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_GENERIC_NODE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxgeometry.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxgeometry.h new file mode 100644 index 00000000..3a103fa2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxgeometry.h @@ -0,0 +1,318 @@ +/**************************************************************************************** + + 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 fbxgeometry.h +#ifndef _FBXSDK_SCENE_GEOMETRY_H_ +#define _FBXSDK_SCENE_GEOMETRY_H_ + +#include + +#include +#include +#include +#include +#include + +#include + +class FbxStatus; +class FbxGeometryWeightedMap; + +/** The base class of geometric objects that support control point deformations (e.g. FbxMesh, FbxNurbs, +* and FbxPatch). The FbxGeometry provides support for the following kinds of deformations. +* +* \li Skin deformation deformers +* \li Vertex cache deformers +* \li Geometry weighted maps +* \li Shapes +* +* Most of the methods of FbxGeometry are wrappers to simplify the access/manipulation of the connections +* to the deformers. For example, calling the GetDeformerCount() method is the same +* thing as calling: +* +* \code +* geometry.GetSrcObjectCount(FbxDeformer::ClassId) +* \endcode +*/ +class FBXSDK_DLL FbxGeometry : public FbxGeometryBase +{ + FBXSDK_OBJECT_DECLARE(FbxGeometry,FbxGeometryBase); + +public: + /** Returns the node attribute type. + * This method is derived in the more high level classes (FbxMesh, FbxNurbs, etc...) and returns the + * actual type of the geometry object. + * + * \return \e eUnknown + */ + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** + * \name Deformer Management + */ + //@{ + + /** Adds a deformer to this geometry (as mentioned in the description of this class, adding a deformer is a synonym + * for "connect a deformer"). + * \param pDeformer Pointer to the deformer to be added. + * \return Index of the added deformer. + */ + int AddDeformer(FbxDeformer* pDeformer); + + /** Remove a deformer. + * \param pIndex Index of deformer to remove. + * \param pStatus The FbxStatus object to hold error codes. + * \return Pointer to the removed deformer (or \c NULL if pIndex is out of range). + */ + FbxDeformer* RemoveDeformer(int pIndex, FbxStatus* pStatus = NULL); + + /** Returns the number of deformers. + * \return The number of deformers that are connected to this geometry. + */ + int GetDeformerCount() const; + + /** Returns the deformer at the specified index. + * \param pIndex The specified deformer index. + * \param pStatus The FbxStatus object to hold error codes. + * \return Pointer to the deformer (or \c NULL if pIndex is out of range). + */ + FbxDeformer* GetDeformer(int pIndex, FbxStatus* pStatus = NULL) const; + + /** Returns the number of deformers of a specified type. + * \param pType The specified deformer type. + * \return The number of deformers of the specified type. + */ + int GetDeformerCount(FbxDeformer::EDeformerType pType) const; + + /** Returns the deformer of a specified type at the specified index. + * \param pIndex The specified deformer index. + * \param pType The specified deformer type. + * \param pStatus The FbxStatus object to hold error codes. + * \return Pointer to the deformer (or \c NULL if pIndex is out of range). + */ + FbxDeformer* GetDeformer(int pIndex, FbxDeformer::EDeformerType pType, FbxStatus* pStatus = NULL) const; + + //@} + + /** + * \name Geometry Weighted Maps Management + */ + //@{ + + /** Returns the source geometry weighted map that is connected to this geometry. + * \return Pointer to the source geometry weighted map that is connected to this geometry if any. + */ + FbxGeometryWeightedMap* GetSourceGeometryWeightedMap(); + + /** Returns the number of destination geometry weighted map(s) that are connected to this geometry. + * \return The number of destination geometry weighted map(s) that are connected to this geometry. + */ + int GetDestinationGeometryWeightedMapCount() const; + + /** Returns the destination geometry weighted map at a specified index. + * \param pIndex The specified index. + * \return Pointer to the destination geometry weighted map at the specified index (if any). + */ + FbxGeometryWeightedMap* GetDestinationGeometryWeightedMap(int pIndex); + + //@} + + /** + * \name Shape Management + */ + //@{ + + /** Add a shape to the specified blend shape deformer and blend shape channel of this geometry. + * \param pBlendShapeIndex The blend shape deformer index. + * \param pBlendShapeChannelIndex The blend shape channel index. + * \param pShape Pointer to the shape object to be added. + * \param pPercent The full deform percentage of this shape. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if success, \c false otherwise. + */ + bool AddShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, FbxShape* pShape, double pPercent = 100, FbxStatus* pStatus = NULL); + + /** Removes all the shapes without destroying them. + * If shapes aren't explicitly destroyed before calling this function, they will be + * destroyed along with the SDK manager that created them. + */ + void ClearShape(); + + /** Returns the number of shapes. + * \return The number of shapes that have been added to this geometry. + */ + int GetShapeCount() const; + + /** Returns the number of shapes. + * \param pBlendShapeIndex The blend shape deformer index. + * \param pBlendShapeChannelIndex The blend shape channel index. + * \param pStatus The FbxStatus object to hold error codes. + * \return The number of shapes that have been added to this blend shape channel of this blend shape deformer. + */ + int GetShapeCount(int pBlendShapeIndex, int pBlendShapeChannelIndex, FbxStatus* pStatus = NULL) const; + + /** Returns the shape found at the specified index on a blend shape channel of a blend shape deformer. + * \param pBlendShapeIndex The blend shape deformer index. + * \param pBlendShapeChannelIndex The blend shape channel index. + * \param pShapeIndex The specified shape index. + * \param pStatus The FbxStatus object to hold error codes. + * \return Pointer to the shape (or \c NULL if pIndex is out of range). + */ + FbxShape* GetShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, int pShapeIndex, FbxStatus* pStatus = NULL); + + /** Returns the shape found at the specified index on a blend shape channel of a blend shape deformer. + * \param pBlendShapeIndex The blend shape deformer index. + * \param pBlendShapeChannelIndex The blend shape channel index. + * \param pShapeIndex The specified shape index. + * \param pStatus The FbxStatus object to hold error codes. + * \return Pointer to the shape (or \c NULL if pIndex is out of range). + */ + const FbxShape* GetShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, int pShapeIndex, FbxStatus* pStatus = NULL) const; + + /** Get the shape animation curve. + * The shape channel is an animatable property with a value range from 0 to 100 (with 100 being full shape deformation). + * The default value is 0. + * \param pBlendShapeIndex The blend shape deformer index. + * \param pBlendShapeChannelIndex The blend shape channel index. + * \param pLayer The animation layer from which we want to get the requested animation curve. + * \param pCreateAsNeeded If \c true, creates the animation curve if it is not already present. + * \param pStatus The FbxStatus object to hold error codes. + * \return Animation curve (or NULL if an error occurred). + * \remarks If pLayer is left at NULL, the method will use the first layer of the Animation stack. + */ + FbxAnimCurve* GetShapeChannel(int pBlendShapeIndex, int pBlendShapeChannelIndex, FbxAnimLayer* pLayer, bool pCreateAsNeeded = false, FbxStatus* pStatus = NULL); + //@} + + /** NURBS and Patches surface modes. + * This information is never directly used inside the FBX SDK. Applications can use these values if they wish to + * carry the "rendering" details of the NURBS and Patches. The FBX SDK guarantee that the value (member of the FbxNurbs, + * FbxNurbsSurface and FbxPatch classes) is stored to FBX files and retrieved from them. + * \remarks The enum has been defined in this class to avoid symbols duplication. + */ + enum ESurfaceMode + { + eRaw, //! Raw. + eLowNoNormals, //! Low and no normals. + eLow, //! Low. + eHighNoNormals, //! High and no normals. + eHigh //! High. + }; + + /** + * \name Pivot Management + * The geometry pivot is used to specify additional translation, rotation, + * and scaling information applied to all control points when the model is + * exported. + */ + //@{ + + /** Returns the pivot matrix. + * \param pXMatrix Placeholder for the returned matrix. + * \return Reference to the passed argument. + */ + FbxAMatrix& GetPivot(FbxAMatrix& pXMatrix) const; + + /** Sets the pivot matrix. + * \param pXMatrix The transformation matrix that is assigned to the pivot matrix. + */ + void SetPivot(FbxAMatrix& pXMatrix); + + /** Applies the pivot matrix to all vertices/normals of the geometry. + */ + void ApplyPivot(); + + //@} + + /** + * \name Default Animation Values + * These functions provides direct access to default animation values that are specific to a geometry. + * These functions only work if the geometry has been associated with a node. + */ + //@{ + + /** Sets the default deformation for a specified shape. + * The default shape property has a value range from 0 to 100 (with 100 being full shape deformation). + * The default value is 0. + * \param pBlendShapeIndex The blend shape deformer index. + * \param pBlendShapeChannelIndex The blend shape channel index. + * \param pPercent Deformation percentage (on a scale ranging from 0 to 100). + * \remarks This function has no effect if pIndex is out of range. + */ + void SetDefaultShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, double pPercent); + + /** Sets the default deformation for a specified channel. + * The default shape property has a value range from 0 to 100 (with 100 being full shape deformation). + * The default value is 0. + * \param pBlendShapeChannel The blend shape channel. + * \param pPercent Deformation percentage (on a scale ranging from 0 to 100). + * \remarks This function has no effect if pShapeName is invalid. + */ + void SetDefaultShape(FbxBlendShapeChannel* pBlendShapeChannel, double pPercent); + + /** Returns the default deformation value for the specified shape. + * The default shape property has a value range from 0 to 100 (with 100 being full shape deformation). + * The default value is 0. + * \param pBlendShapeIndex The blend shape deformer index. + * \param pBlendShapeChannelIndex The blend shape channel index. + * \return The deformation value for the specified shape, or 0 if pIndex is out of range. + */ + double GetDefaultShape(int pBlendShapeIndex, int pBlendShapeChannelIndex) const; + + /** Returns the default deformation value for the specified channel. + * The default shape property has a value range from 0 to 100 (with 100 being full shape deformation). + * The default value is 0. + * \param pBlendShapeChannel The blend shape channel. + * \return The deformation value for the specified shape, or 0 if pShapeName is invalid. + */ + double GetDefaultShape(FbxBlendShapeChannel* pBlendShapeChannel) 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; + + void CleanShapeChannels(FbxAnimLayer* pAnimLayer); + void CleanShapeChannel(FbxAnimLayer* pAnimLayer, int pShapeIndex); + void CreateShapeChannelProperties(FbxString& pShapeName); + void ConvertShapeNamesToV5Format(FbxString pTakeNodeName); + void ConvertShapeNamesToV5Format(FbxString pTakeNodeName, int pShapeIndex); + void RevertShapeNamesToV6Format(FbxString pTakeNodeName); + void RevertShapeNamesToV6Format(FbxString pTakeNodeName, int pShapeIndex); + void ClearTemporaryShapeNames(); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + virtual void SetDocument(FbxDocument* pDocument); + + FbxString CreateShapeChannelName(int pShapeIndex); + FbxString CreateShapeChannelName(FbxString pShapeName); + + void CopyDeformers(const FbxGeometry* pGeometry); + void CopyPivot(const FbxGeometry* pSource); + + // Used during FBX v5 file store + FbxArray mShapeNameArrayV6; + FbxArray mShapeNameArrayV5; + FbxArray mShapeChannelNameArrayV5; + + FbxAMatrix* mPivot; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxgeometrybase.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxgeometrybase.h new file mode 100644 index 00000000..54deafa8 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxgeometrybase.h @@ -0,0 +1,669 @@ +/**************************************************************************************** + + 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 fbxgeometrybase.h +#ifndef _FBXSDK_SCENE_GEOMETRY_BASE_H_ +#define _FBXSDK_SCENE_GEOMETRY_BASE_H_ + +#include + +#include +#include +#include + +#include + +class FbxStatus; + +/** This class is the base class for geometric object such as meshes, NURBS and patches. + * Use the FbxGeometryBase class to manage the control points, normals, binormals and tangents of the + * geometries. + * The meaning of "control point" is dependent of the geometry object type. For meshes, the "control point" + * is the physical 3D coordinate of polygon vertices while, for NURBS, it is the the actual control point on the curves + * defining the surface. This class also allow you to define normals, binormals and tangents regardless of the type of + * geometric object. However, in reality, applying such definitions to NURBS and patches does not make much sense + * since these definitions would only exist at the control points and inbetween them, the interpolation would certainly not + * follow the curve. + * + * Geometric objects are using a system of layered data to extend their construction definition. For example, a typical + * layer for a Mesh contains Normals, UVs and Materials but client applications can decide to define another set of + * Normals and UVs and swap them during the rendering phase to produce some different results. The combinations are limitless + * and it would be impossible to discuss them all. This example has been presented to show one possible context where + * layers can be used. More information can be found in the FbxLayerContainer and FbxLayer classes description. + * \nosubgrouping + */ +class FBXSDK_DLL FbxGeometryBase : public FbxLayerContainer +{ + FBXSDK_OBJECT_DECLARE(FbxGeometryBase, FbxLayerContainer); + +public: + /** + * \name Control Points, Normals, Binormals and Tangent Management. + */ + //@{ + + /** Allocates memory space for the array of control points. + * \param pCount The number of control points. + * \remarks Any previously allocated array of control points will be cleared. + */ + virtual void InitControlPoints(int pCount); + + /** Allocates memory space for the array of normals. + * \param pCount The desired size for the normal array. If pCount is specified, the array will be the same size as pCount. + * If pCount is not specified, the array will be the same length as the array of control points. + * \remarks This function must be called after function FbxLayerContainer::InitControlPoints(). + * \remarks The normals initialized with this function will have the ReferenceMode set to eDirect. Also, + * the array will always be defined on layer 0. + */ + void InitNormals(int pCount = 0 ); + + /** Allocates memory space for the array of normals cloned from the pSrc. + * \param pSrc The source geometry from which the normals information is cloned. + * \remarks This function must be called with the argument, otherwise it does not do anything. Also, + * it will only process the normals array defined on layer 0 of the pSrc. + */ + void InitNormals(FbxGeometryBase* pSrc); + + /** Allocates memory space for the array of tangents on specified layer. + * \param pCount The desired size of the tangent array. If pCount is specified, the array will be the same size as pCount. + * If pCount is not specified, the array will be the same length as the array of control points. + * \param pLayerIndex The specified layer index to allocate memory space for the array of tangents. + * \param pName The specified name for the allocated tangents array. + * \remarks This function must be called after function FbxLayerContainer::InitControlPoints(). + * The tangents initialized with this function will have the reference mode set to eDirect. + */ + void InitTangents(int pCount = 0, const int pLayerIndex = 0, const char* pName = "" ); + + /** Allocates memory space for the array of tangents cloned from the pSrc on the specified layer. + * \param pSrc The source geometry from which the tangents information is cloned. + * \param pLayerIndex The specified layer index to allocate memory space for cloned array of tangents from the pSrc. + * \remarks This function must be called with the argument, otherwise it does not do anything. + */ + void InitTangents(FbxGeometryBase* pSrc, const int pLayerIndex = 0); + + /** Allocates memory space for the array of binormals. + * \param pCount The desired size of the binormal array. If pCount is specified, the array will have the same size as pCount. + * If pCount is not specified, the array will be the same length as the array of control points. + * \param pLayerIndex The specified layer index to allocate memory space for the array of binormals. + * \param pName The specified name for the allocated binormals array. + * \remarks This function must be called after function FbxLayerContainer::InitControlPoints(). + * The binormals initialized with this function will have the reference mode set to eDirect. + */ + void InitBinormals(int pCount = 0, const int pLayerIndex = 0, const char* pName = "" ); + + /** Allocates memory space for the array of binormals cloned from the pSrc. + * \param pSrc The source geometry from which the binormals information is cloned. + * \param pLayerIndex The specified layer index to allocate memory space for cloned array of binormals from the pSrc. + * \remarks This function must be called with the argument, otherwise it does not do anything. + */ + void InitBinormals(FbxGeometryBase* pSrc, const int pLayerIndex = 0); + + /** Sets the control point and the normal values at the specified index. + * \param pCtrlPoint The value of the control point. + * \param pNormal The value of the normal. + * \param pIndex The specified index of the control point/normal. + * \param pI2DSearch When \c true AND the normals array reference mode is eIndexToDirect, search pNormal in the + * existing array to avoid inserting if it already exist. NOTE: This feature uses a linear + * search algorithm, therefore it can be time consuming if the DIRECT array of normals contains + * a huge number of elements. + * \remarks If the arrays (control points and normals) are not big enough to store the values at the + * specified index, they will be automatically resized to accommodate the new entries. + */ + virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint , const FbxVector4 &pNormal , int pIndex, bool pI2DSearch = false); + + + /** Sets the control point at a specified index. + * \param pCtrlPoint The value of the control point. + * \param pIndex The specified index of the control point. + * + * \remarks If the array is not big enough to store the value at the specified index, it will be + * automatically resized to accommodate the new entry. + */ + virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint , int pIndex); + + /** Gets the control point at the specified index. + * \param pIndex The specified index of the control point. + * \return The value of the specific control point. + * + * \remarks If index is out of range, FbxVector4(0, 0, 0) is returned. + */ + virtual FbxVector4 GetControlPointAt(int pIndex) const; + + /** Sets the control point normal value at the specified index. + * \param pNormal The value of the normal. + * \param pIndex The specified index of the normal. + * \param pI2DSearch When \c true AND the normals array reference mode is eIndexToDirect, search pNormal in the + * existing array to avoid inserting it if it already exist. NOTE: this feature uses a linear + * search algorithm, therefore it can be time consuming if the DIRECT array of normals contains + * a huge number of elements. + * \remarks If the array is not big enough to store the value at the specified index, it will be + * automatically resized to accommodate the new entry. + */ + virtual void SetControlPointNormalAt(const FbxVector4 &pNormal, int pIndex, bool pI2DSearch=false); + + /** Returns the number of control points. + * \return The number of control points allocated in the geometry. + */ + virtual int GetControlPointsCount() const; + + + /** Returns a pointer to the array of control points. + * \param pStatus Not used in the implementation of this class. + * \return Pointer to the array of control points, or \c NULL if the array has not been allocated. + * \remarks Use the function FbxGeometryBase::InitControlPoints() to allocate the array. + */ + virtual FbxVector4* GetControlPoints(FbxStatus* pStatus=NULL) const; + + /** Allocates memory space for the array of control points. + * \param pCount The number of control points. + * \remarks Any previously allocated array of control points will NOT be cleared. + */ + virtual void SetControlPointCount(int pCount); + + //@} + + + /** + * \name Public and fast access Properties + */ + //@{ + //! Control the geometry render state. Geometry can still cast shadows even if this is turned off. + FbxPropertyT PrimaryVisibility; + + //! If true, the geometry will produce shadows. + FbxPropertyT CastShadow; + + //! If true, the geometry will receive shadows. + FbxPropertyT ReceiveShadow; + + //! The minimum value of the control points bounding box. + FbxPropertyT BBoxMin; + + //! The maximum value of the control points bounding box. + FbxPropertyT BBoxMax; + + /** Computes the control points Bounding box. + */ + void ComputeBBox(); + //@} + + + /** + * \name Geometry Element Management. + * A FbxGeometryElement describes how the geometry element (normals, UVs and etc.) is mapped to a geometry + * surface and how the mapping information is arranged in memory. + * FbxGeometryElement is exactly the same as FbxLayerElement but does not expose the geometry's layer information. + * Use the geometry element classes to decompose the geometry without dealing with layers. + */ + //@{ + + /** Creates a normal geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementNormal* CreateElementNormal(); + + /** Remove the normal geometry element from this geometry. + * \param pElementNormal A pointer to the normal element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementNormal(FbxGeometryElementNormal* pElementNormal); + + /** Returns this geometry's normal element. + * \param pIndex The normal geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementNormal* GetElementNormal(int pIndex = 0); + + /** Returns this geometry's normal element. + * \param pIndex The normal geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementNormal* GetElementNormal(int pIndex = 0) const; + + /** Get the number of this geometry's normal geometry element. + * \return Total number of normal geometry elements for this geometry. + */ + int GetElementNormalCount() const; + + /** Creates a binormal geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementBinormal* CreateElementBinormal(); + + /** Remove the binormal geometry element from this geometry. + * \param pElementBinormal A pointer to the binormal element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementBinormal(FbxGeometryElementBinormal* pElementBinormal); + + /** Returns this geometry's binormal element. + * \param pIndex The binormal geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementBinormal* GetElementBinormal(int pIndex = 0); + + /** Returns this geometry's binormal element. + * \param pIndex The binormal geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementBinormal* GetElementBinormal(int pIndex = 0) const; + + /** Get the number of this geometry's binormal geometry element. + * \return Total number of binormal geometry elements for this geometry. + */ + int GetElementBinormalCount() const; + + /** Creates a tangent geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementTangent* CreateElementTangent(); + + /** Remove the tangent geometry element from this geometry. + * \param pElementTangent A pointer to the tangent element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementTangent(FbxGeometryElementTangent* pElementTangent); + + /** Returns this geometry's tangent element. + * \param pIndex The tangent geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementTangent* GetElementTangent(int pIndex = 0); + + /** Returns this geometry's tangent element. + * \param pIndex The tangent geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementTangent* GetElementTangent(int pIndex = 0) const; + + /** Get the number of this geometry's tangent geometry element. + * \return Total number of tangent geometry elements for this geometry. + */ + int GetElementTangentCount() const; + + /** Creates a material geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementMaterial* CreateElementMaterial(); + + /** Remove the material geometry element from this geometry. + * \param pElementMaterial A pointer to the material element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementMaterial(FbxGeometryElementMaterial* pElementMaterial); + + /** Returns this geometry's material element. + * \param pIndex The material geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementMaterial* GetElementMaterial(int pIndex = 0); + + /** Returns this geometry's material element. + * \param pIndex The material geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementMaterial* GetElementMaterial(int pIndex = 0) const; + + /** Get the number of this geometry's material geometry element. + * \return Total number of material geometry elements for this geometry. + */ + int GetElementMaterialCount() const; + + /** Creates a polygon group geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementPolygonGroup* CreateElementPolygonGroup(); + + /** Remove the polygon group geometry element from this geometry. + * \param pElementPolygonGroup A pointer to the polygon group element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementPolygonGroup(FbxGeometryElementPolygonGroup* pElementPolygonGroup); + + /** Returns this geometry's polygon group element. + * \param pIndex The polygon group geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementPolygonGroup* GetElementPolygonGroup(int pIndex = 0); + + /** Returns this geometry's polygon group element. + * \param pIndex The polygon group geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementPolygonGroup* GetElementPolygonGroup(int pIndex = 0) const; + + /** Get the number of this geometry's polygon group geometry element. + * \return Total number of polygon group geometry elements for this geometry. + */ + int GetElementPolygonGroupCount() const; + + /** Creates a vertex color geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementVertexColor* CreateElementVertexColor(); + + /** Remove the vertex color geometry element from this geometry. + * \param pElementVertexColor A pointer to the vertex color element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementVertexColor(FbxGeometryElementVertexColor* pElementVertexColor); + + /** Returns this geometry's vertex color element. + * \param pIndex The vertex color geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementVertexColor* GetElementVertexColor(int pIndex = 0); + + /** Returns this geometry's vertex color element. + * \param pIndex The vertex color geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementVertexColor* GetElementVertexColor(int pIndex = 0) const; + + /** Get the number of this geometry's vertex color geometry element. + * \return Total number of vertex color geometry elements for this geometry. + */ + int GetElementVertexColorCount() const; + + /** Creates a smoothing geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementSmoothing* CreateElementSmoothing(); + + /** Remove the smoothing geometry element from this geometry. + * \param pElementSmoothing A pointer to the smoothing element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementSmoothing(FbxGeometryElementSmoothing* pElementSmoothing); + + /** Returns this geometry's smoothing element. + * \param pIndex The smoothing geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementSmoothing* GetElementSmoothing(int pIndex = 0); + + /** Returns this geometry's smoothing element. + * \param pIndex The smoothing geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementSmoothing* GetElementSmoothing(int pIndex = 0) const; + + /** Get the number of this geometry's smoothing geometry element. + * \return Total number of smoothing geometry elements for this geometry. + */ + int GetElementSmoothingCount() const; + + /** Creates a vertex crease geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementCrease* CreateElementVertexCrease(); + + /** Remove the vertex crease geometry element from this geometry. + * \param pElementCrease A pointer to the vertex crease element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementVertexCrease(FbxGeometryElementCrease* pElementCrease); + + /** Returns this geometry's vertex crease element. + * \param pIndex The vertex crease geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementCrease* GetElementVertexCrease(int pIndex = 0); + + /** Returns this geometry's vertex crease element. + * \param pIndex The vertex crease geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementCrease* GetElementVertexCrease(int pIndex = 0) const; + + /** Get the number of this geometry's vertex crease geometry element. + * \return Total number of vertex crease geometry elements for this geometry. + */ + int GetElementVertexCreaseCount() const; + + /** Creates an edge crease geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementCrease* CreateElementEdgeCrease(); + + /** Remove the edge crease geometry element from this geometry. + * \param pElementCrease A pointer to the edge crease element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementEdgeCrease(FbxGeometryElementCrease* pElementCrease); + + /** Returns this geometry's edge crease element. + * \param pIndex The edge crease geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementCrease* GetElementEdgeCrease(int pIndex = 0); + + /** Returns this geometry's edge crease element. + * \param pIndex The edge crease geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementCrease* GetElementEdgeCrease(int pIndex = 0) const; + + /** Get the number of this geometry's edge crease geometry element. + * \return Total number of edge crease geometry elements for this geometry. + */ + int GetElementEdgeCreaseCount() const; + + /** Creates a hole geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementHole* CreateElementHole(); + + /** Remove the hole geometry element from this geometry. + * \param pElementHole A pointer to the hole element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementHole(FbxGeometryElementHole* pElementHole); + + /** Returns this geometry's hole element. + * \param pIndex The hole geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementHole* GetElementHole(int pIndex = 0); + + /** Returns this geometry's hole element. + * \param pIndex The hole geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementHole* GetElementHole(int pIndex = 0) const; + + /** Get the number of this geometry's hole geometry element. + * \return Total number of hole geometry elements for this geometry. + */ + int GetElementHoleCount() const; + + /** Creates a user data geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementUserData* CreateElementUserData(); + + /** Remove the user data geometry element from this geometry. + * \param pElementUserData A pointer to the user data element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementUserData(FbxGeometryElementUserData* pElementUserData); + + /** Returns this geometry's user data element. + * \param pIndex The user data geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementUserData* GetElementUserData(int pIndex = 0); + + /** Returns this geometry's user data element. + * \param pIndex The user data geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementUserData* GetElementUserData(int pIndex = 0) const; + + /** Get the number of this geometry's user data geometry element. + * \return Total number of user data geometry elements for this geometry. + */ + int GetElementUserDataCount() const; + + /** Creates a visibility geometry element for this geometry. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementVisibility* CreateElementVisibility(); + + /** Remove the visibility geometry element from this geometry. + * \param pElementVisibility A pointer to the visibility element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementVisibility(FbxGeometryElementVisibility* pElementVisibility); + + /** Returns this geometry's visibility element. + * \param pIndex The visibility geometry element index. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + FbxGeometryElementVisibility* GetElementVisibility(int pIndex = 0); + + /** Returns this geometry's visibility element. + * \param pIndex The visibility geometry element index. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + */ + const FbxGeometryElementVisibility* GetElementVisibility(int pIndex = 0) const; + + /** Get the number of this geometry's visibility geometry element. + * \return Total number of visibility geometry elements for this geometry. + */ + int GetElementVisibilityCount() const; + + /** Creates a UV geometry element for this geometry. + * \param pUVSetName The UV geometry element name. + * \param pTypeIdentifier The texture channel the UVIndex refers to. + * \return A pointer to the newly created geometry element. + * \remarks The created geometry element is associated with this geometry automatically. + */ + FbxGeometryElementUV* CreateElementUV(const char* pUVSetName, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); + + /** Remove the UV geometry element from this geometry. + * \param pElementUV A pointer to the UV element to be removed. + * \return \c True if the geometry element is removed, \c false otherwise. + */ + bool RemoveElementUV(FbxGeometryElementUV* pElementUV); + + /** Returns this geometry's UV element. + * \param pIndex The UV geometry element index. + * \param pTypeIdentifier The texture channel the UVIndex refers to. + * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. + * \remarks If \e pTypeIdentifier is not specified, the function will return the geometry element + * regardless of its texture type. + */ + FbxGeometryElementUV* GetElementUV(int pIndex = 0, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eUnknown); + + /** Returns this geometry's UV element. + * \param pIndex The UV geometry element index. + * \param pTypeIdentifier The texture channel the UVIndex refers to. + * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. + * \remarks If \e pTypeIdentifier is not specified, the function will return the geometry element + * regardless of its texture type. + */ + const FbxGeometryElementUV* GetElementUV(int pIndex = 0, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eUnknown) const; + + /** Get the number of this geometry's UV geometry element. + * \param pTypeIdentifier The texture channel the UVIndex refers to. + * \return Total number of UV geometry elements for this geometry. + * \remarks If \e pTypeIdentifier is not specified, the function will return the geometry element + * regardless of its texture type. + */ + int GetElementUVCount(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eUnknown) const; + + /** Returns this geometry's UV element. + * \param pUVSetName The UV set name of the UV geometry element. + * \return A pointer to the UV geometry element or \c NULL if no UV geometry element with this name exists. + */ + FbxGeometryElementUV* GetElementUV(const char* pUVSetName); + + /** Returns this geometry's UV element. + * \param pUVSetName The UV set name of the UV geometry element. + * \return A const pointer to the UV geometry element or \c NULL if no UV geometry element with this name exists. + */ + const FbxGeometryElementUV* GetElementUV(const char* pUVSetName) const; + + /** Returns this geometry's all UV set names. + * \param pUVSetNameList A reference to \c FbxStringList that will be filled with this geometry's all UV set names. + */ + void GetUVSetNames(FbxStringList& pUVSetNameList) const; + + //@} + + + /** + * \name Off-loading Serialization section + * The methods in this section are typically called by a peripheral (FbxPeripheral). There should be no + * real interest in calling them directly. The functions will write/read the memory dump of the data contained + * in this class. Each data block written/read will start with an (int) value representing the number of items + * in the array. If this value (v) is not zero, it will be followed by the array content. A block of data that is + * (v * sizeof(array item size)) bytes big. The methods will also call the parent class ones to dump the Layers content. + */ + //@{ + /** Writes the content of the geometry object to the specified stream. + * \param pStream The destination stream. + * \return \c True if the content is successfully processed + * by the receiving stream, \c false otherwise. + */ + virtual bool ContentWriteTo(FbxStream& pStream) const; + + /** Reads the content of the geometry object from the specified stream. + * \param pStream The source stream. + * \return \c True if the geometry object fills itself with the received data + * from the stream successfully, \c false otherwise. + */ + virtual bool ContentReadFrom(const FbxStream& pStream); + //@} + + /** Calculate the actual amount of memory used by this geometry object. + * \return The memory size in bytes (includes the amount use by the data defined in the layers). + */ + virtual int MemoryUsage() 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual void Compact(); + + FbxArray mControlPoints; + + bool GetNormals(FbxLayerElementArrayTemplate** pLockableArray) const; + bool GetNormalsIndices(FbxLayerElementArrayTemplate** pLockableArray) const; + bool GetTangents(FbxLayerElementArrayTemplate** pLockableArray, const int pLayerIndex = 0) const; + bool GetTangentsIndices(FbxLayerElementArrayTemplate** pLockableArray, const int pLayerIndex = 0) const; + bool GetBinormals(FbxLayerElementArrayTemplate** pLockableArray, const int pLayerIndex = 0) const; + bool GetBinormalsIndices(FbxLayerElementArrayTemplate** pLockableArray, const int pLayerIndex = 0) const; + +protected: + virtual void ConstructProperties(bool pForceSet); + virtual void ContentClear(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_BASE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxgeometryweightedmap.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxgeometryweightedmap.h new file mode 100644 index 00000000..77b96bf9 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxgeometryweightedmap.h @@ -0,0 +1,87 @@ +/**************************************************************************************** + + 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 fbxgeometryweightedmap.h +#ifndef _FBXSDK_SCENE_GEOMETRY_WEIGHTED_MAP_H_ +#define _FBXSDK_SCENE_GEOMETRY_WEIGHTED_MAP_H_ + +#include + +#include +#include + +#include + +class FbxGeometry; + +/** \brief This class provides the structure to build a correspondence between 2 geometries. + * + * This correspondence is done at the vertex level. Which means that for each vertex in the + * source geometry, you can have from 0 to N corresponding vertices in the destination + * geometry. Each corresponding vertex is weighted. + * + * For example, if the source geometry is a NURB and the destination geometry is a mesh, + * the correspondence object will express the correspondence between the NURB's control vertices + * and the mesh's vertices. + * + * If the mesh corresponds to a tesselation of the NURB, the correspondence object can be used + * to transfer any deformation that affect the NURB's control vertices to the mesh's vertices. + * + * See FbxWeightedMapping for more details. + */ +class FBXSDK_DLL FbxGeometryWeightedMap : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxGeometryWeightedMap, FbxObject); + +public: + + /** Set correspondence values. + * \param pWeightedMappingTable Pointer to the table containing values + * \remark \e pWeightedMappingTable becomes owned by this object and will be destroyed by it + * when the object goes out of scope or on the next call to SetValues(). The deletion + * uses FbxDelete() so the content of the pointer must have been allocated with FbxNew<>() + */ + void SetValues(const FbxWeightedMapping* pWeightedMappingTable); + + /** Return correspondence values. + * \return Pointer to the correspondence values table. + */ + FbxWeightedMapping* GetValues() const; + + /** Return source geometry. + * \return Pointer to the source geometry, or \c NULL if there is no connected source geometry + */ + FbxGeometry* GetSourceGeometry(); + + /** Return destination geometry. + * \return Pointer to the destination geometry, or \c NULL if there is no connected destination geometry + */ + FbxGeometry* GetDestinationGeometry(); + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + + // Real weigths table + FbxWeightedMapping* mWeightedMapping; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_WEIGHTED_MAP_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxlayer.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxlayer.h new file mode 100644 index 00000000..4880ca1e --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxlayer.h @@ -0,0 +1,2808 @@ +/**************************************************************************************** + + 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 fbxlayer.h +#ifndef _FBXSDK_SCENE_GEOMETRY_LAYER_H_ +#define _FBXSDK_SCENE_GEOMETRY_LAYER_H_ + +#include + +#include +#include +#include +#include + +#include + +class FbxLayerElementArray; +class FbxLayerContainer; + +/** Base class for elements of layers (FbxLayer). + * A layer element type is identified by EType. + * A FbxLayerElement describes how the layer element is mapped to a geometry surface + * and how the mapping information is arranged in memory. + * A FbxLayerElement contains Normals, UVs or other kind of information. + * + * \see FbxLayer + * \see FbxLayerElement::EMappingMode + * \see FbxLayerElement::EReferenceMode + */ +class FBXSDK_DLL FbxLayerElement +{ +public: + /** \enum EType Layer Element type identifier. + * - \e eUnknown Undefined Layer Element class. + * - \e eNormal Layer Element of type FbxLayerElementNormal. + * - \e eBiNormal Layer Element of type FbxLayerElementBinormal. + * - \e eTangent Layer Element of type FbxLayerElementTangent. + * - \e eMaterial Layer Element of type FbxLayerElementMaterial. + * - \e eTextureDiffuse Layer Element of type FbxLayerElementTexture. + * - \e ePolygonGroup Layer Element of type FbxLayerElementPolygonGroup. + * - \e eUV Layer Element of type FbxLayerElementUV. + * - \e eVertexColor Layer Element of type FbxLayerElementVertexColor. + * - \e eSmoothing Layer Element of type FbxLayerElementSmoothing. + * - \e eVertexCrease Layer Element of type FbxLayerElementCrease. + * - \e eEdgeCrease Layer Element of type FbxLayerElementCrease. + * - \e eHole Layer Element of type FbxLayerElementHole. + * - \e eUserData Layer Element of type FbxLayerElementUserData. + * - \e eVisibility Layer Element of type FbxLayerElementVisibility. + * - \e eTextureEmissive Layer Element of type FbxLayerElementTexture. + * - \e eTextureEmissiveFactor Layer Element of type FbxLayerElementTexture. + * - \e eTextureAmbient Layer Element of type FbxLayerElementTexture. + * - \e eTextureAmbientFactor Layer Element of type FbxLayerElementTexture. + * - \e eTextureDiffuseFactor Layer Element of type FbxLayerElementTexture. + * - \e eTextureSpecular Layer Element of type FbxLayerElementTexture. + * - \e eTextureNormalMap Layer Element of type FbxLayerElementTexture. + * - \e eTextureSpecularFactor Layer Element of type FbxLayerElementTexture. + * - \e eTextureShininess Layer Element of type FbxLayerElementTexture. + * - \e eTextureBump Layer Element of type FbxLayerElementTexture. + * - \e eTextureTransparency Layer Element of type FbxLayerElementTexture. + * - \e eTextureTransparencyFactor Layer Element of type FbxLayerElementTexture. + * - \e eTextureReflection Layer Element of type FbxLayerElementTexture. + * - \e eTextureReflectionFactor Layer Element of type FbxLayerElementTexture. + * - \e eTextureDisplacement Layer Element of type FbxLayerElementTexture. + * - \e eTextureDisplacementVector Layer Element of type FbxLayerElementTexture. + * - \e eTypeCount + */ + enum EType + { + eUnknown, + + //Non-Texture layer element types + //Note: Make sure to update static index below if you change this enum! + eNormal, + eBiNormal, + eTangent, + eMaterial, + ePolygonGroup, + eUV, + eVertexColor, + eSmoothing, + eVertexCrease, + eEdgeCrease, + eHole, + eUserData, + eVisibility, + + //Texture layer element types + //Note: Make sure to update static index below if you change this enum! + eTextureDiffuse, + eTextureDiffuseFactor, + eTextureEmissive, + eTextureEmissiveFactor, + eTextureAmbient, + eTextureAmbientFactor, + eTextureSpecular, + eTextureSpecularFactor, + eTextureShininess, + eTextureNormalMap, + eTextureBump, + eTextureTransparency, + eTextureTransparencyFactor, + eTextureReflection, + eTextureReflectionFactor, + eTextureDisplacement, + eTextureDisplacementVector, + + eTypeCount + }; + + const static int sTypeTextureStartIndex = int(eTextureDiffuse); //!< The start index of texture type layer elements. + const static int sTypeTextureEndIndex = int(eTypeCount) - 1; //!< The end index of texture type layer elements. + const static int sTypeTextureCount = sTypeTextureEndIndex - sTypeTextureStartIndex + 1; //!< The count of texture type layer elements. + const static int sTypeNonTextureStartIndex = int(eNormal); //!< The start index of non-texture type layer elements. + const static int sTypeNonTextureEndIndex = int(eVisibility); //!< The end index of non-texture type layer elements. + const static int sTypeNonTextureCount = sTypeNonTextureEndIndex - sTypeNonTextureStartIndex + 1; //!< The count of non-texture type layer elements. + static const char* const sTextureNames[]; //!< Array of names of texture type layer elements. + static const char* const sTextureUVNames[]; //!< Array of names of UV layer elements. + static const char* const sNonTextureNames[]; //!< Array of names of non-texture type layer elements. + static const FbxDataType sTextureDataTypes[]; //!< Array of texture types. + static const char* const sTextureChannelNames[]; //!< Array of texture channels. + + /** \enum EMappingMode Determines how the element is mapped to a surface. + * - \e eNone The mapping is undetermined. + * - \e eByControlPoint There will be one mapping coordinate for each surface control point/vertex. + * - \e eByPolygonVertex There will be one mapping coordinate for each vertex, for every polygon of which it is a part. + This means that a vertex will have as many mapping coordinates as polygons of which it is a part. + * - \e eByPolygon There can be only one mapping coordinate for the whole polygon. + * - \e eByEdge There will be one mapping coordinate for each unique edge in the mesh. + This is meant to be used with smoothing layer elements. + * - \e eAllSame There can be only one mapping coordinate for the whole surface. + */ + enum EMappingMode + { + eNone, + eByControlPoint, + eByPolygonVertex, + eByPolygon, + eByEdge, + eAllSame + }; + + /** \enum EReferenceMode Determines how the mapping information is stored in the array of coordinates. + * - \e eDirect This indicates that the mapping information for the n'th element is found in the n'th place of + FbxLayerElementTemplate::mDirectArray. + * - \e eIndex, This symbol is kept for backward compatibility with FBX v5.0 files. In FBX v6.0 and higher, + this symbol is replaced with eIndexToDirect. + * - \e eIndexToDirect This indicates that the FbxLayerElementTemplate::mIndexArray + contains, for the n'th element, an index in the FbxLayerElementTemplate::mDirectArray + array of mapping elements. eIndexToDirect is usually useful for storing eByPolygonVertex mapping + mode elements coordinates. Since the same coordinates are usually + repeated many times, this saves spaces by storing the coordinate only one time + and then referring to them with an index. Materials and Textures are also referenced with this + mode and the actual Material/Texture can be accessed via the FbxLayerElementTemplate::mDirectArray + */ + enum EReferenceMode + { + eDirect, + eIndex, + eIndexToDirect + }; + + + /** Sets the Mapping Mode. + * \param pMappingMode Specifies the way that layer element is mapped to a surface. + */ + void SetMappingMode(EMappingMode pMappingMode) { mMappingMode = pMappingMode; } + + /** Sets the Reference Mode. + * \param pReferenceMode Specifies the reference mode. + */ + void SetReferenceMode(EReferenceMode pReferenceMode) { mReferenceMode = pReferenceMode; } + + /** Returns the Mapping Mode. + * \return The current Mapping Mode. + */ + EMappingMode GetMappingMode() const { return mMappingMode; } + + /** Returns the Reference Mode. + * \return The current Reference Mode. + */ + EReferenceMode GetReferenceMode() const { return mReferenceMode; } + + /** Sets the name of this object. + * \param pName Specifies the name of this LayerElement object. + */ + void SetName(const char* pName) { mName = FbxString(pName); } + + /** Returns the name of this object. + * \return The current name of this LayerElement object. + */ + const char* GetName() const { return ((FbxLayerElement*)this)->mName.Buffer(); } + + /** Equivalence operator + * \param pOther Layer element to be compared. + * \return \c True if equal, \c false otherwise. + */ + bool operator==(const FbxLayerElement& pOther) const + { + return (mName == pOther.mName) && + (mMappingMode == pOther.mMappingMode) && + (mReferenceMode == pOther.mReferenceMode); + } + + /** Assignment operator + * \param pOther Layer element assigned to this one. + * \return This layer element after assignment. + */ + FbxLayerElement& operator=( FbxLayerElement const& pOther ) + { + mMappingMode = pOther.mMappingMode; + mReferenceMode = pOther.mReferenceMode; + // name, type and owner should not be copied because they are + // initialized when this object is created + return *this; + } + + //! Removes this layer element from its owner and delete it. + void Destroy(); + + //! Clears all the data from this layer element. + virtual bool Clear() + { + return true; + } + +/***************************************************************************************************************************** +** 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 SetType(const FbxDataType* pType) { mType = pType; } + const FbxLayerContainer* GetOwner() const { return mOwner; } + + // Reference count added in case of shared objects or corrupted files that uses the same object. + // This will prevent the deletion of an object that is stil used. + void IncRefCount() { mRefCount++; } + int DecRefCount() { mRefCount--; if (mRefCount < 0) { mRefCount = 0; } return mRefCount; } + +protected: + FbxLayerElement() + : mMappingMode(eNone) + , mReferenceMode(eDirect) + , mName("") + , mOwner(NULL) + , mRefCount(0) + { + } + + virtual ~FbxLayerElement() + { + } + + EMappingMode mMappingMode; + EReferenceMode mReferenceMode; + + FbxString mName; + const FbxDataType* mType; + FbxLayerContainer* mOwner; + int mRefCount; + + void Destruct() { if (DecRefCount() == 0) { FbxDelete(this); } } + virtual void SetOwner(FbxLayerContainer* pOwner, int pInstance = 0); + + FBXSDK_FRIEND_NEW(); + +public: + virtual int MemorySize() const { return 0; } + virtual bool ContentWriteTo(FbxStream& pStream) const; + virtual bool ContentReadFrom(const FbxStream& pStream); + + friend class FbxLayerContainer; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** \internal + * Identifies what error occurs when the data arrays are manipulated. + * \nosubgrouping + */ + +class FBXSDK_DLL LockAccessStatus +{ +public: + /** \internal + * \enum ELockAccessStatus Identifies what error occurs when the data arrays are manipulated. + * - \e eSuccess Operation Successful. + * - \e eUnsupportedDTConversion Attempts to convert to an unsupported DataType. + * - \e eCorruptedCopyback The Release of a converted buffer fails and corrupts the main data. + * - \e eBadValue Invalid value. + * - \e eLockMismatch Attempts to change to an incompatible lock. + * - \e eNoWriteLock A write operation is attempted but no WriteLock is available. + * - \e eNoReadLock A read operation is attempted but the WriteLock is active. + * - \e eNotOwner Attempts to release a lock on an invalid data buffer pointer. + * - \e eDirectLockExist A direct access lock is still active. + */ + enum ELockAccessStatus + { + eSuccess, + eUnsupportedDTConversion, + eCorruptedCopyback, + eBadValue, + eLockMismatch, + eNoWriteLock, + eNoReadLock, + eNotOwner, + eDirectLockExist + }; +}; + +//Special conversion types, we do not want them to resolve to undefined. +typedef FbxHandle* FbxRefPtr; +typedef FbxLayerElementArray* FbxLayerElementArrayPtr; +typedef FbxSurfaceMaterial* FbxSurfaceMaterialPtr; +typedef FbxTexture* FbxTexturePtr; + +inline EFbxType FbxTypeOf(const FbxRefPtr&){ return eFbxReference; } +inline EFbxType FbxTypeOf(const FbxLayerElementArrayPtr&){ return eFbxReference; } +inline EFbxType FbxTypeOf(const FbxSurfaceMaterialPtr&){ return eFbxReference; } +inline EFbxType FbxTypeOf(const FbxTexturePtr&){ return eFbxReference; } + +/** FbxLayerElementArray is the base class for FbxLayerElementArrayTemplate, + * it provides lock handling and data array manipulation of the data buffer for FbxLayerElement. + * \nosubgrouping + */ + +class FBXSDK_DLL FbxLayerElementArray +{ +public: + /** + * \name Constructor and Destructor + */ + //@{ + + /** Constructor. + * \param pDataType The data type of the items in the data array. + */ + FbxLayerElementArray(EFbxType pDataType); + + //!Destructor. + virtual ~FbxLayerElementArray(); + + //@} + + /** + * \name Status handling + */ + //@{ + + //!Clears the access state and sets it to eSuccess. + inline void ClearStatus() { mStatus = LockAccessStatus::eSuccess; } + + //!Retrieves the access state. + inline LockAccessStatus::ELockAccessStatus GetStatus() const { return mStatus; } + //@} + + /** + * \name Locks handling + */ + //@{ + + /** Returns whether write is locked. + * \return \c True if write is locked, \c false otherwise. + */ + inline bool IsWriteLocked() const { return mWriteLock; }; + + /** Retrieves the read lock count. + * \return The read lock count. + */ + inline int GetReadLockCount() const { return mReadLockCount; } + //@} + + /** Returns whether this Array is accessed in any way. + * \return \c True if it is in use, \c false otherwise. + */ + bool IsInUse() const; + + /** Increments the number of read locks on this array. + * \return The current number of read locks (including the one just grabbed) or 0 if a write lock is active. + */ + int ReadLock() const; + + /** Releases a read lock on this array. + * \return The remaining read locks or -1 if a write lock is active. + */ + int ReadUnlock() const; + + /** Locks this array for writing. The data in the array is wiped out. + * \return \c True if a write lock has been successfully granted, \c false if one or more read locks + * are active. + */ + bool WriteLock() const; + + /** Releases the write lock on this array. + */ + void WriteUnlock() const; + + /** Locks this array for writing. The data that already exists in the array is kept and is valid. + * \return \c True if a write lock has been successfully granted, \c false if one or more read locks + * are active. + */ + bool ReadWriteLock() const; + + /** Releases the write lock on this array. + */ + void ReadWriteUnlock() const; + + + /** \enum ELockMode Identifies the access mode to the data buffer. + * - \e eReadLock Read mode. + * - \e eWriteLock Write mode. + * - \e eReadWriteLock Read-write mode. + */ + enum ELockMode + { + eReadLock = 1, + eWriteLock = 2, + eReadWriteLock = 3 + }; + + /** Grants a locked access to the data buffer. + * \param pLockMode Access mode to the data buffer. + * \param pDataType If defined, tries to return the data as this type. + * \return A pointer to the data buffer or NULL if a failure occurs. + * \remarks In the case of a failure, the Status is updated with the + * reason for the failure. Also, when a type conversion occurs, a second buffer + * of the new type is allocated. In this case, the LockMode does not apply to the + * returned buffer since it is a copy but it does apply to the internal data of this + * object. The returned buffer still remains a property of this object and is + * deleted when the pointer is released or the object is destroyed. At the moment of + * release or destruction, the values in this buffer are copied back into this object. + */ + virtual void* GetLocked(ELockMode pLockMode, EFbxType pDataType); + + /** Grants a locked access to the data buffer. + * \param pLockMode Access mode to the data buffer. + * \return A pointer to the data buffer or NULL if a failure occurs. + * \remarks In the case of a failure, the Status is updated with the + * reason for the failure. Also, when a type conversion occurs, a second buffer + * of the new type is allocated. In this case, the LockMode does not apply to the + * returned buffer since it is a copy but it does apply to the internal data of this + * object. The returned buffer still remains a property of this object and is + * deleted when the pointer is released or the object is destroyed. At the moment of + * release or destruction, the values in this buffer are copied back into this object. + */ + void* GetLocked(ELockMode pLockMode=eReadWriteLock) { return GetLocked(pLockMode, mDataType); } + + /** Grants a locked access to the data buffer. + * \param pLockMode Access mode to the data buffer. + * \return A pointer to the data buffer or NULL if a failure occurs. + * \remarks In the case of a failure, the Status is updated with the + * reason for the failure. Also, when a type conversion occurs, a second buffer + * of the new type is allocated. In this case, the LockMode does not apply to the + * returned buffer since it is a copy but it does apply to the internal data of this + * object. The returned buffer still remains a property of this object and is + * deleted when the pointer is released or the object is destroyed. At the moment of + * release or destruction, the values in this buffer are copied back into this object. + */ + template inline T* GetLocked(T*, ELockMode pLockMode=eReadWriteLock) {T v; return (T*)GetLocked(pLockMode, FbxTypeOf(v)); } + + /** Unlock the data buffer. + * \param pDataPtr The buffer to be released. + * \param pDataType The data type of the data buffer. + * \remarks The passed pointer must be the one obtained by the call to GetLocked(). + * Any other pointer causes this method to fail and the Status is updated with + * the reason for the failure. If the passed pointer refers a converted data + * buffer (see comment of GetLocked), this method copies the GetCount() items + * of the received buffer back into this object. Any other items that may have been added + * using a realloc call are ignored. + */ + virtual void Release(void** pDataPtr, EFbxType pDataType); + + /** Unlock the data buffer. + * \param pDataPtr The buffer to be released. + * \remarks The passed pointer must be the one obtained by the call to GetLocked(). + * Any other pointer causes this method to fail and the Status is updated with + * the reason for the failure. If the passed pointer refers a converted data + * buffer (see comment of GetLocked), this method copies the GetCount() items + * of the received buffer back into this object. Any other items that may have been added + * using a realloc call are ignored. + */ + void Release(void** pDataPtr) { Release(pDataPtr, mDataType); } + + /** Unlock the data buffer. + * \param pDataPtr The buffer to be released. + * \param dummy The data type of dummy is used to specialize this function. + * \remarks The passed pointer must be the one obtained by the call to GetLocked(). + * Any other pointer causes this method to fail and the Status is updated with + * the reason for the failure. If the passed pointer refers a converted data + * buffer (see comment of GetLocked), this method copies the GetCount() items + * of the received buffer back into this object. Any other items that may have been added + * using a realloc call are ignored. + */ + template inline void Release(T** pDataPtr, T* dummy) + { + T*** voidPtr = &pDataPtr; + Release((void**)*voidPtr, FbxTypeOf(*dummy)); + } + + /** Returns the Stride size which equals the size of the data type of the data buffer. + */ + virtual size_t GetStride() const; + + /** + * \name Data array manipulation + */ + //@{ + + //! Returns the count of items in the data buffer. + int GetCount() const; + + /** Sets the count of items in the data buffer. + * \param pCount The count of items to be set. + */ + void SetCount(int pCount); + + //! Clears the data buffer. + void Clear(); + + /** Resizes the data buffer. + * \param pItemCount The new size of the data buffer. + */ + void Resize(int pItemCount); + + /** Appends space to the data buffer. + * \param pItemCount The appended space size + */ + void AddMultiple(int pItemCount); + + /** Appends a new item to the end of the data buffer. + * \param pItem Pointer of the new item to be added + * \param pValueType Data type of the new item + * \return The index of the new item + */ + int Add(const void* pItem, EFbxType pValueType); + + /** Inserts a new item at the specified position of the data buffer. + * \param pIndex The specified position + * \param pItem Pointer of the new item to be inserted + * \param pValueType Data type of the new item + * \return The index of the inserted item + * \remarks The input index must be within valid range and no error will be thrown if it is invalid. + */ + int InsertAt(int pIndex, const void* pItem, EFbxType pValueType); + + /** Sets the value for the specified item. + * \param pIndex The index of the item to be updated. + * \param pItem Pointer of the item whose value is copied to pIndex'th item + * \param pValueType Data type of the item + * \remarks The input index must be within valid range and no error will be thrown if it is invalid. + */ + void SetAt(int pIndex, const void* pItem, EFbxType pValueType); + + /** Sets the value of the last item. + * \param pItem Pointer of the item whose value is copied to the last item + * \param pValueType Data type of the item + * \remarks The array should contain at least one item and no error will be thrown if it is empty. + */ + void SetLast(const void* pItem, EFbxType pValueType); + + /** Removes the specified item from the data buffer. + * \param pIndex The index of the item to be removed + * \param pItem Place to hold the value of the removed item. + * \param pValueType Data type of the item + * \remarks The input index must be within valid range and no error will be thrown if it is invalid. + */ + void RemoveAt(int pIndex, void** pItem, EFbxType pValueType); + + /** Removes the last item from the data buffer. + * \param pItem Place to hold the value of the removed item. + * \param pValueType Data type of the item + * \remarks The array should contain at least one item and no error will be thrown if it is empty. + */ + void RemoveLast(void** pItem, EFbxType pValueType); + + /** Removes one item from the data buffer. + * \param pItem The first item who equals pItem is to be removed + * \param pValueType Data type of the item + * \return \c True if the item is removed successfully, \c false otherwise + */ + bool RemoveIt(void** pItem, EFbxType pValueType); + + /** Returns the specified item's value. + * \param pIndex Index of the item + * \param pItem Place to hold the item's value + * \param pValueType Data type of the item + * \return \c True if the item's value is returned successfully, \c false otherwise + * \remarks If the index is invalid, pItem is set to zero. + */ + bool GetAt(int pIndex, void** pItem, EFbxType pValueType) const; + + /** Returns the first item's value. + * \param pItem Place to hold the item's value + * \param pValueType Data type of the item + * \return \c True if the item's value is returned successfully, \c false otherwise + */ + bool GetFirst(void** pItem, EFbxType pValueType) const; + + /** Returns the last item's value. + * \param pItem Place to hold the item's value + * \param pValueType Data type of the item + * \return \c True if the item's value is returned successfully, \c false otherwise + */ + bool GetLast(void** pItem, EFbxType pValueType) const; + + /** Searches for an item in the data buffer. + * \param pItem The value of the item for which to search. + * \param pValueType Data type of the item + * \return The index of the item found, -1 if not found. + * \remarks The index of the first item whose value equals pItem is returned. + */ + int Find(const void* pItem, EFbxType pValueType) const; + + /** Searches for an item after the specified index in the data buffer. + * \param pAfterIndex The specified index after which the searching begins + * \param pItem The value of the item for which to search, the searching begins after pAfterIndex. + * \param pValueType Data type of the item + * \return The index of the item found, -1 if not found. + * \remarks The index of the first item whose value equals pItem is returned. + */ + int FindAfter(int pAfterIndex, const void* pItem, EFbxType pValueType) const; + + /** Searches for an item before the specified index in the data buffer. + * \param pBeforeIndex The specified index before which the searching begins + * \param pItem The value of the item for which to search, the searching begins before pBeforeIndex. + * \param pValueType The item's data type. + * \return The index of the item found, -1 if not found. + * \remarks The index of the first item whose value equals pItem is returned. + */ + int FindBefore(int pBeforeIndex, const void* pItem, EFbxType pValueType) const; + + /** Equivalence operator + * \param pArray Array compared to this one + * \return \c True if equal. \c false otherwise. + */ + bool IsEqual(const FbxLayerElementArray& pArray) const; + + /** Appends a new item to the end of the data buffer. + * \param pItem The new item to be added + * \return The index of the new item + */ + template inline int Add(T const& pItem) { return Add((const void*)&pItem, FbxTypeOf(pItem)); } + + /** Inserts a new item at the specified position of the data buffer. + * \param pIndex The specified position + * \param pItem The new item to be inserted + * \return The index of the inserted item + * \remarks The input index must be within valid range and no error will be thrown if it is invalid. + */ + template inline int InsertAt(int pIndex, T const& pItem) { return InsertAt(pIndex, (const void*)&pItem, FbxTypeOf(pItem)); } + + /** Sets the value of the specified item. + * \param pIndex The index of the item to be updated. + * \param pItem The item whose value is copied to pIndex'th item + * \remarks The input index must be within valid range and no error will be thrown if it is invalid. + */ + template inline void SetAt(int pIndex, T const& pItem) { SetAt(pIndex, (const void*)&pItem, FbxTypeOf(pItem)); } + + /** Sets the value of the last item. + * \param pItem The item whose value is copied to the last item + * \remarks The array should contain at least one item and no error will be thrown if it is empty. + */ + template inline void SetLast(T const& pItem) { SetLast((const void*)&pItem, FbxTypeOf(pItem)); } + + /** Removes the specified item from the data buffer. + * \param pIndex The index of the item to be removed + * \param pItem Place to hold the value of the removed item. + * \remarks The input index must be within valid range and no error will be thrown if it is invalid. + */ + template inline void RemoveAt(int pIndex, T* pItem) + { + T** voidPtr = &pItem; + RemoveAt(pIndex, (void**)voidPtr, FbxTypeOf(*pItem)); + } + + /** Removes the last item from the data buffer. + * \param pItem Place to hold the value of the removed item. + * \remarks The array should contain at least one item and no error will be thrown if it is empty. + */ + template inline void RemoveLast(T* pItem) + { + T** voidPtr = &pItem; + RemoveLast((void**)voidPtr, FbxTypeOf(*pItem)); + } + + /** Removes one item from the data buffer. + * \param pItem The first item who equals pItem is to be removed + * \return \c True if the item is removed successfully, \c false otherwise + */ + template inline bool RemoveIt(T* pItem) + { + T** voidPtr = &pItem; + return RemoveIt((void**)voidPtr, FbxTypeOf(*pItem)); + } + + /** Returns the specified item's value. + * \param pIndex Index of the item + * \param pItem Place to hold the item's value + * \return \c True if the item's value is returned successfully, \c false otherwise + * \remarks If the index is invalid, pItem is set to zero. + */ + template inline bool GetAt(int pIndex, T* pItem) const + { + T** voidPtr = &pItem; + return GetAt(pIndex, (void**)voidPtr, FbxTypeOf(*pItem)); + } + + /** Returns the first item's value. + * \param pItem Place to hold the item's value + * \return \c True if the item's value is returned successfully, \c false otherwise + */ + template inline bool GetFirst(T* pItem) const + { + T** voidPtr = &pItem; + return GetFirst((void**)voidPtr, FbxTypeOf(*pItem)); + } + + /** Returns the last item's value. + * \param pItem Place to hold the item's value + * \return \c True if the item's value is returned successfully, \c false otherwise + */ + template inline bool GetLast(T* pItem) const + { + T** voidPtr = &pItem; + return GetLast((void**)voidPtr, FbxTypeOf(*pItem)); + } + + /** Searches for an item in the data buffer. + * \param pItem The value of the item for which to search. + * \return The index of the item found, -1 if not found. + * \remarks The index of the first item whose value equals pItem is returned. + */ + template inline int Find(T const& pItem) const { return Find((const void*)&pItem, FbxTypeOf(pItem)); } + + /** Searches for an item after the specified index in the data buffer. + * \param pAfterIndex The specified index after which the searching begins + * \param pItem The value of the item for which to search, the searching begins after pAfterIndex. + * \return The index of the item found, -1 if not found. + * \remarks The index of the first item whose value equals pItem is returned. + */ + template inline int FindAfter(int pAfterIndex, T const& pItem) const { return FindAfter(pAfterIndex, (const void*)&pItem, FbxTypeOf(pItem)); } + + /** Searches for one item before the specified index in the data buffer. + * \param pBeforeIndex The specified index before which the searching begins + * \param pItem The value of the item for which to search, the searching begins before pBeforeIndex. + * \return The index of the item found, -1 if not found. + * \remarks The index of the first item whose value equals pItem is returned. + */ + template inline int FindBefore(int pBeforeIndex, T const& pItem) const { return FindBefore(pBeforeIndex, (const void*)&pItem, FbxTypeOf(pItem)); } + + + /** Copies the items in the data buffer to an array. + * \param pDst The destination array where the items are to be copied. + */ + template inline void CopyTo(FbxArray& pDst) + { + T src; + T* srcPtr = &src; + + pDst.Clear(); + if (mDataType != FbxTypeOf(src)) + { + SetStatus(LockAccessStatus::eUnsupportedDTConversion); + return; + } + + pDst.Resize(GetCount()); + for (int i = 0; i < GetCount(); i++) + { + if (GetAt(i, (void**)&srcPtr, mDataType)) + { + pDst.SetAt(i, src); + } + } + SetStatus(LockAccessStatus::eSuccess); + } + //@} + +protected: + void* GetDataPtr(); + void* GetReference(int pIndex, EFbxType pValueType); + void GetReferenceTo(int pIndex, void** pRef, EFbxType pValueType); + + inline void SetStatus(LockAccessStatus::ELockAccessStatus pVal) const + { + const_cast(this)->mStatus = pVal; + } + + void SetImplementation(void* pImplementation); + inline void* GetImplementation() { return mImplementation; } + virtual void ConvertDataType(EFbxType pDataType, void** pDataPtr, size_t* pStride); + + EFbxType mDataType; + +private: + LockAccessStatus::ELockAccessStatus mStatus; + + int mReadLockCount; + bool mWriteLock; + void* mImplementation; + size_t mStride; + int mDirectLockOn; + bool mDirectAccessOn; + + FbxArray mConvertedData; + +}; + +/** \internal + * This class provides simple RAII-style read locking of a FbxLayerElementArray object. + */ +template +struct FbxLayerElementArrayReadLock +{ + /** \internal + * On construction, this class requires the read lock. + */ + FbxLayerElementArrayReadLock(FbxLayerElementArray& pArray) : mArray(pArray) + { + mLockedData = mArray.GetLocked((T*)NULL, FbxLayerElementArray::eReadLock); + } + + /** \internal + * On destruction, this class releases the read lock. + */ + ~FbxLayerElementArrayReadLock() + { + if( mLockedData ) + { + mArray.Release((void **) &mLockedData); + } + } + + /** \internal + * Retrieve the locked array data. + */ + const T* GetData() const + { + return mLockedData; + } + +private: + FbxLayerElementArray& mArray; + T* mLockedData; +}; + +class FbxLayerElementUserData; + +/** FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement. + * It is the subclass of FbxLayerElementArray. + * \nosubgrouping + */ +template class FbxLayerElementArrayTemplate : public FbxLayerElementArray +{ +public: + + /** Constructor + * \param pDataType The data type of the array items. + */ + FbxLayerElementArrayTemplate(EFbxType pDataType) : + FbxLayerElementArray(pDataType) + { + } + + /** Appends a new item to the end of the data buffer. + * \param pItem The new item to be added + * \return The index of the new item + */ + inline int Add( T const &pItem ) { return FbxLayerElementArray::Add(pItem); } + + /** Inserts a new item at the specified position of the data buffer. + * \param pIndex The specified position + * \param pItem The new item to be inserted + * \return The index of the inserted item + */ + inline int InsertAt(int pIndex, T const &pItem) { return FbxLayerElementArray::InsertAt(pIndex, pItem); } + + /** Sets the value of the specified item. + * \param pIndex The index of the item to be updated. + * \param pItem The item whose value is copied to pIndex'th item + */ + inline void SetAt(int pIndex, T const &pItem) { FbxLayerElementArray::SetAt(pIndex, pItem); } + + /** Sets the value of the last item. + * \param pItem The item whose value is copied to the last item + */ + inline void SetLast( T const &pItem) { FbxLayerElementArray::SetLast(pItem); } + + /** Removes the specified item from the data buffer. + * \param pIndex The index of the item to be removed + * \return The value of the item removed + */ + inline T RemoveAt(int pIndex) { T lValue; FbxLayerElementArray::RemoveAt(pIndex, &lValue); return lValue; } + + /** Removes the last item from the data buffer. + * \return The value of the last item removed + */ + inline T RemoveLast() { T lValue; FbxLayerElementArray::RemoveLast(&lValue); return lValue; } + + /** Removes one item from the data buffer. + * \param pItem The first item who equals pItem is to be removed + * \return \c True if the item is removed successfully, \c false otherwise + */ + inline bool RemoveIt(T const &pItem) { return FbxLayerElementArray::RemoveIt(&pItem); } + + /** Returns the specified item's value. + * \param pIndex Index of the item + * \return The value of the specified item + * \remarks If the index is invalid, pItem is set to zero. + */ + inline T GetAt(int pIndex) const { T lValue; FbxLayerElementArray::GetAt(pIndex, &lValue); return lValue; } + + /** Returns the first item's value. + * \return The first item's value. + */ + inline T GetFirst() const { T lValue; FbxLayerElementArray::GetFirst(&lValue); return lValue; } + + /** Returns the last item's value. + * \return The last item's value. + */ + inline T GetLast() const { T lValue; FbxLayerElementArray::GetLast(&lValue); return lValue; } + + /** Searches for an item in the data buffer. + * \param pItem The value of the item for which to search + * \return The index of the item found, -1 if not found. + * \remarks The index of the first item whose value equals pItem is returned. + */ + inline int Find(T const &pItem) { return FbxLayerElementArray::Find(pItem); } + + /** Searches for an item after the specified index in the data buffer. + * \param pAfterIndex The specified index after which the searching begins + * \param pItem The value of the item for which to search, the searching begins after pAfterIndex. + * \return The index of the item found, -1 if not found. + * \remarks The index of the first item whose value equals pItem is returned. + */ + inline int FindAfter(int pAfterIndex, T const &pItem) { return FbxLayerElementArray::FindAfter(pAfterIndex, pItem); } + + /** Searches for one item before the specified index in the data buffer. + * \param pBeforeIndex The specified index before which the searching begins + * \param pItem The value of the item for which to search, the searching begins before pBeforeIndex. + * \return The index of the item found, -1 if not found. + * \remarks The index of the first item whose value equals pItem is returned. + */ + inline int FindBefore(int pBeforeIndex, T const &pItem) { return FbxLayerElementArray::FindBefore(pBeforeIndex, pItem); } + + /** Returns the specified item's value. + * \param pIndex Index of the item + * \return The value of the item + * \remarks If the index is invalid, pItem is set to zero. + */ + T operator[](int pIndex) const { T lValue; FbxLayerElementArray::GetAt(pIndex, &lValue); return lValue; } + + /** Assignment operator. + * \param pArrayTemplate The source array whose items are copied to this array. + */ + FbxLayerElementArray& operator=(const FbxArray& pArrayTemplate) + { + SetStatus(LockAccessStatus::eNoWriteLock); + if (WriteLock()) + { + SetCount(pArrayTemplate.GetCount()); + for (int i = 0; i < pArrayTemplate.GetCount(); i++) + SetAt(i, pArrayTemplate.GetAt(i)); + WriteUnlock(); + SetStatus(LockAccessStatus::eSuccess); + } + return *this; + } + + /** Assignment operator. + * \param pArrayTemplate The source array whose items are copied to this array. + */ + FbxLayerElementArrayTemplate& operator=(const FbxLayerElementArrayTemplate& pArrayTemplate) + { + if ( this != &pArrayTemplate ) + { + SetStatus(LockAccessStatus::eNoWriteLock); + if (WriteLock()) + { + SetCount(pArrayTemplate.GetCount()); + for (int i = 0; i < pArrayTemplate.GetCount(); i++) + SetAt(i, pArrayTemplate.GetAt(i)); + WriteUnlock(); + SetStatus(LockAccessStatus::eSuccess); + } + } + return *this; + } + +private: + // This one is not the best thing to do, but at least I don't get deprecated calls inside this file. + // Note that FbxLayerElementUserData is kind of a weird class in the first place anyway. So either + // we clean it up, or we live with this piece of code ;-) + friend class FbxLayerElementUserData; + T& AsReference(int pIndex) { T* v = (T*)FbxLayerElementArray::GetReference(pIndex, mDataType); return (v)?*v:dummy;} + + T dummy; +}; + + +/** Remap the index array to a new EMappingMode + * \param pLayerEl The layer element to remap + * \param pNewMapping The new mapping mode + * \param pIndexArray The index array to modify + * \return return -1 if the layer element is FbxLayerElement::eDirect + * 0 if layer element or index array is \c NULL and 1 if the remap is successful + */ +extern FBXSDK_DLL int RemapIndexArrayTo(FbxLayerElement* pLayerEl, + FbxLayerElement::EMappingMode pNewMapping, + FbxLayerElementArrayTemplate* pIndexArray); + + +/** This class complements the FbxLayerElement class. + * It provides interfaces to access the direct array and index array of different layer elements. + * \nosubgrouping + */ +template class FbxLayerElementTemplate : public FbxLayerElement +{ +public: + + /** Returns the direct array of Layer Elements. + * \return A reference to the Layer Elements direct array. + * \remarks You cannot put elements in the direct array when the reference mode is set to eIndex. + */ + FbxLayerElementArrayTemplate& GetDirectArray() const + { + FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect); + return *mDirectArray; + } + + /** Returns the direct array of Layer Elements. + * \return A reference to the Layer Elements direct array. + * \remarks You cannot put elements in the direct array when the reference mode is set to eIndex. + */ + FbxLayerElementArrayTemplate& GetDirectArray() + { + FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect); + return *mDirectArray; + } + + /** Returns the index array of Layer Elements. + * \return A reference to the index array. + * \remarks You cannot put elements in the index array when the mapping mode is set to eDirect. + */ + FbxLayerElementArrayTemplate& GetIndexArray() const + { + FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect); + return *mIndexArray; + } + + /** Returns the index array of Layer Elements. + * \return A reference to the index array. + * \remarks You cannot put elements in the index array when the mapping mode is set to eDirect. + */ + FbxLayerElementArrayTemplate& GetIndexArray() + { + FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect); + return *mIndexArray; + } + + /** Removes all elements from the direct and the index arrays. + * \remarks This function fails if there is a lock on the arrays. + * \return \c True if successful, \c false if a lock is present. + */ + bool Clear() + { + bool ret = true; + mDirectArray->Clear(); + ret = (mDirectArray->GetStatus() == LockAccessStatus::eSuccess); + + mIndexArray->Clear(); + ret |= (mIndexArray->GetStatus() == LockAccessStatus::eSuccess); + + return ret; + } + +public: + + /** Equivalence operator. + * \param pOther Another element compared to this object + * \return \c True if equal, \c false if unequal. + */ + bool operator==(const FbxLayerElementTemplate& pOther) const + { + bool ret = true; + + if (pOther.GetReferenceMode() == FbxLayerElement::eDirect || + pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect) + { + const FbxLayerElementArrayTemplate& directArray = pOther.GetDirectArray(); + if( directArray.GetCount() != mDirectArray->GetCount() || + !directArray.ReadLock() || !mDirectArray->ReadLock() ) + { + ret = false; + } + + if( ret && !mDirectArray->IsEqual(directArray) ) + ret = false; + + directArray.ReadUnlock(); + mDirectArray->ReadUnlock(); + } + + if (ret) + { + if (pOther.GetReferenceMode() == FbxLayerElement::eIndex || + pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect) + { + const FbxLayerElementArrayTemplate& indexArray = pOther.GetIndexArray(); + if( indexArray.GetCount() != mIndexArray->GetCount() || + !indexArray.ReadLock() || !mIndexArray->ReadLock() ) + { + ret = false; + } + + if( ret && !mIndexArray->IsEqual(indexArray) ) + ret = false; + + indexArray.ReadUnlock(); + mIndexArray->ReadUnlock(); + } + } + + if (ret == false) + return false; + + return FbxLayerElement::operator==(pOther); + } + + /** Assignment operator. + * \param pOther Another element assigned to this one + */ + FbxLayerElementTemplate& operator=( FbxLayerElementTemplate const& pOther ) + { + FBX_ASSERT(mDirectArray != NULL); + FBX_ASSERT(mIndexArray != NULL); + + if (pOther.GetReferenceMode() == FbxLayerElement::eDirect || + pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect) + { + const FbxLayerElementArrayTemplate& directArray = pOther.GetDirectArray(); + *mDirectArray = directArray; + } + + if (pOther.GetReferenceMode() == FbxLayerElement::eIndex || + pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect) + { + const FbxLayerElementArrayTemplate& indexArray = pOther.GetIndexArray(); + *mIndexArray = indexArray; + } + + FbxLayerElement* myself = (FbxLayerElement*)this; + FbxLayerElement* myOther = (FbxLayerElement*)&pOther; + *myself = *myOther; + return *this; + } + + /** Changes the Mapping mode to the new one and re-computes the index array. + * \param pNewMapping New mapping mode. + * \return If the remapping is successful, returns 1. + * If an error occurs, returns 0. In case the function cannot + * remap to the desired mode because of incompatible modes or + * unsupported modes, returns -1. + */ + int RemapIndexTo(FbxLayerElement::EMappingMode pNewMapping) + { + return RemapIndexArrayTo(this, pNewMapping, mIndexArray); + } + +/***************************************************************************************************************************** +** 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: + FbxLayerElementTemplate() + { + mDirectArray = NULL; + mIndexArray = NULL; + } + + ~FbxLayerElementTemplate() + { + FbxDelete(mDirectArray); + FbxDelete(mIndexArray); + } + + virtual void AllocateArrays() + { + mDirectArray = FbxNew< FbxLayerElementArrayTemplate >(mType->GetType()); + mIndexArray = FbxNew< FbxLayerElementArrayTemplate >(FbxIntDT.GetType()); + } + +public: + virtual int MemorySize() const + { + int size = FbxLayerElement::MemorySize(); + size += (mDirectArray->GetCount()*sizeof(Type)); + size += (mIndexArray->GetCount()*sizeof(int)); + return size; + } + + /** + * \name Serialization section + */ + //@{ + virtual bool ContentWriteTo(FbxStream& pStream) const + { + void* a; + int s,v; + int count = 0; + + // direct array + count = mDirectArray->GetCount(); + s = pStream.Write(&count, sizeof(int)); + if (s != sizeof(int)) return false; + if (count > 0) + { + a = mDirectArray->GetLocked(); + FBX_ASSERT(a != NULL); + v = count*sizeof(Type); + s = pStream.Write(a, v); + mDirectArray->Release(&a); + if (s != v) return false; + } + + // index array + count = mIndexArray->GetCount(); + s = pStream.Write(&count, sizeof(int)); + if (s != sizeof(int)) return false; + if (count > 0) + { + a = mIndexArray->GetLocked(); + FBX_ASSERT(a != NULL); + v = count*sizeof(int); + s = pStream.Write(a, v); + mIndexArray->Release(&a); + if (s != v) return false; + } + + return FbxLayerElement::ContentWriteTo(pStream); + } + + virtual bool ContentReadFrom(const FbxStream& pStream) + { + void* a; + int s,v; + int count = 0; + + // direct array + s = pStream.Read(&count, sizeof(int)); + if (s != sizeof(int)) return false; + mDirectArray->Resize(count); + if (count > 0) + { + a = mDirectArray->GetLocked(); + FBX_ASSERT(a != NULL); + v = count*sizeof(Type); + s = pStream.Read(a, v); + mDirectArray->Release(&a); + if (s != v) return false; + } + + // index array + s = pStream.Read(&count, sizeof(int)); + if (s != sizeof(int)) return false; + mIndexArray->Resize(count); + if (count > 0) + { + a = mIndexArray->GetLocked(); + FBX_ASSERT(a != NULL); + v = count*sizeof(int); + s = pStream.Read(a, v); + mIndexArray->Release(&a); + if (s != v) return false; + } + return FbxLayerElement::ContentReadFrom(pStream); + } + //@} + + typedef Type ArrayElementType; + typedef FbxLayerElementArrayTemplate DirectArrayType; + typedef FbxLayerElementArrayTemplate IndexArrayType; + + FbxLayerElementArrayTemplate* mDirectArray; + FbxLayerElementArrayTemplate* mIndexArray; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#define FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(classDesc) \ + FBXSDK_FRIEND_NEW(); \ + static Fbx##classDesc* Create(FbxLayerContainer* pOwner, const char* pName); + +/** \brief Layer element for mapping Normals to a geometry. + * \remarks To be correctly saved in FBX file, this type of Layer element should have its reference + * mode set to \e eIndexToDirect. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementNormal : public FbxLayerElementTemplate +{ +public: + + /** Allocation method. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementNormal); + +protected: + FbxLayerElementNormal(); + ~FbxLayerElementNormal(); +}; + +/** \brief Layer element for mapping Binormals to a geometry. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementBinormal : public FbxLayerElementTemplate +{ +public: + + /** Allocation method. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementBinormal); + +protected: + FbxLayerElementBinormal(); + ~FbxLayerElementBinormal(); +}; + +/** \brief Layer element for mapping Tangents to a geometry. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementTangent : public FbxLayerElementTemplate +{ +public: + + /** Allocation method. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementTangent); + +protected: + FbxLayerElementTangent(); + ~FbxLayerElementTangent(); +}; + +/** Layer element for mapping materials (FbxSurfaceMaterial) to a geometry. + * + * FBX SDK 2011 and later connects materials (FbxSurfaceMaterial) to nodes (FbxNode). + * The direct array of this class is no longer used. + * The integer "n" in the index array of this class represents the n-th material (zero-based) connected to the node. + * + * For example: + * + * Mapping mode eAllSame and index array {0} means the whole geometry is assigned with the 0-th material + * connected to the node. + * + * Mapping mode eByPolygon and index array {0, 1} means the first polygon is assigned with the 0-th material and + * the second polygon is assigned with the 1-th material. + * + * + * You can access the materials from a node by using FbxNode::GetMaterialCount() and FbxNode::GetMaterial(int pIndex) + * or the more generic calls to GetSrcObjectCount() and + * GetSrcObject(index) + * + * For example: + * + * \code + * FbxNode* node; + * int nbMat = node->GetMaterialCount(); + * int nbMat1= node->GetSrcObjectCount(); + * + * FbxSurfaceMaterial* material; + * FbxLayerElementMaterial* layerElement; + * if (layerElement->GetMappingMode() == FbxLayerElement::eAllSame) + * { + * int index = layerElement->GetIndexArray()[0]; + * material = node->GetMaterial(index); + * } + * \endcode + * + * \remarks + * The DirectArray() methods still exist for legacy reasons but has been made private and should not be used. + * Therefore, to be correctly saved in FBX file, this type of Layer element should have its reference + * mode set to \e eIndexToDirect. + * + * \see FbxSurfaceMaterial + * \see FbxNode + */ +class FBXSDK_DLL FbxLayerElementMaterial : public FbxLayerElementTemplate +{ +public: + typedef FbxLayerElementTemplate ParentClass; + + /** Allocation method. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementMaterial); + + /** \internal + * Internal class to maintain backward compatibility with old FBX code (prior to FBX SDK 2011). + * This class synchronizes the direct array with FbxNode connections. + * Thus, changes on the direct array will reflect on FbxNode. + */ + class LayerElementArrayProxy : public FbxLayerElementArrayTemplate + { + public: + typedef FbxLayerElementArrayTemplate ParentClass; + + LayerElementArrayProxy(EFbxType pType); + void SetContainer( FbxLayerContainer* pContainer, int pInstance = 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 + virtual void AllocateArrays(); + virtual void SetOwner( FbxLayerContainer* pOwner, int pInstance = 0); + virtual void SetInstance( int pInstance ) { SetOwner( mOwner, pInstance ); } + +protected: + FbxLayerElementMaterial(); + ~FbxLayerElementMaterial(); + +private: + FbxLayerElementArrayTemplate& GetDirectArray() const + { + return ParentClass::GetDirectArray(); + } + + FbxLayerElementArrayTemplate& GetDirectArray() + { + return ParentClass::GetDirectArray(); + } + + friend class FbxLayerContainer; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** \brief Layer element for grouping related polygons together. + * \remarks To be correctly saved in FBX file, this type of Layer element should have its reference + * mode set to \e eIndexToDirect. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementPolygonGroup : public FbxLayerElementTemplate +{ +public: + + /** Allocation method. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementPolygonGroup); + +protected: + FbxLayerElementPolygonGroup(); + ~FbxLayerElementPolygonGroup(); +}; + +/** \brief Layer element for mapping UVs to a geometry. + * + * This class represents a UV set belongs to a geometry. Each UV set in a geometry + * has a name to identify itself. The string property FbxTexture.UVSet indicates + * the UV set to use. + * + * \remarks if the Mapping mode of this LayerElement is \e eNone, the stored data + * should be treated as irrelevant. In some circumstances, you can still send this data + * to systems that cannot function without UV coordinates, but ensure + * that you have enough coordinates to do so. + * + * \see FbxTexture + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementUV : public FbxLayerElementTemplate +{ +public: + /** Allocation method. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementUV); + +protected: + FbxLayerElementUV(); + ~FbxLayerElementUV(); +}; + +/** \brief Layer element for mapping Vertex Colors to a geometry. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementVertexColor : public FbxLayerElementTemplate +{ +public: + + /** Allocation method. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementVertexColor); + +protected: + FbxLayerElementVertexColor(); + ~FbxLayerElementVertexColor(); +}; + +template inline FbxLayerElementArrayTemplate& FbxGetDirectArray(FbxLayerElementUserData *pLayerElement, int pIndex, bool* pStatus = NULL); +template inline FbxLayerElementArrayTemplate const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, int pIndex, bool* pStatus = NULL); +template inline FbxLayerElementArrayTemplate& FbxGetDirectArray(FbxLayerElementUserData *pLayerElement, const char* pName, bool* pStatus = NULL ); +template inline FbxLayerElementArrayTemplate const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, const char* pName, bool* pStatus = NULL ); + +/** \brief Layer element for mapping custom user data to a geometry. + * This layer element is different from the other types of layer elements in that it has multiple direct arrays. There is one array for each user data attribute. + * Each array is indexed by the index array. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementUserData : public FbxLayerElementTemplate +{ +public: + FBXSDK_FRIEND_NEW(); + + /** Allocation method. + * \param pOwner The owner of this layer element. + * \param pName The layer element name. + * \param pId The layer element ID. + * \param pDataTypes Attribute data types of this layer element, one direct array is allocated for each Attribute data type. + * \param pDataNames Attribute names of this layer element. + * \return A pointer to the layer element or \c NULL if creation fails. + * \remarks Only "bool", "int", "float" and "double" are supported. + */ + static FbxLayerElementUserData* Create(FbxLayerContainer* pOwner, const char* pName, int pId, FbxArray& pDataTypes, FbxArray& pDataNames); + + /** Allocation method. + * \param pOwner The owner of this layer element. + * \param pOther Other layer element from which to copy. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + static FbxLayerElementUserData* Create(FbxLayerContainer* pOwner, FbxLayerElementUserData const& pOther ); + + /** Returns the direct array with the specified attribute index. + * \param pIndex Specified attribute index. + * \param pStatus A flag to indicate whether the direct array is returned successfully or not. + * \return The specified attribute's direct array. + */ + FbxLayerElementArrayTemplate* GetDirectArrayVoid( int pIndex, bool* pStatus = NULL) + { + if( pIndex >= 0 || pIndex < GetDirectArray().GetCount() ) + { + if (pStatus) *pStatus = true; + return (FbxLayerElementArrayTemplate*)GetDirectArray().AsReference(pIndex); + } + else + { + if( pStatus ) *pStatus = false; + FBX_ASSERT_NOW("Index out of bounds"); + return (FbxLayerElementArrayTemplate*)NULL; + } + } + + /** Returns the direct array with the specified attribute index. + * \param pIndex Specified attribute index. + * \param pStatus A flag to indicate whether the direct array is returned successfully or not. + * \return The specified attribute's direct array. + */ + const FbxLayerElementArrayTemplate* GetDirectArrayVoid( int pIndex, bool* pStatus = NULL) const + { + if( pIndex >= 0 || pIndex < GetDirectArray().GetCount() ) + { + if (pStatus) *pStatus = true; + return (FbxLayerElementArrayTemplate*)GetDirectArray().AsReference(pIndex); + } + else + { + if( pStatus ) *pStatus = false; + FBX_ASSERT_NOW("Index out of bounds"); + return (const FbxLayerElementArrayTemplate*)NULL; + } + } + + + /** Returns the direct array with the specified attribute name. + * \param pName Specified attribute name. + * \param pStatus A flag to indicate whether the direct array is returned successfully or not. + * \return The specified attribute's direct array. + */ + FbxLayerElementArrayTemplate* GetDirectArrayVoid ( const char* pName, bool* pStatus = NULL ) + { + FbxString lName( pName ); + for( int i = 0; i < mDataNames.GetCount(); ++i ) + { + if( *mDataNames[i] == lName ) + return GetDirectArrayVoid(i, pStatus); + } + + if (pStatus) *pStatus = false; + return (FbxLayerElementArrayTemplate*)NULL; + } + + /** Returns the direct array with the specified attribute name. + * \param pName Specified attribute name. + * \param pStatus A flag to indicate whether the direct array is returned successfully or not. + * \return The specified attribute's direct array. + */ + const FbxLayerElementArrayTemplate* GetDirectArrayVoid ( const char* pName, bool* pStatus = NULL ) const + { + FbxString lName( pName ); + for( int i = 0; i < mDataNames.GetCount(); ++i ) + { + if( *mDataNames[i] == lName ) + return GetDirectArrayVoid(i, pStatus); + } + + if (pStatus) *pStatus = false; + return (const FbxLayerElementArrayTemplate*)NULL; + } + + /** Returns the data type for the specified index + * \param pIndex The index of the attribute being queried + * \return The data type, or FbxUndefinedDT if pIndex is out of range + */ + FbxDataType GetDataType( int pIndex ) const + { + if( pIndex < 0 || pIndex >= mDataTypes.GetCount() ) + return FbxUndefinedDT; + + return mDataTypes[pIndex]; + } + + /** Returns the specified attribute data type. + * \param pName The name of the attribute being queried + * \return The data type, or FbxUndefinedDT if no attribute has the given name + */ + FbxDataType GetDataType( const char* pName ) const + { + FbxString lName( pName ); + + for( int i = 0; i < mDataNames.GetCount(); ++i ) + { + if( *mDataNames[i] == lName ) + return mDataTypes[i]; + } + + return FbxUndefinedDT; + } + + /** Returns the attribute name at the specified index + * \param pIndex Attribute index + * \return The name, or \c NULL if pIndex is out of range. + */ + const char* GetDataName( int pIndex ) const + { + if( pIndex >= 0 && pIndex < mDataNames.GetCount() ) + return mDataNames[pIndex]->Buffer(); + + return NULL; + } + + /** Resizes all direct arrays to the specified size. + * \param pSize The new size of the direct arrays. + */ + void ResizeAllDirectArrays( int pSize ) + { + for( int i = 0; i < GetDirectArray().GetCount(); ++i ) + { + switch( mDataTypes[i].GetType() ) + { + case eFbxBool: FbxGetDirectArray(this,i).Resize( pSize ) ; break; + case eFbxInt: FbxGetDirectArray(this,i).Resize( pSize ) ; break; + case eFbxFloat: FbxGetDirectArray(this,i).Resize( pSize ) ; break; + case eFbxDouble: FbxGetDirectArray(this,i).Resize( pSize ); break; + //case eFbxDouble3: GetDirectArray< FbxDouble3 >(i).Resize( pSize ); break; + //case eFbxDouble4: GetDirectArray< FbxDouble4 >(i).Resize( pSize ); break; + //case eFbxDouble4x4: GetDirectArray< FbxDouble4x4>(i).Resize( pSize ); break; + default: + FBX_ASSERT_NOW("unknown type" ); break; + } + } + } + + /** Removes a single element at pIndex from every direct array. + * \param pIndex The index of the element to be removed. + */ + void RemoveFromAllDirectArrays( int pIndex ) + { + for( int i = 0; i < GetDirectArray().GetCount(); ++i ) + { + switch( mDataTypes[i].GetType() ) + { + case eFbxBool: FbxGetDirectArray(this,i).RemoveAt( pIndex ) ; break; + case eFbxInt: FbxGetDirectArray(this,i).RemoveAt( pIndex ) ; break; + case eFbxFloat: FbxGetDirectArray(this,i).RemoveAt( pIndex ) ; break; + case eFbxDouble: FbxGetDirectArray(this,i).RemoveAt( pIndex ); break; + //case eFbxDouble3: GetDirectArray< FbxDouble3 >(i).RemoveAt( pIndex ); break; + //case eFbxDouble4: GetDirectArray< FbxDouble4 >(i).RemoveAt( pIndex ); break; + //case eFbxDouble4x4: GetDirectArray< FbxDouble4x4>(i).RemoveAt( pIndex ); break; + default: + FBX_ASSERT_NOW("unknown type" ); break; + } + } + } + + /** Returns the direct array count for the attribute at pIndex + * \param pIndex The attribute index + * \return The specified attribute's direct array count. + */ + int GetArrayCount( int pIndex ) const + { + if( pIndex >= 0 && pIndex < GetDirectArray().GetCount() ) + { + switch( mDataTypes[pIndex].GetType() ) + { + case eFbxBool: return FbxGetDirectArray(this,pIndex).GetCount(); + case eFbxInt: return FbxGetDirectArray(this,pIndex).GetCount(); + case eFbxFloat: return FbxGetDirectArray(this,pIndex).GetCount(); + case eFbxDouble: return FbxGetDirectArray(this,pIndex).GetCount(); + //case eFbxDouble3: return GetDirectArray< FbxDouble3 >(pIndex).GetCount(); + //case eFbxDouble4: return GetDirectArray< FbxDouble4 >(pIndex).GetCount(); + //case eFbxDouble4x4: return GetDirectArray< FbxDouble4x4>(pIndex).GetCount(); + default: + FBX_ASSERT_NOW("Unknown type" ); break; + } + } + + return -1; + } + + /** Queries the this layer element's ID. + * \return The ID expressed as an int + */ + int GetId() const { return mId; } + + /** Returns this layer element's direct array count. + * \return The direct array count expressed as an int. + * \remarks This count should be equal to the count of user data attributes. + */ + int GetDirectArrayCount() const { return GetDirectArray().GetCount(); } + + /** Assignment operator which performs a deep copy. + * \param pOther Other FbxLayerElementUserData from which to perform a deep copy. + * \return This FbxLayerElementUserData. + */ + FbxLayerElementUserData& operator=( FbxLayerElementUserData const& pOther ) + { + if (this == &pOther) + return *this; + + Clear(); + + mId = pOther.mId; + mDataTypes = pOther.mDataTypes; + mDataNames.Resize(pOther.mDataNames.GetCount()); + for(int i = 0; i < pOther.mDataNames.GetCount(); ++i) + mDataNames.SetAt(i, FbxNew< FbxString >( *pOther.mDataNames[i] ) ); + + Init(); + for(int i = 0; i < pOther.GetDirectArrayCount(); ++i) + { + switch (mDataTypes[i].GetType()) + { + case eFbxBool: + FbxGetDirectArray(this, i) = FbxGetDirectArray(&pOther, i); + break; + + case eFbxInt: + FbxGetDirectArray(this, i) = FbxGetDirectArray(&pOther, i); + break; + + case eFbxFloat: + FbxGetDirectArray(this, i) = FbxGetDirectArray(&pOther, i); + break; + + case eFbxDouble: + FbxGetDirectArray(this, i) = FbxGetDirectArray(&pOther, i); + break; + + default: + FBX_ASSERT_NOW("Unknown type" ); + break; + } + } + + if ( ( mReferenceMode == FbxLayerElement::eIndex || + mReferenceMode == FbxLayerElement::eIndexToDirect) && + ( pOther.GetReferenceMode() == FbxLayerElement::eIndex || + pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect)) + { + GetIndexArray() = pOther.GetIndexArray(); + } + + return *this; + } + + /** Removes all data from this layer element. + * \return \c True always + */ + bool Clear() + { + int i; + const int lCount = GetDirectArray().GetCount(); + FbxLayerElementArray** directArray = NULL; + directArray = GetDirectArray().GetLocked(directArray); + for( i = 0; directArray != NULL && i < lCount; ++i ) + { + if( directArray[i] ) + FbxDelete(directArray[i]); + } + FbxLayerElementArray*** ptr = &directArray; + GetDirectArray().Release((void**)ptr); + for( i = 0; i < mDataNames.GetCount(); ++i ) + { + FBX_SAFE_DELETE(mDataNames[i]); + } + mDataNames.Clear(); + mDataTypes.Clear(); + + FbxLayerElementTemplate::Clear(); + + return true; + } + + /** Queries the amount of memory used by this + * object as well as its content. It does not consider the content pointed. + * \return The amount of memory used. + */ + virtual int MemorySize() const + { + int size = FbxLayerElementTemplate::MemorySize(); + size += sizeof(mId); + + for(int i = 0; i < mDataTypes.GetCount(); i++) + { + size += sizeof(mDataTypes[i]); + } + size += (mDataNames.GetCount() * sizeof(FbxString*)); + + return size; + } + +/***************************************************************************************************************************** +** 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: + /** + * \name Constructor and Destructor. + */ + //@{ + /** Constructs a user data layer element. + * \param pId An identifier for this UserData layer element + * \param pDataTypes Attribute data types for this layer element + * \param pDataNames Attribute names for this layer element + */ + FbxLayerElementUserData( int pId, FbxArray& pDataTypes, FbxArray& pDataNames ) + : + mId( pId ), + mDataTypes( pDataTypes ) + { + FBX_ASSERT( pDataTypes.GetCount() == pDataNames.GetCount() ); + for( int i = 0; i < pDataNames.GetCount(); ++i ) + { + mDataNames.Add( FbxNew< FbxString >( pDataNames[i] ) ); + } + } + + /** Copy constructor. A deep copy is made. + * \param pOther Another FbxLayerElementUserData object to be copied. + */ + FbxLayerElementUserData( FbxLayerElementUserData const& pOther ) : mId(pOther.mId), mDataTypes(pOther.mDataTypes) + { + for (int lIndex = 0; lIndex < pOther.mDataNames.GetCount(); ++lIndex) + { + mDataNames.Add(FbxNew(*(pOther.mDataNames[lIndex]))); + } + + SetType(&FbxLayerElementUserDataDT); + AllocateArrays(); + + for(int i = 0; i < pOther.GetDirectArrayCount(); ++i) + { + switch (mDataTypes[i].GetType()) + { + case eFbxBool: + FbxGetDirectArray(this, i) = FbxGetDirectArray(&pOther, i); + break; + + case eFbxInt: + FbxGetDirectArray(this, i) = FbxGetDirectArray(&pOther, i); + break; + + case eFbxFloat: + FbxGetDirectArray(this, i) = FbxGetDirectArray(&pOther, i); + break; + + case eFbxDouble: + FbxGetDirectArray(this, i) = FbxGetDirectArray(&pOther, i); + break; + + default: + FBX_ASSERT_NOW("Unknown type" ); + break; + } + } + + if ( ( mReferenceMode == FbxLayerElement::eIndex || + mReferenceMode == FbxLayerElement::eIndexToDirect) && + ( pOther.GetReferenceMode() == FbxLayerElement::eIndex || + pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect)) + { + GetIndexArray() = pOther.GetIndexArray(); + } + } + + //!Destructor. + ~FbxLayerElementUserData() + { + Clear(); + } + + //@} + virtual void AllocateArrays() + { + FbxLayerElementTemplate::AllocateArrays(); + Init(); + } + + +private: + + void Init() + { + int i; + GetDirectArray().Resize( mDataTypes.GetCount() ); + + // initialize arrays + for( i = 0; i < mDataTypes.GetCount(); ++i ) + { + FbxHandle** dst = NULL; + dst = GetDirectArray().GetLocked(dst); + if (dst) + { + switch( mDataTypes[i].GetType() ) + { + case eFbxBool: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate >(mDataTypes[i].GetType()); break; + case eFbxInt: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate >(mDataTypes[i].GetType()); break; + case eFbxFloat: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate >(mDataTypes[i].GetType()); break; + case eFbxDouble: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate >(mDataTypes[i].GetType()); break; + default: + FBX_ASSERT_NOW("Trying to assign an unknown type" ); break; + } + FbxHandle*** ptr = &dst; + GetDirectArray().Release((void**)ptr); + } + } + } + + int mId; + FbxArray mDataTypes; + FbxArray mDataNames; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** Returns the direct array with the given attribute index. The template type must match the attribute type at pIndex. + * \param pLayerElement The layer element whose direct array to return. + * \param pIndex The direct array index + * \param pStatus Will be set to \c false if accessing the direct array encounters an error. + * \return If pStatus receives \c true, the direct array at the given index is + * returned. Otherwise the return value is \c undefined. + */ +template +inline FbxLayerElementArrayTemplate& FbxGetDirectArray( FbxLayerElementUserData *pLayerElement,int pIndex, bool* pStatus) +{ + return *(FbxLayerElementArrayTemplate*)pLayerElement->GetDirectArrayVoid(pIndex,pStatus); +} + +/** Returns the direct array with the given attribute index. The template type must match the attribute type at pIndex. + * \param pLayerElement The layer element whose direct array to return. + * \param pIndex The direct array index + * \param pStatus Will be set to \c false if accessing the direct array encounters an error. + * \return If pStatus receives \c true, the direct array at the given index is + * returned. Otherwise the return value is \c undefined. + */ +template +inline FbxLayerElementArrayTemplate const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, int pIndex, bool* pStatus) +{ + return *(const FbxLayerElementArrayTemplate*)pLayerElement->GetDirectArrayVoid(pIndex,pStatus); +} + + +/** Returns the direct array with the given attribute name.The template type must match the attribute type with pName. + * \param pLayerElement The layer element whose direct array to return. + * \param pName The given attribute name. + * \param pStatus Will be set to false if accessing the direct array encounters an error. + * \return If pStatus receives \c true, the direct array at the given index is + * returned. Otherwise the return value is \c undefined. + */ +template +inline FbxLayerElementArrayTemplate& FbxGetDirectArray( FbxLayerElementUserData *pLayerElement,const char* pName, bool* pStatus ) +{ + return *(FbxLayerElementArrayTemplate*)pLayerElement->GetDirectArrayVoid(pName,pStatus); +} + +/** Returns the direct array with the given attribute name.The template type must match the attribute type with pName. + * \param pLayerElement The layer element whose direct array to return. + * \param pName The given attribute name. + * \param pStatus Will be set to false if accessing the direct array encounters an error. + * \return If pStatus receives \c true, the direct array at the given index is + * returned. Otherwise the return value is \c undefined. + */ +template +inline FbxLayerElementArrayTemplate const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, const char* pName, bool* pStatus ) +{ + return *(const FbxLayerElementArrayTemplate*)pLayerElement->GetDirectArrayVoid(pName,pStatus); +} + + +/** Layer element for indicating smoothness of components of a geometry. + * \remarks To be correctly saved in FBX file, this type of Layer element should have its reference + * mode set to \e eDirect. + * + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementSmoothing : public FbxLayerElementTemplate +{ +public: + FBXSDK_FRIEND_NEW(); + + /** Allocation method. + * \param pOwner The owner of this layer element. + * \param pName The name of this layer element. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + static FbxLayerElementSmoothing* Create(FbxLayerContainer* pOwner, const char* pName); + + /** Sets the Reference Mode. + * \param pMode Specifies the reference mode. + * \remarks Only support eDirect. + */ + void SetReferenceMode( FbxLayerElement::EReferenceMode pMode ) + { + if( pMode != FbxLayerElement::eDirect ) + { + FBX_ASSERT_NOW( "Smoothing layer elements must be direct mapped" ); + return; + } + } + +/***************************************************************************************************************************** +** 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: + FbxLayerElementSmoothing() + { + mReferenceMode = FbxLayerElement::eDirect; + } +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** Layer element for indicating crease of components of a geometry. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementCrease : public FbxLayerElementTemplate +{ +public: + FBXSDK_FRIEND_NEW(); + + /** Allocation method. + * \param pOwner The owner of this layer element. + * \param pName The name of this layer element. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + static FbxLayerElementCrease* Create(FbxLayerContainer* pOwner, const char* pName); + + /** Sets the Reference Mode. + * \param pMode Specifies the reference mode. + * \remarks Only support eDirect. + */ + void SetReferenceMode( FbxLayerElement::EReferenceMode pMode ) + { + if( pMode != FbxLayerElement::eDirect ) + { + FBX_ASSERT_NOW( "Crease layer elements must be direct mapped" ); + return; + } + } + +/***************************************************************************************************************************** +** 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: + FbxLayerElementCrease() + { + mReferenceMode = FbxLayerElement::eDirect; + } +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** Layer element for indicating hole of polygon of a geometry. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxLayerElementHole : public FbxLayerElementTemplate +{ +public: + FBXSDK_FRIEND_NEW(); + + /** Allocation method. + * \param pOwner The owner of this layer element. + * \param pName The name of this layer element. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + static FbxLayerElementHole* Create(FbxLayerContainer* pOwner, const char* pName); + + /** Sets the Reference Mode. + * \param pMode Specifies the reference mode. + * \remarks Only support eDirect. + */ + void SetReferenceMode( FbxLayerElement::EReferenceMode pMode ) + { + if( pMode != FbxLayerElement::eDirect ) + { + FBX_ASSERT_NOW( "hole layer elements must be direct mapped" ); + return; + } + } + +/***************************************************************************************************************************** +** 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: + FbxLayerElementHole() + { + mReferenceMode = FbxLayerElement::eDirect; + } +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** Layer element for indicating if specified components are shown/hidden + */ +class FBXSDK_DLL FbxLayerElementVisibility : public FbxLayerElementTemplate +{ +public: + + /** Allocation method. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementVisibility); + +/***************************************************************************************************************************** +** 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: + FbxLayerElementVisibility(); + ~FbxLayerElementVisibility(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** \brief Layer element for mapping Textures to a geometry. This class is deprecated. + * + * Deprecated since FBX SDK 2011. Textures (FbxTexture derived classes) should be connected + * to material properties. + * + * For example: + * + * \code + * FbxFileTexture* file; + * FbxSurfacePhong* phong; + * phong->Diffuse.ConnectSrcObject(file); + * \endcode + * \see FbxSurfaceMaterial + * + * \remarks To be correctly saved in FBX file, this type of Layer element should have its reference + * mode set to \e eIndexToDirect. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLayerElementTexture : public FbxLayerElementTemplate +{ +public: + /** Allocation method. + * \return A pointer to the layer element or \c NULL if creation fails. + */ + FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementTexture); + + /** \enum EBlendMode Lets you control how textures are combined when you apply multiple layers of texture to a surface. + * - \e eTranslucent The new texture layer is transparent (depending on the Alpha value). + * - \e eAdd Add the color of the new texture to the previous texture. + * - \e eModulate Multiples the color value of the new texture by the color values of all previous layers of texture. + * - \e eModulate2 Multiples the color value of the new texture by two and then by the color values of all previous layers of texture. + * - \e eOver Equivalent to eTranslucent. Blends the new texture over top of the old texture, according to the new texture's alpha channel. + * - \e eNormal, The colors of the two layers will not interact in any way, and it will display the full value of the colors in layer 1. + * - \e eDissolve, Dissolve makes the lower layer take on the colors of the top layer, and how much depends on the opacity of the upper layer. + * - \e eDarken, Darken compares each pixel value of the upper layer to its counterpart's pixel value of the lower layer and chooses the darker of the two to display. + * - \e eColorBurn, Color Burn burns in the color of the upper layer with the lower layer. No part of the image will get lighter. + * - \e eLinearBurn, Linear Burn works like multiply but the results are more intense. + * - \e eDarkerColor, This blend mode simply divides pixel values of one layer with the other. + * - \e eLighten, Lighten compares the two layers pixel for pixel and uses the lightest pixel value. No part of the image gets darker. + * - \e eScreen, Screen brightens by lightning the lower layer based on the lightness of the upper layer + * - \e eColorDodge, Color Dodge dodges the lower layer with the upper layer, resulting in a lighter image. No part of the image will be darkened. + * - \e eLinearDodge, Linear Dodge works like screen but with more intense results. + * - \e eLighterColor, This blend mode has the opposite effect of the Darker Color mode. It compares all the values in both layers, then displays the lightest values. + * - \e eSoftLight, Soft Light will multiply the dark tones and screen the light tones. + * - \e eHardLight, Hard Light multiplies the dark colors and screens the light colors. + * - \e eVividLight, Vivid Light will dodges or burn the lower layer pixels depending on whether the upper layer pixels are brighter or darker than neutral gray. It works on the contrast of the lower layer. + * - \e eLinearLight, Linear Light is the same as Vivid light but it works on the brightness of the lower layer. + * - \e ePinLight, Pin Light changes the lower layer pixels depending on how bright the pixels are in the upper layer. + * - \e eHardMix, Produces either white or black, depending on similarities between A and B. + * - \e eDifference, Difference reacts to the differences between the upper and lower layer pixels. + * - \e eExclusion, Exclusion uses the darkness of the lower layer to mask the difference between upper and lower layers. + * - \e eSubtract, The result color is the foreground color subtracted from the background color. The result color is then applied over the background color using the foreground alpha to define the opacity of the result. + * - \e eDivide, This blend mode simply divides pixel values of one layer with the other. + * - \e eHue, Hue changes the hue of the lower layer to the hue of the upper layer but leaves brightness and saturation alone. + * - \e eSaturation, Saturation changes the saturation of the lower layer to the hue of the upper layer but leaves brightness and hue alone. + * - \e eColor, Color changes the hue and saturation of the lower layer to the hue and saturation of the upper layer but leaves luminosity alone. + * - \e eLuminosity, Luminosity changes the luminosity of the lower layer to the luminosity of the upper layer while leaving hue and saturation the same. + * - \e eOverlay, Multiplies (darkens) when the layer on which the mode is set is dark and screens (brightens) when the layer on which the mode is applied is lighter. + * - \e eBlendModeCount Marks the end of the blend mode enum. + */ + enum EBlendMode + { + eTranslucent, + eAdd, + eModulate, + eModulate2, + eOver, + eNormal, + eDissolve, + eDarken, + eColorBurn, + eLinearBurn, + eDarkerColor, + eLighten, + eScreen, + eColorDodge, + eLinearDodge, + eLighterColor, + eSoftLight, + eHardLight, + eVividLight, + eLinearLight, + ePinLight, + eHardMix, + eDifference, + eExclusion, + eSubtract, + eDivide, + eHue, + eSaturation, + eColor, + eLuminosity, + eOverlay, + eBlendModeCount + }; + + /** Sets the way Textures blend between layers. + * \param pBlendMode A valid blend mode. + */ + void SetBlendMode(EBlendMode pBlendMode) { mBlendMode = pBlendMode; } + + /** Sets the transparency level between multiple texture levels. + * \param pAlpha Set to a value between 0.0 and 1.0, where 0.0 is totally transparent and 1.0 is totally opaque. + * \remarks Values smaller than 0.0 are clipped to 0.0, while values greater than 1.0 are clipped to 1.0. + */ + void SetAlpha(double pAlpha) + { + if (pAlpha > 1.0) + mAlpha = 1.0; + else if (pAlpha < 0.0) + mAlpha = 0.0; + else + mAlpha = pAlpha; + } + + /** Returns the way Textures blend between layers. + * \return The current Blend Mode. + */ + EBlendMode GetBlendMode() const { return mBlendMode; } + + /** Returns the transparency level between multiple levels of textures. + * \return An alpha value between 0.0 and 1.0, where 0.0 is totally transparent and 1.0 is totally opaque. + */ + double GetAlpha() const { return mAlpha; } + +/***************************************************************************************************************************** +** 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 + virtual int MemorySize() const + { + int size = FbxLayerElementTemplate::MemorySize(); + size += sizeof(mBlendMode); + size += sizeof(mAlpha); + return size; + } + +protected: + /** Constructor + * By default, textures have a Blend Mode of eTranslucent, + * a Reference Mode of eIndexToDirect, and an Alpha value of 1.0. + */ + FbxLayerElementTexture() : mBlendMode(eTranslucent) + { + mReferenceMode = eIndexToDirect; + mAlpha = 1.0; + } + +private: + EBlendMode mBlendMode; + double mAlpha; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** FbxLayer class provides a base for the layering mechanism. + * + * A layer can contain one or more of the following layer elements: + * \li Normals + * \li Binormals + * \li Tangents + * \li Materials + * \li Polygon Groups + * \li UVs + * \li Vertex Colors + * \li Smoothing informations + * \li Vertex Creases + * \li Edge Creases + * \li Custom User Data + * \li Visibilities + * \li Textures (diffuse, ambient, specular, etc.) (deprecated) + * + * A typical layer for a Mesh contains Normals, UVs and Materials. A typical layer for NURBS contains only Materials. + * In the case of the NURBS, the NURBS' parameterization is used for the UVs; no UVs should be specified. + * + * In most cases, you only need a single layer to describe a geometry. Many applications only support what is defined on the first layer. + * Take this into account when you fill the layer. For example, it is legal to define the Layer 0 with the UVs and then + * define the model's Normals on layer 1. However if you construct a file this way, it may not be imported correctly in other applications. + * Store the Normals in Layer 0 to avoid problems. + * + * Since FBX SDK 2011, Textures are connected to the properties of FbxSurfaceMaterial derived classes. + * FbxLayerElementTexture is no longer used. See the code example in FbxLayerElementTexture for how to connect a texture. + * + * Since FBX SDK 2011, texture layering is achieved by FbxLayeredTexture. See the code example in FbxLayeredTexture for how to blend textures. + * + * Normally, you can access layer from FbxLayerContainer like FbxGeometry. + * For example, + * \code + * FbxMesh* mesh; + * FbxLayer* layer0 = mesh->GetLayer(0); + * FbxLayerElementNormal* normals = layer0->GetNormals(); + * \endcode + * + * \nosubgrouping + * \see FbxLayerElement + * \see FbxLayerElementNormal + * \see FbxLayerElementBinormal + * \see FbxLayerElementTangent + * \see FbxLayerElementMaterial + * \see FbxLayerElementPolygonGroup + * \see FbxLayerElementUV + * \see FbxLayerElementVertexColor + * \see FbxLayerElementSmoothing + * \see FbxLayerElementCrease + * \see FbxLayerElementUserData + * \see FbxLayerElementHole + * \see FbxLayerElementVisibility + */ +class FBXSDK_DLL FbxLayer +{ + +public: + FBXSDK_FRIEND_NEW(); + + /** + * \name Layer Element Management + */ + //@{ + + /** Returns this layer's Normals description . + * \return A pointer to the Normals layer element, or \c NULL if no Normals layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Normals defined. + */ + FbxLayerElementNormal* GetNormals(); + + /** Returns this layer's Normals description . + * \return A pointer to the Normals layer element, or \c NULL if no Normals layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Normals defined. + */ + const FbxLayerElementNormal* GetNormals() const; + + /** Returns this layer's Tangents description. + * \return A pointer to the Tangents layer element, or \c NULL if no Tangents layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Tangents defined. + */ + FbxLayerElementTangent* GetTangents(); + + /** Returns this layer's Tangents description. + * \return A pointer to the Tangents layer element, or \c NULL if no Tangents layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Tangents defined. + */ + const FbxLayerElementTangent* GetTangents() const; + + /** Returns this layer's Binormals description. + * \return A pointer to the Binormals layer element, or \c NULL if no Binormals layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Binormals defined. + */ + FbxLayerElementBinormal* GetBinormals(); + + /** Returns this layer's Binormals description. + * \return A pointer to the Binormals layer element, or \c NULL if no Binormals layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Binormals defined. + */ + const FbxLayerElementBinormal* GetBinormals() const; + + /** Returns this layer's Materials description. + * \return A pointer to the Materials layer element, or \c NULL if no Materials layer element is defined in this layer. + */ + FbxLayerElementMaterial* GetMaterials(); + + /** Returns this layer's Materials description. + * \return A pointer to the Materials layer element, or \c NULL if no Materials layer element is defined in this layer. + */ + const FbxLayerElementMaterial* GetMaterials() const; + + /** Returns this layer's Polygon Groups description. + * \return A pointer to the Polygon Groups layer element, or \c NULL if no Polygon Groups layer element is defined in this layer. + */ + FbxLayerElementPolygonGroup* GetPolygonGroups(); + + /** Returns this layer's Polygon Groups description. + * \return A pointer to the Polygon Groups layer element, or \c NULL if no Polygon Groups layer element is defined in this layer. + */ + const FbxLayerElementPolygonGroup* GetPolygonGroups() const; + + /** Returns this layer's UV description. + * \param pTypeIdentifier Layer element type identifier, should be a texture type identifier. + * \return A pointer to the UVs layer element, or \c NULL if no UV is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have UVs defined. + * The NURBS/Patch parameterization is used as UV parameters to map a texture. + */ + FbxLayerElementUV* GetUVs(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); + + /** Returns this layer's UV description. + * \param pTypeIdentifier Layer element type identifier, should be a texture type identifier. + * \return A pointer to the UVs layer element, or \c NULL if no UV is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have UVs defined. + * The NURBS/Patch parameterization is used as UV parameters to map a texture. + */ + const FbxLayerElementUV* GetUVs(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse) const; + + + /** Returns the number of different UV sets in this layer. + */ + int GetUVSetCount() const; + + /** Returns an array that describes which UV sets are in this layer. + */ + FbxArray GetUVSetChannels() const; + + /** Returns an array of UV sets in this layer. + */ + FbxArray GetUVSets() const; + + /** Returns this layer's Vertex Colors description. + * \return A pointer to the Vertex Colors layer element, or \c NULL if no Vertex Color layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Vertex Colors defined, since no vertex exists. + */ + FbxLayerElementVertexColor* GetVertexColors(); + + /** Returns this layer's Vertex Colors description. + * \return A pointer to the Vertex Colors layer element, or \c NULL if no Vertex Color layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Vertex Colors defined, since no vertex exists. + */ + const FbxLayerElementVertexColor* GetVertexColors() const; + + /** Returns this layer's Smoothing description. + * \return A pointer to the Smoothing layer element, or \c NULL if no Smoothing layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Smoothing defined. + */ + FbxLayerElementSmoothing* GetSmoothing(); + + /** Returns this layer's Smoothing description. + * \return A pointer to the Smoothing layer element, or \c NULL if no Smoothing layer element is defined in this layer. + * \remarks FbxNurbs or FbxPatch geometry should not have Smoothing defined. + */ + const FbxLayerElementSmoothing* GetSmoothing() const; + + /** Returns this layer's vertex crease description. + * \return A pointer to the Crease layer element, or \c NULL if no Crease layer element is defined in this layer. + * \remarks Crease info should only be defined when the geometry is FbxSubDiv. + */ + FbxLayerElementCrease* GetVertexCrease(); + + /** Returns this layer's vertex crease description. + * \return A pointer to the Crease layer element, or \c NULL if no Crease layer element is defined in this layer. + * \remarks Crease info should only be defined when the geometry is FbxSubDiv. + */ + const FbxLayerElementCrease* GetVertexCrease() const; + + /** Returns this layer's edge crease description. + * \return A pointer to the Crease layer element, or \c NULL if no Crease layer element is defined in this layer. + * \remarks Crease info should only be defined when the geometry is FbxSubDiv. + */ + FbxLayerElementCrease* GetEdgeCrease(); + + /** Returns this layer's edge crease description. + * \return A pointer to the Crease layer element, or \c NULL if no Crease layer element is defined in this layer. + * \remarks Crease info should only be defined when the geometry is FbxSubDiv. + */ + const FbxLayerElementCrease* GetEdgeCrease() const; + + /** Returns this layer's Hole description. + * \return A pointer to the Hole layer element, or \c NULL if no Hole layer element is defined in this layer. + * \remarks Hole info should only be defined when the geometry is FbxMesh. + */ + FbxLayerElementHole* GetHole(); + + /** Returns this layer's Hole description. + * \return A pointer to the Hole layer element, or \c NULL if no Hole layer element is defined in this layer. + * \remarks Hole info should only be defined when the geometry is FbxMesh. + */ + const FbxLayerElementHole* GetHole() const; + + /** Returns this layer's User Data. + * \return A pointer to the User Data layer element, or \c NULL if no User Data layer element is defined in this layer. + */ + FbxLayerElementUserData* GetUserData(); + + /** Returns this layer's User Data. + * \return A pointer to the User Data layer element, or \c NULL if no User Data layer element is defined in this layer. + */ + const FbxLayerElementUserData* GetUserData() const; + + /** Returns this layer's visibility. + * \return A pointer to the visibility layer element, or \c NULL if no visibility layer element is defined in this layer. + */ + FbxLayerElementVisibility* GetVisibility(); + + /** Returns this layer's visibility. + * \return A pointer to the visibility layer element, or \c NULL if no visibility layer element is defined in this layer. + */ + const FbxLayerElementVisibility* GetVisibility() const; + + /** Returns this layer's Textures description. + * \param pType Layer element type, should be a texture type identifier. + * \return A pointer to the Textures layer element, or \c NULL if no Textures layer element is defined in this layer. + */ + FbxLayerElementTexture* GetTextures(FbxLayerElement::EType pType); + + /** Returns this layer's Textures description. + * \param pType Layer element type, should be a texture type identifier. + * \return A pointer to the Textures layer element, or \c NULL if no Textures layer element is defined in this layer. + */ + const FbxLayerElementTexture* GetTextures(FbxLayerElement::EType pType) const; + + /** Sets this layer's Textures description. + * \param pType Texture type identifier. + * \param pTextures A pointer to the Textures layer element, or \c NULL to remove the Textures definition. + */ + void SetTextures(FbxLayerElement::EType pType, FbxLayerElementTexture* pTextures); + + /** Returns the specified type of layer element description for this layer. + * \param pType The required Layer element type. + * - Calling with eNormal is the equivalent of calling GetNormals(). + * - Calling with eBiNormal is the equivalent of calling GetBinormals(). + * - Calling with eTangent is the equivalent of calling GetTangents(). + * - Calling with eMaterial is the equivalent of calling GetMaterials(). + * - Calling with ePolygonGroup is the equivalent of calling GetPolygonGroups(). + * - Calling with eUV is the equivalent of calling GetUVs(). + * - Calling with eVertexColor is the equivalent of calling GetVertexColors(). + * - Calling with eSmoothing is the equivalent of calling GetSmoothing(). + * - Calling with eVertexCrease is the equivalent of calling GetVertexCrease(). + * - Calling with eEdgeCrease is the equivalent of calling GetEdgeCrease(). + * - Calling with eUserData is the equivalent of calling GetUserData(). + * - Calling with eVisibility is the equivalent of calling GetVisibility(). + * - Calling with texture type is the equivalent of calling GetTextures(FbxLayerElement::EType pType). + * \param pIsUV If \c true, requests the UV layer element that corresponds with the specified texture type. + * \return A pointer to the requested layer element, or \e NULL if the layer element is not defined in this layer. + */ + FbxLayerElement* GetLayerElementOfType(FbxLayerElement::EType pType, bool pIsUV=false); + + /** Returns the specified type of layer element description for this layer. + * \param pType The required Layer element type. + * - Calling with eNormal is the equivalent of calling GetNormals(). + * - Calling with eBiNormal is the equivalent of calling GetBinormals(). + * - Calling with eTangent is the equivalent of calling GetTangents(). + * - Calling with eMaterial is the equivalent of calling GetMaterials(). + * - Calling with ePolygonGroup is the equivalent of calling GetPolygonGroups(). + * - Calling with eUV is the equivalent of calling GetUVs(). + * - Calling with eVertexColor is the equivalent of calling GetVertexColors(). + * - Calling with eSmoothing is the equivalent of calling GetSmoothing(). + * - Calling with eVertexCrease is the equivalent of calling GetVertexCrease(). + * - Calling with eEdgeCrease is the equivalent of calling GetEdgeCrease(). + * - Calling with eUserData is the equivalent of calling GetUserData(). + * - Calling with eVisibility is the equivalent of calling GetVisibility(). + * - Calling with texture type is the equivalent of calling GetTextures(FbxLayerElement::EType pType). + * \param pIsUV If \c true, requests the UV layer element that corresponds with the specified texture type. + * \return A pointer to the requested layer element, or \e NULL if the layer element is not defined in this layer. + */ + const FbxLayerElement* GetLayerElementOfType(FbxLayerElement::EType pType, bool pIsUV=false) const; + + /** Sets this layer's Normals description. + * \param pNormals A pointer to the Normals layer element, or \c NULL to remove the Normals definition. + * \remarks FbxNurbs or FbxPatch geometry should not have Normals defined. + */ + void SetNormals(FbxLayerElementNormal* pNormals); + + /** Sets this layer's Binormals description. + * \param pBinormals A pointer to the Binormals layer element, or \c NULL to remove the Binormals definition. + * \remarks FbxNurbs or FbxPatch geometry should not have Binormals defined. + */ + void SetBinormals(FbxLayerElementBinormal* pBinormals); + + /** Sets this layer's Tangents description. + * \param pTangents A pointer to the Tangents layer element, or \c NULL to remove the Tangents definition. + * \remarks FbxNurbs or FbxPatch geometry should not have Tangents defined. + */ + void SetTangents(FbxLayerElementTangent* pTangents); + + /** Sets this layer's Materials description. + * \param pMaterials A pointer to the Materials layer element, or \c NULL to remove the Material definition. + */ + void SetMaterials(FbxLayerElementMaterial* pMaterials); + + /** Sets this layer's Polygon Groups description. + * \param pPolygonGroups A pointer to the Polygon Groups layer element, or \c NULL to remove the Polygon Group definition. + */ + void SetPolygonGroups(FbxLayerElementPolygonGroup* pPolygonGroups); + + /** Sets this layer's UVs description. + * \param pUVs A pointer to the UVs layer element, or \c NULL to remove the UV definition. + * \param pTypeIdentifier Layer element type, should be texture type. + * \remarks FbxNurbs or FbxPatch geometry should not have UVs defined. + * The NURBS/Patch parameterization is used as UV parameters to map a texture. + */ + void SetUVs(FbxLayerElementUV* pUVs, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); + + /** Sets this layer's Vertex Colors description. + * \param pVertexColors A pointer to the Vertex Colors layer element, or \c NULL to remove the Vertex Color definition. + * \remarks FbxNurbs or FbxPatch geometry should not have Vertex Colors defined, since no vertex exists. + */ + void SetVertexColors (FbxLayerElementVertexColor* pVertexColors); + + /** Sets this layer's Smoothing description. + * \param pSmoothing A pointer to the Smoothing layer element, or \c NULL to remove the Smoothing definition. + * \remarks FbxNurbs or FbxPatch geometry should not have Smoothing defined. + */ + void SetSmoothing (FbxLayerElementSmoothing* pSmoothing); + + /** Sets this layer's Vertex Crease description. + * \param pCrease A pointer to the Vertex Crease layer element, or \c NULL to remove the Crease definition. + * \remarks Crease should only be defined when the geometry is FbxSubDiv. + */ + void SetVertexCrease (FbxLayerElementCrease* pCrease); + + /** Sets this layer's Edge Crease description. + * \param pCrease A pointer to the Edge Crease layer element, or \c NULL to remove the Crease definition. + * \remarks Crease should only be defined when the geometry is FbxSubDiv. + */ + void SetEdgeCrease (FbxLayerElementCrease* pCrease); + + /** Sets this layer's Hole description. + * \param pHole A pointer to the Hole layer element, or \c NULL to remove the Hole definition. + * \remarks Hole should only be defined when the geometry is FbxMesh. + */ + void SetHole (FbxLayerElementHole* pHole); + + /** Sets this layer's User Data. + * \param pUserData A pointer to the User Data layer element, or \c NULL to remove the User Data. + */ + void SetUserData (FbxLayerElementUserData* pUserData); + + /** Sets this layer's the visibility. + * \param pVisibility A pointer to the visibility layer element, or \c NULL to remove the visibility. + */ + void SetVisibility( FbxLayerElementVisibility* pVisibility ); + + /** Sets the specified type of layer element description for this layer. + * \param pLayerElement A pointer to the layer element, or \c NULL to remove the layer element. + * \param pType The required Layer element type. + * - Calling with eNormal is the equivalent of calling GetNormals(). + * - Calling with eBiNormal is the equivalent of calling GetBinormals(). + * - Calling with eTangent is the equivalent of calling GetTangents(). + * - Calling with eMaterial is the equivalent of calling GetMaterials(). + * - Calling with ePolygonGroup is the equivalent of calling GetPolygonGroups(). + * - Calling with eUV is the equivalent of calling GetUVs(). + * - Calling with eVertexColor is the equivalent of calling GetVertexColors(). + * - Calling with eSmoothing is the equivalent of calling GetSmoothing(). + * - Calling with eVertexCrease is the equivalent of calling GetVertexCrease(). + * - Calling with eEdgeCrease is the equivalent of calling GetEdgeCrease(). + * - Calling with eUserData is the equivalent of calling GetUserData(). + * - Calling with eVisibility is the equivalent of calling GetVisibility(). + * - Calling with texture type is the equivalent of calling GetTextures(FbxLayerElement::EType pType). + * \param pIsUV If \c true, requests the UV layer element that corresponds with the specified texture type. + */ + void SetLayerElementOfType(FbxLayerElement* pLayerElement, FbxLayerElement::EType pType, bool pIsUV=false); + + /** Creates the specified type of layer element description for this layer. + * \param pType The required Layer element type. + * \param pIsUV When \c true, requests the UV LayerElement that corresponds with the specified Layer Element type (only applies to + * TEXTURE type layer elements). + * \return A pointer to the newly created layer element, or \e NULL if the layer element has not been created for this layer. + */ + FbxLayerElement* CreateLayerElementOfType(FbxLayerElement::EType pType, bool pIsUV=false); + + /** Clone function. + * \param pSrcLayer The source layer to be cloned. + */ + void Clone(FbxLayer const& pSrcLayer); + +/***************************************************************************************************************************** +** 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: + //! Assignment operator. + FbxLayer& operator=(FbxLayer const& pSrcLayer); + //@} +private: + + FbxLayer(FbxLayerContainer& pOwner); + virtual ~FbxLayer(); + + void Clear(); + + FbxLayerContainer& mOwner; + + FbxLayerElement* mNonTexturesArray[FbxLayerElement::sTypeNonTextureCount]; + FbxLayerElementUV* mUVsArray[FbxLayerElement::sTypeTextureCount]; + FbxLayerElementTexture* mTexturesArray[FbxLayerElement::sTypeTextureCount]; + + + friend class FbxLayerContainer; + +public: + /** + * \name Serialization section + */ + //@{ + bool ContentWriteTo(FbxStream& pStream) const; + bool ContentReadFrom(const FbxStream& pStream); + //@} + virtual int MemoryUsage() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** + * Utility macro for iterating over texture layer elements + */ +#define FBXSDK_FOR_EACH_TEXTURE(lLayerIndex) for((lLayerIndex)=0;(lLayerIndex)GetElementUV("map1"); + * FbxGeometryElementUV::DirectArrayType lDirectArray = lUVs->GetDirectArray(); + * int lDirectUVCount = lDirectArray.GetCount(); + * FbxVector2 lFirstUV = lDirectArray[0]; + * \endcode + * \see FbxGeometryBase + */ +typedef FbxLayerElement FbxGeometryElement; +typedef FbxLayerElementNormal FbxGeometryElementNormal; +typedef FbxLayerElementBinormal FbxGeometryElementBinormal; +typedef FbxLayerElementTangent FbxGeometryElementTangent; +typedef FbxLayerElementMaterial FbxGeometryElementMaterial; +typedef FbxLayerElementPolygonGroup FbxGeometryElementPolygonGroup; +typedef FbxLayerElementUV FbxGeometryElementUV; +typedef FbxLayerElementVertexColor FbxGeometryElementVertexColor; +typedef FbxLayerElementUserData FbxGeometryElementUserData; +typedef FbxLayerElementSmoothing FbxGeometryElementSmoothing; +typedef FbxLayerElementCrease FbxGeometryElementCrease; +typedef FbxLayerElementHole FbxGeometryElementHole; +typedef FbxLayerElementVisibility FbxGeometryElementVisibility; + +#undef FBXSDK_LAYER_ELEMENT_CREATE_DECLARE + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_LAYER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxlayercontainer.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxlayercontainer.h new file mode 100644 index 00000000..c2675e81 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxlayercontainer.h @@ -0,0 +1,154 @@ +/**************************************************************************************** + + 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 fbxlayercontainer.h +#ifndef _FBXSDK_SCENE_GEOMETRY_LAYER_CONTAINER_H_ +#define _FBXSDK_SCENE_GEOMETRY_LAYER_CONTAINER_H_ + +#include + +#include +#include + +#include + +/** \brief Contains a collection of FbxLayer objects. + * This class is used for managing layers construction, destruction and access. + * See FbxLayerElement for more details. + * \nosubgrouping + * \see FbxLayer + */ +class FBXSDK_DLL FbxLayerContainer : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxLayerContainer,FbxNodeAttribute); +public: + + /** Returns the type of node attribute. + */ + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** + * \name Layer Management + */ + //@{ + + /** Creates a new layer on top of existing layers. + * \return Index of created layer or -1 if an error occurs. + */ + int CreateLayer(); + + //! Deletes all layers. + void ClearLayers(); + + /** Returns the number of layers. + * \return The number of layers. + */ + int GetLayerCount() const; + + /** Returns the number of layers that contain the specified layer element type. + * \param pType The specified Layer Element type. + * \param pUVCount When \c true, requests the UV layer element corresponding to the specified texture type. + * \return The number of layers containing the specified layer element type. + */ + int GetLayerCount(FbxLayerElement::EType pType, bool pUVCount=false) const; + + /** Returns the layer at the specified index. + * \param pIndex Layer index. + * \return Pointer to the layer, or \c NULL if pIndex is out of range. + */ + FbxLayer* GetLayer(int pIndex); + + /** Returns the layer at the specified index. + * \param pIndex Layer index. + * \return Pointer to the layer, or \c NULL if pIndex is out of range. + */ + const FbxLayer* GetLayer(int pIndex) const; + + /** Returns the n'th layer as specified by pIndex that contains the specified layer element type. + * If the pType is FbxLayerElement::eUV, this method will return the n'th layer as specified by pIndex that contains the diffuse UV. + * For example, GetLayer(int pIndex, FbxLayerElement::eUV) is same as GetLayer(int pIndex, FbxLayerElement::eTextureDiffuse, true). + * \param pIndex Layer index. + * \param pType The specified layer element type. + * \param pIsUV When \c true, requests the UV layer element that corresponds with the specified texture type. + * \return Pointer to the layer, or \c NULL if pIndex is out of range. + */ + FbxLayer* GetLayer(int pIndex, FbxLayerElement::EType pType, bool pIsUV=false); + + /** Returns the n'th layer as specified by pIndex that contains the specified layer element type. + * If the pType is FbxLayerElement::eUV, this method will return the n'th layer as specified by pIndex that contains the diffuse UV. + * For example, GetLayer(int pIndex, FbxLayerElement::eUV) is same as GetLayer(int pIndex, FbxLayerElement::eTextureDiffuse, true). + * \param pIndex Layer index. + * \param pType The specified layer element type. + * \param pIsUV When \c true, requests the UV layer element that corresponds with the specified texture type. + * \return Pointer to the layer, or \c NULL if pIndex is out of range. + */ + const FbxLayer* GetLayer(int pIndex, FbxLayerElement::EType pType, bool pIsUV=false) const; + + /** Returns the global index of the n'th layer as specified by pIndex that contains the specified layer element type. + * \param pIndex Layer index of the specified type. + * \param pType The specified layer element type. + * \param pIsUV When \c true, requests the UV layer element that corresponds with the specified texture type. + * \return Global index of the n'th layer as specified by pIndex that contains the specified layer element type, or -1 if the layer is not found. + * \remarks The returned index is the position of the layer in the global array of layers. + * You can use the returned index to call GetLayer(int pIndex). + */ + int GetLayerIndex(int pIndex, FbxLayerElement::EType pType, bool pIsUV=false) const; + + /** Converts the layer's global index to a type-specific index. + * \param pGlobalIndex The index of the layer in the global array of layers. + * \param pType The type upon which the type-specific index will be returned. + * \param pIsUV When \c true, requests the UV layer element that corresponds with the specified texture type. + * \return Layer index of the specified layer element type, or -1 if the layer element type is not found on the layer. + */ + int GetLayerTypedIndex(int pGlobalIndex, FbxLayerElement::EType pType, bool pIsUV=false) const; + //@} + + /** Converts the reference mode from eDirect to eIndexToDirect. + * \param pLayer The Layer to convert. + * \return \c True if conversion is successful, or \c false otherwise. + * \remarks For the time being, this method only applies to the LayerLementType eMaterial + */ + bool ConvertDirectToIndexToDirect(int pLayer); + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + + int GTC(FbxUInt i, int j); + void* GT (int i, FbxUInt l, int j); + int AT (void* t, FbxUInt l, int j); + int GTI(const char* n, FbxUInt l, int j); + int GMC(FbxUInt i, void* n = NULL); + void* GM (int i, FbxUInt l, void* n = NULL); + int AM (void* m, FbxUInt l, void* n = NULL, bool b = false); + int GMI(const char* n, FbxUInt l, void* d = NULL); + + int AddToLayerElementsList(FbxLayerElement* pLEl); + void RemoveFromLayerElementsList(FbxLayerElement* pLEl); + +protected: + virtual void Destruct(bool pRecursive); + + void CopyLayers(const FbxLayerContainer* pLayerContainer); + + virtual void SetDocument(FbxDocument* pDocument); + virtual bool ConnectNotify (FbxConnectEvent const &pEvent); + + FbxArray mLayerArray; + FbxArray mLayerElementsList; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_LAYER_CONTAINER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxlight.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxlight.h new file mode 100644 index 00000000..005b6c81 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxlight.h @@ -0,0 +1,273 @@ +/**************************************************************************************** + + 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 fbxlight.h +#ifndef _FBXSDK_SCENE_GEOMETRY_LIGHT_H_ +#define _FBXSDK_SCENE_GEOMETRY_LIGHT_H_ + +#include + +#include + +#include + +class FbxTexture; + +/** \brief This node attribute contains methods for accessing the properties of a light. + * \nosubgrouping + */ +class FBXSDK_DLL FbxLight : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxLight, FbxNodeAttribute); + +public: + /** + * \name Light Properties + */ + //@{ + /** \enum EType Light types. + * - \e ePoint + * - \e eDirectional + * - \e eSpot + * - \e eArea + * - \e eVolume + */ + enum EType + { + ePoint, + eDirectional, + eSpot, + eArea, + eVolume + }; + + /** \enum EDecayType Decay types. Used for setting the attenuation of the light. + * - \e eNone No decay. The light's intensity will not diminish with distance. + * - \e eLinear Linear decay. The light's intensity will diminish linearly with the distance from the light. + * - \e eQuadratic Quadratic decay. The light's intensity will diminish with the squared distance from the light. + * This is the most physically accurate decay rate. + * - \e eCubic Cubic decay. The light's intensity will diminish with the cubed distance from the light. + */ + enum EDecayType + { + eNone, + eLinear, + eQuadratic, + eCubic + }; + + /** \enum EAreaLightShape Supported area light types. + * - \e eRectangle Rectangle (or often called a plane) area light type. + * - \e eSphere Area light that illuminate all directions. + */ + enum EAreaLightShape + { + eRectangle, + eSphere + }; + + /** Set the shadow texture for the light. + * \param pTexture The texture cast by the light shadow. + */ + void SetShadowTexture(FbxTexture* pTexture); + + /** Get the light state. + * \return Pointer to the texture cast by the light shadow, or \c NULL if the shadow texture has not been set. + */ + FbxTexture* GetShadowTexture() const; + //@} + + /** + * \name Properties + */ + //@{ + /** This property handles the light type. + * + * Default value is ePoint + */ + FbxPropertyT LightType; + + /** This property handles the cast light on object flag. + * + * Default value is true + */ + FbxPropertyT CastLight; + + /** This property handles the draw volumetric light flag. + * + * Default value is true + */ + FbxPropertyT DrawVolumetricLight; + + /** This property handles the draw ground projection flag. + * + * Default value is true + */ + FbxPropertyT DrawGroundProjection; + + /** This property handles the draw facing volumetric projection flag. + * + * Default value is false + */ + FbxPropertyT DrawFrontFacingVolumetricLight; + + /** This property handles the light color. + * + * Default value is (1.0, 1.0, 1.0) + */ + FbxPropertyT Color; + + /** This property handles the light intensity. + * + * Default value is 100.0 + */ + FbxPropertyT Intensity; + + /** This property handles the light inner cone angle (in degrees). Also know as the HotSpot + * + * Default value is 45.0 + */ + FbxPropertyT InnerAngle; + + /** This property handles the light outer cone angle (in degrees). Also known as the Falloff + * + * Default value is 45.0 + */ + FbxPropertyT OuterAngle; + + /** This property handles the light fog intensity + * + * Default value is 50.0 + */ + FbxPropertyT Fog; + + /** This property handles the decay type + * + * Default value is eNone + */ + FbxPropertyT DecayType; + + /** This property handles the decay start distance + * + * Default value is 0.0 + */ + FbxPropertyT DecayStart; + + /** This property handles the gobo file name + * + * Default value is "" + */ + FbxPropertyT FileName; + + /** This property handles the enable near attenuation flag + * + * Default value is false + */ + FbxPropertyT EnableNearAttenuation; + + /** This property handles the near attenuation start distance + * + * Default value is 0.0 + */ + FbxPropertyT NearAttenuationStart; + + /** This property handles the near end attenuation + * + * Default value is 0.0 + */ + FbxPropertyT NearAttenuationEnd; + + /** This property handles the enable far attenuation flag + * + * Default value is false + */ + FbxPropertyT EnableFarAttenuation; + + /** This property handles the far attenuation start distance + * + * Default value is 0.0 + */ + FbxPropertyT FarAttenuationStart; + + /** This property handles the attenuation end distance + * + * Default value is 0.0 + */ + FbxPropertyT FarAttenuationEnd; + + /** This property handles the cast shadow flag + * + * Default value is false + */ + FbxPropertyT CastShadows; + + /** This property handles the shadow color + * + * Default value is (0.0, 0.0, 0.0) + */ + FbxPropertyT ShadowColor; + + /** This property handles type when LightType is eArea + * + * Default value is eRectangle + */ + FbxPropertyT AreaLightShape; + + /** This property handles the left barn door angle + * + * Default value is 20.0 + */ + FbxPropertyT LeftBarnDoor; + + /** This property handles the right barn door angle + * + * Default value is 20.0 + */ + FbxPropertyT RightBarnDoor; + + /** This property handles the top barn door angle + * + * Default value is 20.0 + */ + FbxPropertyT TopBarnDoor; + + /** This property handles the bottom barn door angle + * + * Default value is 20.0 + */ + FbxPropertyT BottomBarnDoor; + + /** This property handles active status of barn doors + * + * Default value is false + */ + FbxPropertyT EnableBarnDoor; + //@} + +/***************************************************************************************************************************** +** 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 + virtual FbxNodeAttribute::EType GetAttributeType() const; + +protected: + virtual void ConstructProperties(bool pForceSet); + virtual FbxStringList GetTypeFlags() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxLight::EType&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxLight::EDecayType&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxLight::EAreaLightShape&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_LIGHT_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxlimitsutilities.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxlimitsutilities.h new file mode 100644 index 00000000..c0bb207b --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxlimitsutilities.h @@ -0,0 +1,106 @@ +/**************************************************************************************** + + 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 fbxlimitsutilities.h +#ifndef _FBXSDK_SCENE_GEOMETRY_LIMIT_UTILS_H_ +#define _FBXSDK_SCENE_GEOMETRY_LIMIT_UTILS_H_ + +#include + +#include +#include +#include + +#include + +/** \brief This class represent a utility of limits for transforms. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxLimitsUtilities +{ +public: + /** \enum EType Limit Type. + * - \e eTranslation Translation type + * - \e eRotation Rotation type + * - \e eScaling Scale type + */ + enum EType + { + eTranslation, + eRotation, + eScaling + }; + + /** \enum ERotationType Rotation type. + * - \e eQuaternion Quaternion rotation type + * - \e eEuler Euler rotation type + */ + enum ERotationType + { + eQuaternion, + eEuler + }; + + /** \enum ERotationClampType Rotation clamp type. + * - \e eRectangular Rectangular clamp type + * - \e eEllipsoid Ellipsoid clamp type + */ + enum ERotationClampType + { + eRectangular, + eEllipsoid + }; + + + FbxLimitsUtilities(FbxNode* pNode); + + /** + * \name Getter/Setter functions + */ + //@{ + void SetAuto(EType pType, bool pAuto); + bool GetAuto(EType pType) const; + + void SetEnable(EType pType, bool pEnable); + bool GetEnable(EType pType) const; + + void SetDefault(EType pType, FbxVector4 pDefault); + FbxVector4 GetDefault(EType pType) const; + + void SetMin(EType pType, FbxVector4 pMin); + FbxVector4 GetMin(EType pType) const; + + void SetMax(EType pType, FbxVector4 pMax); + FbxVector4 GetMax(EType pType) const; + + void SetRotationType(ERotationType pType); + ERotationType GetRotationType() const; + + ERotationClampType GetRotationClampType() const; + + void SetRotationAxis(FbxVector4 pRotationAxis); + FbxVector4 GetRotationAxis() const; + + void SetAxisLength(double pLength); + double GetAxisLength() const; + + void UpdateAutomatic(FbxNode* pNode); + FbxVector4 GetEndPointTranslation(FbxNode* pNode) const; + FbxVector4 GetEndSite(FbxNode* pNode) const; + //@} + + FbxNode* mNode; + double mAxisLength; +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_LIMIT_UTILS_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxline.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxline.h new file mode 100644 index 00000000..ab1237ba --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxline.h @@ -0,0 +1,156 @@ +/**************************************************************************************** + + 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 fbxline.h +#ifndef _FBXSDK_SCENE_GEOMETRY_LINE_H_ +#define _FBXSDK_SCENE_GEOMETRY_LINE_H_ + +#include + +#include +#include + +#include + +/** A line is a geometry made of points. To be different from curves(nurbs, etc), line is linear. +* The class can define a line with as many points as needed. The line can also represent line segments, which means there will be gaps among points. +* To denote line segments and these gaps, certain points could be marked as end points. That's why we supply an index array(mPointArray) and an end point array(mEndPointArray). +* To mark a point as end point, we add its index(of mPointArray) to mEndPointArray. +* \nosubgrouping +* Methods to initialize, set and access control points are provided in the FbxGeometryBase class. +* To initialize control point count, please use FbxLine::InitControlPoints(int pCount). +* To set a control point, please use FbxLine::SetControlPointAt(const FbxVector4 &pCtrlPoint , int pIndex). +* To get control point count, please use FbxLine::GetControlPointsCount(). +* To get a control point, please use FbxLine::GetControlPointAt(int pIndex). The pIndex could be returned by GetPointIndexAt(i). +*/ +class FBXSDK_DLL FbxLine : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxLine, FbxGeometry); + +public: + /** Return the type of node attribute. + * \return Return the type of this node attribute which is \e EType::eLine. + */ + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** Reset the line to default values. + * Frees and set to \c NULL all layers and clear the control point array, the index array and end points array. + */ + void Reset(); + + /** Sets the size of index array(mPointArray). + * \param pCount Specify the size of mPointArray. + */ + void SetIndexArraySize(int pCount); + + /** Return the size of index array(mPointArray). + * \return The number of points defined for this line. + */ + int GetIndexArraySize() const; + + /** Get the pointer to the index array. + * \return the pointer to the index array(mPointArray). + */ + inline FbxArray* GetIndexArray() { return &mPointArray;} + + /** Sets index array(mPointArray) at a specified index. + * \param pValue An index to a control point. Its range is from 0 to count of control point. + * \param pIndex The specified index to mPointArray. Its range is from 0 to size of mPointArray. + * \param pAsEndPoint Mark current point as end point or not. If pAsEndPoint is true, pIndex will be automatically added to mEndPointArray. + * \return True on success, false on failure if pIndex is out of range. + */ + bool SetPointIndexAt(int pValue, int pIndex, bool pAsEndPoint = false); + + /** Gets the point index(i.e: an index to a control point) at the specified index. + * \param pIndex The specified index to the point index array(mPointArray). Its range is from 0 to size of mPointArray. + * \return Return the index to the table of the control points. If pIndex is out of range, it will return -1. + */ + int GetPointIndexAt(int pIndex) const; + + /** Adds a point to the index array (mPointArray). + * \param pValue The index to a control point. Its range is from 0 to count of control point. + * \param pAsEndPoint Mark current point as end point or not. If pAsEndPoint is true, current point index will be automatically added to mEndPointArray. + * \return True on success, false on failure if pValue is out of range. + */ + bool AddPointIndex(int pValue, bool pAsEndPoint = false); + + /** Get the pointer to the end point array. + * \return the pointer to the end points array(mEndPointArray). + */ + inline FbxArray* GetEndPointArray() { return &mEndPointArray;} + + /** Adds a point index to the end point array (mEndPointArray). + * To mark it as end point, its index to mPointArray will be added to mEndPointArray. + * \param pPointIndex The specified index to the point index array(mPointArray). Its range is from 0 to size of mPointArray. + * \return True on success, false on failure if pPointIndex is out of range. + * \remarks The point index in mEndPointArray should be incremental, otherwise, it will return false. + * To add pPointIndex, mEndPointArray will be automatically appended and resized. You never have to set count or resize for mEndPointArray. + * Below is the code sample: + * \code + * int lIndexCount = lLine->GetIndexArraySize(); + * for(int i = 0; i < lIndexCount; i++) + * { + * if(i%2 == 1) + * { + * lLine->AddEndPoint(i); + * } + * } + * \endcode + */ + bool AddEndPoint(int pPointIndex); + + /** Gets the point index(an index to the point index array) at the specified index. + * \param pEndPointIndex The specified index to the end points array(mEndPointArray). Its range is from 0 to size of mEndPointArray. + * \return Return the index to the point index array(mPointArray). If pEndPointIndex is out of range, it will return -1. + * \remarks Below is the code sample: + * \code + * int lEndPointsCount = lLine->GetEndPointCount(); + * for (int j = 0; j < lEndPointsCount; j++) + * { + * //Get the index to the index array. + * int lEndIndex = lLine->GetEndPointAt(j); + * // to get the control point index of the end point + * int lControlPointIndex = lLine->GetPointIndexAt(lEndIndex); + * } + * \endcode + */ + int GetEndPointAt(int pEndPointIndex) const; + + /** Query the number of end points. + * \return Return the size of end point array(mEndPointArray). + */ + int GetEndPointCount() const; + + /** This property decide whether this line is renderable in 3DSMax. + * Lines from Maya are not renderable by default. + */ + FbxPropertyT Renderable; + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); + +private: + FbxArray mPointArray; + FbxArray mEndPointArray; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_LINE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxlodgroup.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxlodgroup.h new file mode 100644 index 00000000..83069785 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxlodgroup.h @@ -0,0 +1,322 @@ +/**************************************************************************************** + + 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 fbxlodgroup.h +#ifndef _FBXSDK_SCENE_GEOMETRY_LOD_GROUP_H_ +#define _FBXSDK_SCENE_GEOMETRY_LOD_GROUP_H_ + +#include + +#include + +#include + +/** Defines a LOD (Level of Detail) group. + * This LodGroup node is a group node that can be used to detect how + * close a group of objects is to a camera. Typically this node is + * used for controlling "Level of Detail" visibility. + * + * Properties in the class are designed according to Maya implementation. + * So these properties may be incompatible with other software, like 3ds Max. + * + * In Maya, with "Level of Detail",the visibility of the children of this + * transform are controlled by the distance of a group to the camera and the + * threshold values. + * + * For example, under a LOD group node, there are three children: + * ship_detailed, ship_medium, and ship_rough. There are 2 threshold + * values: 5, 10. When the camera is less than 5 units away of the group + * bounding box, only ship_detailed is visible. When the view is zoomed out and + * the camera is between 5 and 10 units away from the group, only ship_medium is + * visible. Finally, when the view is zoomed out more and the camera is 10 or + * more units away from the group, only ship_rough is visible. + * + * This node attribute contains the properties of a null node. + * + * Example code to create LODGroup: + * \code + * FbxNode *lLodGroup = FbxNode::Create(pScene, "LODNode"); + * FbxLODGroup *lLodGroupAttr = FbxLODGroup::Create(pScene, "LODGroup1"); + * // Array lChildNodes contains geometries of all LOD levels + * for (int j = 0; j < lChildNodes.GetCount(); j++) + * { + * lLodGroup->AddChild(lChildNodes.GetAt(j)); + * } + * \endcode + * + * This object can also be configured to define thresholds as percentage values. + * Typically, these percentage values represent the ratio between the group bounding + * box height (in screen space) and the viewing screen height. + * + * To switch to this mode, the client application must set the value of the + * ThresholdsUsedAsPercentage property to "true" before the calls to the AddThreshold/ + * SetThreshold methods. Client applications should always check the return value of + * these methods to validate that the action was successful. + * + * Note that, for backward compatibility, the data is always stored as FbxDistance type. + * The client application should always check the return value of this method to validate + * that the argument contains a meaningful value (see GetThreshold for more details). + * + * Example code to create LODGroup that store percentage values: + * \code + * FbxNode *lLodGroup = FbxNode::Create(pScene, "LODNode"); + * FbxLODGroup *lLodGroupAttr = FbxLODGroup::Create(pScene, "LODGroup1"); + * lLodGroupAttr->ThresholdsUsedAsPercentage.Set(true); + * FBX_ASSERT(lLodGroupAttr->AddThreshold(33.3)) == true); + * FBX_ASSERT(lLodGroupAttr->AddThreshold(66.6)) == true); + * FBX_ASSERT(lLodGroupAttr->AddThreshold(FbxDistance(0.6f, "cm")) == false); + * + * FbxDistance dval; + * FbxDouble val = 0.0; + * bool res; + * res = lLodGroupAttr->GetThreshold(0, val); // res = true, val = 33.3 + * res = lLodGroupAttr->GetThreshold(0, dval); // res = false, dval.value()=33.3 + * res = lLodGroupAttr->GetThreshold(2, val); // res = false, val = 1.0 + * \nosubgrouping + */ +class FBXSDK_DLL FbxLODGroup : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxLODGroup, FbxNodeAttribute); + +public: + //! Return the type of node attribute which is EType::eLODGroup. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** \enum EDisplayLevel types to determine how to display nodes in LODGroup. + * - \e eUseLOD Display the node according LOD threshold + * - \e eShow Always show this node + * - \e eHide Always hide this node + */ + enum EDisplayLevel + { + eUseLOD, + eShow, + eHide + }; + + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + /** Specifies if the threshold values stored by this LOD object are defining + * a distance to the camera (by default) or a percentage value. + * + * \remarks This property needs to be set before any call to the Add\SetThreshold + * methods since its value is used to validate that the correct method is + * called. + * + * To access this property do: ThresholdsUsedAsPercentage.Get(). + * To set this property do: ThresholdsUsedAsPercentage.Set(bool). + * + * Default value is false + */ + FbxPropertyT ThresholdsUsedAsPercentage; + + /** + * \name Distance Mode + * The properties in this block are meaningful only if ThresholdsUsedAsPercentage + * is set to false and should be ignored otherwise. + */ + //@{ + /** This property handles the use of the Min/Max distances. + * Enables the minimum and maximum distance to take effect. + * For example, if the distance between the group and the camera is smaller + * than the minimum distance, then the whole group disappears. + * + * To access this property do: MinMaxDistance.Get(). + * To set this property do: MinMaxDistance.Set(bool). + * + * Default value is false. + */ + FbxPropertyT MinMaxDistance; + + /** The minimum distance at which the group is displayed. + * + * To access this property do: MinDistance.Get(). + * To set this property do: MinDistance.Set(double). + * + * Default value is -100 + */ + FbxPropertyT MinDistance; + + /** The maximum distance at which the group is displayed. + * + * To access this property do: MaxDistance.Get(). + * To set this property do: MaxDistance.Set(double). + * + * Default value is 100 + */ + FbxPropertyT MaxDistance; + + /** Work in world space of transform or local space If true, + * the camera distance to the LOD group will be computed in world space. + * This means it is possible to parent the LOD transform below other transforms + * and still have it work as expected. If this attribute is set to false, + * the distance computation ignores any parent transforms of the LOD transform. + * + * To access this property do: WorldSpace.Get(). + * To set this property do: WorldSpace.Set(bool). + * + * Default value is false + */ + FbxPropertyT WorldSpace; + //@} + + ////////////////////////////////////////////////////////////////////////// + // + // Methods + // + ////////////////////////////////////////////////////////////////////////// + + /** Get the number of elements in the threshold list. + * In correct situations, the size of this list is one less than the LOD node + * children objects count. + * \return The current size of the threshold list. + */ + int GetNumThresholds() const; + + /** Add a new threshold. + * \param pThreshValue Threshold value (distance). + * \return true if successful and false otherwise. + * \remarks The thresholds list can only expand. Removing items is not + * possible unless a new FbxLODGroup is created to replace this one. + * \remarks This method does not check the received value and blindly adds it + * to the list. Identical values can exist in different positions in + * the list. + * \remarks This method will fail if ThresholdsUsedAsPercentage=true. + */ + bool AddThreshold(const FbxDistance& pThreshValue); + + /** Add a new threshold. + * \param pThreshValue Threshold value (percentage). + * \return true if successful and false otherwise. + * \remarks The thresholds list can only expand. Removing items is not + * possible unless a new FbxLODGroup is created to replace this one. + * \remarks This method does not check the received value and blindly adds it + * to the list. Identical values can exist in different positions in + * the list. + * \remarks This method will fail if ThresholdsUsedAsPercentage=false. + */ + bool AddThreshold(FbxDouble pThreshValue); + + /** Replace the value of the specified threshold. + * \param pEl Element index in the thresholds list. + * \param pThreshValue New threshold value (distance). + * \return true if successful and false otherwise. + * \remarks This method will fail if ThresholdsUsedAsPercentage=true. + */ + bool SetThreshold(int pEl, const FbxDistance& pThreshValue); + + /** Replace the value of the specified threshold. + * \param pEl Element index in the thresholds list. + * \param pThreshValue New threshold value (percentage). + * \return true if successful and false otherwise. + * \remarks This method will fail if ThresholdsUsedAsPercentage=false. + */ + bool SetThreshold(int pEl, FbxDouble pThreshValue); + + /** Get the value of the specified threshold. + * \param pEl Element index in the thresholds list. + * \param pThreshValue The current threshold value. + * \return true if successful and false otherwise. + * \remarks pThreshValue is left unchanged if a bad index is provided, + * else the value stored in the list is returned in pThreshValue + * but may be irrelevant if ThresholdsUsedAsPercentage=true. In + * this case, the return of this function will also be \c false. + */ + bool GetThreshold(int pEl, FbxDistance& pThreshValue) const; + + /** Get the value of the specified threshold. + * \param pEl Element index in the thresholds list. + * \param pThreshValue The current threshold value. + * \return true if successful and false otherwise. + * \remarks pThreshValue is left unchanged if a bad index is provided, + * else the value stored in the list is returned in pThreshValue + * but may be irrelevant if ThresholdsUsedAsPercentage=false. In + * this case, the return of this function will also be \c false. + */ + bool GetThreshold(int pEl, FbxDouble& pThreshValue) const; + + /** Get the number of elements in the displayLevel list. + * In correct situations, the size of this list equals the LOD node + * children objects count. + * \return The current size of the displayLevel list. + */ + int GetNumDisplayLevels() const; + + /** Add a new displayLevel value to the current list. + * + * The value overrides the display of any level and can force it to hide + * or show the object at that level. For example, if the distance between + * the group and the camera is smaller than the first threshold, then the + * object at level 0 is visible. If the display level for the object at + * level 2 is changed to eShow, ie. if the attribute displayLevel[2] is + * set to eShow, then the object at level 2 will show regardless of + * the current active level. + * + * \param pValue Display level value + * \return true if successful and false if any error occurred. + * \remarks Removing items is not possible unless a new FbxLODGroup is + * created to replace this one. + * \remarks This method does not check the received value and blindly adds it + * to the list. Identical values can exist in different positions in + * the list. + */ + bool AddDisplayLevel(FbxLODGroup::EDisplayLevel pValue); + + /** Set the display level value for the specified child object. + * \param pEl The index of the object. + * \param pValue New display level value. + * \return true if successful and false otherwise. + */ + bool SetDisplayLevel(int pEl, FbxLODGroup::EDisplayLevel pValue); + + /** Get the display level value for the specified child object. + * \param pEl The index of the object. + * \param pValue the current display level value. + * \return true if successful and false otherwise. + * \remarks In case of failure, the pValue is left unchanged. + */ + bool GetDisplayLevel(int pEl, FbxLODGroup::EDisplayLevel& pValue) 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + +private: + int mNbThresholds; + FbxProperty mThresholds; + + bool RetrieveThreshold(int pEl, FbxDistance& pThreshValue) const; + bool StoreThreshold(int pEl, const FbxDistance& pThreshValue); + + int mNbDisplayLevels; + FbxProperty mDisplayLevels; + + bool DisplayLevel(int pEl, FbxLODGroup::EDisplayLevel pValue); + +public: + virtual FbxStringList GetTypeFlags() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxLODGroup::EDisplayLevel&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_LOD_GROUP_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxmarker.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxmarker.h new file mode 100644 index 00000000..d70d03de --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxmarker.h @@ -0,0 +1,283 @@ +/**************************************************************************************** + + 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 fbxmarker.h +#ifndef _FBXSDK_SCENE_GEOMETRY_MARKER_H_ +#define _FBXSDK_SCENE_GEOMETRY_MARKER_H_ + +#include + +#include + +#include + +/** This node attribute contains the properties of a marker. + * A FbxMarker can represent a motion capture marker or a HIK IK/FK effector. + * \nosubgrouping + */ +class FBXSDK_DLL FbxMarker : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxMarker, FbxNodeAttribute); + +public: + //! Return the type of node attribute which is EType::eMarker. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + //! Reset the marker to default values. + void Reset(); + + /** \enum EType Marker types. + * - \e eStandard + * - \e eOptical + * - \e eEffectorFK + * - \e eEffectorIK + */ + enum EType + { + eStandard, + eOptical, + eEffectorFK, + eEffectorIK + }; + + /** Set marker type. + * \param pType The type of marker. + */ + void SetType(EType pType); + + /** Get marker type. + * \return The type of the marker. + */ + EType GetType() const; + + /** \enum ELook Marker look. + * - \e eCube + * - \e eHardCross + * - \e eLightCross + * - \e eSphere + * - \e eCapsule + * - \e eBox + * - \e eBone + * - \e eCircle + * - \e eSquare + * - \e eStick + * - \e eNone + */ + enum ELook + { + eCube, + eHardCross, + eLightCross, + eSphere, + eCapsule, + eBox, + eBone, + eCircle, + eSquare, + eStick, + eNone + }; + + /** + * \name Default Animation Values + * This set of functions provides direct access to default + * animation values specific to a marker. The default animation + * values are found in the default take node of the associated node. + * Hence, these functions only work if the marker has been associated + * with a node. + */ + //@{ + + /** Get default occlusion. + * \return 0.0 if optical marker animation is valid by default, 1.0 if it is occluded by default. + * \remarks This function only works if marker type is set to FbxMarker::eOptical. + */ + double GetDefaultOcclusion() const; + + /** Set default occlusion. + * \param pOcclusion 0.0 if optical marker animation is valid by default, 1.0 if it is occluded by default. + * \remarks This function only works if marker type is set to FbxMarker::eOptical. + */ + void SetDefaultOcclusion(double pOcclusion); + + /** Get default IK reach translation. + * \return A value between 0.0 and 100.0, 100.0 means complete IK reach. + * \remarks This function only works if marker type is set to FbxMarker::eEffectorIK. + */ + double GetDefaultIKReachTranslation() const; + + /** Set default IK reach translation. + * \param pIKReachTranslation A value between 0.0 and 100.0, 100.0 means complete IK reach. + * \remarks This function only works if marker type is set to FbxMarker::eEffectorIK. + */ + void SetDefaultIKReachTranslation(double pIKReachTranslation); + + /** Get default IK reach rotation. + * \return A value between 0.0 and 100.0, 100.0 means complete IK reach. + * \remarks This function only works if marker type is set to FbxMarker::eEffectorIK. + */ + double GetDefaultIKReachRotation() const; + + /** Set default IK reach rotation. + * \param pIKReachRotation A value between 0.0 and 100.0, 100.0 means complete IK reach. + * \remarks This function only works if marker type is set to FbxMarker::eEffectorIK. + */ + void SetDefaultIKReachRotation(double pIKReachRotation); + + /** Get default IK pull. + * \return A value between 0.0 and 100.0, 100.0 means complete IK pull. + * \remarks This function only works if marker type is set to FbxMarker::eIK_EFFECTOR. + */ + double GetDefaultIKPull() const; + + /** Set default IK pull. + * \param pIKPull A value between 0.0 and 100.0, 100.0 means complete IK pull. + * \remarks This function only works if marker type is set to FbxMarker::eIK_EFFECTOR. + */ + void SetDefaultIKPull(double pIKPull); + + /** Get default IK pull hips. + * \return A value between 0.0 and 100.0, 100.0 means complete IK pull. + * \remarks This function only works if marker type is set to FbxMarker::eIK_EFFECTOR. + */ + double GetDefaultIKPullHips() const; + + /** Set default IK pull hips. + * \param pIKPullHips A value between 0.0 and 100.0, 100.0 means complete IK pull. + * \remarks This function only works if marker type is set to FbxMarker::eIK_EFFECTOR. + */ + void SetDefaultIKPullHips(double pIKPullHips); + + //@} + + /** + * \name Obsolete functions + */ + //@{ + + /** Get default color. + * \param pColor Filled with appropriate data + * \return Input parameter filled with appropriate data. + * \remarks Marker color can not be animated anymore. + */ + FbxColor& GetDefaultColor(FbxColor& pColor) const; + + /** Set default color. + * \param pColor The marker color to be set. + * \remarks Marker color can not be animated anymore. + */ + void SetDefaultColor(FbxColor& pColor); + + //@} + + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + + /** This property handles the marker's look. + * + * To access this property do: Look.Get(). + * To set this property do: Look.Set(ELook). + * + * Default value is eCube + */ + FbxPropertyT Look; + + /** This property handles the marker's link visibility. + * + * To access this property do: DrawLink.Get(). + * To set this property do: DrawLink.Set(FbxBool). + * + * Default value is true + */ + FbxPropertyT DrawLink; + + /** This property handles the marker's size. + * + * To access this property do: Size.Get(). + * To set this property do: Size.Set(FbxDouble). + * + * Default value is 100 + */ + FbxPropertyT Size; + + /** This property handles the marker's label visibility. + * + * To access this property do: ShowLabel.Get(). + * To set this property do: ShowLabel.Set(FbxBool). + * + * Default value is false + */ + FbxPropertyT ShowLabel; + + /** This property handles the marker's pivot position. + * + * To access this property do: IKPivot.Get(). + * To set this property do: IKPivot.Set(FbxDouble3). + * + * Default value is (0., 0., 0.) + */ + FbxPropertyT IKPivot; + + // Dynamic properties + + /** This method grants access to the occlusion property. + * \remarks If the marker is not of type Optical or the property + * is invalid, return NULL + */ + FbxProperty GetOcclusion() const; + + /** This method grants access to the IKReachTranslation property. + * \remarks If the marker is not of type IK Effector or the property + * is invalid, return NULL + */ + FbxProperty GetIKReachTranslation() const; + + /** This method grants access to the IKReachRotation property. + * \remarks If the marker is not of type IK Effector or the property + * is invalid, return NULL + */ + FbxProperty GetIKReachRotation() const; + + /** This method grants access to the IKPull property. + * \remarks If the marker is not of type IK Effector or the property + * is invalid, return NULL + */ + FbxProperty GetIKPull() const; + + /** This method grants access to the IKPullHips property. + * \remarks If the marker is not of type IK Effector or the property + * is invalid, return NULL + */ + FbxProperty GetIKPullHips() 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void ConstructProperties(bool pForceSet); + virtual const char* GetTypeName() const; + virtual FbxStringList GetTypeFlags() const; + + EType mType; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxMarker::ELook&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_MARKER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxmesh.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxmesh.h new file mode 100644 index 00000000..c9cfcbfe --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxmesh.h @@ -0,0 +1,833 @@ +/**************************************************************************************** + + 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 fbxmesh.h +#ifndef _FBXSDK_SCENE_GEOMETRY_MESH_H_ +#define _FBXSDK_SCENE_GEOMETRY_MESH_H_ + +#include + +#include +#include + +#include + +/** A mesh is a geometry made of polygons. +* The class can define a geometry with as many n-sided polygons as needed. Users can freely +* mix triangles, quadrilaterals, and other polygons. Since the mesh-related terminology of the FBX SDK +* differs a little from the known standards, here are our definitions: +* \li A control point is an XYZ coordinate, it is synonym of vertex. +* \li A polygon vertex is an index to a control point (the same control point can be referenced by multiple polygon vertices). +* \li A polygon is a group of polygon vertices. The minimum valid number of polygon vertices to define a polygon is 3. +* \nosubgrouping +* Methods to initialize, set and access control points are provided in the FbxGeometryBase class. */ +class FBXSDK_DLL FbxMesh : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxMesh, FbxGeometry); + +public: + /** Return the type of node attribute. + * \return Return the type of this node attribute which is \e EType::eMesh. */ + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** \name Polygon Management */ + //@{ + /** Begins the process of adding a polygon to the mesh. + * Add vertexes to the polygon using AddPolygon. When the polygon is complete call EndPolygon to complete the creation of the polygon. + * \param pMaterial Index of material to assign to this polygon if material mapping type is \e eByPolygon. Otherwise it must be \c -1. + * \param pTexture Index of texture to assign to this polygon if texture mapping type is \e eByPolygon. Otherwise it must be \c -1. + * \param pGroup Group index assigned to polygon. + * \param pLegacy When set to \c true, automatically create a LayerElement of type Texture; This was the default behavior of earlier + * versions of the FBX SDK. Since version 2010, the textures are connected to the material object. + * \remark This function must be called before AddPolygon(). + * \remark If used, the pTexture index will reference textures assigned to the DIFFUSE channel (FbxLayerElement::eTextureDiffuse). */ + void BeginPolygon(int pMaterial=-1, int pTexture=-1, int pGroup=-1, bool pLegacy=true); + + /** Begin writing a polygon. + * Add vertexes to the polygon using AddPolygon. When the polygon is complete call EndPolygon to complete the creation of the polygon. + * \param pMaterial Index of material to assign to this polygon if material mapping type is \e eByPolygon. Otherwise it must be \c -1. + * \param pTextures Array of index of texture (by texture type) to assign to this polygon if texture mapping type is \e eByPolygon. + * Otherwise it must be an array of \c -1. This array is expected to be of size: FbxLayerElement::sTypeTextureCount. If one texture + * type is not used, the corresponding entry must be left at \c -1. */ + void BeginPolygonExt(int pMaterial, int* pTextures); + + /** Add a polygon vertex to the current polygon. + * \param pIndex Index in the table of the control points. + * \param pTextureUVIndex Index of texture UV coordinates to assign to this polygon if texture UV mapping type is \e eByPolygonVertex. Otherwise it must be \c -1. + * \remark After adding all the polygons of the mesh, call function "BuildMeshEdgeArray" to generate edge data for the mesh. */ + void AddPolygon(int pIndex, int pTextureUVIndex = -1); + + //! End writing a polygon, it should be called after adding one polygon. + void EndPolygon(); + + /** Get the polygon count of this mesh. + * \return Return the number of polygons in the mesh. */ + inline int GetPolygonCount() const { return mPolygons.GetCount(); } + + /** Get the number of polygon vertices in a polygon. + * \param pPolygonIndex Index of the polygon. + * \return The number of polygon vertices in the indexed polygon. If the polygon index is out of bounds, return -1. */ + inline int GetPolygonSize(int pPolygonIndex) const + { + return ( pPolygonIndex >= 0 && pPolygonIndex < mPolygons.GetCount() ) ? mPolygons[pPolygonIndex].mSize : -1; + } + + /** Get the current group ID of the specified polygon. + * A polygon group can be useful to identify a number of polygons that share the same properties. The FBX SDK does not use this information internally + * but guarantee its persistence in the FBX files and in memory. + * \param pPolygonIndex Index of the polygon. + * \return Group index assigned to the polygon. If the polygon index is out of bounds, return -1. */ + int GetPolygonGroup(int pPolygonIndex) const; + + /** Assign the specified polygon a group ID. + * A polygon can only be assigned to one group at the time. + * \param pPolygonIndex Index of the polygon. + * \param pGroup Group index assigned to the polygon. + * \return Group index assigned to the polygon. If the polygon index is out of bounds, do nothing. */ + inline void SetPolygonGroup(int pPolygonIndex, int pGroup) const + { + if( pPolygonIndex >= 0 && pPolygonIndex= 0 && pPolygonIndex < mPolygons.GetCount() && pPositionInPolygon >= 0 && pPositionInPolygon < mPolygons[pPolygonIndex].mSize ) ? + mPolygonVertices[mPolygons[pPolygonIndex].mIndex + pPositionInPolygon] : -1; + } + + /** Get the normal associated with the specified polygon vertex. + * \param pPolyIndex Index of the polygon. + * \param pVertexIndex Index of the vertex in the polygon. + * \param pNormal The returned normal. + * \return \c True on success, \c false on failure. + * \remark \c pNormal remain unchanged if the requested vertex does not exists. */ + bool GetPolygonVertexNormal(int pPolyIndex, int pVertexIndex, FbxVector4& pNormal) const; + + /** Get the normals associated with the mesh for every polygon vertex. + * \param pNormals The returned normals. + * \return \c True on success, \c false on failure. */ + bool GetPolygonVertexNormals(FbxArray& pNormals) const; + + /** Get the UV associated with the specified polygon vertex. + * \param pPolyIndex Index of the polygon. + * \param pVertexIndex Index of the vertex in the polygon. + * \param pUVSetName The name of the UV set that contains the UV. + * \param pUV The returned UV. + * \param pUnmapped State flag that indicates if the polygon vertex does not have an associated UV. + * \return \c True on success, \c false on failure. + * \remark \c pUV remain unchanged if the requested vertex does not exists. + * \remark This function return \c true if the specified polygon vertex does not have an associated UV. In this case, + * pUnampped is set to \c true and the content of \c pUV is undefined. + */ + bool GetPolygonVertexUV(int pPolyIndex, int pVertexIndex, const char* pUVSetName, FbxVector2& pUV, bool& pUnmapped) const; + + /** Get the UVs associated with the mesh for every polygon vertex. + * \param pUVSetName The name of the UV set that contains the UVs. + * \param pUVs The returned UVs. + * \param pUnmappedUVId If specified, this array will be filled with the indices of the UVs that are not associated to a polygon vertex and thus, + * have an undefined value. If the array as a size of 0, then all the polygon vertices have an associated UV coordinate and the \c pUVs + * array can be used as is. Otherwise, the calling application may be required to process the invalid UV coordinates to avoid inconsistent + * results. It is strongly suggested to use the FbxLayerElementUV's Direct and Indexed arrays directly (specially if the calling application + * supports indirection of the UVs). + * \remark unmapped UV coordinates are set to (0,0) + * \return \c True on success, \c false on failure. + */ + bool GetPolygonVertexUVs(const char* pUVSetName, FbxArray& pUVs, FbxArray* pUnmappedUVId = NULL) const; + + /** Get the array of polygon vertices (i.e: indices to the control points). + * This array is a concatenation of the list of polygon vertices of all the polygons. Example: a mesh made of 2 triangles with vertices [1,2,3] + * and vertices [2,3,4] results in [1,2,3,2,3,4]. The first polygon starts at position 0 and the second at position 3. + * \return The array of polygon vertices. */ + int* GetPolygonVertices() const; + + /** Gets the number of polygon vertices in the mesh. + * \return The overall size of the array of polygon vertices in the mesh. + * \remark This value can be smaller than the value returned by GetControlPointsCount() (meaning that not all of the control points stored in the object are used to define the mesh). + * However, typically it will be much bigger since any given control point can be used to define a vertex on multiple polygons. */ + inline int GetPolygonVertexCount() const { return mPolygonVertices.Size(); } + + /** Gets the start index into the array returned by GetPolygonVertices() for the given polygon. + * This method can be used for a faster access to the polygon vertices indices. If, for example, we want to + * access the indices for polygon 3, the following code would do the trick + * \code + * int lStartIndex = mesh.GetPolygonVertexIndex(3); + * if( lStartIndex == -1 ) return; + * int* lVertices = mesh.GetPolygonVertices()[lStartIndex]; + * int lCount = mesh.GetPolygonSize(3); + * for( int i = 0; i < lCount; ++i ) + * { + * int vertexID = lVertices[i]; + * ... + * } + * \endcode + * \param pPolygonIndex The polygon of interest. + * \return The index into the GetPolygonVertices() array. + * \remark If the polygon index is out of bounds, return -1. */ + int GetPolygonVertexIndex(int pPolygonIndex) const; + + /** Remove the specified polygon from the mesh. + * This method will automatically update the layers accordingly. + * \param pPolygonIndex Index of the polygon. + * \return Polygon index. + * \remark If the polygon index is out of bounds, return -1. */ + int RemovePolygon(int pPolygonIndex); + + /** Remove the duplicated edges from the mesh. + * This method will remove duplicated edges. It will not change any vertex and not change the mesh topology. + * \param pEdgeIndexList Index list of edges. + * \return the count of removed edges. + * \remark the edge index list must be ordered. The last one is the max. If the edge index is out of bounds, return -1. */ + int RemoveDuplicatedEdges(FbxArray& pEdgeIndexList); + //@} + + /** \name Texture UV Utility Functions. + * + * The methods found in this section are utility functions used to handle UV coordinates quickly. Internally, they + * refer to \c FbxLayer and \c FbxLayerElementUV methods to do the job. Except for the GetAllChannelUV(int pLayer), + * all the methods are implicitly working on Layer 0. Use the \c FbxLayer methods to have access to the other layers. */ + //@{ + /** Init texture UV coordinates. + * \param pCount Number of texture UV elements. + * \param pTypeIdentifier Specifies which texture channel this UV refers to. + * \remark \c pCount must equal the number of control points of the Mesh if + * the UV mapping mode is \e FbxLayerElement::eByControlPoint. */ + void InitTextureUV(int pCount, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); + + /** Add texture UV coordinates. + * Appends a new element at the end of the array of texture UV coordinates. + * \param pUV Texture UV coordinates, ranging between \c 0 and \c 1. + * \param pTypeIdentifier Specifies which texture channel this UV refers to. + * \remark The final number of texture UV elements must equal the number of control + * points if the UV mapping mode is \e FbxLayerElement::eByControlPoint. */ + void AddTextureUV(FbxVector2 pUV, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); + + /** Get the number of texture UV coordinates. + * \param pTypeIdentifier The texture channel the UV refers to. */ + int GetTextureUVCount(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); + + /** Get the number of layer containing at least one channel UVMap. + * return \e 0 if no UV maps have been defined. */ + int GetUVLayerCount() const; + + /** Fills an array describing, for the given layer, which texture channel have UVs associated to it. + * \param pLayer Index of the layer. + * \return Array with the channel descriptor. + * \remark Only the channels that have UVs associated are reported in the array. For example, let's assume that we have defined UVs for the Diffuse, + * Ambient and Bump channels on layer 0. The resulting array will have the following three entries: + * \li FbxLayerElement::eDIFFUSE_TEXTURE + * \li FbxLayerElement::eAMBIENT_TEXTURE + * \li FbxLayerElement::eBUMP_TEXTURE */ + FbxArray GetAllChannelUV(int pLayer); + //@} + + /** \name Material, Texture and UV Indices Utility Functions. + * The methods found in this section are utility functions used to handle Material, Texture and UV indices quickly. + * Internally, they refer to \c FbxLayer and \c FbxLayerElementUV methods to do the job. These functions are only + * working on Layer 0. Use the \c FbxLayer methods directly to access other layers. */ + //@{ + /** Initialize material indices. + * \param pMappingMode The mapping mode. + * This method must be called after FbxGeometryBase::InitControlPoints(). + * The material indices refer to the position of a material in the FbxLayerElementMaterial's direct array. + * See FbxLayerElementMaterial for more details. Supported mapping types are \e eByControlPoint, + * \e eByPolygon and \e eALL_SAME. + * - If mapping mode is \e eByControlPoint, there will be as many indices in the material index array + * as there are control points. + * - If mapping mode is \e eByPolygon, there will be as many indices in the material index array + * as there are polygons in the mesh. + * - If mapping mode is \e eALL_SAME, there will be only one index in the material index array. + * \remark This function will set the Reference mode of the FbxLayerElementMaterial on layer 0 to \e eIndexToDirect. */ + void InitMaterialIndices(FbxLayerElement::EMappingMode pMappingMode); + + /** Initialize texture indices. + * \param pMappingMode The mapping mode. + * The texture indices refer to the texture connection to the material. In older versions of the FBX SDK, the + * indices were referring to the entries in the direct array of the FbxLayerElementTexture. + * See FbxLayerElementTexture for more details. Supported mapping modes are \e eByPolygon + * and \e eALL_SAME. + * - If mapping mode is \e eByPolygon, there will be as many indices in the texture index array + * as there are polygons in the mesh. + * - If mapping mode is \e eALL_SAME, there will be only one index in the texture index array. + * \param pTextureType The texture channel identifier. + * \remark This function will set the Reference mode of the FbxLayerElementTexture on layer 0 to \e eIndexToDirect. */ + void InitTextureIndices(FbxLayerElement::EMappingMode pMappingMode, FbxLayerElement::EType pTextureType); + + /** Initialize texture UV indices. + * \param pMappingMode The mapping mode. + * The texture UV indices refer to the index of an element in the FbxLayerElementUV's direct array. + * See FbxLayerElementUV for more details. Supported mapping types are \e eByControlPoint , \e eByPolygonVertex + * and \e eALL_SAME. + * - If mapping mode is \e eByControlPoint, there will be as many indices in the UV index array + * as there are control points. This will also set the Reference mode of the FbxLayerElementUV on + * layer 0 to \e eDirect. + * - If mapping mode is \e eByPolygonVertex, there will be an index in the UV index array + * for each vertex, for each polygon it is part of. This will also set the Reference mode of the FbxLayerElementUV on + * layer 0 to \e eIndexToDirect. + * - If mapping mode is \e eALL_SAME, there will be no index in the UV index array. This will also set the Reference + * mode of the FbxLayerElementUV on layer 0 to \e eDirect. + * \param pTypeIdentifier The texture channel the UVIndices refers to. */ + void InitTextureUVIndices(FbxLayerElement::EMappingMode pMappingMode, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); + + /** Get a texture UV index associated with a polygon vertex (i.e: an index to a control point). + * \param pPolygonIndex Index of polygon. + * The valid range for this parameter is 0 to FbxMesh::GetPolygonCount(). + * \param pPositionInPolygon Position of polygon vertex in indexed polygon. + * The valid range for this parameter is 0 to FbxMesh::GetPolygonSize(pPolygonIndex). + * \param pTypeIdentifier The texture channel the UVIndex refers to. + * \return Return a texture UV index. + * \remark This function only works if the texture UV mapping mode is set to \e eByPolygonVertex, + * otherwise it returns -1. */ + int GetTextureUVIndex(int pPolygonIndex, int pPositionInPolygon, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); + + /** Set a texture UV index associated with a polygon vertex (i.e: an index to a control point). + * \param pPolygonIndex Index of polygon. + * The valid range for this parameter is 0 to FbxMesh::GetPolygonCount(). + * \param pPositionInPolygon Position of polygon vertex in indexed polygon. + * The valid range for this parameter is 0 to FbxMesh::GetPolygonSize(pPolygonIndex). + * \param pIndex The index of the texture UV we want to assign to the polygon vertex. + * \param pTypeIdentifier The texture channel the UVIndex refers to. + * \remark This function only works if the texture UV mapping type is set to \e eByPolygonVertex. */ + void SetTextureUVIndex(int pPolygonIndex, int pPositionInPolygon, int pIndex, FbxLayerElement::EType pTypeIdentifier); + //@} + + /** \name Utility functions */ + //@{ + /** Reset the mesh to default values. + * Frees and set to \c NULL all layers and clear the polygon and the control point array. */ + void Reset(); + + /** Generate vertex normals on the mesh. + * The normal computation takes into consideration, as much as possible, the smoothing groups. + * \param pOverwrite If true, re-generate normals data regardless of availability, otherwise left untouched if exist. + * \param pByCtrlPoint If true, the recomputed normals will be defined by control points instead of by polygon vertex. + * \param pCW True if the normals are calculated clockwise, false otherwise (counter-clockwise). + * \return \c true if successfully generated normals data, or if already available and pOverwrite is false. */ + bool GenerateNormals(bool pOverwrite=false, bool pByCtrlPoint = false, bool pCW=false); + + /** Compares the normals calculated by doing cross-products between the polygon vertex and by the ones + * stored in the normal array. + * \returns \c false if ALL of them are Clockwise. Returns \c true otherwise. */ + bool CheckIfVertexNormalsCCW(); + + //! Internal structure used to keep the duplicate vertex information. + class DuplicateVertex + { + public: + DuplicateVertex() : + lVertexPolyIndex(0), + lNewVertexIndex(0), + lNormal(0, 0, 0), + lUV(0, 0), + lEdgeIndex(0) + { + } + + int lVertexPolyIndex; //!< Index in mPolygonsVertex where the vertex is found. + int lNewVertexIndex; //!< The new index of the vertex. + FbxVector4 lNormal; //!< The normal associated with this duplicate control point. + FbxVector2 lUV; //!< The UV associated with this duplicate control point. + int lEdgeIndex; //!< The edge index. + }; + + //! Internal structure used to compute the normals on a mesh + class VertexNormalInfo + { + public: + VertexNormalInfo() : + mTotalNormal(0, 0, 0), + mNumNormal(0) + { + } + + FbxVector4 mTotalNormal; //!< Sum of all the normals found. + int mNumNormal; //!< Number of normals added. + }; + + /** Verify if the mesh has polygons that are defined on the same point more than once. + * \return true if the mesh has that kind of polygon, false otherwise. */ + bool CheckSamePointTwice() const; + + /** Remove bad polygons from a mesh. + * Degenerate polygons use a vertex more than once. Remove them from the mesh and + * from the layer element indices as needed. + * \return Number of polygons removed from the mesh, -1 if an error occurred. */ + int RemoveBadPolygons(); + //@} + + /** \name Point Splitting/Merging utility functions */ + //@{ + /** Split points. + * \param pTypeIdentifier Specify which UVs are processed. + * \return \c true if a split occurred, false otherwise. + * \remark This method replaces the BuildSplitList and SplitPointsForHardEdge. */ + bool SplitPoints(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); + + /** Insert the new indexes of the object that have to be merged. + * \param pMergeList The list that will contain the indexes of the objects to merge. + * \param pExport If set to \c true, include the duplicate indexes in the merge list. */ + bool BuildMergeList(FbxArray& pMergeList, bool pExport=false); + + /** Merge the points specified in the list. + * \param pMergeList List containing the information on the points that will be merged. */ + void MergePointsForPolygonVerteNormals(FbxArray &pMergeList); + //@} + + /** \name Edge management functions */ + //@{ + /** Automatically generate edge data for the mesh. Clears all previously stored edge information */ + void BuildMeshEdgeArray(); + + /** Query the number of edges defined on this mesh + * \return The number of edges defined for this mesh */ + int GetMeshEdgeCount() const; + + /** Get the index for the edge between the given vertices. + * Note that the result of this method is the same if pStartVertexIndex and pEndVertexIndex are swapped. + * \param pStartVertexIndex The starting point of the edge. + * \param pEndVertexIndex The ending point of the edge. + * \param pReversed flag will be set to true if the reverse edge is found, false otherwise. + * \param pExistedEdgeCount legal edge count in mEdgeArray + * \return -1 if no edge exists for the given pair of vertices. */ + int GetMeshEdgeIndex(int pStartVertexIndex, int pEndVertexIndex, bool& pReversed, int pExistedEdgeCount=-1); + + /** Use this method before calling GetMeshEdgeIndexForPolygon if making several calls to that method. + * Once done calling GetMeshEdgeIndexForPolygon, call EndGetMeshEdgeIndex. This will optimize access time. + * Do not modify the mesh between calls to BeginGetMeshEdgeIndex and EndGetMeshEdgeIndex. */ + void BeginGetMeshEdgeIndexForPolygon(); + + /** Use this method after calling GetMeshEdgeIndexForPolygon if making several calls to that method. + * This will optimize access time. + * Do not modify the mesh between calls to BeginGetMeshEdgeIndex and EndGetMeshEdgeIndex. */ + void EndGetMeshEdgeIndexForPolygon(); + + /** Get the index for the specific edge of pPolygon. + * \param pPolygon The polygon of interest. + * \param pPositionInPolygon The specific edge number in the polygon. + * \return -1 if the specific edge does not exist. + * \remark To optimize access time when making several calls to this method, enclose these calls + * between the BeginGetMeshEdgeIndexForPolygon() and EndGetMeshEdgeIndexForPolygon() calls. */ + int GetMeshEdgeIndexForPolygon(int pPolygon, int pPositionInPolygon); + + /** Get the vertices for the given edge. Note that the values returned are indices into the control point array. + * \param pEdgeIndex The edge to query. + * \param pStartVertexIndex The edge's starting point will be stored here. + * \param pEndVertexIndex The edge's starting point will be stored here. */ + void GetMeshEdgeVertices(int pEdgeIndex, int& pStartVertexIndex, int& pEndVertexIndex) const; + + /** Use this method before calling GetMeshEdgeVertices if making several calls to that method. + * Once done calling GetMeshEdgeVertices, call EndGetMeshEdgeVertices. This will optimize access time. + * Do not modify the mesh between calls to BeginGetMeshEdgeVertices and EndGetMeshEdgeVertices. */ + void BeginGetMeshEdgeVertices(); + + /** Use this method after calling GetMeshEdgeVertices if making several calls to that method. + * This will optimize access time. + * Do not modify the mesh between calls to BeginGetMeshEdgeVertices and EndGetMeshEdgeVertices. */ + void EndGetMeshEdgeVertices(); + + /** Presets the number edge data elements. + * \param pEdgeCount The number of edges to allocate. */ + void SetMeshEdgeCount(int pEdgeCount); + + /** Sets element in edge array to specific value. + * \param pEdgeIndex The edge index + * \param pValue The edge data */ + inline void SetMeshEdge(int pEdgeIndex, int pValue){ if( pEdgeIndex >= 0 && pEdgeIndex < mEdgeArray.GetCount() ) mEdgeArray[pEdgeIndex] = pValue; } + + /** Add an edge with the given start/end points. Note that the inserted edge + * may start at the given end point, and end at the given start point. + * \param pStartVertexIndex The starting point of the edge. + * \param pEndVertexIndex The ending point of the edge. + * \param pCheckForDuplicates Set to true to check if the mesh already contains an edge with these two points. + * Can be set to false to speed up this method, when the incoming edges are known to be consistent. + * \return Edge index of the new edge, or -1 on failure (edge/reverse edge already exists, no face using these 2 points consecutively ) */ + int AddMeshEdgeIndex(int pStartVertexIndex, int pEndVertexIndex, bool pCheckForDuplicates); + + /** Set the index for the edge with the given start/end points. Note that the edge + * may start at the given end point, and end at the given start point. + * \param pEdgeIndex The edge index of the edge. + * \param pStartVertexIndex The starting point of the edge. + * \param pEndVertexIndex The ending point of the edge. + * \param pCheckForDuplicates Set to true to check if the mesh already contains an edge with these two points. + * Can be set to false to speed up this method, when the incoming edges are known to be consistent. + * \param pExistedEdgeCount the valid edge count that we have created in edge array. This parameter only works when pCheckForDuplicates is true. + * The default value is -1 which meaning current edge array has been fully filled with valid edges, i.e., + * we will search the full edge array for the duplicated edge. + * \return Edge index of the edge, or -1 on failure (no face using these 2 points consecutively ), or -2 if edge/reverse edge already exists */ + int SetMeshEdgeIndex(int pEdgeIndex, int pStartVertexIndex, int pEndVertexIndex, bool pCheckForDuplicates, int pExistedEdgeCount=-1); + + /** Call this before calling AddMeshEdgeIndex or SetMeshEdgeIndex to increase performance. + * Once finished adding/setting edges EndAddMeshEdgeIndex should be called. */ + void BeginAddMeshEdgeIndex(); + + /** After calling AddMeshEdgeIndex or SetMeshEdgeIndex, EndAddMeshEdgeIndex should be called. */ + void EndAddMeshEdgeIndex(); + + /** Adds an edge for the specified polygon, and edge number within the polygon. See SetMeshEdgeIndex for notes the the parameters. + * \param pPolygonIndex The polygon of interest. + * \param pPositionInPolygon The edge within the polygon + * \return edge index or -1 if failed. */ + int AddMeshEdgeIndexForPolygon(int pPolygonIndex, int pPositionInPolygon); + + /** Sets the specified edge to the specified polygon's edge. + * Note that the position in the polygon ranges from 0 to GetPolygonSize(pPolygonindex) - 1 + * and represents the edge from GetPolygonVertex(pPolygonIndex, pPositionInPolygon) to + * GetPolygonVertex( pPolygonIndex, pPositionInPolygon + 1 ) or from pPositionInPolygon to + * 0 if pPositionInPolygon == GetPolygonSize(pPolygonindex) - 1 + * \param pEdgeIndex The edge. + * \param pPolygonIndex The polygon. + * \param pPositionInPolygon The specific edge number in the polygon. + * \return true on success, false on failure. ( edge for the poly and position already exists ) */ + bool SetMeshEdgeIndex(int pEdgeIndex, int pPolygonIndex, int pPositionInPolygon); + + /** Determines if the mesh is composed entirely of triangles. + * \return true if all polygons are triangles, false otherwise */ + bool IsTriangleMesh() const; + //@} + + /** Reserve memory in the polygon array to hold the specified number of polygons + * \param pCount The number of polygons this mesh will hold */ + inline void ReservePolygonCount(int pCount) { mPolygons.Reserve(pCount); } + + /** Reserve memory in the polygon vertex array to hold the specified number of polygon vertices. + * \param pCount The number of polygon vertices */ + inline void ReservePolygonVertexCount(int pCount) { mPolygonVertices.Reserve(pCount); } + + bool GetTextureUV(FbxLayerElementArrayTemplate** pLockableArray, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse) const; + bool GetMaterialIndices(FbxLayerElementArrayTemplate** pLockableArray) const; + bool GetTextureIndices(FbxLayerElementArrayTemplate** pLockableArray, FbxLayerElement::EType pTextureType) const; + + /** \name Crease utility functions */ + //@{ + /** Get crease weight by edge index. + * \param pEdgeIndex Edge index. + * \return Crease weight value in the range [0.0 - 1.0]. */ + double GetEdgeCreaseInfo(int pEdgeIndex); + + /** Get crease edge array. + * \param pCreaseArray Edge crease data array. + * \return \c true if the pCreaseArray is filled successfully. */ + bool GetEdgeCreaseInfoArray(FbxLayerElementArrayTemplate** pCreaseArray); + + /** Get crease weight by vertex index. + * \param pVertexIndex Vertex index. + * \return Crease weight value in the range [0.0 - 1.0]. */ + double GetVertexCreaseInfo(int pVertexIndex); + + /** Get vertex crease array. + * \param pCreaseArray Edge vertex data array. + * \return \c true if the pCreaseArray is filled successfully. */ + bool GetVertexCreaseInfoArray(FbxLayerElementArrayTemplate** pCreaseArray); + + /** Set crease weight by edge index. + * \param pEdgeIndex Edge index. + * \param pWeight Crease weight value in the range [0.0 - 1.0]. + * \return \c true if successfully set the crease weight. */ + bool SetEdgeCreaseInfo(int pEdgeIndex, double pWeight); + + /** Set crease weight data array. + * \param pWeightArray Edge crease data. + * \return \c true if successfully set the crease weight. */ + bool SetEdgeCreaseInfoArray(FbxArray* pWeightArray); + + /** Set crease weight by vertex index. + * \param pVertexIndex Vertex index. + * \param pWeight Crease weight value in the range [0.0 - 1.0]. + * \return \c true if successfully set the crease weight. */ + bool SetVertexCreaseInfo(int pVertexIndex, double pWeight); + + /** Set crease weight data array. + * \param pWeightArray Vertex crease data. + * \return \c true if successfully set the crease weight. */ + bool SetVertexCreaseInfoArray(FbxArray* pWeightArray); + //@} + + /** \name Smooth mesh preview utility functions */ + //@{ + /** \enum ESmoothness Display Smoothness. + * It represents smooth mesh preview mode. This concept is not used in the FBX SDK but simply + * carried over so applications can access it and perform the appropriate tasks. */ + enum ESmoothness + { + eHull, //!< Default value, not active "smooth mesh preview". + eRough, //!< Not active "smooth mesh preview". + eMedium, //!< Both display cage and smooth mesh. + eFine //!< Display smooth mesh. + }; + + /** \enum EBoundaryRule the boundary rule. */ + enum EBoundaryRule + { + eLegacy, //!< Default value. + eCreaseAll, //!< Used for hard corner. + eCreaseEdge //!< Used for round corner. + }; + + /** Get display smoothness from mesh. + * \return Mesh smoothness. + * \remark It represents smooth mesh preview mode. */ + FbxMesh::ESmoothness GetMeshSmoothness() const; + + /** Set the mesh display smoothness mode. + * \param pSmoothness New smoothness factor. + * \remark It represents smooth mesh preview mode. */ + void SetMeshSmoothness(FbxMesh::ESmoothness pSmoothness); + + /** Get preview subdivision levels from mesh. + * \return Mesh preview subdivision levels. */ + int GetMeshPreviewDivisionLevels() const; + + /** Set mesh preview subdivision levels. + * \param pPreviewDivisionLevels Number of subdivisions levels. */ + void SetMeshPreviewDivisionLevels(int pPreviewDivisionLevels); + + /** Get render subdivision levels from mesh. + * \return Mesh render subdivision levels + * \remark Sometimes, render division level can be the same as preview level. */ + int GetMeshRenderDivisionLevels() const; + + /** Set mesh render subdivision levels. + * \param pRenderDivisionLevels Number of subdivision levels. */ + void SetMeshRenderDivisionLevels(int pRenderDivisionLevels); + + /** Query whether to display subdivisions isolines on mesh. + * \return The current state of the internal flag. */ + bool GetDisplaySubdivisions() const; + + /** Set the DisplySubdivisions state. + * \param pDisplySubdivisions New value for this flag. */ + void SetDisplaySubdivisions(bool pDisplySubdivisions); + + /** Get BoundaryRule from mesh. + * \return Current value of the internal state. */ + EBoundaryRule GetBoundaryRule() const; + + /** Set BoundaryRule for this mesh. + * \param pBoundaryRule New value for the internal state of this mesh. + * \remark BoundaryRule will affect the corners of smooth mesh. */ + void SetBoundaryRule(EBoundaryRule pBoundaryRule); + + /** Query whether to preserve borders when preview smooth mesh is enabled. + * \return The current state of the flag. */ + bool GetPreserveBorders() const; + + /** Set the state of the PreserveBorders flag. + * \param pPreserveBorders New value for this flag. + * \remark This flag value will affect smooth mesh preview results. */ + void SetPreserveBorders(bool pPreserveBorders); + + /** Query whether to preserve hard edges when preview smooth mesh. + * \return The current state of the flag. */ + bool GetPreserveHardEdges() const; + + /** Set the state of the PreserveHardEdges flag. + * \param pPreserveHardEdges New value for this flag. + * \remark This flag value will affect smooth mesh preview results. */ + void SetPreserveHardEdges(bool pPreserveHardEdges); + + /** Query whether to PropagateEdgeHardness when preview smooth mesh. + * \return The current state of the flag. */ + bool GetPropagateEdgeHardness() const; + + /** Set state of the PropagateEdgeHardness flag. + * \param pPropagateEdgeHardness New value for this flag. + * \remark This flag will affect smooth mesh preview results. */ + void SetPropagateEdgeHardness(bool pPropagateEdgeHardness); + //@} + + /** \name Geometry hole management utility functions */ + //@{ + /** Get hole flag by face index (an index to a polygon). + * \param pFaceIndex Index of the queried polygon. + * \return The hole flag for the given face. */ + bool GetPolyHoleInfo(int pFaceIndex); + + /** Get hole flags Array. + * \param pHoleArray Hole flags array. + * \return \c true if the pHoleArray is filled successfully. */ + bool GetPolyHoleInfoArray(FbxLayerElementArrayTemplate** pHoleArray); + + /** Sets the flag indicating whether the face represents a hole or not. + * \param pFaceIndex Index of the processed polygon. + * \param pIsHole If \c true, this face represent a hole. + * \return \c true if successfully set the hole info. */ + bool SetPolyHoleInfo(int pFaceIndex, bool pIsHole); + + /** Set hole flags array. + * \param pHoleArray Hole flag array. + * \return \c true if successfully set the hole flags. */ + bool SetPolyHoleInfoArray(FbxArray* pHoleArray); + //@} + + /** \name Tangents data management utility functions */ + //@{ + /** Generate tangents data for UVSet with specific name. + * Note that the UV winding order is stored in the W component of the tangent. + * W = 1.0 (right-handed) + * W = -1.0 (left-handed) + * In the case of a left-handed tangent, this function automatically flips the + * resulting binormal to correct for mirrored geometry. + * \param pUVSetName The UVSet name to generate tangents data with. The UVSet on the first layer is the the default UVSet to generate. + * \param pOverwrite If true, re-generate tangents data regardless of availability, otherwise left untouched if exist. + * \param pIgnoreTangentFlip If true, don't test for the tangent flip when deciding which smoothing group to assign. + * \return \c true if successfully generated tangents data, or if already available and pOverwrite is false. */ + bool GenerateTangentsData(const char* pUVSetName=NULL, bool pOverwrite=false, bool pIgnoreTangentFlip = false); + + /** Generate tangents data for UVSet in specific layer. + * Note that the UV winding order is stored in the W component of the tangent. + * W = 1.0 (right-handed) + * W = -1.0 (left-handed) + * In the case of a left-handed tangent, this function automatically flips the + * resulting binormal to correct for mirrored geometry. + * \param pUVSetLayerIndex The layer to generate tangents data with. + * \param pOverwrite If true, re-generate tangents data regardless of availability, otherwise left untouched if exist. + * \param pIgnoreTangentFlip If true, don't test for the tangent flip when deciding which smoothing group to assign. + * \return \c true if successfully generated tangents data, or if already available and pOverwrite is false. */ + bool GenerateTangentsData(int pUVSetLayerIndex, bool pOverwrite=false, bool pIgnoreTangentFlip = false); + + + /** Generate tangents data for all UVSets in all layers. + * Note that the UV winding order is stored in the W component of the tangent: + * W = 1.0 (right-handed) + * W = -1.0 (left-handed) + * In the case of a left-handed tangent, this function automatically flips the + * resulting binormal to correct for mirrored geometry. + * \param pOverwrite If true, re-generate tangents data regardless of availability, otherwise left untouched if exist. + * \param pIgnoreTangentFlip If true, don't test for the tangent flip when deciding which smoothing group to assign. + * \return \c true if successfully generated tangents data, or if already available and pOverwrite is false. */ + bool GenerateTangentsDataForAllUVSets(bool pOverwrite=false, bool pIgnoreTangentFlip=false); + //@} + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual void Compact(); + + //Please use GetPolygonVertexIndex and GetPolygonVertices to access these arrays. + //DO NOT MODIFY them directly, otherwise unexpected behavior will occur. + //These members are public only for application data copy performance reasons. + struct PolygonDef{ int mIndex; int mSize; int mGroup; }; + + FbxArray mPolygons; + FbxArray mPolygonVertices; + FbxArray mEdgeArray; + + //These are only used in context of triangulation to backup original polygon layout necessary for handling mesh cache after triangulation + FbxArray* mOriginalPolygons; + FbxArray* mOriginalPolygonVertices; + int mOriginalControlPointsCount; + + //Internal structure used to keep the mapping information between edges and polygons. + struct ComponentMap + { + FbxArray mData; // The array to store data. + FbxArray mOffsets; // The array to store the offsets of the data in mData. + + int GetDataCount(int pIndex) { return mOffsets[pIndex + 1] - mOffsets[pIndex]; } + int GetData(int pIndex, int pSubIndex) { return mData[ mOffsets[pIndex] + pSubIndex ]; } + int GetComponentCount() { return mOffsets.GetCount() - 1; } + }; + void ComputeComponentMaps(ComponentMap& pEdgeToPolyMap, ComponentMap& pPolyToEdgeMap); + + // Internal structure used to keep the mapping information between the control points and the + // vertices referencing them + class FBXSDK_DLL ControlPointToVerticesMap + { + public: + ControlPointToVerticesMap(); + ~ControlPointToVerticesMap(); + bool Valid(); + + void Fill(FbxMesh* pMesh); + + int GetCount(); + bool Init(int pNbEntries); + void Clear(); + + FbxArray* GetVerticesArray(int pControlPoint); + FbxArray* operator[](int pControlPoint); + + private: + FbxArray< FbxArray* > mMap; + }; + void ComputeControlPointToVerticesMap(ControlPointToVerticesMap& pMap); + + // this function will compare the vertex normals with the corresponding ones in pMesh and + // make them similar (i.e: if pMesh(NVi) == pMesh(NVj) then make this(NVi) == this(NVj)) + bool ConformNormalsTo(const FbxMesh* pMesh); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + virtual void ContentClear(); + + void InitTextureIndices(FbxLayerElementTexture* pLayerElementTexture, FbxLayerElement::EMappingMode pMappingMode); + void RemoveTextureIndex(FbxLayerElementTexture* pLayerElementTextures, int pPolygonIndex, int pOffset); + void RemoveUVIndex(FbxLayerElementUV* pLayerElementUV, int pPolygonIndex, int pOffset); + + bool GetBadPolyIndices(FbxArray& pArrayBadPolyIndices, bool pCheckOne) const; + + struct SplitEdgeData { int mOriginalEdge; bool mIsNew; }; + + ESmoothness mSmoothness; + int mPreviewDivisionLevels; + int mRenderDivisionLevels; + + bool mDisplaySubdivisions; + EBoundaryRule mBoundaryRule; + bool mPreserveBorders; + bool mPreserveHardEdges; + bool mPropagateEdgeHardness; + + struct PolygonIndexDef { int mPolygonIndex; int mSubPolygonIndex; }; + + struct V2PVMap + { + PolygonIndexDef* mV2PV; + int* mV2PVOffset; + int* mV2PVCount; + FbxArray* > mPVEdge; + bool mValid; + + //Used for fast search in GetMeshEdgeIndexForPolygon this array does not follow the same allocation as the above ones because + //it is not used in the normal BeginAddMeshEdgeIndex(). It is filled only by the call to BeginGetMeshEdgeIndexForPolygon(). + FbxArray mV2Edge; + } mV2PVMap; + + struct EdgeLookupDef { FbxArray mPVFlags; bool mValid; } mPVEndFlags; + + //Finds the polygon index for the given edge + int FindPolygonIndex(int pEdgeIndex); + static int PolygonIndexCompare(const void* p1, const void* p2); + void PolySetTexture(FbxLayer* pLayer, int pTextureIndex, FbxLayerElement::EType pTextureType); + template bool GetPolygonVertexLayerElementIndex(const FbxLayerElementTemplate* pLayerElement, int pPolyIndex, int pVertexIndex, int& pIndex) const; + template bool GetPolygonVertexLayerElementValue(const FbxLayerElementTemplate* pLayerElement, int pPolyIndex, int pVertexIndex, T& pValue, bool pAllowUnmapped) const; + + friend class FbxGeometryConverter; + +private: + bool GenerateTangentsData(FbxLayerElementUV* pUVSet, int pLayerIndex, bool pOverwrite=false, bool pIgnoreTangentFlip = false); + void FillMeshEdgeTable(FbxArray& pTable, int* pValue, void (*FillFct)(FbxArray& pTable, int pIndex, int* pValue)); + void ComputeNormalsPerCtrlPoint(FbxArray& lNormalInfo, bool pCW=false); + void ComputeNormalsPerPolygonVertex(FbxArray& lNormalInfo, bool pCW=false); + void GenerateNormalsByCtrlPoint(bool pCW); + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_MESH_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxnode.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxnode.h new file mode 100644 index 00000000..ec85656c --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxnode.h @@ -0,0 +1,2392 @@ +/**************************************************************************************** + + 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 fbxnode.h +#ifndef _FBXSDK_SCENE_GEOMETRY_NODE_H_ +#define _FBXSDK_SCENE_GEOMETRY_NODE_H_ + +#include + +#include +#include + +#include + +class FbxStatus; +class FbxNodeAttribute; +class FbxCachedEffect; +class FbxLODGroup; +class FbxNull; +class FbxMarker; +class FbxSkeleton; +class FbxGeometry; +class FbxMesh; +class FbxNurbs; +class FbxNurbsCurve; +class FbxLine; +class FbxNurbsSurface; +class FbxTrimNurbsSurface; +class FbxPatch; +class FbxCamera; +class FbxCameraStereo; +class FbxCameraSwitcher; +class FbxLight; +class FbxOpticalReference; +class FbxSubDiv; +class FbxCharacter; +class FbxSurfaceMaterial; +class FbxAnimStack; +class FbxAnimCurveFilterMatrixConverter; + +/** Represents an element in the scene graph. A scene graph is a tree of FbxNode + * objects. The tree management services are self contained in this class. + * + * \note The FBX SDK does not test the validity of the constructed scene graph. It + * is the responsibility of the caller to make sure that it does not generate cyclic + * graphs in a node hierarchy. + * + * Besides the tree management, this class defines all the properties required to describe + * the position of the object in the scene. This information include the basic Translation, + * Rotation and Scaling properties and the more advanced options for pivots, limits, and IK joints + * attributes such the stiffness and dampening. + * + * When it is first created, the FbxNode object is "empty" (i.e: it is an object without any + * graphical representation that only contains the position information). In this state, it can + * be used to represent parents in the node tree structure but not much more. The normal use of + * this type of objects is to add them an attribute that will specialize the node (see the + * "Node Attribute Management" section). + * + * The node attribute is an object in itself and is connected to the the FbxNode. This also + * means that the same node attribute can be shared among multiple nodes. FbxCamera, FbxLight, + * FbxMesh, etc... are all node attributes and they all derive from the base class FbxNodeAttribute. + * + */ +class FBXSDK_DLL FbxNode : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxNode, FbxObject); + +public: + /** + * \name Node Tree Management + */ + //@{ + /** Get the parent node. + * \return Pointer to parent node or \c NULL if the current node has no parent. + */ + FbxNode* GetParent(); + const FbxNode* GetParent() const; + + /** Add a child node and its underlying node tree. + * \param pNode Node we want to make child of \c this. + * \return \c true on success, \c false if \e pNode is \c NULL or the system is + * unable to make the connection. + * \remarks If \e pNode already has a parent, first it is removed from current parent and then + * added to this one. + */ + bool AddChild(FbxNode* pNode); + + /** Remove the child node. + * \param pNode The child node to be removed. + * \return The removed child node. + */ + FbxNode* RemoveChild(FbxNode* pNode); + + /** Get the number of children nodes. + * \param pRecursive If \c true the method will also count all the descendant children. + * \return Total number of children for this node. + */ + int GetChildCount(bool pRecursive = false) const; + + /** Get child by index. + * \param pIndex The child index. + * \return Child node or \c NULL if \e pIndex is out of range (i.e: < 0 or > GetChildCount()). + */ + FbxNode* GetChild(int pIndex); + + /** Get child by index. + * \param pIndex The child index. + * \return Child node or \c NULL if \e pIndex is out of range (i.e: < 0 or > GetChildCount()). + */ + const FbxNode* GetChild(int pIndex) const; + + /** Finds a child node by name. + * \param pName Name of the searched child node. + * \param pRecursive Flag to request recursive calls. + * \param pInitial If set to \c true, the search compares the initial name of + * the node (see the FbxObject class) + * \return Found child node or \c NULL if no child node with this name exists. + */ + FbxNode* FindChild(const char* pName, bool pRecursive=true, bool pInitial=false); + //@} + + /** + * \name Node Target Management + * The FbxNode class allows the client to set a "follow" target node. This target + * forces the node to re-align itself so it points to the target. By default, the node + * uses its X axis as the aiming constraint. A rotation offset can be added to change + * this behavior. While the default relative orientation to the target (the X axis) is + * sufficient for the FBX cameras (with a (0,0,0) rotation vector, they are aiming + * along the X axis), this rotation offset becomes particularly useful with the lights + * objects because their default orientation (when they have a 0,0,0 rotation vector) is to + * point along the -Y axis and they need to be adjusted with a 90-degree offset on the Z axis. + * + * The FbxNode class also permits the use of node to define an Up-vector. By default, + * the node's up vector points towards the Up node. If the Up node is not specified, + * then the node's Up vector points towards the Y axis. Here too, a rotation offset can be + * added to change the default behavior. + * + * Of course, these offsets can be applied to anything, not only the cameras and lights. + * + * \note Objects in the FBX SDK are always created in the right handed, Y-Up system and need + * to be adjusted for any other axis system by explicitly convert them (the class + * FbxAxisSystem can help in that process). + * + */ + //@{ + /** The target must be part of the same scene and it cannot be itself. + * \param pNode The target. + */ + void SetTarget(FbxNode* pNode); + + /** Get the target for this node. + * \returns \c NULL if target isn't set. + */ + FbxNode* GetTarget() const; + + /** Set rotation offset from default relative orientation to target. + * \param pVector The rotation offset. + */ + void SetPostTargetRotation(FbxVector4 pVector); + + /** Get rotation offset from default relative orientation to target. + * \return The rotation offset. + */ + FbxVector4 GetPostTargetRotation() const; + + /** The target up node must be part of the same scene and it cannot be itself. + * \param pNode The target. + */ + void SetTargetUp(FbxNode* pNode); + + /** Get the target up node. + * \return \c NULL if the target up model isn't set. + */ + FbxNode* GetTargetUp() const; + + /** Set up vector offset from default relative target up vector. + * \param pVector The rotation offset. + */ + void SetTargetUpVector(FbxVector4 pVector); + + /** Get up vector offset from default relative target up vector. + * \return The up vector offset. + */ + FbxVector4 GetTargetUpVector() const; + //@} + + /** + * \name Node Display Parameters + */ + //@{ + /** Set the node Visibility value from the boolean parameter. + * \param pIsVisible Node is visible in the scene if set to \c true. + * \remarks This method checks for the validity of the property before attempting to + * set its value. In fact, the exact same result can be achieved by the following code: + * \code + * if( Visibility.IsValid() ) + * { + * Visibility.Set(FbxDouble(pIsVisible)); + * } + * \endcode + * + * \see Visibility property. + */ + void SetVisibility(bool pIsVisible); + + /** Get the current value of the Visibility property. + * \return \c false if the Visibility property value is 0.0 and \c true for any other value. + * \remarks This method expects the Visibility property to exist and to be valid. If this + * condition is not met, the returned value will be \c false. + */ + bool GetVisibility() const; + + /** \enum EShadingMode Shading modes. + * These shading modes are not directly used by the FBX SDK but it is guaranteed that the information is + * carried to and from the FBX files. The typical context of using these modes is to affect the rendering of + * geometric objects (this is, of course, performed at the application level) and the possible definition + * for each mode is: + */ + enum EShadingMode + { + eHardShading, //!< Solid geometries rendered with smooth surfaces - using the system light. + eWireFrame, //!< Geometries displayed in wire frame. + eFlatShading, //!< Solid geometries rendered faceted - using the system light. + eLightShading, //!< Solid geometries rendered with the scene lights. + eTextureShading, //!< Solid geometries rendered with smooth textured surfaces - using system light. + eFullShading //!< Solid geometries rendered with smooth textured surfaces and scene lights. + }; + + /** Set the shading mode. + * \param pShadingMode The shading mode. + */ + void SetShadingMode(EShadingMode pShadingMode); + + /** Get the shading mode. + * \return The currently set shading mode. + */ + EShadingMode GetShadingMode() const; + //@} + + /** + * \name Node Attribute Management + */ + //@{ + /** Set the node attribute. + * \param pNodeAttribute Node attribute object + * \return Pointer to previous node attribute object. + * \c NULL if the node didn't have a node attribute or if + * the new node attribute is equal to the one currently set. + * \remarks A node attribute can be shared between nodes. + * \remarks If this node has more than one attribute (added via the AddAttribute() method), this call + * will destroy all, but the default node attribute. + */ + FbxNodeAttribute* SetNodeAttribute(FbxNodeAttribute* pNodeAttribute); + + /** Get the default node attribute. + * The default node attribute is the attribute that has been set by the call to SetNodeAttribute(). + * \return Pointer to the default node attribute or \c NULL if the node doesn't + * have a node attribute. + */ + FbxNodeAttribute* GetNodeAttribute(); + + /** Get the default node attribute. + * The default node attribute is the attribute that has been set by the call to SetNodeAttribute(...). + * \return Pointer to the default node attribute or \c NULL if the node doesn't + * have a node attribute. + */ + const FbxNodeAttribute* GetNodeAttribute() const; + + //! Get the number of node attribute(s) connected to this node. + int GetNodeAttributeCount() const; + + /** Get the index, in the list of connected node attributes, of the node attribute that is set + * to be the default one. + * \return Index of the default node attribute or \c -1 if there is no default node attribute set. + */ + int GetDefaultNodeAttributeIndex() const; + + /** Set index of the default node attribute. + * \param pIndex Identifies which of the connected node attributes is becoming the default one. + * This value represent the connection number of the node. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the operation succeeds or \c false if the passed index is invalid. + */ + bool SetDefaultNodeAttributeIndex(int pIndex, FbxStatus* pStatus = NULL); + + /** Get the connected node attribute by specifying its index in the connection list. + * \param pIndex The connection number of the node. + * \return Pointer to corresponding node attribute or \c NULL if the index is out of range. + */ + FbxNodeAttribute* GetNodeAttributeByIndex(int pIndex); + + /** Get the connected node attribute by specifying its index in the connection list. + * \param pIndex The connection number of the node. + * \return Pointer to corresponding node attribute or \c NULL if the index is out of range. + */ + const FbxNodeAttribute* GetNodeAttributeByIndex(int pIndex) const; + + /** Get the connection index of the specified node attribute. + * This method will do a linear search of all the connected node attributes (from the last to + * the first connection) until it finds \e pNodeAttribue. + * \param pNodeAttribute The pointer to the node attribute. + * \param pStatus The FbxStatus object to hold error codes. + * \return The connection number of the node attribute or \c -1 if pNodeAttribute is \c NULL + * or not connected to this node. + */ + int GetNodeAttributeIndex(FbxNodeAttribute* pNodeAttribute, FbxStatus* pStatus = NULL) const; + + /** Add the new node attribute to this node. + * If no other node attribute is already set as the default one, this new node attribute is + * automatically set as the default one. + * \param pNodeAttribute The pointer to a node attribute. + * \param pStatus The FbxStatus object to hold error codes. + * \return \c true if the operation succeeded or \c false if the operation failed. + * \remarks The failing conditions for this methods are: + * - The received object pointer is \c NULL. + * - The received object is already connected to this node. + * - An internal error prevented the connection to successfully complete. + */ + bool AddNodeAttribute(FbxNodeAttribute* pNodeAttribute, FbxStatus* pStatus = NULL); + + /** Remove the node attribute from the connection list of this node. + * \param pNodeAttribute The pointer to a node attribute. + * \return Pointer to the removed node attribute or \c NULL if the operation failed. + */ + FbxNodeAttribute* RemoveNodeAttribute(FbxNodeAttribute* pNodeAttribute); + + /** Remove the node attribute, specified by the connection index, from the connection + * list of this node. + * \param pIndex Index of the node attribute. + * \return Pointer to the removed node attribute or \c NULL if the operation failed. + * \remarks If the specified node attribute is also the default one, its predecessor in + * the connection list will become the new default node attribute. And if there + * are no more predecessors, the node DefaultNodeAttributeIndex is reset to -1. + */ + FbxNodeAttribute* RemoveNodeAttributeByIndex(int pIndex); + + /** Get the default node attribute casted to a FbxCachedEffect pointer. + * \return Pointer to the cached effect object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxCachedEffect* GetCachedEffect(); + + /** Get the default node attribute casted to a FbxLODGroup pointer. + * \return Pointer to the lod group object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxLODGroup* GetLodGroup(); + + /** Get the default node attribute casted to a FbxNull pointer. + * \return Pointer to the null object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxNull* GetNull(); + + /** Get the node attribute casted to a FbxMarker pointer. + * \return Pointer to the marker object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxMarker* GetMarker(); + + /** Get the node attribute casted to a FbxSkeleton pointer. + * \return Pointer to the skeleton object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxSkeleton* GetSkeleton(); + + /** Get the node attribute casted to a FbxGeometry pointer. + * \return Pointer to the geometry object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + * \remarks For this method to succeed, the node attribute's GetAttributeType() must returns one of the + * following: + * - FbxNodeAttribute::eMesh + * - FbxNodeAttribute::eNurbs + * - FbxNodeAttribute::eNurbsSurface + * - FbxNodeAttribute::ePatch + * - FbxNodeAttribute::eNurbsCurve + * - FbxNodeAttribute::eBoundary + * - FbxNodeAttribute::eTrimNurbsSurface + * - FbxNodeAttribute::eSubDiv + * - FbxNodeAttribute::eLine + */ + FbxGeometry* GetGeometry(); + + /** Get the node attribute casted to a FbxMesh pointer. + * \return Pointer to the mesh object. + * \remarks This method will try to process the default node attribute first. If it cannot + * find it, it will scan the list of connected node attributes and get the first + * object that is a FbxNodeAttribute::eMesh. + * \remarks If the above search failed to get a valid pointer or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxMesh* GetMesh(); + + /** Get the node attribute casted to a FbxNurbs pointer. + * \return Pointer to the nurb object. + * \remarks This method will try to process the default node attribute first. If it cannot + * find it, it will scan the list of connected node attributes and get the first + * object that is a FbxNodeAttribute::eNurbs. + * \remarks If the above search failed to get a valid pointer or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxNurbs* GetNurbs(); + + /** Get the node attribute casted to a FbxNurbsSurface pointer. + * \return Pointer to the nurbs surface object. + * \remarks This method will try to process the default node attribute first. If it cannot + * find it, it will scan the list of connected node attributes and get the first + * object that is a FbxNodeAttribute::eNurbsSurface. + * \remarks If the above search failed to get a valid pointer or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxNurbsSurface* GetNurbsSurface(); + + /** Get the node attribute casted to a FbxNurbsCurve pointer. + * \return Pointer to the nurbs curve object. + * \remarks This method will try to process the default node attribute first. If it cannot + * find it, it will scan the list of connected node attributes and get the first + * object that is a FbxNodeAttribute::eNurbsCurve. + * \remarks If the above search failed to get a valid pointer or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxNurbsCurve* GetNurbsCurve(); + + /** Get the node attribute casted to a FbxLine pointer. + * \return Pointer to the line object. + * \remarks This method will try to process the default node attribute first. If it cannot + * find it, it will scan the list of connected node attributes and get the first + * object that is a FbxNodeAttribute::eLine. + * \remarks If the above search failed to get a valid pointer or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxLine* GetLine(); + + /** Get the node attribute casted to a FbxTrimNurbsSurface pointer. + * \return Pointer to the trim nurbs surface object. + * \remarks This method will try to process the default node attribute first. If it cannot + * find it, it will scan the list of connected node attributes and get the first + * object that is a FbxNodeAttribute::eTrimNurbsSurface. + * \remarks If the above search failed to get a valid pointer or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxTrimNurbsSurface* GetTrimNurbsSurface(); + + /** Get the node attribute casted to a FbxSubDiv pointer. + * \return Pointer to the subdivision surface object. + * \remarks This method will try to process the default node attribute first. If it cannot + * find it, it will scan the list of connected node attributes and get the first + * object that is a FbxNodeAttribute::eSubDiv. + * \remarks If the above search failed to get a valid pointer or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxSubDiv* GetSubdiv(); + + /** Get the node attribute casted to a FbxPatch pointer. + * \return Pointer to the patch object. + * \remarks This method will try to process the default node attribute first. If it cannot + * find it, it will scan the list of connected node attributes and get the first + * object that is a FbxNodeAttribute::ePatch. + * \remarks If the above search failed to get a valid pointer or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxPatch* GetPatch(); + + /** Get the node attribute casted to a FbxCamera pointer. + * \return Pointer to the camera object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxCamera* GetCamera(); + const FbxCamera* GetCamera() const; + + /** Get the node attribute casted to a FbxCameraStereo pointer. + * \return Pointer to the stereo camera object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxCameraStereo* GetCameraStereo(); + + /** Get the node attribute casted to a FbxCameraSwitcher pointer. + * \return Pointer to the camera switcher object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxCameraSwitcher* GetCameraSwitcher(); + + /** Get the node attribute casted to a FbxLight pointer. + * \return Pointer to the light object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxLight* GetLight(); + const FbxLight* GetLight() const; + + /** Get the node attribute casted to a FbxOpticalReference pointer. + * \return Pointer to the optical reference object. + * \remarks If the type cast failed because there is not default node attribute set or it cannot + * be successfully casted, this method will return \c NULL. + */ + FbxOpticalReference* GetOpticalReference(); + //@} + + /** + * \name Transformation propagation + * This set of functions provides direct access to the transformation propagations settings + * of the FbxNode. These settings determine how transformations must be applied when + * evaluating a node's transformation matrix. The possible values are: + * - eInheritRrSs : Scaling of parent is applied in the child world after the local child rotation. + * - eInheritRSrs : Scaling of parent is applied in the parent world. + * - eInheritRrs : Scaling of parent does not affect the scaling of children. + */ + //@{ + /** Sets how child transforms are inherited from parent transforms. + * \param pInheritType One of the following values eInheritRrSs, eInheritRSrs or eInheritRrs + */ + void SetTransformationInheritType(FbxTransform::EInheritType pInheritType); + + //! Get transformation inherit type. + void GetTransformationInheritType(FbxTransform::EInheritType& pInheritType) const; + //@} + + /** + * \name Pivot Management + * Pivots are used to specify translation, rotation and scaling centers in coordinates + * relative to a node's origin. + * A node has two pivot contexts defined by the EPivotSet enumeration. The node's animation + * data can be converted from one pivot context to the other. Each context can be set to be + * either active or passive (reference). By default the two pivot contexts are passive. They + * need to be active to be processed during the evaluation of the node final transformation + * matrix. In its passive state, a pivot context can still be accessed to retrieve its content + * for any other required purpose. Each pivot context stores values (as FbxVector4) for: + * \code + * - Rotation offset (Roff) + * - Rotation pivot (Rp) + * - Pre-rotation (Rpre) + * - Post-rotation (Rpost) + * - Scaling offset (Soff) + * - Scaling pivot (Sp) + * - Geometric translation (Gt) + * - Geometric rotation (Gr) + * - Geometric scaling (Gs) + * + * These values combine in the matrix form to compute the World transform of the node + * using the formula: + * + * World = ParentWorld * T * Roff * Rp * Rpre * R * Rpost * Rp-1 * Soff * Sp * S * Sp-1 + * \endcode + * + * The geometric transformation (Gt * Gr * Gs) is applied only to the node attribute and after + * the node transformations. This transformation is not inherited across the node hierarchy. + * + * \note Please refer to the FBX SDK programmers guide for more details. + * + * The application of the pivots is performed by calling the method ConvertPivotAnimation(). Typically, + * you set-up the eDestinationPivot context to match what your system can directly support and leave at (0,0,0) the + * attributes that are not supported by your system. When the values of a specific attribute in the + * two contexts (source and destination) are identical, the system considers that no adjustment is + * required because the attribute is directly supported in the destination world. + * + * Below is an example of code that shows how the pivot information could be setup before calling ConvertPivotAnimation(). + * \code + * FbxVector4 lZero(0,0,0); + * FbxVector4 lOne(1,1,1); + * pNode->SetPivotState(FbxNode::eSourcePivot, FbxNode::ePivotActive); + * pNode->SetPivotState(FbxNode::eDestinationPivot, FbxNode::ePivotActive); + * + * EFbxRotationOrder lRotationOrder; + * pNode->GetRotationOrder(FbxNode::eSourcePivot , lRotationOrder); + * pNode->SetRotationOrder(FbxNode::eDestinationPivot , lRotationOrder); + * + * //For cameras and lights (without targets) let's compensate the postrotation. + * if( pNode->GetCamera() || pNode->GetLight() ) + * { + * if( !pNode->GetTarget() ) + * { + * FbxVector4 lRV(90, 0, 0); + * if( pNode->GetCamera() ) + * lRV.Set(0, 90, 0); + * + * FbxVector4 prV = pNode->GetPostRotation(FbxNode::eSourcePivot); + * FbxAMatrix lSourceR; + * FbxAMatrix lR(lZero, lRV, lOne); + * FbxVector4 res = prV; + * + * // Rotation order don't affect post rotation, so just use the default XYZ order + * FbxRotationOrder rOrder; + * rOrder.V2M(lSourceR, res); + * + * lR = lSourceR * lR; + * rOrder.M2V(res, lR); + * prV = res; + * pNode->SetPostRotation(FbxNode::eSourcePivot, prV); + * pNode->SetRotationActive(true); + * } + * + * // Point light do not need to be adjusted (since they radiate in all the directions). + * if( pNode->GetLight() && pNode->GetLight()->LightType.Get() == FbxLight::ePoint ) + * { + * pNode->SetPostRotation(FbxNode::eSourcePivot, FbxVector4(0,0,0,0)); + * } + * } + * // apply Pre rotations only on bones / end of chains + * if( pNode->GetNodeAttribute() && pNode->GetNodeAttribute()->GetAttributeType() == FbxNodeAttribute::eSkeleton + * || (pNode->GetMarker() && pNode->GetMarker()->GetType() == FbxMarker::eEffectorFK) + * || (pNode->GetMarker() && pNode->GetMarker()->GetType() == FbxMarker::eEffectorIK) ) + * { + * if( pNode->GetRotationActive() ) + * { + * pNode->SetPreRotation(FbxNode::eDestinationPivot, pNode->GetPreRotation(FbxNode::eSourcePivot)); + * } + * + * // No pivots on bones + * pNode->SetRotationPivot(FbxNode::eDestinationPivot, lZero); + * pNode->SetScalingPivot(FbxNode::eDestinationPivot, lZero); + * pNode->SetRotationOffset(FbxNode::eDestinationPivot,lZero); + * pNode->SetScalingOffset(FbxNode::eDestinationPivot, lZero); + * } + * else + * { + * // any other type: no pre-rotation support but... + * pNode->SetPreRotation(FbxNode::eDestinationPivot, lZero); + * + * // support for rotation and scaling pivots. + * pNode->SetRotationPivot(FbxNode::eDestinationPivot, pNode->GetRotationPivot(FbxNode::eSourcePivot)); + * pNode->SetScalingPivot(FbxNode::eDestinationPivot, pNode->GetScalingPivot(FbxNode::eSourcePivot)); + * // Rotation and scaling offset are supported + * pNode->SetRotationOffset(FbxNode::eDestinationPivot, pNode->GetRotationOffset(FbxNode::eSourcePivot)); + * pNode->SetScalingOffset(FbxNode::eDestinationPivot, pNode->GetScalingOffset(FbxNode::eSourcePivot)); + * // + * // If we don't "support" scaling pivots, we can simply do: + * // pNode->SetRotationPivot(FbxNode::eDestinationPivot, lZero); + * // pNode->SetScalingPivot(FbxNode::eDestinationPivot, lZero); + * } + * \endcode + * + */ + //@{ + /** \enum EPivotSet Pivot context identifier. + */ + enum EPivotSet + { + eSourcePivot, //!< The source pivot context. + eDestinationPivot //!< The destination pivot context. + }; + + /** \enum EPivotState Pivot context state. + */ + enum EPivotState + { + ePivotActive, //!< The pivot context with this state is affecting the node's transform computation. + ePivotReference //!< The pivot context with this state is not used during the node transform computation but can be accessed for reference purposes. + }; + + /** Change the state of the pivot context. + * \param pPivotSet Specify which pivot context is manipulated. + * \param pPivotState The new state of the pivot context. + */ + void SetPivotState(EPivotSet pPivotSet, EPivotState pPivotState); + + /** Get the pivot context state. + * The returned value tells if this pivot context is used in the + * evaluation of the node transform or not. + * \param pPivotSet Specify which pivot context is queried. + * \param pPivotState The current state of the pivot set. + */ + void GetPivotState(EPivotSet pPivotSet, EPivotState& pPivotState) const; + + /** Set rotation space + * Determine the rotation space (Euler or Spheric) and the rotation order. + * \param pPivotSet Specify which pivot context is manipulated. + * \param pRotationOrder The new value for the pivot rotation order. + */ + void SetRotationOrder(EPivotSet pPivotSet, EFbxRotationOrder pRotationOrder); + + /** Get rotation order + * \param pPivotSet Specify which pivot context is queried. + * \param pRotationOrder The current value of the pivot rotation order. + */ + void GetRotationOrder(EPivotSet pPivotSet, EFbxRotationOrder& pRotationOrder) const; + + /** Set rotation space for limit only. + * \param pPivotSet Specify which pivot context is manipulated. + * \param pUseForLimitOnly When set to \c true, the current rotation space + * (set with SetRotationOrder) define the rotation space for + * the limit only; leaving the rotation animation in + * Euler XYZ space. When set to \c false, the current rotation + * space defines the rotation space for both the limits and the + * rotation animation data. + */ + void SetUseRotationSpaceForLimitOnly(EPivotSet pPivotSet, bool pUseForLimitOnly); + + /** Get rotation space for limit only. + * \param pPivotSet Specify which pivot context is queried. + * \return The current rotation space limit flag value. + */ + bool GetUseRotationSpaceForLimitOnly(EPivotSet pPivotSet) const; + + /** Set the RotationActive state. + * \param pVal The new state of the property. + * \remarks When this flag is set to false, the RotationOrder, the Pre/Post rotation values + * and the rotation limits should be ignored. + */ + void SetRotationActive(bool pVal); + + /** Get the RotationActive state. + * \return The value of the RotationActive flag. + */ + bool GetRotationActive() const; + + /** Specify which Quaternion interpolation mode is used on the pivot context. + * \param pPivotSet Specify which pivot context is manipulated. + * \param pQuatIterp The new value. + * \remarks When the \e pPivotSet is eSourcePivot, this method also updates the value of the + * QuaternionInterpolate property. + */ + void SetQuaternionInterpolation(EPivotSet pPivotSet, EFbxQuatInterpMode pQuatIterp); + + /** Get the Quaternion interpolation mode of the pivot context. + * \param pPivotSet Specify which pivot context is queried. + * \return The current mode set on the pivot context. + */ + EFbxQuatInterpMode GetQuaternionInterpolation(EPivotSet pPivotSet) const; + + /** Set the rotation stiffness. + * The stiffness attribute is used by IK solvers to generate a resistance + * to a joint motion. The higher the stiffness the less it will rotate. + * Stiffness works in a relative sense: it determines the willingness of + * this joint to rotate with respect to the other joint in the IK chain. + * \param pRotationStiffness The rotation stiffness values are limited to + * the range [0, 100]. + */ + void SetRotationStiffness(FbxVector4 pRotationStiffness); + + /** Get the rotation stiffness + * \return The currently set rotation stiffness values. + */ + FbxVector4 GetRotationStiffness() const; + + /** Set the minimum damp range angles. + * This attributes apply resistance to a joint rotation as it approaches the + * lower boundary of its rotation limits. This functionality allows joint + * motion to slow down smoothly until the joint reaches its rotation limits + * instead of stopping abruptly. The MinDampRange specifies when the + * deceleration should start. + * \param pMinDampRange Angle, in degrees, where deceleration should start + */ + void SetMinDampRange(FbxVector4 pMinDampRange); + + /** Get the minimum damp range angles + * \return The currently set minimum damp range angles. + */ + FbxVector4 GetMinDampRange() const; + + /** Set the maximum damp range angles. + * This attributes apply resistance to a joint rotation as it approaches the + * upper boundary of its rotation limits. This functionality allows joint + * motion to slow down smoothly until the joint reaches its rotation limits + * instead of stopping abruptly. The MaxDampRange specifies when the + * deceleration should start. + * \param pMaxDampRange Angle, in degrees, where deceleration should start + */ + void SetMaxDampRange(FbxVector4 pMaxDampRange); + + /** Get the maximum damp range angles + * \return The currently set maximum damp range angles. + */ + FbxVector4 GetMaxDampRange() const; + + /** Set the minimum damp strength. + * This attributes apply resistance to a joint rotation as it approaches the + * lower boundary of its rotation limits. This functionality allows joint + * motion to slow down smoothly until the joint reaches its rotation limits + * instead of stopping abruptly. The MinDampStrength defines the + * rate of deceleration. + * \param pMinDampStrength Values are limited to the range [0, 100]. + */ + void SetMinDampStrength(FbxVector4 pMinDampStrength); + + /** Get the minimum damp strength + * \return The currently set minimum damp strength values. + */ + FbxVector4 GetMinDampStrength() const; + + /** Set the maximum damp strength. + * This attributes apply resistance to a joint rotation as it approaches the + * upper boundary of its rotation limits. This functionality allows joint + * motion to slow down smoothly until the joint reaches its rotation limits + * instead of stopping abruptly. The MaxDampStrength defines the + * rate of deceleration. + * \param pMaxDampStrength Values are limited to the range [0, 100]. + */ + void SetMaxDampStrength(FbxVector4 pMaxDampStrength); + + /** Get the maximum damp strength + * \return The currently set maximum damp strength values. + */ + FbxVector4 GetMaxDampStrength() const; + + /** Set the preferred angle. + * The preferredAngle attribute defines the initial joint configuration used + * by a single chain IK solver to calculate the inverse kinematic solution. + * \param pPreferedAngle Angle in degrees + */ + void SetPreferedAngle(FbxVector4 pPreferedAngle); + + /** Get the preferred angle + * \return The currently set preferred angle. + */ + FbxVector4 GetPreferedAngle() const; + + /** Set a translation offset for the rotation pivot. + * The translation offset is in coordinates relative to the node's origin. + * \param pPivotSet Specify which pivot set to modify. + * \param pVector The X,Y and Z translation values (the 4th component of the FbxVector4 is ignored). + */ + void SetRotationOffset(EPivotSet pPivotSet, FbxVector4 pVector); + + /** Get the translation offset for the rotation pivot. + * The translation offset is in coordinates relative to the node's origin. + * \param pPivotSet Specify which pivot set to to query the value. + * \return The X, Y and Z translation offset values (the 4th component of the FbxVector4 is always 1). + */ + const FbxVector4& GetRotationOffset(EPivotSet pPivotSet) const; + + /** Set rotation pivot. + * The rotation pivot is the center of rotation in coordinates relative to + * the node's origin. + * \param pPivotSet Specify which pivot set to modify. + * \param pVector The new position of the rotation pivot (the 4th component of the FbxVector4 is ignored). + */ + void SetRotationPivot(EPivotSet pPivotSet, FbxVector4 pVector); + + /** Get rotation pivot. + * The rotation pivot is the center of rotation in coordinates relative to + * the node's origin. + * \param pPivotSet Specify which pivot set to query. + * \return The current position of the rotation pivot (the 4th component of the FbxVector4 is always 1). + */ + const FbxVector4& GetRotationPivot(EPivotSet pPivotSet) const; + + /** Set pre-rotation in Euler angles. + * The pre-rotation is the rotation applied to the node before + * rotation animation data. + * \param pPivotSet Specify which pivot set to modify. + * \param pVector The X,Y,Z rotation values to set (the 4th component of the FbxVector4 is ignored). + */ + void SetPreRotation(EPivotSet pPivotSet, FbxVector4 pVector); + + /** Get pre-rotation in Euler angles. + * The pre-rotation is the rotation applied to the node before + * rotation animation data. + * \param pPivotSet Specify which pivot set to query. + * \return The X,Y and Z rotation values (the 4th component of the FbxVector4 is always 1). + */ + const FbxVector4& GetPreRotation(EPivotSet pPivotSet) const; + + /** Set post-rotation in Euler angles. + * The post-rotation is the rotation applied to the node after the + * rotation animation data. + * \param pPivotSet Specify which pivot set to modify. + * \param pVector The X,Y,Z rotation values to set (the 4th component of the FbxVector4 is ignored). + */ + void SetPostRotation(EPivotSet pPivotSet, FbxVector4 pVector); + + /** Get post-rotation in Euler angles. + * The post-rotation is the rotation applied to the node after the + * rotation animation data. + * \param pPivotSet Specify which pivot set to query. + * \return The X,Y and Z rotation values (the 4th component of the FbxVector4 is always 1). + */ + const FbxVector4& GetPostRotation(EPivotSet pPivotSet) const; + + /** Set a translation offset for the scaling pivot. + * The translation offset is in coordinates relative to the node's origin. + * \param pPivotSet Specify which pivot set to modify. + * \param pVector The X,Y and Z translation values (the 4th component of the FbxVector4 is ignored). + */ + void SetScalingOffset(EPivotSet pPivotSet, FbxVector4 pVector); + + /** Get the translation offset for the scaling pivot. + * The translation offset is in coordinates relative to the node's origin. + * \param pPivotSet Specify which pivot set to query the value. + * \return The X, Y and Z translation offset values (the 4th component of the FbxVector4 is always 1). + */ + const FbxVector4& GetScalingOffset(EPivotSet pPivotSet) const; + + /** Set scaling pivot. + * The scaling pivot is the center of scaling in coordinates relative to + * the node's origin. + * \param pPivotSet Specify which pivot set to modify. + * \param pVector The new position of the scaling pivot (the 4th component of the FbxVector4 is ignored). + */ + void SetScalingPivot(EPivotSet pPivotSet, FbxVector4 pVector); + + /** Get scaling pivot. + * The scaling pivot is the center of scaling in coordinates relative to + * the node's origin. + * \param pPivotSet Specify which pivot set to query. + * \return The current position of the rotation pivot (the 4th component of the FbxVector4 is always 1). + */ + const FbxVector4& GetScalingPivot(EPivotSet pPivotSet) const; + + /** Set geometric translation + * The geometric translation is a local translation that is applied + * to a node attribute only. This translation is applied to the node attribute + * after the node transformations. This translation is not inherited across the + * node hierarchy. + * \param pPivotSet Specify which pivot set to modify. + * \param pVector The X, Y, and Z translation values (the 4th component of the FbxVector4 is ignored). + */ + void SetGeometricTranslation(EPivotSet pPivotSet, FbxVector4 pVector); + + /** Get geometric translation + * \param pPivotSet Specify which pivot set to query. + * \return The current geometric translation (the 4th component of the FbxVector4 is always 1). + */ + FbxVector4 GetGeometricTranslation(EPivotSet pPivotSet) const; + + /** Set geometric rotation + * The geometric rotation is a local rotation that is applied + * to a node attribute only. This rotation is applied to the node attribute + * after the node transformations. This rotation is not inherited across the + * node hierarchy. + * \param pPivotSet Specify which pivot set to modify. + * \param pVector The X,Y and Z rotation values (the 4th component of the FbxVector4 is ignored). + */ + void SetGeometricRotation(EPivotSet pPivotSet, FbxVector4 pVector); + + /** Get geometric rotation + * \param pPivotSet Specify which pivot set to query. + * \return The current geometric rotation (the 4th component of the FbxVector4 is always 1). + */ + FbxVector4 GetGeometricRotation(EPivotSet pPivotSet) const; + + /** Set geometric scaling + * The geometric scaling is a local scaling that is applied + * to a node attribute only. This scaling is applied to the node attribute + * after the node transformations. This scaling is not inherited across the + * node hierarchy. + * \param pPivotSet Specify which pivot set to modify. + * \param pVector The X,Y and Z scale values (the 4th component of the FbxVector4 is ignored). + */ + void SetGeometricScaling(EPivotSet pPivotSet, FbxVector4 pVector); + + /** Get geometric scaling + * \param pPivotSet Specify which pivot set to query. + * \return The current geometric scaling (the 4th component of the FbxVector4 is always 1). + */ + FbxVector4 GetGeometricScaling(EPivotSet pPivotSet) const; + + /** Reset a pivot set to the default pivot context. + * If the node has a geometry, reset the geometry's pivot to the identity matrix. + * \param pPivotSet Pivot set to reset. + * \remarks The default pivot context is a context with all the vector attributes + * set to (0,0,0) except the GeometricScaling attribute that is reset to (1,1,1). + */ + void ResetPivotSet( FbxNode::EPivotSet pPivotSet ); + + /** This version is an improved version of the ConvertPivotAnimation(). It fully supports all the + * attributes defined in the pivot sets and can process animation data defined on different animation + * stack. + * \param pAnimStack The animation stack on which the conversion will take place. If equals \c NULL, convert the animation on all the animation stacks. + * \param pConversionTarget If set to EPivotSet::eDestinationPivot, + * convert animation data from the EPivotSet::eSourcePivot pivot context + * to the EPivotSet::eDestinationPivot pivot context. Otherwise, the + * conversion is computed the other way around. + * \param pFrameRate Resampling frame rate in frames per second. + * \param pKeyReduce Apply or skip key reducing filter. + * \remarks Due to the intrinsic properties of the mathematical operations performed, + * sometimes, it is necessary to resample animation curves to maintain the accurate + * conversion. When this resampling is required, the method will use the \e pFrameRate + * value to specify the number of samples. To avoid a huge number of keys in the animation + * curves, a constant key reducer filter (FbxKFCurveFilterConstantKeyReducer) is + * automatically applied to all the affected curves to remove as much consecutive keys + * that have the same value. This filter is private and its settings cannot be changed. + * It is possible that, after the filtering pass, the animations curves do not contain keys + * anymore. This is a normal result and does not affect the overall results. + * \note Although it is possible to call this method several times with a different + * AnimStack name, users must be aware that some pivot computation can irreversibly + * modify the geometric nodes with a cumulative effect of the \e GeometricTranslation, + * \e GeometricRotation and \e GeometricScaling which will produce undesirable results. It is recommended + * to call ConvertPivotAnimationRecursive with \p pAnimStackName = NULL and let the method convert + * the animation on all the Anim stacks at once. + * In the case when there are no geometric nodes in the scene tree, specifying the animation stack + * is safe and somewhat faster. + * If any transform limits are active, they are applied during the conversion and disabled. + */ + void ConvertPivotAnimationRecursive(FbxAnimStack* pAnimStack, EPivotSet pConversionTarget, double pFrameRate, bool pKeyReduce=true); + + /** Reset all the pivot sets to the default pivot context and convert the animation. + * \param pFrameRate Resampling frame rate in frames per second. + * \param pKeyReduce Apply or skip key reducing filter. + * \param pToNodeCenter: Reset pivots to node center if \c true, or retain pivot places if \c false. + * \param pForceResetLimits If \c true, this flag will reset all the Translation, Rotation and Scaling + * limits and clears the enabled flags. + * \remarks The resulting animation will be visually equivalent and all the pivots will be cleared. + * The conversion is performed on all animation stacks. + * \remarks Will recursively convert the animation of all the children nodes. + * \remarks The \e pForceResetLimits flag has a destructive behavior and should be used only in very + * limited cases where the values of the limits are not required after the call to this method. + * \remarks Currently, this function just works under RSrs inherit type if pToNodeCenter is set to \c false. + */ + void ResetPivotSetAndConvertAnimation(double pFrameRate=30.0, bool pKeyReduce=false, bool pToNodeCenter=true, bool pForceResetLimits=false); + + /** Set rotation pivot as node center recursively + * \param pParentGeometricOffset Offset vector to be applied. + */ + void SetRotationPivotAsCenterRecursive(FbxVector4 pParentGeometricOffset=FbxVector4()); + //@} + + /** + * \name Node Evaluation Functions + */ + //@{ + /** Retrieve the proper animation evaluator to use for this node. + * \return If the object has no scene, returns the default evaluator, otherwise the object's scene evaluator. */ + FbxAnimEvaluator* GetAnimationEvaluator() const; + + /** Returns this node's global transformation matrix at the specified time. The node's translation, rotation and scaling limits are taken into consideration. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting global transform of the specified node at the specified time. + * \remarks This function is the equivalent of calling Scene->GetEvaluator()->GetNodeGlobalTransform(). + */ + FbxAMatrix& EvaluateGlobalTransform(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Returns this node's local transformation matrix at the specified time. The node's translation, rotation and scaling limits are taken into consideration. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting local transform of the specified node for the specified time. + * \remarks The local transform matrix is calculated in this way: ParentGlobal.Inverse * Global, all transforms such as pre/post rotation are taken into consideration. + * This will return a different value than LclTranslation, LclRotation and LclScaling at the specified time. To evaluate these properties separately + * without taking pre/post rotation, pivots and offsets into consideration, please use GetNodeLocalTranslation(), GetNodeLocalRotation() and GetNodeLocalScaling(). + * This function is the equivalent of calling Scene->GetEvaluator()->GetNodeLocalTransform(). + */ + FbxAMatrix& EvaluateLocalTransform(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Returns this node's LclTranslation property at the specified time. + * No pivot, offsets, or any other transform is taken into consideration. The translation limit is applied. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting value of LclTranslation property of the specified node at the specified time. + * \remarks This function is the equivalent of calling Scene->GetEvaluator()->GetNodeLocalTranslation(). + */ + FbxVector4& EvaluateLocalTranslation(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Returns this node's LclRotation property at the specified time. + * No pre/post rotation, rotation pivot, rotation offset or any other transform is taken into consideration. The rotation limit is applied. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting value of LclRotation property of the specified node at the specified time. + * \remarks This function is the equivalent of calling Scene->GetEvaluator()->GetNodeLocalRotation(). + */ + FbxVector4& EvaluateLocalRotation(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Returns this node's LclScaling property at the specified time. + * No scaling pivot, scaling offset or any other transform is taken into consideration. The scaling limit is applied. + * \param pTime The time used for evaluate. If FBXSDK_TIME_INFINITE is used, this returns the default value, without animation curves evaluation. + * \param pPivotSet The pivot set to take into account + * \param pApplyTarget Applies the necessary transform to align into the target node + * \param pForceEval Force the evaluator to refresh the evaluation state cache even if its already up-to-date. + * \return The resulting value of LclScaling property of the specified node at the specified time. + * \remarks This function is the equivalent of calling Scene->GetEvaluator()->GetNodeLocalScaling(). + */ + FbxVector4& EvaluateLocalScaling(FbxTime pTime=FBXSDK_TIME_INFINITE, FbxNode::EPivotSet pPivotSet=FbxNode::eSourcePivot, bool pApplyTarget=false, bool pForceEval=false); + + /** Compute the node's bounding box and its center in global coordinates. + * \param pBBoxMin The minimum value of the bounding box upon successful return. + * \param pBBoxMax The maximum value of the bounding box upon successful return. + * \param pBBoxCenter The center value of the bounding box upon successful return. + * \param pTime If different from FBXSDK_TIME_INFINITE, time used to compute the bounding box for deformed geometry. + * \return \c true if successful, otherwise \c false. + * \remark If geometry have been unloaded from memory, their bounding box cannot be calculated and will use any value set previously. */ + bool EvaluateGlobalBoundingBoxMinMaxCenter(FbxVector4& pBBoxMin, FbxVector4& pBBoxMax, FbxVector4& pBBoxCenter, const FbxTime& pTime=FBXSDK_TIME_INFINITE); + + /** Compute closest ray intersection point with mesh attributes of this node (triangle meshes only!). + * \param pOut The closest intersection point from pRayOrigin location in pRayDir direction. Variable is unchanged if return value is \c false. + * \param pRayOrigin The origin location to cast the ray from. + * \param pRayDir The direction the cast ray to test mesh triangles from. + * \param pCulling If \c true, only test triangles that are front facing, otherwise test both sides. + * \param pTime The time to use to evaluate mesh deformations. + * \return \c true if a triangle intersect with the ray, otherwise \c false. + * \remark This function will automatically fail if the node's meshes are not triangulated. */ + bool EvaluateRayIntersectionPoint(FbxVector4& pOut, const FbxVector4& pRayOrigin, const FbxVector4& pRayDir, bool pCulling=false, const FbxTime& pTime=FBXSDK_TIME_INFINITE); + //@} + + /** + * \name Character Link + */ + //@{ + /** Get number of character links. + * \return The number of character links. + */ + int GetCharacterLinkCount() const; + + /** Get character link at given index. + * \param pIndex Index of character link. + * \param pCharacter Pointer to receive linked character if function succeeds. + * \param pCharacterLinkType Pointer to receive character link type if function succeeds, + * cast to \c FbxCharacterLink::Type. + * \param pNodeId Pointer to receive the node ID if function succeeds. This ID should be casted + * to \c FbxCharacter::ENodeId type when the character link type is \c eCharacterLink or + * \c eControlSetLink else to the \c FbxEffector::ENodeId type if the character link type is + * \c eControlSetEffector or \c eControlSetEffectorAux. + * \param pNodeSubId For internal use. + * \return \c false if the index is out of range or any of the pointer arguments is NULL. + */ + bool GetCharacterLink(int pIndex, FbxCharacter** pCharacter, int* pCharacterLinkType, int* pNodeId, int* pNodeSubId); + + /** Looks if the given character link exists on this node. + * \param pCharacter Character searched. + * \param pCharacterLinkType Character link type searched. Its value must be one of + * the \c FbxCharacterLink::Type symbols.. + * \param pNodeId Node ID searched. If \e pCharacterLinkType is \c eCharacterLink or \c eControlSetLink + * the \e pNodeId value is casted to the \c FbxCharacter::ENodeId type. If the \e pCharacterLinkType + * is \c eControlSetEffector or \c eControlSetEffectorAux then the \e pNodeId is casted to the + * \c FbxEffector::ENodeId type. + * \param pNodeSubId For internal use. + * \return Index of found character link if it exists, -1 otherwise. + */ + int FindCharacterLink(FbxCharacter* pCharacter, int pCharacterLinkType, int pNodeId, int pNodeSubId) const; + //@} + + /** Find out start and end time of the animation curves for this node (and its children). + * \param pInterval This node's animation interval. + * \param pAnimStack Animation stack where to retrieve animation curves. + * \param pAnimLayerId Specific animation layer on the animStack to use. + * \return \c true if the node (or its children) is animated, \c false otherwise. + * \remarks If pAnimStack is left NULL, the function will try to get the first AnimStack that is connected + * to the scene. \e pAnimLayerId represent the index of the connection. For example, the call: + * \code + * lNode->GetAnimationInterval(span, myStack, 3); + * \endcode + * will scan all the animation curves of this node, and it's children, that are defined on the third + * animation layer of \c myStack. + */ + bool GetAnimationInterval(FbxTimeSpan& pInterval, FbxAnimStack* pAnimStack=NULL, int pAnimLayerId=0); + + /** + * \name Material Management + */ + //@{ + /** Add a material to this node. + * \param pMaterial The material to add. + * \return non-negative index of added material, or -1 on error. + */ + int AddMaterial(FbxSurfaceMaterial* pMaterial); + + /** Remove a material from this node. + * \param pMaterial The material to remove. + * \return true on success, false otherwise + */ + bool RemoveMaterial(FbxSurfaceMaterial* pMaterial); + + /** + * \return The number of materials applied to this node. + * \remarks If this node has an instanced node attribute, it is possible + * to have a material applied to this node more than once. The material + * count may not reflect the distinct material count. + */ + int GetMaterialCount() const; + + /** Access a material on this node. + * \param pIndex Valid range is [0, GetMaterialCount() - 1] + * \return The pIndex-th material, or NULL if pIndex is invalid. + */ + FbxSurfaceMaterial* GetMaterial(int pIndex) const; + + /** Remove all materials applied to this node. + */ + void RemoveAllMaterials(); + + /** Find an applied material with the given name. + * \param pName The requested name + * \return an index to a material, or -1 if no applied material + * has the requested name. + */ + int GetMaterialIndex(const char* pName) const; + //@} + + /** + * \name Public and fast access Properties + */ + //@{ + /** This property contains the translation information of the node + * + * To access this property do: LclTranslation.Get(). + * To set this property do: LclTranslation.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT LclTranslation; + + /** This property contains the rotation information of the node + * + * To access this property do: LclRotation.Get(). + * To set this property do: LclRotation.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT LclRotation; + + /** This property contains the scaling information of the node + * + * To access this property do: LclScaling.Get(). + * To set this property do: LclScaling.Set(FbxDouble3). + * + * Default value is 1.,1.,1. + */ + FbxPropertyT LclScaling; + + /** This property contains the visibility information of the node. + * The assumed behavior of this property is to affect the visibility of the node, all the + * nodes attributes connected to it as well as all its descendants. This property can be + * animated. + * + * To access this property do: Visibility.Get(). + * To set this property do: Visibility.Set(FbxDouble). + * + * Default value is 1. + * \remarks \li This property holds values ranging from 0.0 to 1.0 where the value 0.0 means + * a totally invisible object, the value 1.0, a full visible object and anything inbetween, a + * percentage degree of visibility.\n + * + * \li Since not all the applications may support a degree of visibility, it is agreed that + * a value of 0.0 means invisible and anything else means visible. + * + * \see Show property. + */ + FbxPropertyT Visibility; + + /** This property contains the visibility inheritance flag that allow applications to modify + * the Visibility property interpretation. By default, this value is set to \c true because it is + * assumed (as explained in the Visibility property description) that the node visibility is inherited + * from its parent. In other words, applications should always process the Visibility property of the + * node and, depending on its value, decide whether or not the node has to be displayed. After + * this first assessment, check the node VisibilityInheritance flag. If its value is set to \c false then + * move to the next object, else use the parent's Visibility value and modify this node display state + * by performing the logical AND operation between this node Visibility property and its parent's. + * + * To access this property do: VisibilityInheritance.Get(). + * To set this property do: VisibilityInheritance.Set(FbxBool). + * + * Default value is \c true. + * \remarks This property is non-animatable and is not used inside the FBX SDK but it is guaranteed + * to exist in FBX files with version 7.2 and above. + * \see Visibility property. + */ + FbxPropertyT VisibilityInheritance; + + + /** This property contains the quaternion interpolate flag of the node + * + * To access this property do: QuaternionInterpolate.Get(). + * To set this property do: QuaternionInterpolate.Set(EFbxQuatInterpMode). + * + * Default value is eQuatInterpOff. + */ + FbxPropertyT QuaternionInterpolate; + + /** This property contains the rotation offset information of the node + * + * To access this property do: RotationOffset.Get(). + * To set this property do: RotationOffset.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT RotationOffset; + + /** This property contains the rotation pivot information of the node + * + * To access this property do: RotationPivot.Get(). + * To set this property do: RotationPivot.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT RotationPivot; + + /** This property contains the scaling offset information of the node + * + * To access this property do: ScalingOffset.Get(). + * To set this property do: ScalingOffset.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT ScalingOffset; + + /** This property contains the scaling pivot information of the node + * + * To access this property do: ScalingPivot.Get(). + * To set this property do: ScalingPivot.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT ScalingPivot; + + /** This property enables or disables the limit on translation. + * When set to \c false the object can translate in any direction without limitations. + * Else the + * \ref TranslationMinX, \ref TranslationMinY, \ref TranslationMinZ, + * \ref TranslationMaxX, \ref TranslationMaxY and \ref TranslationMaxZ flags are used to + * limit the translation on each individual axis. + * + * To access this property do: TranslationActive.Get(). + * To set this property do: TranslationActive.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT TranslationActive; + + /** This property sets the minimum translation values the object can occupy on each individual axis. + * + * To access this property do: TranslationMin.Get(). + * To set this property do: TranslationMin.Set(FbxDouble3). + * Default value is 0.,0.,0. + * + */ + FbxPropertyT TranslationMin; + + /** This property sets the maximum translation values the object can occupy on each individual axis. + * + * To access this property do: TranslationMax.Get(). + * To set this property do: TranslationMax.Set(FbxDouble3). + * Default value is 0.,0.,0. + * + */ + FbxPropertyT TranslationMax; + + /** This property enables or disables the limit on translation X. + * When set to \c true, the object translation is constrained by the value of \ref TranslationMin. + * + * To access this property do: TranslationMinX.Get(). + * To set this property do: TranslationMinX.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT TranslationMinX; + + /** This property enables or disables the limit on translation Y. + * When set to \c true, the object translation is constrained by the value of \ref TranslationMin. + * + * To access this property do: TranslationMinY.Get(). + * To set this property do: TranslationMinY.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT TranslationMinY; + + + /** This property enables or disables the limit on translation Z. + * When set to \c true, the object translation is constrained by the value of \ref TranslationMin. + * + * To access this property do: TranslationMinZ.Get(). + * To set this property do: TranslationMinZ.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT TranslationMinZ; + + /** This property enables or disables the limit on translation X. + * When set to \c true, the object translation is constrained by the value of \ref TranslationMax. + * + * To access this property do: TranslationMaxX.Get(). + * To set this property do: TranslationMaxX.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT TranslationMaxX; + + /** This property enables or disables the limit on translation Y. + * When set to \c true, the object translation is constrained by the value of \ref TranslationMax. + * + * To access this property do: TranslationMaxY.Get(). + * To set this property do: TranslationMaxY.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT TranslationMaxY; + + /** This property enables or disables the limit on translation Z. + * When set to \c true, the object translation is constrained by the value of \ref TranslationMax. + * + * To access this property do: TranslationMaxZ.Get(). + * To set this property do: TranslationMaxZ.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT TranslationMaxZ; + + /** This property contains the rotation order information of the node + * + * To access this property do: RotationOrder.Get(). + * To set this property do: RotationOrder.Set(EFbxRotationOrder). + * Default value is eEulerXYZ. + * + */ + FbxPropertyT RotationOrder; + + /** This property contains the rotation space for limit only flag of the node. + * When set to \c true, the Rotation space is applied only on the limit data (provided the \ref RotationActive is + * also \c true). + * + * To access this property do: RotationSpaceForLimitOnly.Get(). + * To set this property do: RotationSpaceForLimitOnly.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT RotationSpaceForLimitOnly; + + /** This property contains the x value of the rotation stiffness of the node + * + * To access this property do: RotationStiffnessX.Get(). + * To set this property do: RotationStiffnessX.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT RotationStiffnessX; + + /** This property contains the y value of the rotation stiffness of the node + * + * To access this property do: RotationStiffnessY.Get(). + * To set this property do: RotationStiffnessY.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT RotationStiffnessY; + + /** This property contains the z value of the rotation stiffness of the node + * + * To access this property do: RotationStiffnessZ.Get(). + * To set this property do: RotationStiffnessZ.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT RotationStiffnessZ; + + /** This property contains axis length information of the node + * + * To access this property do: AxisLen.Get(). + * To set this property do: AxisLen.Set(FbxDouble). + * + * Default value is 10. + */ + FbxPropertyT AxisLen; + + /** This property contains pre-rotation information of the node + * + * To access this property do: PreRotation.Get(). + * To set this property do: PreRotation.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT PreRotation; + + /** This property contains post-rotation information of the node + * + * To access this property do: PostRotation.Get(). + * To set this property do: PostRotation.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT PostRotation; + + /** This property enables or disables the limit on rotation. + * When set to \c false the object can rotate in any direction without limitations. + * Else the + * \ref RotationMinX, \ref RotationMinY, \ref RotationMinZ, + * \ref RotationMaxX, \ref RotationMaxY and \ref RotationMaxZ flags are used to + * limit the rotation on each individual axis. + * \remarks The PreRotation value is applied before the limit, while the PostRotation is applied + * after the limit. + * + * To access this property do: RotationActive.Get(). + * To set this property do: RotationActive.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT RotationActive; + + /** This property sets the minimum rotation values the object can occupy on each individual axis. + * + * To access this property do: RotationMin.Get(). + * To set this property do: RotationMin.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT RotationMin; + + /** This property sets the maximum rotation values the object can occupy on each individual axis. + * + * To access this property do: RotationMax.Get(). + * To set this property do: RotationMax.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT RotationMax; + + /** This property enables or disables the limit on rotation X. + * When set to \c true, the object rotation is constrained by the value of \ref RotationMin. + * + * To access this property do: RotationMinX.Get(). + * To set this property do: RotationMinX.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT RotationMinX; + + /** This property enables or disables the limit on rotation Y. + * When set to \c true, the object rotation is constrained by the value of \ref RotationMin. + * + * To access this property do: RotationMinY.Get(). + * To set this property do: RotationMinY.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT RotationMinY; + + /** This property enables or disables the limit on rotation Z. + * When set to \c true, the object rotation is constrained by the value of \ref RotationMin. + * + * To access this property do: RotationMinZ.Get(). + * To set this property do: RotationMinZ.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT RotationMinZ; + + /** This property enables or disables the limit on rotation X. + * When set to \c true, the object rotation is constrained by the value of \ref RotationMax. + * + * To access this property do: RotationMaxX.Get(). + * To set this property do: RotationMaxX.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT RotationMaxX; + + /** This property enables or disables the limit on rotation Y. + * When set to \c true, the object rotation is constrained by the value of \ref RotationMax. + * + * To access this property do: RotationMaxY.Get(). + * To set this property do: RotationMaxY.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT RotationMaxY; + + /** This property enables or disables the limit on rotation Z. + * When set to \c true, the object rotation is constrained by the value of \ref RotationMax. + * + * To access this property do: RotationMaxZ.Get(). + * To set this property do: RotationMaxZ.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT RotationMaxZ; + + /** This property contains inherit type information of the node + * + * To access this property do: InheritType.Get(). + * To set this property do: InheritType.Set(FbxTransform::EInheritType). + * + * Default value is eInheritRrSs. + */ + FbxPropertyT InheritType; + + /** This property enables or disables the limit on scaling. + * When set to \c false the object can scale in any direction without limitations. + * Else the + * \ref ScalingMinX, \ref ScalingMinY, \ref ScalingMinZ, + * \ref ScalingMaxX, \ref ScalingMaxY and \ref ScalingMaxZ flags are used to + * limit the scaling on each individual axis. + * + * To access this property do: ScalingActive.Get(). + * To set this property do: ScalingActive.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ScalingActive; + + /** This property sets the minimum scaling values the object can occupy on each individual axis. + * + * To access this property do: ScalingMin.Get(). + * To set this property do: ScalingMin.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT ScalingMin; + + /** This property sets the maximum scaling values the object can occupy on each individual axis. + * + * To access this property do: ScalingMax.Get(). + * To set this property do: ScalingMax.Set(FbxDouble3). + * + * Default value is 1.,1.,1. + */ + FbxPropertyT ScalingMax; + + /** This property activates or disables the limit on scaling X. When active, the object scaling + * is constrained by the value of \ref ScalingMin. + * + * To access this property do: ScalingMinX.Get(). + * To set this property do: ScalingMinX.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ScalingMinX; + + /** This property enables or disables the limit on scaling Y. + * When set to \c true, the object scaling is constrained by the value of \ref ScalingMin. + * + * To access this property do: ScalingMinY.Get(). + * To set this property do: ScalingMinY.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ScalingMinY; + + /** This property enables or disables the limit on scaling Z. + * When set to \c true, the object scaling is constrained by the value of \ref ScalingMin. + * + * To access this property do: ScalingMinZ.Get(). + * To set this property do: ScalingMinZ.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ScalingMinZ; + + /** This property enables or disables the limit on scaling X. + * When set to \c true, the object scaling is constrained by the value of \ref ScalingMax. + * + * To access this property do: ScalingMaxX.Get(). + * To set this property do: ScalingMaxX.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ScalingMaxX; + + /** This property enables or disables the limit on scaling Y. + * When set to \c true, the object scaling is constrained by the value of \ref ScalingMax. + * + * To access this property do: ScalingMaxY.Get(). + * To set this property do: ScalingMaxY.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ScalingMaxY; + + /** This property enables or disables the limit on scaling Z. + * When set to \c true, the object scaling is constrained by the value of \ref ScalingMax. + * + * To access this property do: ScalingMaxZ.Get(). + * To set this property do: ScalingMaxZ.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT ScalingMaxZ; + + /** This property contains geometric translation information of the node + * + * To access this property do: GeometricTranslation.Get(). + * To set this property do: GeometricTranslation.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT GeometricTranslation; + + /** This property contains geometric rotation information of the node + * + * To access this property do: GeometricRotation.Get(). + * To set this property do: GeometricRotation.Set(FbxDouble3). + * + * Default value is 0.,0.,0. + */ + FbxPropertyT GeometricRotation; + + /** This property contains geometric scaling information of the node + * + * To access this property do: GeometricScaling.Get(). + * To set this property do: GeometricScaling.Set(FbxDouble3). + * + * Default value is 1.,1.,1. + */ + FbxPropertyT GeometricScaling; + + // IK Settings + ////////////////////////////////////////////////////////// + + /** This property contains the x component of the minimum damp range angles of the node + * + * To access this property do: MinDampRangeX.Get(). + * To set this property do: MinDampRangeX.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MinDampRangeX; + + /** This property contains the y component of the minimum damp range angles of the node + * + * To access this property do: MinDampRangeY.Get(). + * To set this property do: MinDampRangeY.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MinDampRangeY; + + /** This property contains the z component of the minimum damp range angles of the node + * + * To access this property do: MinDampRangeZ.Get(). + * To set this property do: MinDampRangeZ.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MinDampRangeZ; + + /** This property contains the x component of the maximum damp range angles of the node + * + * To access this property do: MaxDampRangeX.Get(). + * To set this property do: MaxDampRangeX.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MaxDampRangeX; + + /** This property contains the y component of the maximum damp range angles of the node + * + * To access this property do: MaxDampRangeY.Get(). + * To set this property do: MaxDampRangeY.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MaxDampRangeY; + + /** This property contains the z component of the maximum damp range angles of the node + * + * To access this property do: MaxDampRangeZ.Get(). + * To set this property do: MaxDampRangeZ.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MaxDampRangeZ; + + /** This property contains the x component of the minimum damp strength of the node + * + * To access this property do: MinDampStrengthX.Get(). + * To set this property do: MinDampStrengthX.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MinDampStrengthX; + + /** This property contains the y component of the minimum damp strength of the node + * + * To access this property do: MinDampStrengthY.Get(). + * To set this property do: MinDampStrengthY.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MinDampStrengthY; + + /** This property contains the z component of the minimum damp strength of the node + * + * To access this property do: MinDampStrengthZ.Get(). + * To set this property do: MinDampStrengthZ.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MinDampStrengthZ; + + /** This property contains the x component of the maximum damp strength of the node + * + * To access this property do: MaxDampStrengthX.Get(). + * To set this property do: MaxDampStrengthX.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MaxDampStrengthX; + + /** This property contains the y component of the maximum damp strength of the node + * + * To access this property do: MaxDampStrengthY.Get(). + * To set this property do: MaxDampStrengthY.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MaxDampStrengthY; + + /** This property contains the z component of the maximum damp strength of the node + * + * To access this property do: MaxDampStrengthZ.Get(). + * To set this property do: MaxDampStrengthZ.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT MaxDampStrengthZ; + + /** This property contains the x component of the preferred angle of the node + * + * To access this property do: PreferedAngleX.Get(). + * To set this property do: PreferedAngleX.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT PreferedAngleX; + + /** This property contains the y component of the preferred angle of the node + * + * To access this property do: PreferedAngleY.Get(). + * To set this property do: PreferedAngleY.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT PreferedAngleY; + + /** This property contains the z component of the preferred angle of the node + * + * To access this property do: PreferedAngleZ.Get(). + * To set this property do: PreferedAngleZ.Set(FbxDouble). + * + * Default value is 0. + */ + FbxPropertyT PreferedAngleZ; + + /////////////////////////////////////////////////////// + + /** This property contains lookat property of the node + * + * To access this property do: LookAtProperty.Get(). + * To set this property do: LookAtProperty.Set(FbxReference). + * + */ + FbxPropertyT LookAtProperty; + + /** This property contains the up vector property of the node + * + * To access this property do: UpVectorProperty.Get(). + * To set this property do: UpVectorProperty.Set(FbxReference). + * + */ + FbxPropertyT UpVectorProperty; + + /** This property contains the show information of the node. + * As opposed to the Visibility property, this one cannot be animated. The assumed behavior of + * this property is to represent the show/hide state of all the nodes attributes connected to this + * node only. + * + * To access this property do: Show.Get(). + * To set this property do: Show.Set(FbxBool). + * + * Default value is true. + * + * \remarks \li Because node attributes can be shared by multiple nodes (instances), the FBX SDK provides an utility + * function FbxScene::SyncShowPropertyForInstance() to propagates the same Show value across all the nodes + * referencing the node attribute. The applied logic is that as soon as one of these nodes has the Show + * property set to \c false, all will be set to \c false (basically it is an AND operation on all the + * Show flags). + * + * \li Depending on the support of the Show and Visibility properties that applications will implement, there + * may be conflicts with these two states. In this case, it is suggested that the Visibility property + * always overrides the Show. + * + * \see Visibility property. + */ + FbxPropertyT Show; + + /** This property contains negative percent shape support information of the node + * + * To access this property do: NegativePercentShapeSupport.Get(). + * To set this property do: NegativePercentShapeSupport.Set(FbxBool). + * + * Default value is true. + */ + FbxPropertyT NegativePercentShapeSupport; + + /** This property contains default attribute index information of the node + * + * To access this property do: DefaultAttributeIndex.Get(). + * To set this property do: DefaultAttributeIndex.Set(FbxInt). + * + * Default value is -1. + */ + FbxPropertyT DefaultAttributeIndex; + + /** This property contains manipulation state information of the node + * + * To access this property do: Freeze.Get(). + * To set this property do: Freeze.Set(FbxBool). + * + * Default value is false. + */ + FbxPropertyT Freeze; + + /** This property contains level of detail mode information of the node + * + * To access this property do: LODBox.Get(). + * To set this property do: LODBox.Set(FbxBool). + * + * True: Bounding box + * False: Geometry object is displayed. + * Default value is false. + */ + FbxPropertyT LODBox; + //@} + +/***************************************************************************************************************************** +** 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 Pivot + { + public: + static const FbxVector4 sZeroVector; + static const FbxVector4 sOneVector; + + Pivot() + { + mRotationOffset = NULL; + mRotationPivot = NULL; + mPreRotation = NULL; + mPostRotation = NULL; + mScalingOffset = NULL; + mScalingPivot = NULL; + mGeometricTranslation = NULL; + mGeometricRotation = NULL; + mGeometricScaling = NULL; + Reset(); + } + ~Pivot() { Reset(); } + + void Reset() + { + FBX_SAFE_DELETE(mRotationOffset); + FBX_SAFE_DELETE(mRotationPivot); + FBX_SAFE_DELETE(mPreRotation); + FBX_SAFE_DELETE(mPostRotation); + FBX_SAFE_DELETE(mScalingOffset); + FBX_SAFE_DELETE(mScalingPivot); + FBX_SAFE_DELETE(mGeometricTranslation); + FBX_SAFE_DELETE(mGeometricRotation); + FBX_SAFE_DELETE(mGeometricScaling); + mRotationOrder = eEulerXYZ; + mRotationSpaceForLimitOnly = false; + mPivotState = FbxNode::ePivotReference; + mQuaternionInterpolate = eQuatInterpOff; + } + + inline const FbxVector4& GetRotationOffset() const { return (mRotationOffset) ? *mRotationOffset : sZeroVector; } + inline void SetRotationOffset(const FbxVector4& pV) + { + if( !mRotationOffset ) + { + #if defined(__GNUC__) && (__GNUC__ < 4) + mRotationOffset = FbxNew< FbxVector4 >((FbxVector4&)pV); + #else + mRotationOffset = FbxNew< FbxVector4 >(pV); + #endif + } + else + { + *mRotationOffset = pV; + } + } + + inline const FbxVector4& GetRotationPivot() const { return (mRotationPivot) ? *mRotationPivot : sZeroVector; } + inline void SetRotationPivot(const FbxVector4& pV) + { + if( !mRotationPivot ) + { + #if defined(__GNUC__) && (__GNUC__ < 4) + mRotationPivot = FbxNew< FbxVector4 >((FbxVector4&)pV); + #else + mRotationPivot = FbxNew< FbxVector4 >(pV); + #endif + } + else + { + *mRotationPivot = pV; + } + } + + inline const FbxVector4& GetPreRotation() const { return (mPreRotation) ? *mPreRotation : sZeroVector; } + inline void SetPreRotation(const FbxVector4& pV) + { + if( !mPreRotation ) + { + #if defined(__GNUC__) && (__GNUC__ < 4) + mPreRotation = FbxNew< FbxVector4 >((FbxVector4&)pV); + #else + mPreRotation = FbxNew< FbxVector4 >(pV); + #endif + } + else + { + *mPreRotation = pV; + } + } + + inline const FbxVector4& GetPostRotation() const { return (mPostRotation) ? *mPostRotation : sZeroVector; } + inline void SetPostRotation(const FbxVector4& pV) + { + if( !mPostRotation ) + { + #if defined(__GNUC__) && (__GNUC__ < 4) + mPostRotation = FbxNew< FbxVector4 >((FbxVector4&)pV); + #else + mPostRotation = FbxNew< FbxVector4 >(pV); + #endif + } + else + { + *mPostRotation = pV; + } + } + + inline const FbxVector4& GetScalingOffset() const { return (mScalingOffset) ? *mScalingOffset : sZeroVector; } + inline void SetScalingOffset(const FbxVector4& pV) + { + if( !mScalingOffset ) + { + #if defined(__GNUC__) && (__GNUC__ < 4) + mScalingOffset = FbxNew< FbxVector4 >((FbxVector4&)pV); + #else + mScalingOffset = FbxNew< FbxVector4 >(pV); + #endif + } + else + { + *mScalingOffset = pV; + } + } + + inline const FbxVector4& GetScalingPivot() const { return (mScalingPivot) ? *mScalingPivot : sZeroVector; } + inline void SetScalingPivot(const FbxVector4& pV) + { + if( !mScalingPivot ) + { + #if defined(__GNUC__) && (__GNUC__ < 4) + mScalingPivot = FbxNew< FbxVector4 >((FbxVector4&)pV); + #else + mScalingPivot = FbxNew< FbxVector4 >(pV); + #endif + } + else + { + *mScalingPivot = pV; + } + } + + inline const FbxVector4& GetGeometricTranslation() const { return (mGeometricTranslation) ? *mGeometricTranslation : sZeroVector; } + inline void SetGeometricTranslation(const FbxVector4& pV) + { + if( !mGeometricTranslation ) + { + #if defined(__GNUC__) && (__GNUC__ < 4) + mGeometricTranslation = FbxNew< FbxVector4 >((FbxVector4&)pV); + #else + mGeometricTranslation = FbxNew< FbxVector4 >(pV); + #endif + } + else + { + *mGeometricTranslation = pV; + } + } + + inline const FbxVector4& GetGeometricRotation() const { return (mGeometricRotation) ? *mGeometricRotation : sZeroVector; } + inline void SetGeometricRotation(const FbxVector4& pV) + { + if( !mGeometricRotation ) + { + #if defined(__GNUC__) && (__GNUC__ < 4) + mGeometricRotation = FbxNew< FbxVector4 >((FbxVector4&)pV); + #else + mGeometricRotation = FbxNew< FbxVector4 >(pV); + #endif + } + else + { + *mGeometricRotation = pV; + } + } + + inline const FbxVector4& GetGeometricScaling() const { return (mGeometricScaling) ? *mGeometricScaling : sOneVector; } + inline void SetGeometricScaling(const FbxVector4& pV) + { + if( !mGeometricScaling ) + { + #if defined(__GNUC__) && (__GNUC__ < 4) + mGeometricScaling = FbxNew< FbxVector4 >((FbxVector4&)pV); + #else + mGeometricScaling = FbxNew< FbxVector4 >(pV); + #endif + } + else + { + *mGeometricScaling = pV; + } + } + + inline EFbxRotationOrder GetRotationOrder() const { return mRotationOrder; } + inline void SetRotationOrder(EFbxRotationOrder pROrder) { mRotationOrder = pROrder; } + inline bool GetRotationSpaceForLimitOnly() const { return mRotationSpaceForLimitOnly; } + inline void SetRotationSpaceForLimitOnly(bool pVal) { mRotationSpaceForLimitOnly = pVal; } + inline EFbxQuatInterpMode GetQuaternionInterpolate() const { return mQuaternionInterpolate; } + inline void SetQuaternionInterpolate(EFbxQuatInterpMode pVal) { mQuaternionInterpolate = pVal; } + inline FbxNode::EPivotState GetPivotState() const { return mPivotState; } + inline void SetPivotState(FbxNode::EPivotState pVal) { mPivotState = pVal; } + + private: + FbxVector4* mRotationOffset; + FbxVector4* mRotationPivot; + FbxVector4* mPreRotation; + FbxVector4* mPostRotation; + FbxVector4* mScalingOffset; + FbxVector4* mScalingPivot; + FbxVector4* mGeometricTranslation; + FbxVector4* mGeometricRotation; + FbxVector4* mGeometricScaling; + EFbxRotationOrder mRotationOrder; + bool mRotationSpaceForLimitOnly; + EFbxQuatInterpMode mQuaternionInterpolate; + FbxNode::EPivotState mPivotState; + }; + + class FBXSDK_DLL Pivots + { + public: + Pivots() + { + for( int i = 0; i < 2; i++ ) + { + mIsDefault[i] = true; + mPivotState[i] = FbxNode::ePivotReference; + mPivot[i] = NULL; + } + } + + ~Pivots() + { + FbxDelete(mPivot[0]); + FbxDelete(mPivot[1]); + } + + Pivot& Get(int id) + { + FBX_ASSERT(id == 0 || id == 1); + if (mPivot[id] == NULL && mIsDefault[id]) + { + smDefaultPivot.SetPivotState(mPivotState[id]); + return smDefaultPivot; + } + + if (!mPivot[id]) + mPivot[id] = FbxNew< Pivot >(); + + FBX_ASSERT(mPivot[id] != NULL); + if (mPivot[id]) + mPivot[id]->SetPivotState(mPivotState[id]); + + return *mPivot[id]; + } + + #define MACRO_PIVOT_VECTOR_FCTS(name, defVect) \ + inline const FbxVector4& Get##name(int id) const \ + {\ + FBX_ASSERT(id == 0 || id == 1); \ + Pivot* p = mPivot[id]; \ + if (p == NULL) p = &smDefaultPivot; \ + return p->Get##name(); \ + }\ + inline void Set##name(int id, const FbxVector4& pV) \ + {\ + FBX_ASSERT(id == 0 || id == 1); \ + if (mIsDefault[id] && pV[0] == defVect[0] && pV[1] == defVect[1] && pV[2] == defVect[2]) return; \ + mIsDefault[id] = false; \ + Get(id).Set##name(pV); \ + } + + MACRO_PIVOT_VECTOR_FCTS(RotationOffset, Pivot::sZeroVector); + MACRO_PIVOT_VECTOR_FCTS(RotationPivot, Pivot::sZeroVector); + MACRO_PIVOT_VECTOR_FCTS(PreRotation, Pivot::sZeroVector); + MACRO_PIVOT_VECTOR_FCTS(PostRotation, Pivot::sZeroVector); + MACRO_PIVOT_VECTOR_FCTS(ScalingOffset, Pivot::sZeroVector); + MACRO_PIVOT_VECTOR_FCTS(ScalingPivot, Pivot::sZeroVector); + MACRO_PIVOT_VECTOR_FCTS(GeometricTranslation, Pivot::sZeroVector); + MACRO_PIVOT_VECTOR_FCTS(GeometricRotation, Pivot::sZeroVector); + MACRO_PIVOT_VECTOR_FCTS(GeometricScaling, Pivot::sOneVector); + + #define MACRO_PIVOT_BOOL_FCTS(name) \ + inline bool Get##name(int id) const \ + {\ + FBX_ASSERT(id == 0 || id == 1); \ + Pivot* p = mPivot[id]; \ + if (p == NULL) p = &smDefaultPivot; \ + return p->Get##name(); \ + }\ + inline void Set##name(int id, bool pV) \ + {\ + FBX_ASSERT(id == 0 || id == 1); \ + mIsDefault[id] = false; \ + Get(id).Set##name(pV); \ + } + + MACRO_PIVOT_BOOL_FCTS(RotationSpaceForLimitOnly); + + inline EFbxQuatInterpMode GetQuaternionInterpolate(int id) const + { + FBX_ASSERT(id == 0 || id == 1); + Pivot* p = mPivot[id]; + if (p == NULL) p = &smDefaultPivot; + return p->GetQuaternionInterpolate(); + } + + inline void SetQuaternionInterpolate(int id, EFbxQuatInterpMode pV) + { + FBX_ASSERT(id == 0 || id == 1); + // If pivot has default values, and we want to set default eQuatInterpOff, + // return to avoid allocating memory for the pivot (in Get(id).) + if (mIsDefault[id] && pV == eQuatInterpOff) return; + mIsDefault[id] = false; + Get(id).SetQuaternionInterpolate(pV); + } + + inline EFbxRotationOrder GetRotationOrder(int id) const + { + FBX_ASSERT(id == 0 || id == 1); + Pivot* p = mPivot[id]; + if (p == NULL) p = &smDefaultPivot; + return p->GetRotationOrder(); + } + + inline void SetRotationOrder(int id, EFbxRotationOrder pROrder) + { + FBX_ASSERT(id == 0 || id == 1); + // If pivot has default values, and we want to set default rotation order eEulerXYZ, + // return to avoid allocating memory for the pivot (in Get(id).) + if (mIsDefault[id] && pROrder == eEulerXYZ) return; + mIsDefault[id] = false; + Get(id).SetRotationOrder(pROrder); + } + + inline FbxNode::EPivotState GetPivotState(int id) const + { + FBX_ASSERT(id == 0 || id == 1); + return mPivotState[id]; + } + + inline void SetPivotState(int id, FbxNode::EPivotState pVal) + { + FBX_ASSERT(id == 0 || id == 1); + if (pVal == FbxNode::ePivotReference) return; + mPivotState[id] = pVal; + if (mPivot[id]) + mPivot[id]->SetPivotState(pVal); + } + + #undef MACRO_PIVOT_VECTOR_FCTS + #undef MACRO_PIVOT_BOOL_FCTS + + void Reset() + { + smDefaultPivot.Reset(); + for (int i = 0; i < 2; i++) + { + mIsDefault[i] = true; + mPivotState[i] = FbxNode::ePivotReference; + if (mPivot[i]) mPivot[i]->Reset(); + } + } + + private: + Pivot* mPivot[2]; + FbxNode::EPivotState mPivotState[2]; + bool mIsDefault[2]; + static Pivot smDefaultPivot; + }; + + class FBXSDK_DLL LinkToCharacter + { + public: + bool operator==(LinkToCharacter& pLinkToCharacter) + { + if (mCharacter == pLinkToCharacter.mCharacter && + mType == pLinkToCharacter.mType && + mIndex == pLinkToCharacter.mIndex && + mSubIndex == pLinkToCharacter.mSubIndex) + { + return true; + } + else return false; + } + + FbxCharacter* mCharacter; + int mType; + int mIndex; + int mSubIndex; + }; + + void AddChildName(char* pChildName); + char* GetChildName(FbxUInt pIndex) const; + FbxUInt GetChildNameCount() const; + + FbxTransform& GetTransform(); + FbxLimits& GetTranslationLimits(); + FbxLimits& GetRotationLimits(); + FbxLimits& GetScalingLimits(); + Pivots& GetPivots(); + + void UpdatePivotsAndLimitsFromProperties(); + void UpdatePropertiesFromPivotsAndLimits(); + + void SetRotationActiveProperty(bool pVal); + void PivotSetToMBTransform(EPivotSet pPivotSet); + + int AddCharacterLink(FbxCharacter* pCharacter, int pCharacterLinkType, int pNodeId, int pNodeSubId); + int RemoveCharacterLink(FbxCharacter* pCharacter, int pCharacterLinkType, int pNodeId, int pNodeSubId); + + // Duplicate this node as well as all its node attributes and the Target and UpTarget objects. + FbxNode* DeepCloneWithNodeAttributes(); + + virtual FbxObject& Copy(const FbxObject& pObject); + virtual const char* GetTypeName() const; + virtual FbxStringList GetTypeFlags() const; + virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty); + + enum ECullingType + { + eCullingOff, + eCullingOnCCW, + eCullingOnCW + }; + + ECullingType mCullingType; + bool mCorrectInheritType; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); + + void Reset(); + bool GetAnimationIntervalRecursive(FbxTimeSpan& pTimeInterval, FbxAnimLayer* pAnimLayer); + +private: + typedef FbxSet GeomInstSet; + + void ResetLimitsRecursive(FbxNode* pNode); + + void ConvertPivotAnimationRecurseLoop(FbxAnimStack* pAnimStack, const EPivotSet pConversionTarget, const double pFrameRate, const bool pKeyReduce, GeomInstSet& pGeomInstSet); + void ConvertPivotAnimation(FbxAnimStack* pAnimStack, const EPivotSet pConversionTarget, const double pFrameRate, const bool pKeyReduce, GeomInstSet& pGeomInstSet); + bool ConvertPivotAnimation_SetupMatrixConverter(FbxAnimCurveFilterMatrixConverter& pConverter, const EPivotSet& pSrcSet, const EPivotSet& pDstSet, const double pFrameRate, const bool pKeyReduce, GeomInstSet& pGeomInstSet); + void ConvertPivotAnimation_ApplyGeometryPivot(const EPivotSet& pSrcSet, const EPivotSet& pDstSet, GeomInstSet& pGeomInstSet); + + FbxTransform mTransform; + Pivots mPivots; + FbxObject* mAnimCurveNodeContainer; + FbxArray mChildrenNameList; + FbxVector4 mPostTargetRotation; + FbxVector4 mTargetUpVector; + FbxNode::EShadingMode mShadingMode; + FbxArray mLinkToCharacter; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const EFbxRotationOrder&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxTransform::EInheritType&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const EFbxQuatInterpMode&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_NODE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxnodeattribute.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxnodeattribute.h new file mode 100644 index 00000000..e9e76e18 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxnodeattribute.h @@ -0,0 +1,123 @@ +/**************************************************************************************** + + 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 fbxnodeattribute.h +#ifndef _FBXSDK_SCENE_GEOMETRY_NODE_ATTRIBUTE_H_ +#define _FBXSDK_SCENE_GEOMETRY_NODE_ATTRIBUTE_H_ + +#include + +#include + +#include + +class FbxNode; + +/** \brief This class is the base class to all types of node attributes. + * \nosubgrouping + * A node attribute is the content of a node. A \c NULL node attribute is set + * by calling function FbxNode::SetNodeAttribute() with a \c NULL pointer. + */ +class FBXSDK_DLL FbxNodeAttribute : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxNodeAttribute, FbxObject); + +public: + //! Property Names + static const char* sColor; + + //! Property Default Values + static const FbxDouble3 sDefaultColor; + + /** This property handles the color. + * + * Default value is (0.8, 0.8, 0.8) + */ + FbxPropertyT Color; + + /** \enum EType Node attribute types. + * - \e eUnknown + * - \e eNull + * - \e eMarker + * - \e eSkeleton + * - \e eMesh + * - \e eNurbs + * - \e ePatch + * - \e eCamera + * - \e eCameraStereo, + * - \e eCameraSwitcher + * - \e eLight + * - \e eOpticalReference + * - \e eOpticalMarker + * - \e eNurbsCurve + * - \e eTrimNurbsSurface + * - \e eBoundary + * - \e eNurbsSurface + * - \e eShape + * - \e eLODGroup + * - \e eSubDiv + * - \e eCachedEffect + * - \e eLine + */ + enum EType + { + eUnknown, + eNull, + eMarker, + eSkeleton, + eMesh, + eNurbs, + ePatch, + eCamera, + eCameraStereo, + eCameraSwitcher, + eLight, + eOpticalReference, + eOpticalMarker, + eNurbsCurve, + eTrimNurbsSurface, + eBoundary, + eNurbsSurface, + eShape, + eLODGroup, + eSubDiv, + eCachedEffect, + eLine + }; + + /** Return the type of node attribute. + * This class is pure virtual. + */ + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** Return the node count using this attribute. + * \return The count of nodes with this attribute set. + */ + int GetNodeCount() const; + + /** Return the node this attribute is set to. + * \param pIndex The index of the node to retrieve + * \return Pointer to the node, or \c NULL if the current attribute is not set to a node. + */ + FbxNode* GetNode(int pIndex=0) 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 +protected: + virtual void ConstructProperties(bool pForceSet); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_NODE_ATTRIBUTE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxnull.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxnull.h new file mode 100644 index 00000000..9eb91516 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxnull.h @@ -0,0 +1,119 @@ +/**************************************************************************************** + + 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 fbxnull.h +#ifndef _FBXSDK_SCENE_GEOMETRY_NULL_H_ +#define _FBXSDK_SCENE_GEOMETRY_NULL_H_ + +#include + +#include + +#include + +/** \brief This node attribute contains the properties of a null node. + * \nosubgrouping + */ +class FBXSDK_DLL FbxNull : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxNull, FbxNodeAttribute); + +public: + //! Returns the EType::eNull node attribute type. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + //! Resets the default values. + void Reset(); + + /** + * \name Null Node Properties + */ + //@{ + + /** \enum ELook Null node look types. + * - \e eNone + * - \e eCross + */ + enum ELook + { + eNone, + eCross, + }; + + /** Returns the default size value. + * \return The default size of this object (100). + */ + double GetSizeDefaultValue() const; + + //@} + + /** + * \name Property Names + */ + //@{ + static const char* sSize; + static const char* sLook; + //@} + + /** + * \name Property Default Values + */ + //@{ + static const FbxDouble sDefaultSize; + static const ELook sDefaultLook; + //@} + + + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + + /** This property handles the null node size. + * + * To access this property do: Size.Get(). + * To set this property do: Size.Set(FbxDouble). + * + * The default value is 100. + */ + FbxPropertyT Size; + + /** This property handles the look of the null node. + * + * To access this property do: Look.Get(). + * To set this property do: Look.Set(ELook). + * + * The default value is true + */ + FbxPropertyT Look; + + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + +public: + virtual FbxStringList GetTypeFlags() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxNull::ELook&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_NULL_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxnurbs.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxnurbs.h new file mode 100644 index 00000000..ca2f9ba3 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxnurbs.h @@ -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 fbxnurbs.h +#ifndef _FBXSDK_SCENE_GEOMETRY_NURBS_H_ +#define _FBXSDK_SCENE_GEOMETRY_NURBS_H_ + +#include + +#include + +#include + +/** A NURBS surface is a type of parametric geometry. A NURBS surface is defined by the + order, form, knot vector and control points in the U and V coordinates. + + For more information on the meaning of form, knot vectors and control points, + see the FbxNurbsCurve documentation. The same rules apply for the NURBS curves + and NURBS surfaces, but NURBS surfaces have two dimensions (U and V). + + * \nosubgrouping + */ +class FBXSDK_DLL FbxNurbs : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxNurbs, FbxGeometry); + +public: + //! Returns the FbxNodeAttribute::EType::eNurbs node attribute type. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + //! Resets the NURBS surface its default values. + void Reset(); + + /** + * \name NURBS surface properties + */ + //@{ + + /** Sets the surface mode. + * \param pMode Surface mode identifier (see class FbxGeometry) + */ + void SetSurfaceMode(FbxGeometry::ESurfaceMode pMode); + + /** Returns the surface mode. + * \return The surface mode identifier that is currently set. + */ + inline ESurfaceMode GetSurfaceMode() const {return mSurfaceMode;} + + /** NURBS types. + */ + enum EType + { + ePeriodic, //!< Periodic. + eClosed, //!< Closed. + eOpen //!< Open. + }; + + /** Allocates memory space for an array of control points as well as knot + * and multiplicity vectors. + * \param pUCount Number of U-dimension control points. + * \param pUType U-dimension NURBS type. + * \param pVCount Number of V-dimension control points. + * \param pVType V-dimension NURBS type. + * \remarks Always call this function after FbxNurbs::SetOrder(). + */ + void InitControlPoints(int pUCount, EType pUType, int pVCount, EType pVType); + + /** Returns the number of U-dimension control points. + * \return Number of U-dimension control points. + */ + inline int GetUCount() const {return mUCount;} + + /** Returns the number of V-dimension control points. + * \return Number of V-dimension control points. + */ + inline int GetVCount() const {return mVCount;} + + /** Returns the U-dimension NURBS type. + * \return NURBS type identifier. + */ + inline EType GetNurbsUType() const {return mUType;} + + /** Returns the V-dimension NURBS type. + * \return NURBS type identifier. + */ + inline EType GetNurbsVType() const {return mVType;} + + /** Returns the number of elements in the U-dimension knot vector. See FbxNurbsCurve for more information. + * \return The number of elements in the U-dimension knot vector. + */ + int GetUKnotCount() const; + + /** Returns the U-dimension knot vector. + * \return Pointer to the U-dimension knot vector. + */ + double* GetUKnotVector() const; + + /** Returns the number of elements in the V-dimension knot vector. See FbxNurbsCurve for more information. + * \return The number of elements in the V-dimension knot vector. + */ + int GetVKnotCount() const; + + /** Returns the V-dimension knot vector. + * \return Pointer to the V-dimension knot vector. + */ + double* GetVKnotVector() const; + + /** Returns multiplicity of U-dimension control points. + * \return Pointer to the array of multiplicity values. + * \remarks The length of this vector is equal to the U count. + * Its elements are set to 1 by default. + */ + int* GetUMultiplicityVector() const; + + /** Returns multiplicity of V-dimension control points. + * \return Pointer to the array of multiplicity values. + * \remarks The length of this vector is equal to the V count. + * Its elements are set to 1 by default. + */ + int* GetVMultiplicityVector() const; + + /** Sets the order of the NURBS surface. + * \param pUOrder NURBS order in U dimension. + * \param pVOrder NURBS order in V dimension. + */ + void SetOrder(FbxUInt pUOrder, FbxUInt pVOrder); + + /** Returns the NURBS order in U dimension. + * \return NURBS order in U dimension. + */ + inline int GetUOrder() const {return mUOrder;} + + /** Returns the NURBS order in V dimension. + * \return NURBS order in V dimension. + */ + inline int GetVOrder() const {return mVOrder;} + + /** Sets the NURBS step. + * The step value is the number of divisions between adjacent control points. + * \param pUStep Steps in U dimension. + * \param pVStep Steps in V dimension. + */ + void SetStep(int pUStep, int pVStep); + + /** Returns the number of divisions between adjacent control points in U dimension. + * \return Steps in U dimension. + */ + inline int GetUStep() const {return mUStep;} + + /** Returns the number of divisions between adjacent control points in V dimension. + * \return Steps in V dimension. + */ + inline int GetVStep() const {return mVStep;} + + /** Calculates the number of surface spans in the U dimension. + * See FbxNurbsCurve::GetSpanCount() for more information. + * \return The number of spans in the U dimension if the surface has been initialized. + * If the spans have not been initialized, returns -1. + */ + int GetUSpanCount() const; + + /** Calculates the number of surface spans in the V dimension. + * See FbxNurbsCurve::GetSpanCount() for more information. + * \return The number of spans in the V dimension if the surface has been initialized. + * If the spans have not been initialized, returns -1. + */ + int GetVSpanCount() const; + + //@} + + /** + * \name NURBS export flags + */ + //@{ + + /** Sets the flag that induces UV flipping at export. + * \param pFlag If \c true, UV flipping occurs. + */ + void SetApplyFlipUV(bool pFlag); + + /** Returns the flag that induces UV flipping at export. + * \return The current state of the UV flip flag. + */ + bool GetApplyFlipUV() const; + + /** Sets the flag that induces link flipping at export. + * \param pFlag If \c true, the links control points indices are flipped. + */ + void SetApplyFlipLinks(bool pFlag); + + /** Returns the flag that induces link flipping at export. + * \return The current state of the link flip flag. + */ + bool GetApplyFlipLinks() const; + + /** Returns flip flags state. + * \return \c True if we need to flip either the UV or the links. + */ + bool GetApplyFlip() const { return GetApplyFlipUV() || GetApplyFlipLinks(); } + + //@} + +/***************************************************************************************************************************** +** 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 + // Error identifiers, these are only used internally. + enum EErrorCode + { + eNurbsTypeUnknown, + eWrongNumberOfControlPoint, + eWeightTooSmall, + eUMultiplicityVectorError, + eVMultiplicityVectorError, + eUKnotVectorError, + eVKnotVectorError, + eErrorCount + }; + + virtual FbxObject& Copy(const FbxObject& pObject); + virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint , int pIndex) { ParentClass::SetControlPointAt(pCtrlPoint, pIndex); } + virtual void InitControlPoints(int pCount) { ParentClass::InitControlPoints(pCount); } + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + + FbxUInt mUOrder, mVOrder; + int mUCount, mVCount; + int mUStep, mVStep; + EType mUType, mVType; + + double* mUKnotVector; + double* mVKnotVector; + + int* mUMultiplicityVector; + int* mVMultiplicityVector; + + ESurfaceMode mSurfaceMode; + + // Export flags. + bool mApplyFlipUV; + bool mApplyFlipLinks; + + friend class FbxGeometryConverter; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_NURBS_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxnurbscurve.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxnurbscurve.h new file mode 100644 index 00000000..9ff3f0a3 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxnurbscurve.h @@ -0,0 +1,233 @@ +/**************************************************************************************** + + 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 fbxnurbscurve.h +#ifndef _FBXSDK_SCENE_GEOMETRY_NURBS_CURVE_H_ +#define _FBXSDK_SCENE_GEOMETRY_NURBS_CURVE_H_ + +#include + +#include +#include + +#include + +/** + A Non-Uniform Rational B-Spline (NURBS) curve is a type of parametric geometry. A NURBS + curve is defined by the order, form, knot vector and control points. + + Let M be the order of the curve. + Let N be the number of control points of the curve. + + The form of the curve can be open, closed or periodic. A curve with end points + that do not meet is defined as an open curve. The number of knots in an open curve + is defined as N+(M+1). + + A closed curve simply has its last control point equal to its first control point. + Note that this does not imply tangent continuity at the end point. The curve may + have a kink at this point. In FBX the last control point is not specified by the user + in the InitControlPoints() method. For example, if there are to be 10 control points in + total, and the curve is to be closed, than only 9 control points need to be passed + into the InitControlPoints() method. The last control point is implied to be equal + to the first control point. Thus N represents the number of unique CVs. + + A periodic curve has its last M control points equal to its first M control points. + A periodic curve is tangent continuous at the ends. Similar to a closed curve, + when creating a periodic curve, only the unique control points need to be set. For + example a periodic curve of order 3 with 10 control points requires only 7 CVs to + be specified in the InitControlPoints() method. The last 3 CVs, which are the same as + the first 3, are not included. + + The calculation of the number of knots in closed and periodic curves is more complex. + Since we have excluded one CV in N in a closed curve, the number of knots is N+(M+1)+1. + Similarly, we excluded M CVs in periodic curves so the number of knots is N+(M+1)+M. + + Note that FBX stores one extra knot at the beginning and and end of the knot vector, + compared to some other graphics applications such as Maya. The two knots are not + used in calculation, but they are included so that no data is lost when converting + from file formats that do store the extra knots. + + * \nosubgrouping + */ +class FBXSDK_DLL FbxNurbsCurve : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxNurbsCurve,FbxGeometry); + +public: + //! Returns the EType::eNurbsCurve node attribute type. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** \enum EDimension The dimension of the CVs. + * - \e e2D The CVs are two dimensional points. + * - \e e3D The CVs are three dimensional points. + */ + enum EDimension + { + e2D = 2, + e3D + }; + + /** \enum EType The curve's form. + * - \e eOpen + * - \e eClosed + * - \e ePeriodic + */ + enum EType + { + eOpen, + eClosed, + ePeriodic + }; + + /** Allocates memory space for the control points array as well as for the knot + * vector. + * \param pCount Number of control points. + * \param pVType NURBS type. + * \remarks This function should always be called after FbxNurbsCurve::SetOrder(). + */ + void InitControlPoints( int pCount, EType pVType ); + + /** Returns the knot vector. + * \return Pointer to the knots array. + */ + inline double* GetKnotVector() const { return mKnotVector; } + + /** Returns the number of elements in the knot vector. + * \return The number of knots. + */ + int GetKnotCount() const; + + /** Sets the order of the curve. + * \param pOrder The curve order. + * \remarks The curve order must be set before InitControlPoints() is called. + */ + inline void SetOrder( int pOrder ) { mOrder = pOrder; } + + /** Returns the NURBS curve order. + * \return The NURBS curve order. + */ + inline int GetOrder() const { return mOrder; } + + /** Sets the step of the curve. + * \param pStep The curve step. + * \remarks To tessellate curve, it denotes the evaluation frequency between two neighbor knots. + */ + inline void SetStep( int pStep ) { mStep = pStep; } + + /** Returns the NURBS curve step. + * \return The NURBS curve step. + * \remarks To tessellate curve, it denotes the evaluation frequency between two neighbor knots. + */ + inline int GetStep() const { return mStep; } + + /** Sets the dimension of the CVs. + * For 3D curves: control point = ( x, y, z, w ), where w is the weight. + * For 2D curves: control point = ( x, y, 0, w ), where the z component is unused, and w is the weight. + * \param pDimension The control points dimension(3D or 2D). + */ + inline void SetDimension( EDimension pDimension ) { mDimension = pDimension; } + + /** Returns the control points dimension. + * \return The curve dimension. + */ + inline EDimension GetDimension() const { return mDimension; } + + /** Determines if the curve is rational or not. + * \return \c True if the curve is rational, return \c false if not. + */ + bool IsRational(); + + /** Calculates the number of curve spans with the following: + * Where + * S = Number of spans + * N = Number of CVs + * M = Order of the curve + * + * S = N - M + 1; + * + * In this calculation N includes the duplicate CVs for closed and periodic curves. + * + * \return The number of curve spans if the curve has been initialized, returns -1 if the curve has not been initialized. + */ + int GetSpanCount() const; + + /** Returns NURBS type. + * \return NURBS type identifier. + */ + inline EType GetType() const { return mNurbsType; } + + /** Checks if the curve is a poly line. (A poly line is a + * linear NURBS curve ) + * + * \return \c True if curve is a poly line, return \c false if it is not a poly line. + */ + inline bool IsPolyline() const { return ( GetOrder() == 2 ); } + + /** This function determines if this NURBS curve is a Bezier curve. + * Bezier curves are a special case of NURBS curve. + * \return \c True if curve is a Bezier curve. If it is not a Bezier curve return \c false. + */ + bool IsBezier() const; + + /** Evaluate the point on the curve. Save the result as a point array. Meanwhile, return the length of the point array. + * \param pPointArray Save the evaluate result as a point array. + * \param pStep The evaluation frequency between two neighbor knots. Its default value is 16, which is same as Maya. + * \return The length of the point array. + */ + int TessellateCurve(FbxArray& pPointArray, int pStep = 16); + + /** Evaluate the point on the curve. Per the evaluation result, create a FbxLine and return the pointer to the line. + * \param pStep The evaluation frequency between two neighbor knots. Its default value is 16, which is same as Maya. + * \return A line to hold the tessellate points. + */ + FbxLine* TessellateCurve(int pStep = 16); + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + + bool FullMultiplicity() const; + + // Error identifiers, these are only used internally. + enum EErrorCode + { + eNurbsCurveTypeUnknown, + eWeightTooSmall, + eKnotVectorError, + eWrongNumberOfControlPoint, + eErrorCount + }; + + bool mIsRational; + + virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint , int pIndex) { ParentClass::SetControlPointAt(pCtrlPoint, pIndex); } + virtual void InitControlPoints(int pCount) { ParentClass::InitControlPoints(pCount); } + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + + void Reset(); + +private: + double* mKnotVector; + EType mNurbsType; + int mOrder; + EDimension mDimension; + int mStep; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_NURBS_CURVE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxnurbssurface.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxnurbssurface.h new file mode 100644 index 00000000..1d462cd7 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxnurbssurface.h @@ -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 fbxnurbssurface.h +#ifndef _FBXSDK_SCENE_GEOMETRY_NURBS_SURFACE_H_ +#define _FBXSDK_SCENE_GEOMETRY_NURBS_SURFACE_H_ + +#include + +#include + +#include + +class FbxNode; + +/** A NURBS surface is a type of parametric geometry. A NURBS surface is defined by the + order, form, knot vector and control points in the U and V directions. + + For more information on the meaning of the form, knot vector and control points, + see the documentation for the FbxNurbsCurve. The same concepts for NURBS curves + apply to NURBS surfaces. NURBS surfaces simply have two dimensions (U and V). + + * \nosubgrouping + */ +class FBXSDK_DLL FbxNurbsSurface : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxNurbsSurface, FbxGeometry); + +public: + //! Returns the FbxNodeAttribute::EType::eNurbsSurface node attribute type. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + //! Resets the NURBS surface its default values. + void Reset(); + + /** + * \name NURBS surface Properties + */ + //@{ + + /** Sets the surface mode. + * \param pMode Surface mode identifier (see class FbxGeometry). + */ + void SetSurfaceMode(FbxGeometry::ESurfaceMode pMode); + + /** Returns the surface mode. + * \return The surface mode identifier that is currently set. + */ + inline ESurfaceMode GetSurfaceMode() const {return mSurfaceMode;} + + /** \enum EType NURBS types. + * - \e ePeriodic + * - \e eClosed + * - \e eOpen + */ + enum EType + { + ePeriodic, + eClosed, + eOpen + }; + + /** Allocates memory space for an array of control points as well as knot + * and multiplicity vectors. + * \param pUCount Number of U-dimension control points. + * \param pUType U-dimension NURBS type. + * \param pVCount Number of V-dimension control points. + * \param pVType V-dimension NURBS type. + * \remarks Always call this function after FbxNurbsSurface::SetOrder(). + */ + void InitControlPoints(int pUCount, EType pUType, int pVCount, EType pVType); + + /** Returns the number of U-dimension control points. + * \return Number of U-dimension control points. + */ + inline int GetUCount() const {return mUCount;} + + /** Returns the number of V-dimension control points. + * \return Number of V-dimension control points. + */ + inline int GetVCount() const {return mVCount;} + + /** Returns the U-dimension NURBS type. + * \return NURBS type identifier. + */ + inline EType GetNurbsUType() const {return mUType;} + + /** Returns the V-dimension NURBS type. + * \return NURBS type identifier. + */ + inline EType GetNurbsVType() const {return mVType;} + + /** Returns the number of elements in the U-dimension knot vector. See FbxNurbsCurve for more information. + * \return The number of elements in the U-dimension knot vector. + */ + int GetUKnotCount() const; + + /** Returns the U-dimension knot vector. + * \return Pointer to the U-dimension knot vector. + */ + double* GetUKnotVector() const; + + /** Returns the number of elements in the V-dimension knot vector. See FbxNurbsCurve for more information. + * \return The number of elements in the V-dimension knot vector. + */ + int GetVKnotCount() const; + + /** Returns the V-dimension knot vector. + * \return Pointer to the V-dimension knot vector. + */ + double* GetVKnotVector() const; + + /** Sets the order of the NURBS surface. + * \param pUOrder NURBS order in U dimension. + * \param pVOrder NURBS order in V dimension. + */ + void SetOrder(FbxUInt pUOrder, FbxUInt pVOrder); + + /** Returns the NURBS order in U dimension. + * \return NURBS order in U dimension. + */ + inline int GetUOrder() const {return mUOrder;} + + /** Returns the NURBS order in V dimension. + * \return NURBS order in V dimension. + */ + inline int GetVOrder() const {return mVOrder;} + + /** Sets the NURBS step. + * The step value is the number of divisions between adjacent control points. + * \param pUStep Steps in U dimension. + * \param pVStep Steps in V dimension. + */ + void SetStep(int pUStep, int pVStep); + + /** Returns the number of divisions between adjacent control points in U dimension. + * \return Steps in U dimension. + */ + inline int GetUStep() const {return mUStep;} + + /** Returns the number of divisions between adjacent control points in V dimension. + * \return Steps in V dimension. + */ + inline int GetVStep() const {return mVStep;} + + /** Calculates the number of surface spans in the U dimension. + * See FbxNurbsCurve::GetSpanCount() for more information. + * \return The number of spans in the U dimension if the surface has been initialized. + * If the spans have not been initialized, returns -1. + */ + int GetUSpanCount() const; + + /** Calculates the number of surface spans in the V dimension. + * See FbxNurbsCurve::GetSpanCount() for more information. + * \return The number of spans in the V dimension if the surface has been initialized. + * If the spans have not been initialized, returns -1. + */ + int GetVSpanCount() const; + + //@} + + /** + * \name NURBS surface Export Flags + */ + //@{ + + /** Sets the flag that induces UV flipping at export. + * \param pFlag If \c true, UV flipping occurs. + */ + void SetApplyFlipUV(bool pFlag); + + /** Returns the flag that induces UV flipping at export. + * \return The current state of the UV flip flag. + */ + bool GetApplyFlipUV() const; + + /** Sets the flag that induces link flipping at export. + * \param pFlag If \c true, the links control points indices are flipped. + */ + void SetApplyFlipLinks(bool pFlag); + + /** Returns the flag that induces link flipping at export. + * \return The current state of the link flip flag. + */ + bool GetApplyFlipLinks() const; + + /** Returns flip flags state. + * \return \c True if we need to flip either the UV or the links. + */ + bool GetApplyFlip() const { return GetApplyFlipUV() || GetApplyFlipLinks(); } + + /** Adds a curve to the NURBS surface. + * Adds a 2D, parametric space curve to this surface + * \param pCurve The curve to be added to the surface. + */ + void AddCurveOnSurface( FbxNode* pCurve ); + + /** Retrieves a curve from this surface + * \param pIndex Index of the curve to retrieve (Valid range is 0 to GetCurveOnSurfaceCount() - 1). + * \return The curve at the specified index, or returns NULL if pIndex is out of range. + */ + FbxNode* GetCurveOnSurface( int pIndex ); + + /** Retrieves a curve from this surface + * \param pIndex Index of the curve to retrieve (Valid range is 0 to GetCurveOnSurfaceCount() - 1). + * \return The curve at the specified index, or returns NULL if pIndex is out of range. + */ + const FbxNode* GetCurveOnSurface( int pIndex ) const; + + /** Returns the number of curves on this surface. + * \return The number of curves on this surface. + */ + int GetCurveOnSurfaceCount() const; + + /** Removes a curve from this surface. + * \param pCurve The curve to be removed. + * \return \c True if the curve is removed successfully, if unsuccessful, returns \c false. + */ + bool RemoveCurveOnSurface( FbxNode* pCurve ); + + //@} + + /** Checks if the surface has all rational control points. + * \return \c True if rational, \c false otherwise + */ + bool IsRational() 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 + // Error identifiers, these are only used internally. + enum EErrorCode + { + eNurbsTypeUnknown, + eWrongNumberOfControlPoint, + eWeightTooSmall, + eUKnotVectorError, + eVKnotVectorError, + eErrorCount + }; + + virtual FbxObject& Copy(const FbxObject& pObject); + virtual void InitControlPoints(int pCount) { ParentClass::InitControlPoints(pCount); } + + void SetFlipNormals(bool pFlipNormals); + bool GetFlipNormals() const; + bool IsValidKnots() const; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + + FbxUInt mUOrder, mVOrder; + int mUCount, mVCount; + int mUStep, mVStep; + EType mUType, mVType; + + double* mUKnotVector; + double* mVKnotVector; + + ESurfaceMode mSurfaceMode; + + bool mApplyFlipUV; + bool mApplyFlipLinks; + bool mFlipNormals; + + friend class FbxGeometryConverter; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_NURBS_SURFACE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxopticalreference.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxopticalreference.h new file mode 100644 index 00000000..780363d1 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxopticalreference.h @@ -0,0 +1,45 @@ +/**************************************************************************************** + + 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 fbxopticalreference.h +#ifndef _FBXSDK_SCENE_GEOMETRY_OPTICAL_REFERENCE_H_ +#define _FBXSDK_SCENE_GEOMETRY_OPTICAL_REFERENCE_H_ + +#include + +#include + +#include + +/** \brief This node attribute contains the properties of an optical reference. + * \nosubgrouping + * Mainly used for optical motion capture systems. + */ +class FBXSDK_DLL FbxOpticalReference : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxOpticalReference,FbxNodeAttribute); + +public: + //! Return the type of node attribute which is FbxNodeAttribute::EType::eOpticalReference. + virtual FbxNodeAttribute::EType GetAttributeType() 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 +protected: + virtual FbxStringList GetTypeFlags() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_OPTICAL_REFERENCE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxpatch.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxpatch.h new file mode 100644 index 00000000..9a15907d --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxpatch.h @@ -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 fbxpatch.h +#ifndef _FBXSDK_SCENE_GEOMETRY_PATCH_H_ +#define _FBXSDK_SCENE_GEOMETRY_PATCH_H_ + +#include + +#include + +#include + +/** A patch is a type of node attribute with parametric surface. + * A patch object is useful for creating gently curved surfaces, and provides very detailed control for manipulating complex geometry. + * \nosubgrouping + */ +class FBXSDK_DLL FbxPatch : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxPatch,FbxGeometry); + +public: + //! Returns the FbxNodeAttribute::EType::ePatch node attribute type. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + //! Resets the patch to its default values. + void Reset(); + + /** + * \name Patch Properties + */ + //@{ + + /** Sets the surface mode. + * \param pMode Surface mode identifier (see Class FbxGeometry). + */ + void SetSurfaceMode(FbxGeometry::ESurfaceMode pMode); + + /** Returns the surface mode. + * \return The current surface mode identifier. + */ + inline FbxGeometry::ESurfaceMode GetSurfaceMode() const {return mSurfaceMode;} + + /** \enum EType Patch types. + * - \e eBezier + * - \e eBezierQuadric + * - \e eCardinal + * - \e eBSpline + * - \e eLinear + */ + enum EType + { + eBezier, + eBezierQuadric, + eCardinal, + eBSpline, + eLinear + }; + + /** Allocates memory space for the control points array. + * \param pUCount Number of U-dimension control points. + * \param pUType U-dimension patch type. + * \param pVCount Number of V-dimension control points. + * \param pVType V-dimension patch type. + */ + void InitControlPoints(int pUCount, EType pUType, int pVCount, EType pVType); + + /** Returns the number of control points in the U-dimension. + * \return The number of control points in the U-dimension. + */ + inline int GetUCount() const {return mUCount;} + + /** Returns the number of control points in the V-dimension. + * \return The number of control points in the V-dimension. + */ + inline int GetVCount() const {return mVCount;} + + /** Returns the U-dimension patch type. + * \return Patch type identifier in the U-dimension. + */ + inline EType GetPatchUType() const {return mUType;} + + /** Returns the V-dimension patch type. + * \return Patch type identifier in the V-dimension. + */ + inline EType GetPatchVType () const {return mVType;} + + /** Sets the patch step. + * The step is the number of divisions between adjacent control points. + * \param pUStep Steps in U-dimension. + * \param pVStep Steps in V-dimension. + */ + void SetStep(int pUStep, int pVStep); + + /** Returns the number of divisions between adjacent control points in the U-dimension. + * \return Step value in the U-dimension. + */ + inline int GetUStep() const {return mUStep;} + + /** Returns the number of divisions between adjacent control points in the V-dimension. + * \return Step value in the V-dimension. + */ + inline int GetVStep() const {return mVStep;} + + /** Sets closed flags. + * \param pU Set to \c true if the patch is closed in U dimension. + * \param pV Set to \c true if the patch is closed in V dimension. + */ + void SetClosed(bool pU, bool pV); + + /** Returns state of the U closed flag. + * \return \c True if the patch is closed in U dimension. + */ + inline bool GetUClosed() const {return mUClosed;} + + /** Returns state of the V closed flag. + * \return \c True if the patch is closed in V dimension. + */ + inline bool GetVClosed() const {return mVClosed;} + + /** Sets U-capped flags. + * \param pUBottom Set to \c true if the patch is capped at the bottom in the U-dimension. + * \param pUTop \c Set to \c true if the patch is capped on the top in the U-dimension. + * \remarks Capping options are saved but not loaded by Motionbuilder because they + * are computed from the patch topography. + */ + void SetUCapped(bool pUBottom, bool pUTop); + + /** Returns state of the bottom U-capped flag. + * \return \c True if the patch is capped at the bottom in the U-dimension. + */ + inline bool GetUCappedBottom() const {return mUCappedBottom;} + + /** Returns state of the top U-capped flag. + * \return \c True if the patch is capped on the top in the U-dimension. + */ + inline bool GetUCappedTop() const {return mUCappedTop;} + + /** Sets V-capped flags. + * \param pVBottom Sets to \c true if the patch is capped at the bottom in the V-dimension. + * \param pVTop Sets to \c true if the patch is capped on the top in the V-dimension. + * \remarks Capping options are saved but not loaded by Motionbuilder because they + * are computed from the patch topography. + */ + void SetVCapped(bool pVBottom, bool pVTop); + + /** Returns state of the bottom V-capped flag. + * \return \c True if the patch is capped at the bottom. + */ + inline bool GetVCappedBottom() const {return mVCappedBottom;} + + /** Returns state of the top V-capped flag. + * \return \c True if the patch is capped on the top. + */ + inline bool GetVCappedTop() const {return mVCappedTop;} + + //@} + + /** + * \name Off-loading Serialization section + */ + //@{ + /** Writes the content of the patch to the given stream. + * \param pStream The destination stream. + * \return \c True if the content is successfully processed by the receiving stream. + * If it is not successful, returns \c false. + */ + virtual bool ContentWriteTo(FbxStream& pStream) const; + + /** Reads the content of the patch from the given stream. + * \param pStream The source stream. + * \return \c True if the patch completes with the data received from the stream successfully. + * If it is not successful, returns \c false. + */ + virtual bool ContentReadFrom(const FbxStream& pStream); + //@} + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual void InitControlPoints(int pCount) { ParentClass::InitControlPoints(pCount); } + virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint , int pIndex) { ParentClass::SetControlPointAt(pCtrlPoint, pIndex); } + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + + EType mUType, mVType; + int mUCount, mVCount; + int mUStep, mVStep; + bool mUClosed, mVClosed; + bool mUCappedBottom, mUCappedTop; + bool mVCappedBottom, mVCappedTop; + + FbxGeometry::ESurfaceMode mSurfaceMode; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_PATCH_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxproceduralgeometry.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxproceduralgeometry.h new file mode 100644 index 00000000..dc41bbc1 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxproceduralgeometry.h @@ -0,0 +1,34 @@ +/**************************************************************************************** + + 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 fbxproceduralgeometry.h +#ifndef _FBXSDK_SCENE_GEOMETRY_PROCEDURAL_H_ +#define _FBXSDK_SCENE_GEOMETRY_PROCEDURAL_H_ + +#include + +#include + +#include + +/** Base class for procedural geometry. In a standard geometry (FbxGeometry, FbxGeometryBase), control points, + * normals, possibly polygons (FbxMesh) and other specifications are described. A procedural geometry contains minimal information + * to be created on-the-fly. + * \nosubgrouping + */ +class FBXSDK_DLL FbxProceduralGeometry : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxProceduralGeometry, FbxGeometry); +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_PROCEDURAL_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxshape.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxshape.h new file mode 100644 index 00000000..c338d268 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxshape.h @@ -0,0 +1,107 @@ +/**************************************************************************************** + + 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 fbxshape.h +#ifndef _FBXSDK_SCENE_GEOMETRY_SHAPE_H_ +#define _FBXSDK_SCENE_GEOMETRY_SHAPE_H_ + +#include + +#include + +#include + +class FbxBlendShapeChannel; +class FbxGeometry; + +/** A shape describes the deformation on a set of control points, which is similar to the cluster deformer in Maya. + * For example, we can add a shape to a created geometry. And the shape and the geometry have the same + * topological information but different position of the control points. + * With varying amounts of influence, the geometry performs a deformation effect. + * \nosubgrouping + * \see FbxGeometry + */ +class FBXSDK_DLL FbxShape : public FbxGeometryBase +{ + FBXSDK_OBJECT_DECLARE(FbxShape, FbxGeometryBase); + +public: + /** Set the blend shape channel that contains this target shape. + * \param pBlendShapeChannel Pointer to the blend shape channel to set. + * \return \c true on success, \c false otherwise. + */ + bool SetBlendShapeChannel(FbxBlendShapeChannel* pBlendShapeChannel); + + /** Get the blend shape channel that contains this target shape. + * \return a pointer to the blend shape channel if set or NULL. + */ + FbxBlendShapeChannel* GetBlendShapeChannel() const; + + /** Get the base geometry of this target shape. + * \return a pointer to the base geometry if set or NULL. + * \remarks Since target shape can only connected to its base geometry through + * blend shape channel and blend shape deformer. + * So only when this target shape is connected to a blend shape channel, + * and the blend shape channel is connected to a blend shape deformer, + * and the blend shape deformer is used on a base geometry, then to get + * base geometry will success. + */ + FbxGeometry* GetBaseGeometry(); + + /** Get the length of the arrays of control point indices and weights. + * \return Length of the arrays of control point indices and weights. + * Returns 0 if no control point indices have been added or the arrays have been reset. + */ + int GetControlPointIndicesCount() const; + + /** Get the array of control point indices. + * \return Pointer to the array of control point indices. + * \c NULL if no control point indices have been added or the array has been reset. + */ + int* GetControlPointIndices() const; + + + /** Set the array size for the control point indices + * \param pCount The new count. + */ + void SetControlPointIndicesCount(int pCount); + + /** Add a control point index to the control point indices array + * \param pIndex The control point index to add. + */ + void AddControlPointIndex(int pIndex); + + /** Restore the shape to its initial state. + * Calling this function will clear the following: + * \li Pointer to blend shape channel. + * \li Control point indices. + */ + void Reset(); + +/***************************************************************************************************************************** +** 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 + virtual void Compact(); + virtual FbxObject& Copy(const FbxObject& pObject); + virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; + +protected: + virtual FbxNodeAttribute::EType GetAttributeType() const; + virtual FbxStringList GetTypeFlags() const; + + FbxArray mControlPointIndices; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_SHAPE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxskeleton.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxskeleton.h new file mode 100644 index 00000000..175da58d --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxskeleton.h @@ -0,0 +1,200 @@ +/**************************************************************************************** + + 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 fbxskeleton.h +#ifndef _FBXSDK_SCENE_GEOMETRY_SKELETON_H_ +#define _FBXSDK_SCENE_GEOMETRY_SKELETON_H_ + +#include + +#include + +#include + +/** This class specializes a node attribute to represent the elements forming "bone" + * chains. The FbxSkeleton name of the class comes from the analogy with the human body + * skeletal structure. In fact, an object of this type is nothing more than a transform + * node with special properties that are useful for its graphical representation and during + * IK/FK and skin deformation computations. Typically, a scene will contain chains of FbxSkeleton + * node attributes that, together, form a skeleton segment. For instance, the representation of the + * leg of a character can be achieved using one parent node with the attribute eRoot, followed by + * one child (femur) of type eLimb, this child having a child also (tibia) of the same type. Finally, + * terminated with a last node attribute of type eEffector (ankle). + * + * \nosubgrouping + */ +class FBXSDK_DLL FbxSkeleton : public FbxNodeAttribute +{ + FBXSDK_OBJECT_DECLARE(FbxSkeleton,FbxNodeAttribute); + +public: + //! Return the type of node attribute (i.e: FbxNodeAttribute::EType::eSkeleton). + virtual FbxNodeAttribute::EType GetAttributeType() const; + + //! Reset the skeleton to default values and type to \c eRoot. + void Reset(); + + /** + * \name Skeleton Properties + */ + //@{ + + /** \enum EType Skeleton types. + * \remarks \e eEffector is synonymous to \e eRoot. + * \remarks The \e eLimbNode type is a bone defined uniquely by a transform and a size value while + * \remarks the \e eLimb type is a bone defined by a transform and a length. + */ + enum EType + { + eRoot, /*!< First element of a chain. */ + eLimb, /*!< Chain element. */ + eLimbNode, /*!< Chain element. */ + eEffector /*!< Last element of a chain. */ + }; + + /** Set the skeleton type. + * \param pSkeletonType Skeleton type identifier. + */ + void SetSkeletonType(EType pSkeletonType); + + /** Get the skeleton type. + * \return Skeleton type identifier. + */ + EType GetSkeletonType() const; + + /** Get a flag to know if the skeleton type was set. + * \return \c true if a call to SetSkeletonType() has been made. + * \remarks When the attribute is not set, the application can choose to ignore the attribute or use the default value. + * \remarks The flag is set back to \c false when Reset() is called. + */ + bool GetSkeletonTypeIsSet() const; + + /** Get the default value for the skeleton type. + * \return \c eRoot + */ + EType GetSkeletonTypeDefaultValue() const; + + /** Get the default value for the limb length. + * \return 1.0 + */ + double GetLimbLengthDefaultValue() const; + + /** Get the default value for the limb node size. + * \return 100.0 + */ + double GetLimbNodeSizeDefaultValue() const; + + /** Set limb or limb node color. + * \param pColor RGB values for the limb color. + * \return \c true if skeleton type is \c eLimb or \c eLimbNode, \c false otherwise. + * \remarks Limb or limb node color is only set if skeleton type is \c eLimb or \c eLimbNode. + */ + bool SetLimbNodeColor(const FbxColor& pColor); + + /** Get limb or limb node color. + * \return Currently set limb color. + * \remarks Limb or limb node color is only valid if skeleton type is \c eLimb or \c eLimbNode. + */ + FbxColor GetLimbNodeColor() const; + + /** Get a flag to know if the limb node color was set. + * \return \c true if a call to SetLimbNodeColor() has been made. + * \remarks When the attribute is not set, the application can choose to ignore the attribute or use the default value. + * \remarks The flag is set back to \c false when Reset() is called. + */ + bool GetLimbNodeColorIsSet() const; + + /** Get the default value for the limb node color. + * \return R=0.8, G=0.8, B=0.8 + */ + FbxColor GetLimbNodeColorDefaultValue() const; + + /** To see if this skeleton is Root. + * \return \c true if this is root of the skeleton, \c false otherwise. + * \remarks if a skeleton node do not have a parent or its parent is not a skeleton node itself, then this + * skeleton is root in the hierarchy. + */ + bool IsSkeletonRoot() const; + + //@} + + + /** + * \name Property Names + */ + static const char* sSize; + static const char* sLimbLength; + + /** + * \name Property Default Values + */ + //@{ + static const FbxDouble sDefaultSize; + static const FbxDouble sDefaultLimbLength; + + + ////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////// + + /** This property handles the limb node size. + * + * To access this property do: Size.Get(). + * To set this property do: Size.Set(FbxDouble). + * + * Default value is 100.0 + */ + FbxPropertyT Size; + + /** This property handles the skeleton limb length. + * + * To access this property do: LimbLength.Get(). + * To set this property do: LimbLength.Set(FbxDouble). + * + * FbxSkeleton is a node attribute and it will be attached to a FbxNode which represents the transform. + * Given a chain of skeleton nodes the parent and child skeletons will be attached to a parent node and a child node. + * The orientation of the limb is computed from the vector between the parent and child position (from parent to child). + * The LimbLength represents the proportion + * of the parent node's position to the child node's position which is used to compute the actual limb length. + * The default value of 1.0 means the LimbLength is equal to the length between the parent and child node's position. + * So if the value is 0.5, it means the LimbLength will be half of the length between the parent and child node's position. + */ + FbxPropertyT LimbLength; + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + + void Reset( bool pResetProperties ); + + virtual const char* GetTypeName() const; + virtual FbxStringList GetTypeFlags() const; + + EType mSkeletonType; + + bool mLimbLengthIsSet; + bool mLimbNodeSizeIsSet; + bool mLimbNodeColorIsSet; + bool mSkeletonTypeIsSet; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_SKELETON_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxskin.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxskin.h new file mode 100644 index 00000000..6eed4202 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxskin.h @@ -0,0 +1,192 @@ +/**************************************************************************************** + + 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 fbxskin.h +#ifndef _FBXSDK_SCENE_GEOMETRY_SKIN_H_ +#define _FBXSDK_SCENE_GEOMETRY_SKIN_H_ + +#include + +#include + +#include + +class FbxCluster; +class FbxGeometry; + +/** Skin deformer class. + * + * A skin deformer contains clusters (FbxCluster). Each cluster acts on a subset of the geometry's + * control points, with different weights. For example, a mesh of humanoid shape + * can have a skin attached, that describes the way the humanoid mesh is deformed + * by bones. When the bones are animated, the clusters act on the geometry to + * animate it too. + * + * The corresponding deformer types are FbxDeformer::eSkin. + * \nosubgrouping + */ + +class FBXSDK_DLL FbxSkin : public FbxDeformer +{ + FBXSDK_OBJECT_DECLARE(FbxSkin, FbxDeformer); + +public: + /** Set deformation accuracy. + * \remarks Use the Accuracy option to set the accuracy of skin deformations. + * 100% is full accuracy and 1% is a rough estimation of the envelope deformation. + * \param pDeformAccuracy value for deformation accuracy. + */ + void SetDeformAccuracy(double pDeformAccuracy); + + /** Get deformation accuracy. + * \return deformation accuracy value. + */ + double GetDeformAccuracy() const; + + /** Set the geometry affected by this skin deformer. + * \param pGeometry Pointer to the geometry object to set. + * \return \c true on success, \c false otherwise. + */ + bool SetGeometry(FbxGeometry* pGeometry); + + /** Get the geometry affected by this skin deformer. + * \return a pointer to the geometry if set or NULL. + */ + FbxGeometry* GetGeometry(); + + /** Add a cluster. + * \param pCluster Pointer to the cluster object to add. + * \return \c true on success, \c false otherwise. + */ + bool AddCluster(FbxCluster* pCluster); + + /** Remove cluster at given index. + * \param pCluster Pointer to the cluster to remove from this skin deformer. + * \return Pointer to cluster or \c NULL if pCluster is not owned by this skin deformer. + */ + FbxCluster* RemoveCluster(FbxCluster* pCluster); + + /** Get the number of clusters. + * \return Number of clusters that have been added to this object. + */ + int GetClusterCount() const; + + /** Get cluster at given index. + * \param pIndex Index of cluster. + * \return Pointer to cluster or \c NULL if index is out of range. + */ + FbxCluster* GetCluster(int pIndex); + + /** Get cluster at given index. + * \param pIndex Index of cluster. + * \return Pointer to cluster or \c NULL if index is out of range. + */ + const FbxCluster* GetCluster(int pIndex) const; + + /** Get the type of the deformer. + * \return Deformer type identifier. + */ + EDeformerType GetDeformerType() const {return eSkin; }; + + /** \enum EType Skinning type. + * The skinning type decides which method will be used to do the skinning. + * - \e eRigid Type eRigid means rigid skinning, which means only one joint can influence each control point. + * - \e eLinear Type eLinear means the classic linear smooth skinning. + * - \e eDualQuaternion Type eDualQuaternion means the dual quaternion smooth skinning. + * - \e eBlend Type eBlend means to blend classic linear and dual quaternion smooth skinning according to blend weights. + */ + enum EType + { + eRigid, + eLinear, + eDualQuaternion, + eBlend + }; + + /** Set the skinning type. + * \param pType The skinning type. + */ + void SetSkinningType(EType pType); + + /** Get the skinning type. + * \return The skinning type. + */ + EType GetSkinningType() const; + + /** + * \name Control Points + * A skin has an array of indices to control points and associated blend weights. + * The indices refer to the control points in the instance of class FbxGeometry. + * The blend weights are the influence of the different skinning type over the + * deformation effect of the indexed control points. + */ + //@{ + + /** Add an element in both arrays of control point indices and blendWeights. + * \param pIndex The index of the control point. + * \param pBlendWeight The blend weight for this control point. The value should between 0 and 1. + * Any value that is less than 0 will be set to 0, any value that is greater than 1 will be set to 1. + * 0 means completely linear skinning, 1 means completely dual quaternion skinning, + * a value between 0 and 1 means the weighted blending of the above two skinning methods. + */ + void AddControlPointIndex(int pIndex, double pBlendWeight = 0); + + /** Get the length of the arrays of control point indices and blend weights. + * \return Length of the arrays of control point indices and blend weights. + * Returns 0 if no control point indices have been added or the arrays have been reset. + */ + int GetControlPointIndicesCount() const; + + /** Get the array of control point indices. + * \return Pointer to the array of control point indices. + * \c NULL if no control point indices have been added or the array has been reset. + */ + int* GetControlPointIndices() const; + + /** Get the array of control point blend weights. + * \return Pointer to the array of control point blend weights. + * \c NULL if no control point indices have been added or the array has been reset. + */ + double* GetControlPointBlendWeights() const; + + /** Set the array size for the three arrays: the array of control point indices, the array of weights + * and the array of blend weights. + * \param pCount The new count. + */ + void SetControlPointIWCount(int pCount); + + //@} + +/***************************************************************************************************************************** +** 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 + virtual void Compact(); + virtual FbxObject& Copy(const FbxObject& pObject); + virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual FbxStringList GetTypeFlags() const; + + // Skin deformer + double mDeformAccuracy; + EType mSkinningType; + + //Control points + FbxArray mControlPointIndices; + FbxArray mControlPointBlendWeights; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_SKIN_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxsubdeformer.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxsubdeformer.h new file mode 100644 index 00000000..53c7876f --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxsubdeformer.h @@ -0,0 +1,100 @@ +/**************************************************************************************** + + 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 fbxsubdeformer.h +#ifndef _FBXSDK_SCENE_GEOMETRY_SUB_DEFORMER_H_ +#define _FBXSDK_SCENE_GEOMETRY_SUB_DEFORMER_H_ + +#include + +#include + +#include + +/** Base class for cluster sub-deformer( FbxCluster) and blend shape channel sub-deformer( FbxBlendShapeChannel) + * + * The corresponding sub-deformer types are FbxSubDeformer::eCluster and FbxSubDeformer::eBlendShapeChannel. + * + * A cluster, or link, is an entity acting on a geometry (FbxGeometry). + * More precisely, the cluster acts on a subset of the geometry's control points. + * For each control point that the cluster acts on, the intensity of the cluster's + * action is modulated by a weight. The link mode (ELinkMode) specifies how + * the weights are taken into account. + * The cluster's link node specifies the node (FbxNode) that influences the + * control points of the cluster. If the node is animated, the control points + * will move accordingly. + * A cluster is usually part of a skin (see FbxDeformer, FbxSkin). For example, + * imagine a mesh representing a humanoid, and imagine a skeleton made of bones. + * Each bone is represented by a node in FBX. + * To bind the geometry to the nodes, + * we create a skin (FbxSkin). The skin has many clusters, each one corresponding + * to a bone. + * Each node influences some control + * points of the mesh. A node has a high influence on some of the points (high weight) + * and lower influence on some other points (low weight). Some points of the mesh + * are not affected at all by the bone, so they would not be part of the corresponding + * cluster. + * + * A blend shape channel is a sub-deformer to help blend shape deformer to organize the target shapes. + * One blend shape deformer can have multiple blend shape channels in parallel, and each of them can + * control one or multiple target shapes. If there are multiple target shapes connected to one channel, + * and each target shape could have its own full deformation percentage, for example, one channel could have 3 target shapes, + * whose full deform percentage are 30, to 80 to 100, then when the percent change from 0 to 100, the base geometry will + * deform from the first target shape to the last one, this is called In-Between blend-shapes. + * The blend shape channel also control the deform percent of each target shape or In-Between blend shape on it. + * \nosubgrouping + */ +class FBXSDK_DLL FbxSubDeformer : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxSubDeformer, FbxObject); + public: + + /** Set multi layer state flag. + * \param pMultiLayer If \c true, multi-layering is enabled. + */ + void SetMultiLayer(bool pMultiLayer); + + /** Get multilayer state. + * \return The state of the multi-layer flag. + */ + bool GetMultiLayer() const; + + + /** \enum EType Sub-deformer type + */ + enum EType + { + eUnknown, //!< Untyped sub-deformer + eCluster, //!< Type FbxCluster + eBlendShapeChannel //!< Type FbxBlendShapeChannel + }; + + /** Get the type of the sub-deformer. + * \return SubDeformer type identifier. + */ + virtual EType GetSubDeformerType() const { return eUnknown; } + +/***************************************************************************************************************************** +** 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 void Construct(const FbxObject* pFrom); + virtual FbxStringList GetTypeFlags() const { return FbxStringList(); } + + // Local + bool mMultiLayer; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_SUB_DEFORMER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxsubdiv.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxsubdiv.h new file mode 100644 index 00000000..fdf31af5 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxsubdiv.h @@ -0,0 +1,147 @@ +/**************************************************************************************** + + 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 fbxsubdiv.h +#ifndef _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_ +#define _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_ + +#include + +#include +#include + +#include + +class FbxMesh; + +/***************************************************************************************************************************** +** 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 FbxSubDiv : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxSubDiv, FbxGeometry); + +public: + enum EScheme + { + eCatmullClark, //Catmull CClark subdivision surface + eDooCSabin, //Doo CSabin subdivision surface + eLoop, //Loop subdivision surface + eLinear, //Linear subdivision surface + }; + + enum ETesselationPattern + { + eOddFractional, + eEvenFractional, + eInteger, + ePower2, //Max, Maya use this one + }; + + enum EDisplaySmoothness + { + eHull, + eRough, + eMedium, + eFine, + }; + + /** InitSubdivLevel Initialize the subdiv + * \param pLevelCount number of levels + * \param pScheme subdivision scheme + * \param pPattern Tessellation pattern + */ + void InitSubdivLevel(int pLevelCount, + EScheme pScheme = eCatmullClark, + ETesselationPattern pPattern = ePower2); + + virtual FbxNodeAttribute::EType GetAttributeType() const; + + + //max subdivision level number + static const int MAX_SUBDIV_LEVEL = 16; + + //subdiv levels in subdivision, including the base mesh and each subdiv levels + FbxArray mSubDivLevel; + + //Get the base mesh + FbxMesh* GetBaseMesh() const; + + //Get the mesh from finest level + FbxMesh* GetFinestMesh() const; + + //Set the finest mesh + bool SetFinestMesh(FbxMesh* pMesh); + + //Set the finest mesh + bool SetBaseMesh(FbxMesh* pMesh); + + //Get the mesh from specific level + FbxMesh* GetMesh(int pLevel) const; + + /** SetSubdivLevelMesh Set certain subdivision mesh + * \param pLevel working level + * \param pMesh new level mesh. pLevel = 0 means base mesh, + pLevel = MaxLevel -1 means finest mesh + */ + void SetSubdivLevelMesh(int pLevel, FbxMesh* pMesh); + + int GetLevelCount() const; + void SetLevelCount(int pLevelCount); + + int GetCurrentLevel() const; + void SetCurrentLevel(int pCurrentLevel); + + FbxMesh* GetCurrentMesh() const; + + FbxSubDiv::EScheme GetSubdivScheme() const; + + FbxSubDiv::ETesselationPattern GetTessPattern() const; + + void SetSubdivScheme(FbxSubDiv::EScheme pScheme); + + void SetTessPattern(FbxSubDiv::ETesselationPattern pPattern); + + FbxSubDiv::EDisplaySmoothness GetDisplaySmoothness() const; + + void SetDisplaySmoothness(FbxSubDiv::EDisplaySmoothness pSmoothness); + +private: + + //base geometry mesh for subdivision + FbxMesh* mBaseMesh; + + //finest geometry mesh for subdivision + FbxMesh* mFinestMesh; + + //current operating subdivision level + int mCurrLevel; + + //number of subdiv level + int mLevelCount; + + //scheme of subdiv + EScheme mScheme; + + //pattern of subdiv + ETesselationPattern mPattern; + + //display smoothness of subdiv + EDisplaySmoothness mSmoothness; +}; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxtrimnurbssurface.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxtrimnurbssurface.h new file mode 100644 index 00000000..2797ac9b --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxtrimnurbssurface.h @@ -0,0 +1,240 @@ +/**************************************************************************************** + + 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 fbxtrimnurbssurface.h +#ifndef _FBXSDK_SCENE_GEOMETRY_TRIM_NURBS_SURFACE_H_ +#define _FBXSDK_SCENE_GEOMETRY_TRIM_NURBS_SURFACE_H_ + +#include + +#include +#include +#include + +#include + +/** FbxBoundary describes a trimming boundary for a trimmed NURBS object. + * Note:Outer boundaries run counter-clockwise in UV space and inner + * boundaries run clockwise. An outer boundary represents the outer edges + * of the trimmed surface whereas the inner boundaries define "holes" in + * the surface. + */ +class FBXSDK_DLL FbxBoundary : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxBoundary, FbxGeometry); + +public: + + //! Properties + static const char* sOuterFlag; + + /** This property handles outer flag. + * + * Default value is false. + */ + FbxPropertyT OuterFlag; + + /** Adds an edge to this boundary. + * \param pCurve The curve to be appended to the end of this boundary + */ + void AddCurve( FbxNurbsCurve* pCurve ); + + /** Returns the number of edges within this boundary. + * \return The number of edges within this boundary + */ + int GetCurveCount() const; + + /** Returns the edge at the specified index. + * \param pIndex The specified index, no bound checking is done. + * \return The edge at the specified index if + * pIndex is in the range [0, GetEdgeCount() ), + * otherwise the return value is undefined. + */ + FbxNurbsCurve* GetCurve( int pIndex ); + + /** Returns the edge at the specified index. + * \param pIndex The specified index, no bound checking is done. + * \return The edge at the specified index if + * pIndex is in the range [0, GetEdgeCount() ), + * otherwise, the return value is undefined. + */ + const FbxNurbsCurve* GetCurve( int pIndex ) const; + + + //! Returns the type of node attribute. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + /** Detects if the point is in the boundary's control hull. + * \param pPoint The point to be detected. + * \return \c True if the point is in the boundary's control hull, returns \c false if it is not in the control hull. + */ + bool IsPointInControlHull(const FbxVector4& pPoint ); + + /** Computes the origin point in the boundary + * \return The origin point. + */ + FbxVector4 ComputePointInBoundary(); + +/***************************************************************************************************************************** +** 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 + virtual FbxObject& Copy(const FbxObject& pObject); + + void ClearCurves(); + void CopyCurves( FbxBoundary const& pOther ); + bool IsValid(bool mustClosed = true); + bool IsCounterClockwise(); + +protected: + virtual void ConstructProperties(bool pForceSet); + + void Reset(); + bool LineSegmentIntersect(const FbxVector4 & pStart1, const FbxVector4 & pEnd1, const FbxVector4 & pStart2, const FbxVector4 & pEnd2 ) const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** FbxTrimNurbsSurface describes a NURBS surface with regions + trimmed or cut away with trimming boundaries. + */ +class FBXSDK_DLL FbxTrimNurbsSurface : public FbxGeometry +{ + FBXSDK_OBJECT_DECLARE(FbxTrimNurbsSurface,FbxGeometry); +public: + //! Returns the type of node attribute. + virtual FbxNodeAttribute::EType GetAttributeType() const; + + + /** Returns the number of regions on this trimmed NURBS surface. + * Note: There is always at least one region. + * \return The number of regions + */ + int GetTrimRegionCount() const; + + /** Calls this function before adding boundaries to a new trim region. + * The number of regions is incremented on this call. + */ + void BeginTrimRegion(); + + /** Calls this function after the last boundary for a given region is added. + * If no boundaries are added between the calls to BeginTrimRegion + * and EndTrimRegion, the last region is removed. + */ + void EndTrimRegion(); + + /** Appends a trimming boundary to the set of trimming boundaries. + * The first boundary specified for a given trim region should be + * the outer boundary. All other boundaries are inner boundaries. + * This must be called after a call to BeginTrimRegion(). Boundaries + * cannot be shared among regions. Duplicate the boundary if necessary. + * \param pBoundary The boundary to add. + * \return \c True if the boundary is added successfully. + * If the boundary is not added successfully, returns \c false. + */ + bool AddBoundary( FbxBoundary* pBoundary ); + + /** Returns the boundary at a given index for the specified region + * \param pIndex The index of the boundary to retrieve, no bound checking is done. + * \param pRegionIndex The index of the region which is bordered by the boundary. + * \return The trimming boundary at index pIndex, + * if pIndex is in the range [0, GetBoundaryCount() ), + * otherwise the result is undefined. + */ + FbxBoundary* GetBoundary( int pIndex, int pRegionIndex = 0 ); + + /** Returns the boundary at a given index for the specified region + * \param pIndex The index of the boundary to retrieve, no bound checking is done. + * \param pRegionIndex The index of the region which is bordered by the boundary. + * \return The trimming boundary at index pIndex, + * if pIndex is in the range [0, GetBoundaryCount() ), + * otherwise the result is undefined. + */ + const FbxBoundary* GetBoundary( int pIndex, int pRegionIndex = 0 ) const; + + /** Returns the number of boundaries for a given region. + * \param pRegionIndex The index of the region. + * \return The number of trim boundaries for the given region. + */ + int GetBoundaryCount(int pRegionIndex = 0) const; + + /** Sets the NURBS surface that is trimmed by the trimming boundaries. + * \param pNurbs The NURBS surface to be trimmed. + */ + void SetNurbsSurface( const FbxNurbsSurface* pNurbs ); + + /** Returns the NURBS surface that is trimmed by the trim boundaries. + * \return A pointer to the (untrimmed) NURBS surface. + */ + FbxNurbsSurface* GetNurbsSurface(); + + /** Returns the NURBS surface that is trimmed by the trim boundaries. + * \return A pointer to the (untrimmed) NURBS surface. + */ + const FbxNurbsSurface* GetNurbsSurface() const; + + /** Sets the flag which indicates whether the surface normals are flipped. + * You can flip the normals of the surface to reverse the surface. + * \param pFlip If \c true, the surface is reversed. If it is false, the surface is not reversed. + */ + inline void SetFlipNormals( bool pFlip ) { mFlipNormals = pFlip; } + + /** Checks if the normals are flipped. + * \return \c True if normals are flipped, returns \c false if they are not flipped. + */ + inline bool GetFlipNormals() const { return mFlipNormals; } + + virtual int GetControlPointsCount() const; + + /** Sets the control point and the normal values for a specified index. + * \param pCtrlPoint The value of the control point. + * \param pNormal The value of the normal. + * \param pIndex The specified index. + * \param pI2DSearch Unused in this implementation. + */ + virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint, const FbxVector4 &pNormal , int pIndex, bool pI2DSearch = false); + + /** Sets the control point for a specified index. + * \param pCtrlPoint The value of the control point. + * \param pIndex The specified index. + */ + virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint, int pIndex) { ParentClass::SetControlPointAt(pCtrlPoint, pIndex); } + + /** Returns the NURBS surface's control points. + * \param pStatus The FbxStatus object to hold error codes. + */ + virtual FbxVector4* GetControlPoints(FbxStatus* pStatus = NULL) 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 + virtual FbxObject& Copy(const FbxObject& pObject); + + bool IsValid(bool mustClosed = true); + void ClearBoundaries(); + void CopyBoundaries( FbxTrimNurbsSurface const& pOther ); + bool IsValid(int pRegion, bool mustClosed = true); + void RebuildRegions(); + +protected: + virtual void Construct(const FbxObject* pFrom); + +private: + bool mFlipNormals; + FbxArray mRegionIndices; + bool mNewRegion; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_TRIM_NURBS_SURFACE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxvertexcachedeformer.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxvertexcachedeformer.h new file mode 100644 index 00000000..9200b78d --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxvertexcachedeformer.h @@ -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 fbxvertexcachedeformer.h +#ifndef _FBXSDK_SCENE_GEOMETRY_VERTEX_CACHE_DEFORMER_H_ +#define _FBXSDK_SCENE_GEOMETRY_VERTEX_CACHE_DEFORMER_H_ + +#include + +#include +#include + +#include + +/** \brief This class deforms control points of a geometry using control point positions + * stored in the associated cache object. + * \nosubgrouping + */ +class FBXSDK_DLL FbxVertexCacheDeformer : public FbxDeformer +{ + FBXSDK_OBJECT_DECLARE(FbxVertexCacheDeformer, FbxDeformer); + +public: + //! Vertex cache deformer data type + enum ECacheChannelType + { + ePositions, //!< This vertex cache deformer handles positions + eNormals, //!< This vertex cache deformer handles normals + eUVs, //!< This vertex cache deformer handles uvs + eTangents, //!< This vertex cache deformer handles tangents + eBinormals, //!< This vertex cache deformer handles binormals + eUserDefined //!< This vertex cache deformer handles user specified data (the cache channel string can provide a hint) + }; + + /** Assign a cache object to be used by this deformer. + * \param pCache The cache object. */ + void SetCache(FbxCache* pCache); + + /** Get the cache object used by this deformer. + * \return A pointer to the cache object used by this deformer, or \c NULL if no cache object is assigned. */ + FbxCache* GetCache() const; + + //! Indicate if the deformer is active or not. + FbxPropertyT Active; + + //! The channel name used in the cache file + FbxPropertyT Channel; + + //! The cache set used by this vertex cache deformer + FbxPropertyT CacheSet; + + //! The vertex cache deformer type + FbxPropertyT 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 + virtual FbxObject& Copy(const FbxObject& pObject); + virtual EDeformerType GetDeformerType() const { return FbxDeformer::eVertexCache; } + +protected: + virtual void ConstructProperties(bool pForceSet); + virtual FbxStringList GetTypeFlags() const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxVertexCacheDeformer::ECacheChannelType&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_VERTEX_CACHE_DEFORMER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/geometry/fbxweightedmapping.h b/libs/fbx/include/fbxsdk/scene/geometry/fbxweightedmapping.h new file mode 100644 index 00000000..c859f4b5 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/geometry/fbxweightedmapping.h @@ -0,0 +1,139 @@ +/**************************************************************************************** + + 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 fbxweightedmapping.h +#ifndef _FBXSDK_SCENE_GEOMETRY_WEIGHTED_MAPPING_H_ +#define _FBXSDK_SCENE_GEOMETRY_WEIGHTED_MAPPING_H_ + +#include + +#include + +#include + +/** Define a weighted bidirectional mapping relation on objects. + * \nosubgrouping + * There are two object set. The source object of mapping is in source set. + * The destination object is in destination set. + * Each object can have multiple mapping relation with other objects. + */ +class FBXSDK_DLL FbxWeightedMapping +{ +public: + /** Object set type in the mapping relation. + */ + enum ESet + { + eSource, //!< Object is as source. + eDestination //!< Object is as destination. + }; + + /** Record one mapping from one object. */ + struct Element + { + //! The index of another object in the mapping in the another ESet array. + int mIndex; + //! Weight of the mapping. + double mWeight; + }; + + /** + * \name Constructor and Destructor + */ + //@{ + + /** Constructor. + * Initialize the source set and destination set. + * \param pSourceSize Source set size + * \param pDestinationSize Destination set size + */ + FbxWeightedMapping(int pSourceSize, int pDestinationSize); + + //! Destructor. + ~FbxWeightedMapping(); + //@} + + + /** Remove all weighted relations and give new source and destination sets sizes. + * \param pSourceSize New source set size. + * \param pDestinationSize New destination set size. + */ + void Reset(int pSourceSize, int pDestinationSize); + + /** Add a weighted mapping relation. + * \param pSourceIndex Index of the source object. + * \param pDestinationIndex Index of the destination object. + * \param pWeight Weight of the mapping. + */ + void Add(int pSourceIndex, int pDestinationIndex, double pWeight); + + /** Get the number of elements of a set. + * \param pSet source or destination set. + */ + int GetElementCount(ESet pSet) const; + + /** Get the number of relations an element of a set is linked to. + * For example, for one object (which index is specified by pElement) in source set (specified by pSet), + * the function return how many objects (as destination) the object (as source) mapping to. + * \param pSet Source or destination set. + * \param pElement Object index in the set. + */ + int GetRelationCount(ESet pSet, int pElement) const; + + /** Get one of the relations an element of a set is linked to. + * \param pSet Source or destination set. + * \param pElement Object index in the set. + * \param pIndex Relation index of the object linked to. + * \return Element gives the index of an element in the other set and the assigned weight. + */ + Element& GetRelation(ESet pSet, int pElement, int pIndex); + + /** Given the index of an element in the other set, get the index of one of the relations + * an element of a set is linked to. Returns -1 if there is not relation between these elements. + * \param pSet Source or destination set. + * \param pElementInSet Object index in the set. + * \param pElementInOtherSet Object index in another set. + * \return The index of one of the relations, -1 if there is not relation between these elements. + */ + int GetRelationIndex(ESet pSet, int pElementInSet, int pElementInOtherSet) const; + + /** Get the sum of the weights from the relations an element of a set is linked to. + * \param pSet Source or destination set. + * \param pElement Object index in the set. + * \param pAbsoluteValue Flag to convert negative value to positive value. + * \return The sum of the weights from the relations. + */ + double GetRelationSum(ESet pSet, int pElement, bool pAbsoluteValue) const; + + + /** Normalize the weights of the relations of all the elements of a set. + * \param pSet Source or destination set. + * \param pAbsoluteValue Flag to convert negative value to positive value. + */ + void Normalize(ESet pSet, bool pAbsoluteValue); + + FbxWeightedMapping& operator=(const FbxWeightedMapping& pWMap); + +private: + + //! Remove all weighted relations. + void Clear(); + + FbxArray*> mElements[2]; + +}; + +typedef class FbxArray FbxArrayTemplateElement; +typedef class FbxArray*> FbxArrayTemplateArrayTemplateElement; + +#include + +#endif /* _FBXSDK_SCENE_GEOMETRY_WEIGHTED_MAPPING_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxbindingoperator.h b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingoperator.h new file mode 100644 index 00000000..d6dd99ae --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingoperator.h @@ -0,0 +1,859 @@ +/**************************************************************************************** + + 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 fbxbindingoperator.h +#ifndef _FBXSDK_SCENE_SHADING_BINDING_OPERATOR_H_ +#define _FBXSDK_SCENE_SHADING_BINDING_OPERATOR_H_ + +#include + +#include + +#include + +/** This object represents a binding operation on a FbxObject or FbxProperty. + * For example, FbxBindingOperator can be used to bind a light object + * to a parameter of shader via FbxNodeDirectionBOF or FbxNodePositionBOF. + * \code + * //Create an entry lEntry of binding table lTable. + * FbxBindingTableEntry& lEntry = lTable->AddNewEntry(); + * + * //Create a NodePositionConvert binding operator and add it as source of the lEntry. + * FbxOperatorEntryView lSrc(&lEntry, true, true); + * lSrc.SetOperatorName( "NodePositionConvert"); + * FbxBindingOperator* lOp = pImpl.AddNewBindingOperator( "NodePositionConvert", FbxNodePositionBOF::FunctionName); + * + * //Add a property entry to the binding operator. + * FbxBindingTableEntry& lEntryPropParam = lOp->AddNewEntry(); + * FbxPropertyEntryView lPropSrc(&lEntryPropParam, true, true); + * //Set the shader parameter (the property's name) as source of the lEntryPropParam. + * lPropSrc.SetProperty(lProp.GetHierarchicalName()); + * //Set the operator function FbxNodePositionBOF as destination of the lEntryPropParam. + * lEntryPropParam.SetDestination( FbxNodePositionBOF::FunctionName ); + * + * //Set the shader parameter as destination of the lEntry. + * FbxSemanticEntryView lDst( &lEntry, false, true ); + * lDst.SetSemantic( lProp.GetName() ); + * \endcode + * \nosubgrouping + * \see FbxOperatorEntryView, FbxBindingTableEntry, FbxPropertyEntryView + */ +class FBXSDK_DLL FbxBindingOperator : public FbxBindingTableBase +{ + FBXSDK_OBJECT_DECLARE(FbxBindingOperator, FbxBindingTableBase); + +public: + /** Run the operator on the given object. + * \param pObject The object that will be evaluated. + * \param pResult A pointer to a buffer to hold the result. + * \return \c true on success, \c false otherwise. + */ + template + bool Evaluate(const FbxObject* pObject, FBXTYPE* pResult) const + { + EFbxType lResultType; + void* lResult = NULL; + + bool lSuccess = Evaluate(pObject, &lResultType, &lResult); + + if (lSuccess) + { + FbxTypeCopy(*pResult, lResult, lResultType); + } + + FreeEvaluationResult(lResultType, lResult); + + return lSuccess; + } + + /** Run the inverse operator on the given object, + * assigning the result directly to the object. + * \param pObject The object that will be evaluated. + * \param pInOut Type of value being reversed. + * \param setObj Control to set the property (only to query by the default ). + * \param index Used only in FbxMultiplyDistBOF. + * \return \c true on success, \c false otherwise. + */ + template + bool ReverseEvaluation(const FbxObject* pObject, FBXTYPE * pInOut, + bool setObj=false, int index=0) const + { + + const void* lIn = pInOut; + void* lOut = NULL; + EFbxType lOutType; + + bool lSuccess = ReverseEvaluate(pObject, lIn, &lOut, &lOutType, setObj, index); + + if (lSuccess) + { + FbxTypeCopy(*pInOut, lOut, lOutType); + } + + FreeEvaluationResult(lOutType, lOut); + + return lSuccess; + } + + /** Evaluate the value of an operator parameter. + * \param pObject The object that will be evaluated. + * \param pEntryDestinationName The name of the parameter. + * This is used to get the property or operator that is related to this parameter, + * then to evaluate the property or operator. + * \param pResult A pointer to the result. + * \return \c true on success, \c false otherwise. + * \remarks This method can handle different types of entries. For property entry and constant entry, + * this method will find out the property via the pEntryDestinationName and then evaluate its value; + * for operator entry, this method will find out the operator via the pEntryDestinationName and + * evaluate the operator function to get the property's value; for any other types of entry, this method + * is meaningless. + */ + template + bool EvaluateEntry(const FbxObject* pObject, const char* pEntryDestinationName, FBXTYPE* pResult) const + { + EFbxType lResultType; + void* lResult = NULL; + + bool lSuccess = EvaluateEntry(pObject, pEntryDestinationName, &lResultType, &lResult); + + if (lSuccess) + { + FbxTypeCopy(*pResult, lResult, lResultType); + } + + FreeEvaluationResult(lResultType, lResult); + + return lSuccess; + } + + /** This property stores the name of function. + * + * Default value is "". + */ + FbxPropertyT FunctionName; + + /** This property stores the name of target. + * + * Default value is "". + */ + FbxPropertyT TargetName; + + ////////////////////////////////////////////////////////////////////////// + // Static values + ////////////////////////////////////////////////////////////////////////// + + //! Function name. + static const char* sFunctionName; + //! Target name. + static const char* sTargetName; + + //! Default value for function name. + static const char* sDefaultFunctionName; + //! Default value for target name. + static const char* sDefaultTargetName; + + + ////////////////////////////////////////////////////////////////////////// + // Functions + ////////////////////////////////////////////////////////////////////////// + + /** \internal + * + */ + static void RegisterFunctions(); + + /** \internal + * + */ + static void UnregisterFunctions(); + + + /** It represents a binding relationship between current object and the target. + * Any binding operation need to specify a certain kind of binding function. + * \nosubgrouping + */ + class FBXSDK_DLL Function + { + public: + //!Destructor. + virtual ~Function() {} + + /** Run the operator on the given object. + * \param pOperator The operator that will be applied. + * \param pObject The object that will be evaluated. + * \param pResultType Will be filled by the type of the result. + * \param pResult Will be filled by a pointer to a buffer that hold the result. + * The caller must call FreeEvaluationResult() when it is done with this pointer. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const = 0; + + /** Run the inverse operator on the given object, + * assigning the result directly to the object. + * \param pOperator The operator that will be applied. + * \param pTarget The object that will be evaluated. + * \param pIn + * \param pOut + * \param pOutType Type of value being reversed. + * \param setObj Control to set the property (only to query by the default ). + * \param index Used only in FbxMultiplyDistBOF. + * \return \c true on success, \c false otherwise. + */ + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const = 0; + }; + + /** The abstract factory class for binding function. + * \nosubgrouping + */ + class FBXSDK_DLL FunctionCreatorBase + { + public: + //!Destructor. + virtual ~FunctionCreatorBase() {} + + /** Get name of the function. + * \return The name of the function. + */ + virtual const char* GetFunctionName() const = 0; + + /** Create the function. + */ + virtual Function* CreateFunction() const = 0; + }; + + /** The concrete factory class for binding function. + * \nosubgrouping + */ + template + class FunctionCreator : public FunctionCreatorBase + { + public: + + /** Get Name of the operation function. + * \return The Name of the operation function. + */ + virtual const char* GetFunctionName() const + { + return FUNCTION::FunctionName; + } + + /** Create the operation function. + */ + virtual Function* CreateFunction() const + { + return FbxNew< FUNCTION >(); + } + }; + + /** This utility class is used to register and unregister the binding function creators. + * \nosubgrouping + */ + class FBXSDK_DLL FunctionRegistry + { + public: + /** To register the binding function creator. + * \param pCreator The binding function creator to register. + */ + static void RegisterFunctionCreator(FunctionCreatorBase const& pCreator) + { + sRegistry.Insert(pCreator.GetFunctionName(), &pCreator); + } + + /** To unregister the binding function creator. + * \param pCreator The binding function creator to unregister. + */ + static void UnregisterFunctionCreator(FunctionCreatorBase const& pCreator) + { + sRegistry.Remove(pCreator.GetFunctionName()); + } + + /** To find the binding function creator by name. + * \param pName The name of the operation function creator to find. + */ + static const FunctionCreatorBase* FindCreator(const char* pName) + { + RegistryType::RecordType* lRecord = sRegistry.Find(pName); + + if (lRecord) + { + return lRecord->GetValue(); + } + else + { + return NULL; + } + } + + private: + typedef FbxMap RegistryType; + static RegistryType sRegistry; + }; + + +/***************************************************************************************************************************** +** 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 EvaluateEntry(const FbxObject* pObject, const char* pEntryDestinationName, EFbxType* pResultType, void** pResult) const; + bool GetEntryProperty(const FbxObject* pObject, const char* pEntryDestinationName, FbxProperty & pProp) const; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + virtual void ConstructProperties(bool pForceSet); + + void InstantiateFunction(); + bool Evaluate(const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + bool ReverseEvaluate(const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) const; + void FreeEvaluationResult(EFbxType pResultType, void* pResult) const; + + Function* mFunction; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** An evaluation operator to get the position of the node that is bound with this operator via a certain property. + * The position of the node is represented by translation. + */ +class FbxNodePositionBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluate the position of the node that is bound with this operator via a certain property. + * The position of the node is represented by translation. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned, eFbxDouble4 in this case. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + + //! Inverse evaluation for this binding function is not implemented yet. + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxNodePositionBOF(); + virtual ~FbxNodePositionBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** An evaluation operator to get the direction of the node that is bound with this operator via a certain property. + * The direction of the node is represented by Euler rotation. + */ +class FbxNodeDirectionBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluate the direction of the node that is bound with this operator via a certain property. + * The direction of the node is represented by Euler rotation. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned, eFbxDouble4 in this case. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + + //! Inverse evaluation for this binding function is not implemented yet. + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxNodeDirectionBOF(); + virtual ~FbxNodeDirectionBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** A pass through operator used to assign constants to parameters. +*/ +class FbxAssignBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object property specified by "X" and returns it. + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType Will be filled by the type of the result. + * \param pResult Will be filled by a pointer to a buffer that hold the result. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + + //! Inverse evaluation for this binding function is not implemented yet. + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxAssignBOF(); + virtual ~FbxAssignBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** A conditional operator that outputs one out of two properties, based on + * the value of a predicate property. + */ +class FbxConditionalBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object property specified by "predicate". + * If the property value is true (!= 0, != ""), returns the value of the + * property specified by "ifTrue", else returns the value of the property + * specified by "ifFalse". + * + * Currently the data types supported for the input property are + * limited to "integer", "boolean", "float", "double" and "string". + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxConditionalBOF(); + virtual ~FbxConditionalBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** A switch operator that outputs one out of n properties, based on + * the value of a predicate property. + */ +class FbxSwitchBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object property specified by "predicate". + * Returns the value of the property specified by "case_n", where n + * is the value of "predicate". If there is no case_n entry, returns + * the value of the property specified by "default". + * + * Currently the data types supported for the predicate property are + * limited to "integer" and "boolean". + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxSwitchBOF(); + virtual ~FbxSwitchBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +class FbxTRSToMatrixBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object properties specified by "T", "R" and "S" and + * return a transform matrix. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxTRSToMatrixBOF(); + virtual ~FbxTRSToMatrixBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +class FbxAddBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object properties specified by "X" and "Y" + * return X+Y as a float. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxAddBOF(); + virtual ~FbxAddBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +class FbxSubstractBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object properties specified by "X" and "Y" + * return X-Y as a float. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxSubstractBOF(); + virtual ~FbxSubstractBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +class FbxMultiplyBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object properties specified by "X" and "Y" + * return X*Y as a float. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + //Set index to 1 to get realWorldScale. + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxMultiplyBOF(); + virtual ~FbxMultiplyBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +class FbxMultiplyDistBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object properties specified by "X" and "Y" + * return X*Y as a float. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxMultiplyDistBOF(); + virtual ~FbxMultiplyDistBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +class FbxOneOverXBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object properties specified by "X" + * return 1/X as a float. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxOneOverXBOF(); + virtual ~FbxOneOverXBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +class FbxPowerBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object properties specified by "X" and "Y" + * return X^Y as a float. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxPowerBOF(); + virtual ~FbxPowerBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +class FbxDegreeToRadianBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object property specified by "X" + * return X converted to radian as a float. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxDegreeToRadianBOF(); + virtual ~FbxDegreeToRadianBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +class FbxVectorDegreeToVectorRadianBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object property specified by "X" + * return X converted to radian as a vector3. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxVectorDegreeToVectorRadianBOF(); + virtual ~FbxVectorDegreeToVectorRadianBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + + +class FbxSphericalToCartesianBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Evaluates the object property specified by "rho", "theta" and "phi" + * return the converted Cartesian coordinates as a double3. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxSphericalToCartesianBOF(); + virtual ~FbxSphericalToCartesianBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + + +class FbxIsYupBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Check if the scene coordinate system is y-up + * return a bool. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxIsYupBOF(); + virtual ~FbxIsYupBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + + +/** A symbol(string) operator that search the string table and return its corresponding unique id, based on + * the value of a predicate property. + */ +class FbxSymbolIDBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Check in the symbol table the string and returns its unique ID as an integer + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxSymbolIDBOF(); + virtual ~FbxSymbolIDBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + + +/** A chooser operator that check spot distribution and returns the correct value, based on + * the value of a predicate property. + */ +class FbxSpotDistributionChooserBOF : public FbxBindingOperator::Function +{ +public: + //! Name of the operation function. + static const char* FunctionName; + + /** Check the enum of the spot distribution and returns the correct value + * as an int. + * + * \param pOperator Operator running on the object. + * \param pObject The object that will be evaluated. + * \param pResultType The type of the result to be returned. + * \param pResult A pointer to a buffer that can hold the result. + * \return \c true on success, \c false otherwise. + */ + virtual bool Evaluate(const FbxBindingOperator* pOperator, const FbxObject* pObject, EFbxType* pResultType, void** pResult) const; + + //! Inverse evaluation for this binding function is not implemented yet. + virtual bool ReverseEvaluate(const FbxBindingOperator* pOperator, const FbxObject* pTarget, const void* pIn, void** pOut, EFbxType* pOutType, bool setObj, int index) 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 + FbxSpotDistributionChooserBOF(); + virtual ~FbxSpotDistributionChooserBOF(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_BINDING_OPERATOR_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxbindingsentryview.h b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingsentryview.h new file mode 100644 index 00000000..9d3a817b --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingsentryview.h @@ -0,0 +1,63 @@ +/**************************************************************************************** + + 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 fbxbindingsentryview.h +#ifndef _FBXSDK_SCENE_SHADING_BINDINGS_ENTRY_VIEW_H_ +#define _FBXSDK_SCENE_SHADING_BINDINGS_ENTRY_VIEW_H_ + +#include + +#include + +#include + +/** FbxBindingsEntryView represents binding table entry in entry tables. + * The name of the binding table can be used as source or destination for the binding entry. + * \see FbxBindingTableEntry and FbxBindingTable. + */ +class FBXSDK_DLL FbxBindingsEntryView : public FbxEntryView +{ +public: + /** Name of the entry type used in the binding entry. + * It should be "FbxBindingsEntry" in this case. + */ + static const char* sEntryType; + + /** Constructor. + * \param pEntry The binding table entry to create the entry view for. + * \param pAsSource \c true to create the entry view as source, \c false as destination. + * \param pCreate \c true to create the entry view, \c false otherwise. + */ + FbxBindingsEntryView( FbxBindingTableEntry* pEntry, bool pAsSource, bool pCreate = false ); + + //! Destructor. + ~FbxBindingsEntryView(); + + /** Get the binding table's name for the binding entry. + * \return The binding table's name. + */ + const char* GetBindingTableName() const; + + /** Set the binding table's name for binding entry. + * \param pName The binding table's name to set. + */ + void SetBindingTableName(const char* pName); + + /** Get the entry type. + * \return Entry type as string "FbxBindingsEntry". + * \remarks Always use EntryType() to get the right entry type. + */ + virtual const char* EntryType() const; +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_BINDINGS_ENTRY_VIEW_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxbindingtable.h b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingtable.h new file mode 100644 index 00000000..b9a74ea9 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingtable.h @@ -0,0 +1,147 @@ +/**************************************************************************************** + + 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 fbxbindingtable.h +#ifndef _FBXSDK_SCENE_SHADING_BINDING_TABLE_H_ +#define _FBXSDK_SCENE_SHADING_BINDING_TABLE_H_ + +#include + +#include + +#include + +/** A binding table represents a collection of bindings + * from source types such as FbxObject, or FbxLayerElements + * to corresponding destinations, usually a third party shader parameters. + * Binding represents a link between internal object(e.g. FbxObject) and + * external object(e.g. HLSL shader parameters). + * \nosubgrouping + * \see FbxBindingOperator, FbxBindingTableBase + */ +class FBXSDK_DLL FbxBindingTable : public FbxBindingTableBase +{ + FBXSDK_OBJECT_DECLARE(FbxBindingTable, FbxBindingTableBase); + +public: + /** This property stores the name of target. + * + * Default value is "". + */ + FbxPropertyT TargetName; + + /** This property stores the type of target. + * + * Default value is "". + */ + FbxPropertyT TargetType; + + /** Relative URL of file containing the shader implementation description. + * e.g.: ./shader.mi + * Default value is "". + */ + FbxPropertyT DescRelativeURL; + + /** Absolute URL of file containing the shader implementation description. + * e.g.: file:///usr/tmp/shader.mi + * Default value is "". + */ + FbxPropertyT DescAbsoluteURL; + + /** Identify the shader to use in previous description's URL. + * e.g.: MyOwnShader + * Default value is "". + */ + FbxPropertyT DescTAG; + + /** Relative URL of file containing the shader implementation code. + * e.g.: ./bin/shader.dll + * Default value is "". + */ + FbxPropertyT CodeRelativeURL; + + /** Absolute URL of file containing the shader implementation code. + * e.g.: file:///usr/tmp/bin/shader.dll + * Default value is "". + */ + FbxPropertyT CodeAbsoluteURL; + + /** Identify the shader function entry to use in previous code's URL. + * e.g.: MyOwnShaderFunc + * Default value is "". + */ + FbxPropertyT CodeTAG; + + ////////////////////////////////////////////////////////////////////////// + // Static values + ////////////////////////////////////////////////////////////////////////// + + //! Target name. + static const char* sTargetName; + + //! Target type. + static const char* sTargetType; + + //! Relative URL for shader description. + static const char* sDescRelativeURL; + + //! Absolute URL for shader description. + static const char* sDescAbsoluteURL; + + //! Identify the shader to use in previous description's URL. + static const char* sDescTAG; + + //! Relative URL for shader code. + static const char* sCodeRelativeURL; + + //! Absolute URL for shader code. + static const char* sCodeAbsoluteURL; + + //! Identify the shader function entry to use in previous code's URL. + static const char* sCodeTAG; + + + //! Default value for target name. + static const char* sDefaultTargetName; + + //! Default value for target type. + static const char* sDefaultTargetType; + + //! Default value for relative URL for shader description. + static const char* sDefaultDescRelativeURL; + + //! Default value for absolute URL for shader description. + static const char* sDefaultDescAbsoluteURL; + + //! Default value for identifying the shader to use in previous description's URL. + static const char* sDefaultDescTAG; + + //! Default value for relative URL for shader code. + static const char* sDefaultCodeRelativeURL; + + //! Default value for absolute URL for shader code. + static const char* sDefaultCodeAbsoluteURL; + + //! Default value for identifying the shader function entry to use in previous code's URL. + static const char* sDefaultCodeTAG; + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_BINDING_TABLE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxbindingtablebase.h b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingtablebase.h new file mode 100644 index 00000000..12fe91fa --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingtablebase.h @@ -0,0 +1,86 @@ +/**************************************************************************************** + + 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 fbxbindingtablebase.h +#ifndef _FBXSDK_SCENE_SHADING_BINDING_TABLE_BASE_H_ +#define _FBXSDK_SCENE_SHADING_BINDING_TABLE_BASE_H_ + +#include + +#include +#include +#include + +#include + +/** A binding table represents a collection of bindings + * from source types such as FbxObject, or FbxLayerElements + * to destinations which can be of similar types. + * \see FbxBindingTableEntry. + * \nosubgrouping + */ +class FBXSDK_DLL FbxBindingTableBase : public FbxObject +{ + FBXSDK_ABSTRACT_OBJECT_DECLARE(FbxBindingTableBase,FbxObject); + +public: + /** Adds a new entry to the binding table. + * \return The new entry. + */ + FbxBindingTableEntry& AddNewEntry(); + + /** Query the number of table entries. + * \return The number of entries. + */ + size_t GetEntryCount() const; + + /** Access a table entry. + * \param pIndex Valid range is [0, GetEntryCount()-1]. + * \return A valid table entry if pIndex is valid. Otherwise the value is undefined. + */ + FbxBindingTableEntry const& GetEntry( size_t pIndex ) const; + + /** Access a table entry. + * \param pIndex Valid range is [0, GetEntryCount()-1]. + * \return A valid table entry if pIndex is valid. Otherwise the value is undefined. + */ + FbxBindingTableEntry& GetEntry( size_t pIndex ); + + /** Retrieve the table entry for the given source value. + * \param pSrcName The source value to query. + * \return The corresponding entry, or NULL if no entry in + * the table has a source equal in value to pSrcName. + */ + const FbxBindingTableEntry* GetEntryForSource(const char* pSrcName) const; + + /** Retrieve the table entry for the given destination value. + * \param pDestName The destination value to query. + * \return The corresponding entry, or NULL if no entry in + * the table has a destination equal in value to pDestName. + */ + const FbxBindingTableEntry* GetEntryForDestination(const char* pDestName) 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 + // Remark: This method copies the mEntries table AND clears the UserData on the resulting copy to prevent shared memory + // data between clones/copies. + virtual FbxObject& Copy(const FbxObject& pObject); + +private: + FbxDynamicArray mEntries; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_BINDING_TABLE_BASE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxbindingtableentry.h b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingtableentry.h new file mode 100644 index 00000000..7a840f75 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxbindingtableentry.h @@ -0,0 +1,117 @@ +/**************************************************************************************** + + 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 fbxbindingtableentry.h +#ifndef _FBXSDK_SCENE_SHADING_BINDING_TABLE_ENTRY_H_ +#define _FBXSDK_SCENE_SHADING_BINDING_TABLE_ENTRY_H_ + +#include + +#include + +#include + +/** A binding table entry stores a binding between a source and a + * destination. Users should not instantiate this class directly, + * but always call FbxBindingTableBase::AddNewEntry() to create + * a new entry in the binding table. + * \nosubgrouping + */ +class FBXSDK_DLL FbxBindingTableEntry +{ +public: + /** + *\name Constructor and Destructor + */ + //@{ + //!Constructor. + FbxBindingTableEntry(); + + /**Copy constructor. + * \param pEntry FbxBindingTableEntry to be copied. + * \remark the UserDataPtr is a shared pointer. + */ + FbxBindingTableEntry(const FbxBindingTableEntry& pEntry); + + //!Destructor. + ~FbxBindingTableEntry(); + //@} + + /** + * \name Access + */ + //@{ + /** Set the source. + * \param pSource The source to set. + */ + void SetSource( const char* pSource ); + + //!Retrieve the source. + const char* GetSource() const; + + /** Set the destination. + * \param pDestination The destination to set. + */ + void SetDestination( const char* pDestination ); + + //!Retrieve the destination. + const char* GetDestination() const; + + /** Set the source type or destination type. + * \param pType The source type or destination type to set. + * \param pAsSource Flag indicates source type or destination type to set. + */ + void SetEntryType( const char* pType, bool pAsSource ); + + /** Get the source type or destination type. + * \param pAsSource Flag indicates source type or destination type to get. + * \return Source type or destination type. + */ + const char* GetEntryType( bool pAsSource ) const; + + /** Retrieve user data pointer. + * \return User data pointer. + */ + void* GetUserDataPtr(); + + /** Retrieve user data pointer. + * \return User data pointer. + */ + const void* GetUserDataPtr() const; + + /** Set user data pointer. + * \param pData user data pointer. + */ + void SetUserDataPtr(void* pData ); + //@} + + /** Assignment operator. + * \param pEntry FbxBindingTableEntry assigned to this one. + * \remark the UserDataPtr is a shared pointer. + */ + FbxBindingTableEntry& operator=(const FbxBindingTableEntry& pEntry); + +/***************************************************************************************************************************** +** 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: + FbxString mSource; + FbxString mDestination; + FbxString mSourceType; + FbxString mDestinationType; + void* mData; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_BINDING_TABLE_ENTRY_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxconstantentryview.h b/libs/fbx/include/fbxsdk/scene/shading/fbxconstantentryview.h new file mode 100644 index 00000000..63f500df --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxconstantentryview.h @@ -0,0 +1,65 @@ +/**************************************************************************************** + + 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 fbxconstantentryview.h +#ifndef _FBXSDK_SCENE_SHADING_CONSTANT_ENTRY_VIEW_H_ +#define _FBXSDK_SCENE_SHADING_CONSTANT_ENTRY_VIEW_H_ + +#include + +#include + +#include + +class FbxBindingTableEntry; + +/** FbxConstantEntryView represents constant string entry in entry tables. + * The constant string can be used as source or destination for the binding entry. + * \see FbxBindingTableEntry and FbxBindingTable. + */ +class FBXSDK_DLL FbxConstantEntryView : public FbxEntryView +{ +public: + /** Name of the entry type used in the binding entry. + * It should be "FbxConstantEntry" in this case. + */ + static const char* sEntryType; + + /** Constructor. + * \param pEntry The binding table entry to create the entry view for. + * \param pAsSource \c true to create the entry view as source, \c false as destination. + * \param pCreate \c true to create the entry view, \c false otherwise. + */ + FbxConstantEntryView( FbxBindingTableEntry* pEntry, bool pAsSource, bool pCreate = false ); + + //! Destructor. + ~FbxConstantEntryView(); + + /** Get the constant string for binding entry. + * \return The constant string. + */ + const char* GetConstantName() const; + + /** Set the constant string for binding entry. + * \param pName The constant string to set. + */ + void SetConstantName(const char* pName); + + /** Get the entry type. + * \return Entry type as string "FbxConstantEntry". + * \remarks Always use EntryType() to get the right entry type. + */ + virtual const char* EntryType() const; +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_CONSTANT_ENTRY_VIEW_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxentryview.h b/libs/fbx/include/fbxsdk/scene/shading/fbxentryview.h new file mode 100644 index 00000000..f306ca37 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxentryview.h @@ -0,0 +1,79 @@ +/**************************************************************************************** + + 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 fbxentryview.h +#ifndef _FBXSDK_SCENE_SHADING_ENTRY_VIEW_H_ +#define _FBXSDK_SCENE_SHADING_ENTRY_VIEW_H_ + +#include + +#include + +class FbxBindingTableEntry; + +/** Entry view class represents binding entry in entry tables. + * \see FbxBindingTableEntry and FbxBindingTable. + * \nosubgrouping + */ +class FBXSDK_DLL FbxEntryView +{ +public: + + //! Entry type. + static const char* sEntryType; + + /** + * \name Constructor and Destructor. + */ + //@{ + + /** Constructor. + * \param pEntry The binding table entry to create the entry view for. + * \param pAsSource \c true to create the entry view as source, \c false as destination. + * \param pCreate \c true to create the entry view, \c false otherwise. + */ + FbxEntryView( FbxBindingTableEntry* pEntry, bool pAsSource, bool pCreate = false ); + + //! Destructor. + virtual ~FbxEntryView(); + //@} + + + /** Check whether this entry view is valid or not. + * If this entry view corresponds with an valid entry which is not NULL, and the + * entry type of this entry view is the same as that of the entry it corresponds with, + * then this entry view is valid. + * \return \c true if the entry view is valid, \c false otherwise. + */ + virtual bool IsValid() const; + + /** Create a new entry view. + * \return \c true if the entry view is created successfully, \c false otherwise. + */ + virtual bool Create(); + + /** Get the entry type of this entry view. + */ + virtual const char* EntryType() 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 +protected: + bool mAsSource; + FbxBindingTableEntry* mEntry; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_ENTRY_VIEW_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxfiletexture.h b/libs/fbx/include/fbxsdk/scene/shading/fbxfiletexture.h new file mode 100644 index 00000000..156bab38 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxfiletexture.h @@ -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 fbxfiletexture.h +#ifndef _FBXSDK_SCENE_SHADING_TEXTURE_FILE_H_ +#define _FBXSDK_SCENE_SHADING_TEXTURE_FILE_H_ + +#include + +#include + +#include + +/** This class describes image mapping on top of geometry. + * \note To apply a texture to geometry, first connect the + * geometry to a FbxSurfaceMaterial object (e.g. FbxSurfaceLambert) + * and then connect one of its properties (e.g. Diffuse) to the + * FbxFileTexture object. + * \see FbxSurfaceLambert + * \see FbxSurfacePhong + * \see FbxSurfaceMaterial + * \note For some example code, see also the CreateTexture() function + * in the ExportScene03 of FBX SDK examples. + * \nosubgrouping + */ +class FBXSDK_DLL FbxFileTexture : public FbxTexture +{ + FBXSDK_OBJECT_DECLARE(FbxFileTexture, FbxTexture); + +public: + /** + * \name Texture Properties + */ + //@{ + /** This property handles the material use. + * Default value is false. + */ + FbxPropertyT UseMaterial; + + /** This property handles the Mipmap use. + * Default value is false. + */ + FbxPropertyT UseMipMap; + + /** Resets the default texture values. + * \remarks The texture file name is not reset. + */ + void Reset(); + + /** Sets the associated texture file. + * \param pName The absolute path of the texture file. + * \return \c True if successful, returns \c false otherwise. + * \remarks The texture file name must be valid, you cannot leave the name empty. + */ + bool SetFileName(const char* pName); + + /** Sets the associated texture file. + * \param pName The relative path of the texture file. + * \return \c True if successful, returns \c false otherwise. + * \remarks The texture file name must be valid. + */ + bool SetRelativeFileName(const char* pName); + + /** Returns the absolute texture file path. + * \return The absolute texture file path. + * \remarks An empty string is returned if FbxFileTexture::SetFileName() has not been called before. + */ + const char* GetFileName () const; + + /** Returns the relative texture file path. + * \return The relative texture file path. + * \remarks An empty string is returned if FbxFileTexture::SetRelativeFileName() has not been called before. + */ + const char* GetRelativeFileName() const; + + /** \enum EMaterialUse Specify if texture uses model material. + */ + enum EMaterialUse + { + eModelMaterial, //! Texture uses model material. + eDefaultMaterial //! Texture does not use model material. + }; + + /** Sets the material use. + * \param pMaterialUse Specify how texture uses model material. + */ + void SetMaterialUse(EMaterialUse pMaterialUse); + + /** Returns the material use. + * \return How the texture uses model material. + */ + EMaterialUse GetMaterialUse() 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 + virtual FbxObject& Copy(const FbxObject& pObject); + + bool operator==(FbxFileTexture const& pTexture) const; + + FbxString& GetMediaName(); + void SetMediaName(const char* pMediaName); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + + void Init(); + void SyncVideoFileName(const char* pFileName); + void SyncVideoRelativeFileName(const char* pFileName); + + FbxString mFileName; + FbxString mRelativeFileName; + FbxString mMediaName; // not a prop +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_TEXTURE_FILE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbximplementation.h b/libs/fbx/include/fbxsdk/scene/shading/fbximplementation.h new file mode 100644 index 00000000..b87cc70e --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbximplementation.h @@ -0,0 +1,241 @@ +/**************************************************************************************** + + 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 fbximplementation.h +#ifndef _FBXSDK_SCENE_SHADING_IMPLEMENTATION_H_ +#define _FBXSDK_SCENE_SHADING_IMPLEMENTATION_H_ + +#include + +#include + +#include + +class FbxBindingOperator; +class FbxBindingTable; + +/** This object represents the shading node implementation. + * It defines basic information about the shader and the binding table(FbxBindingTable). + * For example, you can create a new FbxImplementation like this: + * \code + * FbxImplementation* lImpl = FbxImplementation::Create( &pMyScene, "MyImplementation" ); + * pMyObject.AddImplementation( lImpl ); + * pMyObject.SetDefaultImplementation( lImpl ); + * lImpl->RenderAPI = FBXSDK_RENDERING_API_DIRECTX; //FBXSDK_RENDERING_API_DIRECTX, FBXSDK_RENDERING_API_OPENGL, FBXSDK_RENDERING_API_MENTALRAY or FBXSDK_RENDERING_API_PREVIEW + * lImpl->RenderAPIVersion = "9.0"; //API Version + * + * lImpl->Language = FBXSDK_SHADING_LANGUAGE_HLSL; //FBXSDK_SHADING_LANGUAGE_HLSL, FBXSDK_SHADING_LANGUAGE_GLSL, FBXSDK_SHADING_LANGUAGE_CGFX or FBXSDK_SHADING_LANGUAGE_MRSL + * lImpl->LanguageVersion = "1.0"; //Language Version + * \endcode + * + * After the new FbxImplementation is created, you can access FbxBindingTable like this: + * \code + * FbxBindingTable* lTable = lImpl->GetTableByTargetName("root"); + * \endcode + * Also, you can access the exist FbxImplementation in FbxObject by this: + * \code + * const FbxImplementation* lImpl = GetImplementation( pMyObject, FBXSDK_IMPLEMENTATION_CGFX ); // FBXSDK_IMPLEMENTATION_PREVIEW, FBXSDK_IMPLEMENTATION_MENTALRAY, FBXSDK_IMPLEMENTATION_CGFX, FBXSDK_IMPLEMENTATION_HLSL, FBXSDK_IMPLEMENTATION_OGS or FBXSDK_IMPLEMENTATION_NONE + * \endcode + * \nosubgrouping + * \see FbxImplementationFilter + */ +class FBXSDK_DLL FbxImplementation : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxImplementation, FbxObject); + +public: + /** + * \name Target Name. + */ + //@{ + FbxString RenderName; + //@} + + /** + * \name Shader Language and API descriptions. + */ + //@{ + + /** Shader Language. + * \see FBXSDK_SHADING_LANGUAGE_HLSL, FBXSDK_SHADING_LANGUAGE_GLSL, FBXSDK_SHADING_LANGUAGE_CGFX and FBXSDK_SHADING_LANGUAGE_MRSL in conventions.h + */ + FbxPropertyT Language; + + //! Shader Language version. + FbxPropertyT LanguageVersion; + + /** Render API. + * \see FBXSDK_SHADING_LANGUAGE_HLSL, FBXSDK_SHADING_LANGUAGE_GLSL, FBXSDK_SHADING_LANGUAGE_CGFX and FBXSDK_SHADING_LANGUAGE_MRSL in conventions.h + */ + FbxPropertyT RenderAPI; + + //! Render API version. + FbxPropertyT RenderAPIVersion; + //@} + + + /** + * \name Binding description + */ + //@{ + + //! Name of root binding table. + FbxPropertyT RootBindingName; + + //! Property to store the shader parameters(constants) values in this implementation. + FbxProperty GetConstants() const; + + /** Add a new binding table to the table list. + * \param pTargetName The target name for the binding table. + * \param pTargetType The target type for the binding table. + * \return the new binding table. + */ + FbxBindingTable* AddNewTable( const char* pTargetName, const char* pTargetType ); + + /** Retrieves a handle on the root binding table. + * \return A const pointer to the root table or NULL if it does not exist. + */ + const FbxBindingTable* GetRootTable() const; + + /** Retrieves a handle on the root binding table. + * \return A pointer to the root table or NULL if it does not exist. + */ + FbxBindingTable* GetRootTable(); + + /** Gets the number of binding tables. + * \return the number of binding tables. + */ + int GetTableCount() const; + + /** Retrieves a handle on the (pIndex)th binding table. + * \param pIndex The index of the table to retrieve. Valid values are [ 0, GetTableCount() ). + * \return A const pointer to the pIndex-th table or NULL if pIndex is out of range. + */ + const FbxBindingTable* GetTable( int pIndex ) const; + /** Retrieves a handle on the (pIndex)th binding table. + * \param pIndex The index of the table to retrieve. Valid values are [ 0, GetTableCount() ). + * \return A const pointer to the pIndex-th table or NULL if pIndex is out of range. + */ + FbxBindingTable* GetTable( int pIndex ); + + /** Returns the binding table that has the given target name. + * \param pName The target name of the table to look for. + * \return A const pointer to the binding table with the given target name, or NULL if there is no such binding table. + */ + const FbxBindingTable* GetTableByTargetName( const char* pName ) const; + + /** Returns the binding table that has the given target name. + * \param pName The target name of the table to look for. + * \return A pointer to the binding table with the given target name, or NULL if there is no such binding table. + */ + FbxBindingTable* GetTableByTargetName( const char* pName ); + + /** Returns the binding table that has the given target type. + * \param pTargetName The target type to look for. + * \return A const pointer to the binding table with the given target type, or NULL if there is no such binding table. + */ + const FbxBindingTable* GetTableByTargetType( const char* pTargetName ) const; + + /** Returns the binding table that has the given target type. + * \param pTargetName The target type to look for. + * \return A pointer to the binding table with the given target type, or NULL if there is no such binding table. + */ + FbxBindingTable* GetTableByTargetType( const char* pTargetName ); + + + /** Add a new binding operator to the operator list. + * \param pTargetName The target name for the binding operator. + * \param pFunctionName The function name for the binding operator. + * \return The new operator. + */ + FbxBindingOperator* AddNewBindingOperator( const char* pTargetName, const char* pFunctionName ); + + /** Gets the number of binding operators. + * \return the number of binding operators. + */ + int GetBindingOperatorCount() const; + + /** Returns the binding operator that has the given name. + * \param pTargetName The target name of the binding operator to look for. + * \return A const pointer to the binding operator with the given name, or NULL if there is no such binding table. + */ + const FbxBindingOperator* GetOperatorByTargetName( const char* pTargetName ) const; + //@} + + + /** + * \name Static values + */ + //@{ + + // property names + + /** Shader Language name. + * \see Language + */ + static const char* sLanguage; + + /** Shader Language version. + * \see LanguageVersion + */ + static const char* sLanguageVersion; + + /** Shader render API. + * \see RenderAPI + */ + static const char* sRenderAPI; + + /** Shader render API version. + * \see RenderAPIVersion + */ + static const char* sRenderAPIVersion; + + /** Name of root binding table. + * \see RootBindingName + */ + static const char* sRootBindingName; + + /** Name of property to store the shader parameters(constants) values in this implementation. + * \see GetConstants + */ + static const char* sConstants; + + //! default value for implementation type. + static const char* sDefaultType; + + //! default value for shader language. + static const char* sDefaultLanguage; + + //! default value for shader language version. + static const char* sDefaultLanguageVersion; + + //! default value for shader render API. + static const char* sDefaultRenderAPI; + + //! default value for shader render API version. + static const char* sDefaultRenderAPIVersion; + + //! default value for root binding table name. + static const char* sDefaultRootBindingName; + //@} + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_IMPLEMENTATION_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbximplementationfilter.h b/libs/fbx/include/fbxsdk/scene/shading/fbximplementationfilter.h new file mode 100644 index 00000000..85a18f43 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbximplementationfilter.h @@ -0,0 +1,116 @@ +/**************************************************************************************** + + 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 fbximplementationfilter.h +#ifndef _FBXSDK_SCENE_SHADING_IMPLEMENTATION_FILTER_H_ +#define _FBXSDK_SCENE_SHADING_IMPLEMENTATION_FILTER_H_ + +#include + +#include + +#include + +class FbxCriteria; + +/** \brief This object represents a shading node filter criteria + * based on the shading node implementation. + * \nosubgrouping + */ +class FBXSDK_DLL FbxImplementationFilter : public FbxObjectFilter +{ + +public: + + /** The default shading API. + */ + static const char * sCHR_ANY_SHADING_API; + + /** The default shading API version. + */ + static const char * sCHR_ANY_SHADING_API_VERSION; + + /** The default shading language. + */ + static const char * sCHR_ANY_SHADING_LANGUAGE; + + /** The default shading language version. + */ + static const char * sCHR_ANY_SHADING_LANGUAGE_VERSION; + + + /** Constructor + * \param pShadingAPI a string containing the implementation API name: + * MentalRay + * OpenGL + * DirectX + * + * \param pShadingAPIVersion a string containing the implementation API version: + * eg. 1.0 + * + * \param pShadingLanguage a string identifying the implementation language name: + * GLSL = GL Shading Language + * HLSL = High Level Shading Language + * CGFX = CG effect(NVidia) + * RIB = RenderMan (RIB) + * etc... + * + * \param pShadingLanguageVersion a string identifying the implementation language version: + * eg. 1.0 + * + * \remarks by default the created criteria correspond to any shader + */ + FbxImplementationFilter( + const char * pShadingAPI = sCHR_ANY_SHADING_API, + const char * pShadingAPIVersion = sCHR_ANY_SHADING_API_VERSION, + const char * pShadingLanguage = sCHR_ANY_SHADING_LANGUAGE, + const char * pShadingLanguageVersion = sCHR_ANY_SHADING_LANGUAGE_VERSION + ); + + //! Destructor. + virtual ~FbxImplementationFilter(); + + /** Tells if this filter matches the given shading node implementation + * \param pObjectPtr The given shading node implementation + */ + virtual bool Match(const FbxObject * pObjectPtr) const; + + //! Stores the shading API + FbxString mShadingAPI; + + //! Stores the shading API Version + FbxString mShadingAPIVersion; + + //! Stores the shading language + FbxString mShadingLanguage; + + //! Stores the shading language version + FbxString mShadingLanguageVersion; + +/***************************************************************************************************************************** +** 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 + /** Utility method to determine if the given object is a shading node + * that we recognize. + */ + static bool IsShadingObject( const FbxObject* pObject ); + + /** Returns a criteria suitable for use with querying connections + * to shading nodes that we recognize, on FbxObject. + */ + static FbxCriteria Criteria(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_IMPLEMENTATION_FILTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbximplementationutils.h b/libs/fbx/include/fbxsdk/scene/shading/fbximplementationutils.h new file mode 100644 index 00000000..a3051649 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbximplementationutils.h @@ -0,0 +1,79 @@ +/**************************************************************************************** + + 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 fbximplementationutils.h +#ifndef _FBXSDK_SCENE_SHADING_IMPLEMENTATION_UTILS_H_ +#define _FBXSDK_SCENE_SHADING_IMPLEMENTATION_UTILS_H_ + +#include + +#include +#include +#include +#include + +#include + +/** Get FbxImplementation from FbxObject. + * \param pObject FbxObject to get FbxImplementation. + * \param pImplementationTarget Name of the implementation property to get. + * \return FbxImplementation Pointer to FbxImplementation. + */ +FBXSDK_DLL const FbxImplementation* GetImplementation( const FbxObject* pObject, const char* pImplementationTarget ); + +/** Get bound property value from FbxBindingTable. + * \param pBindingTable FbxBindingTable to get bound property value. + * \param pEntryName Name of the Entry type to get. + * \param pImplementation FbxImplementation of the bound property value to get if the Entry type is FbxOperatorEntryView::sEntryType. + * \param pBoundObject FbxObject of the bound property value to get if the Entry type is FbxPropertyEntryView::sEntryType. + * \param pValue Pointer to bound property value from FbxBindingTable. + * \return Whether get bound property value success or not. + */ +template bool GetBoundPropertyValue(const FbxBindingTable* pBindingTable, + const char* pEntryName, + const FbxImplementation* pImplementation, + const FbxObject* pBoundObject, + T& pValue) +{ + if ((NULL != pImplementation) && (NULL != pBindingTable) && (NULL != pBoundObject) && (NULL != pEntryName)) + { + const FbxBindingTableEntry* lEntry = pBindingTable->GetEntryForDestination(pEntryName); + + if (NULL != lEntry) + { + if (strcmp(lEntry->GetEntryType(true), FbxPropertyEntryView::sEntryType) == 0) + { + const char* lPropName = lEntry->GetSource(); + FbxProperty lProp = pBoundObject->FindPropertyHierarchical(lPropName); + if (lProp.IsValid()) + { + pValue = lProp.Get(); + return true; + } + } + else if (strcmp(lEntry->GetEntryType(true), FbxOperatorEntryView::sEntryType) == 0) + { + const char* lOperatorName = lEntry->GetSource(); + const FbxBindingOperator* lOp = pImplementation->GetOperatorByTargetName(lOperatorName); + if (lOp) + { + return lOp->Evaluate(pBoundObject, &pValue); + } + } + } + } + + return false; +} + +#include + +#endif /* _FBXSDK_SCENE_SHADING_IMPLEMENTATION_UTILS_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxlayeredtexture.h b/libs/fbx/include/fbxsdk/scene/shading/fbxlayeredtexture.h new file mode 100644 index 00000000..000a9a43 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxlayeredtexture.h @@ -0,0 +1,179 @@ +/**************************************************************************************** + + 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 fbxlayeredtexture.h +#ifndef _FBXSDK_SCENE_SHADING_LAYERED_TEXTURE_H_ +#define _FBXSDK_SCENE_SHADING_LAYERED_TEXTURE_H_ + +#include + +#include + +#include + +/** FbxLayeredTexture is a combination of multiple textures(FbxTexture) blended sequentially. + * For example, you can access individual texture by: + * \code + * FbxTexture* pIndiTexture = lLayeredTexture->GetSrcObject(FbxTexture::ClassId, pTextureIndex); + * \endcode + * Another example to construct a layered texture with two sub textures. + * \code + * FbxFileTexture *background, *file1; + * FbxLayeredTexture* layeredTexture; + * + * // connect two file textures to a layered texture via OO connections + * layeredTexture->ConnectSrcObject(background); + * layeredTexture->ConnectSrcObject(file1); + * + * // set the second file texture's blend mode and alpha. + * layeredTexture->SetTextureBlendMode(1, FbxLayeredTexture::eOver); + * layeredTexture->SetTextureAlpha(1, 0.5); + * \endcode + * \nosubgrouping + * \see FbxTexture + */ +class FBXSDK_DLL FbxLayeredTexture : public FbxTexture +{ + FBXSDK_OBJECT_DECLARE(FbxLayeredTexture, FbxTexture); + +public: + /** \enum EBlendMode Blend modes. + * - \e eTranslucent, The new texture layer is transparent (depending on the Alpha value). + * - \e eAdditive, Add the color of the new texture to the previous texture. + * - \e eModulate, Multiples the color value of the new texture by the color values of all previous layers of texture. + * - \e eModulate2, Multiples the color value of the new texture by two and then by the color values of all previous layers of texture. + * - \e eOver, Equivalent to eTranslucent. Blends the new texture over top of the old texture, according to the new texture's alpha channel. + * - \e eNormal, The colors of the two layers will not interact in any way, and it will display the full value of the colors in layer 1. + * - \e eDissolve, Dissolve makes the lower layer take on the colors of the top layer, and how much depends on the opacity of the upper layer. + * - \e eDarken, Darken compares each pixel value of the upper layer to its counterpart's pixel value of the lower layer and chooses the darker of the two to display. + * - \e eColorBurn, Color Burn burns in the color of the upper layer with the lower layer. No part of the image will get lighter. + * - \e eLinearBurn, Linear Burn works like multiply but the results are more intense. + * - \e eDarkerColor, This blend mode simply divides pixel values of one layer with the other. + * - \e eLighten, Lighten compares the two layers pixel for pixel and uses the lightest pixel value. No part of the image gets darker. + * - \e eScreen, Screen brightens by lightning the lower layer based on the lightness of the upper layer + * - \e eColorDodge, Color Dodge dodges the lower layer with the upper layer, resulting in a lighter image. No part of the image will be darkened. + * - \e eLinearDodge, Linear Dodge works like screen but with more intense results. + * - \e eLighterColor, This blend mode has the opposite effect of the Darker Color mode. It compares all the values in both layers, then displays the lightest values. + * - \e eSoftLight, Soft Light will multiply the dark tones and screen the light tones. + * - \e eHardLight, Hard Light multiplies the dark colors and screens the light colors. + * - \e eVividLight, Vivid Light will dodges or burn the lower layer pixels depending on whether the upper layer pixels are brighter or darker than neutral gray. It works on the contrast of the lower layer. + * - \e eLinearLight, Linear Light is the same as Vivid light but it works on the brightness of the lower layer. + * - \e ePinLight, Pin Light changes the lower layer pixels depending on how bright the pixels are in the upper layer. + * - \e eHardMix, Produces either white or black, depending on similarities between A and B. + * - \e eDifference, Difference reacts to the differences between the upper and lower layer pixels. + * - \e eExclusion, Exclusion uses the darkness of the lower layer to mask the difference between upper and lower layers. + * - \e eSubtract, The result color is the foreground color subtracted from the background color. The result color is then applied over the background color using the foreground alpha to define the opacity of the result. + * - \e eDivide, This blend mode simply divides pixel values of one layer with the other. + * - \e eHue, Hue changes the hue of the lower layer to the hue of the upper layer but leaves brightness and saturation alone. + * - \e eSaturation, Saturation changes the saturation of the lower layer to the hue of the upper layer but leaves brightness and hue alone. + * - \e eColor, Color changes the hue and saturation of the lower layer to the hue and saturation of the upper layer but leaves luminosity alone. + * - \e eLuminosity, Luminosity changes the luminosity of the lower layer to the luminosity of the upper layer while leaving hue and saturation the same. + * - \e eOverlay, Multiplies (darkens) when the layer on which the mode is set is dark and screens (brightens) when the layer on which the mode is applied is lighter. + * - \e eBlendModeCount, Marks the end of the blend mode enum. + */ + enum EBlendMode + { + eTranslucent, + eAdditive, + eModulate, + eModulate2, + eOver, + eNormal, + eDissolve, + eDarken, + eColorBurn, + eLinearBurn, + eDarkerColor, + eLighten, + eScreen, + eColorDodge, + eLinearDodge, + eLighterColor, + eSoftLight, + eHardLight, + eVividLight, + eLinearLight, + ePinLight, + eHardMix, + eDifference, + eExclusion, + eSubtract, + eDivide, + eHue, + eSaturation, + eColor, + eLuminosity, + eOverlay, + eBlendModeCount + }; + + /** Equivalence operator. + * \param pOther The object for comparison. + * \return \c True if pOther is equivalent to this object, returns \c false otherwise. + */ + bool operator==( const FbxLayeredTexture& pOther ) const; + + /** Sets the blending mode of a specified texture. + * \param pIndex The texture index. + * \param pMode The blend mode to be set. + * \return \c True if successful, returns \c false otherwise. + */ + bool SetTextureBlendMode( int pIndex, EBlendMode pMode ); + + /** Returns the blending mode of a specified texture + * \param pIndex The texture index. + * \param pMode The parameter that will hold the returned blend mode. + * \return \c True if successful, returns \c false otherwise. + */ + bool GetTextureBlendMode( int pIndex, EBlendMode& pMode ) const; + + /** Sets the alpha of a specified texture. + * \param pIndex The texture index. + * \param pAlpha The alpha to be set. + * \return \c True if successful, returns \c false otherwise. + */ + bool SetTextureAlpha( int pIndex, double pAlpha ); + + /** Returns the alpha of a specified texture + * \param pIndex The texture index. + * \param pAlpha The parameter that will hold the returned alpha. + * \return \c True if successful, returns \c false otherwise. + */ + bool GetTextureAlpha( int pIndex, double& pAlpha ) 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 + virtual FbxObject& Copy(const FbxObject& pObject); + +protected: + struct InputData + { + EBlendMode mBlendMode; + double mAlpha; + }; + +public: + FbxArray mInputData; + +protected: + virtual bool ConnectNotify (FbxConnectEvent const &pEvent); + + bool RemoveInputData( int pIndex ); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxLayeredTexture::EBlendMode&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_SHADING_LAYERED_TEXTURE_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxlayerentryview.h b/libs/fbx/include/fbxsdk/scene/shading/fbxlayerentryview.h new file mode 100644 index 00000000..0d20fff4 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxlayerentryview.h @@ -0,0 +1,89 @@ +/**************************************************************************************** + + 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 fbxlayerentryview.h +#ifndef _FBXSDK_SCENE_SHADING_LAYER_ENTRY_VIEW_H_ +#define _FBXSDK_SCENE_SHADING_LAYER_ENTRY_VIEW_H_ + +#include + +#include +#include +#include + +#include + +class FbxLayerContainer; + +/** FbxLayerEntryView encodes a layer element representation (the index of the layer, the type of the layer + * element and whether the layer element is a UVSet layer element) to a string stored in FbxBindingTableEntry + * and decodes the string back to a layer element representation. + * This class is used in combination with FbxBindingTableEntry to represent a source or a destination + * FbxLayerElement. + * \see FbxBindingTableEntry and FbxBindingTable. + */ +class FBXSDK_DLL FbxLayerEntryView : public FbxEntryView +{ +public: + + /** Name of the entry type used in the binding entry. + * It should be "FbxLayerEntry" in this case. + */ + static const char* sEntryType; + + /** Constructor. + * \param pEntry The binding table entry to create the entry view for. + * \param pAsSource \c true to create the entry view as source, \c false as destination. + * \param pCreate \c true to create the entry view, \c false otherwise. + */ + FbxLayerEntryView(FbxBindingTableEntry* pEntry, bool pAsSource, bool pCreate = false ); + + //! Destructor. + virtual ~FbxLayerEntryView(); + + /** Set the layer element for the binding entry. + * \param pLayerIndex LayerElement index. + * \param pType LayerElement type. + * \param pUVSet Whether this is a UVSet LayerElement. + */ + void SetLayerElement( int pLayerIndex, FbxLayerElement::EType pType, bool pUVSet ); + + /** Get the layer element for binding entry. + * \param pLayerIndex LayerElement index. + * \param pType LayerElement type. + * \param pUVSet Whether this is a UVSet LayerElement. + */ + void GetLayerElement( int &pLayerIndex, FbxLayerElement::EType& pType, bool& pUVSet ) const; + + /** Get the layer element for binding entry. + * \param pContainer FbxLayerContainer to get the layer element from. + * \return The layer element for binding entry. + */ + FbxLayerElement* GetLayerElement( FbxLayerContainer* pContainer ) const; + + /** Get the entry type. + * \return Entry type as string "FbxLayerEntry". + * \remarks Always use EntryType() to get the right entry type. + */ + virtual const char* EntryType() 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 +protected: + static const char* sDelimiter; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_LAYER_ENTRY_VIEW_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxoperatorentryview.h b/libs/fbx/include/fbxsdk/scene/shading/fbxoperatorentryview.h new file mode 100644 index 00000000..07cfdf30 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxoperatorentryview.h @@ -0,0 +1,66 @@ +/**************************************************************************************** + + 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 fbxoperatorentryview.h +#ifndef _FBXSDK_SCENE_SHADING_OPERATOR_ENTRY_VIEW_H_ +#define _FBXSDK_SCENE_SHADING_OPERATOR_ENTRY_VIEW_H_ + +#include + +#include + +#include + +class FbxBindingTableEntry; + +/** FbxOperatorEntryView represents binding operator entry in entry tables. + * The binding operator can be used as source or destination for the binding entry. + * \see FbxBindingTableEntry and FbxBindingTable. + * \nosubgrouping + */ +class FBXSDK_DLL FbxOperatorEntryView : public FbxEntryView +{ +public: + /** Name of the entry type used in the binding entry. + * It should be "FbxOperatorEntry" in this case. + */ + static const char* sEntryType; + + /** Constructor. + * \param pEntry The binding table entry to create the entry view for. + * \param pAsSource \c true to create the entry view as source, \c false as destination. + * \param pCreate \c true to create the entry view, \c false otherwise. + */ + FbxOperatorEntryView( FbxBindingTableEntry* pEntry, bool pAsSource, bool pCreate = false ); + + //! Destructor. + ~FbxOperatorEntryView(); + + /** Get the operator name from the binding entry. + * \return The operator name. + */ + const char* GetOperatorName() const; + + /** Set the operator name to the binding entry. + * \param pName The operator name to set. + */ + void SetOperatorName(const char* pName); + + /** Get the entry type. + * \return Entry type as string "FbxOperatorEntry". + * \remarks Always use EntryType() to get the right entry type. + */ + virtual const char* EntryType() const; +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_OPERATOR_ENTRY_VIEW_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxproceduraltexture.h b/libs/fbx/include/fbxsdk/scene/shading/fbxproceduraltexture.h new file mode 100644 index 00000000..07c89358 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxproceduraltexture.h @@ -0,0 +1,82 @@ +/**************************************************************************************** + + 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 fbxproceduraltexture.h +#ifndef _FBXSDK_SCENE_SHADING_TEXTURE_PROCEDURAL_H_ +#define _FBXSDK_SCENE_SHADING_TEXTURE_PROCEDURAL_H_ + +#include + +#include + +#include + +/** Contains the information to generate a texture procedurally. Data information for the texture + * generation is contained in a blob property. + * \see FbxTexture + * \nosubgrouping + */ +class FBXSDK_DLL FbxProceduralTexture : public FbxTexture +{ + FBXSDK_OBJECT_DECLARE(FbxProceduralTexture, FbxTexture); + + public: + /** + * \name Procedural Texture Properties + */ + //@{ + + /** This property handles the raw data for generating procedural texture. + */ + FbxPropertyT BlobProp; + + /** Resets the default procedural texture values. + */ + void Reset(); + + //@} + + /** + * \name Property Access Methods + */ + //@{ + + /** Sets the blob. + * \param pBlob Blob containing information for the procedural texture + */ + void SetBlob(FbxBlob& pBlob); + + /** Get the blob. + * \return Blob containing information for the procedural texture + */ + FbxBlob GetBlob() 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 + virtual FbxObject& Copy(const FbxObject& pObject); + + bool operator==(FbxProceduralTexture const& pTexture) const; + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + + void Init(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_TEXTURE_PROCEDURAL_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxpropertyentryview.h b/libs/fbx/include/fbxsdk/scene/shading/fbxpropertyentryview.h new file mode 100644 index 00000000..c3fcb77e --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxpropertyentryview.h @@ -0,0 +1,82 @@ +/**************************************************************************************** + + 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 fbxpropertyentryview.h +#ifndef _FBXSDK_SCENE_SHADING_PROPERTY_ENTRY_VIEW_H_ +#define _FBXSDK_SCENE_SHADING_PROPERTY_ENTRY_VIEW_H_ + +#include + +#include +#include + +#include + +/** FbxPropertyEntryView represents property entry in entry tables. + * The property can be used as source or destination for the binding entry. + * Use this class to manipulate binding table's attributes. + * + * \code Here is a code snippet to show how it used. + * FbxProperty lProp; + * FbxBindingTable lTable; + * FbxBindingTableEntry& lEntry = lBindingTable.AddNewEntry(); + * FbxPropertyEntryView lView( lEntry, true, true); + * lView.SetProperty( lProp.GetName()); + * \endcode + * + * \see FbxBindingTableEntry and FbxBindingTable. + * + * \nosubgrouping + */ +class FBXSDK_DLL FbxPropertyEntryView : public FbxEntryView +{ +public: + + /** Name of the entry type used in the binding entry. + * It should be "FbxPropertyEntry" in this case. + */ + static const char* sEntryType; + + /** + * \name Constructor and Destructor. + */ + //@{ + /** Constructor. + * \param pEntry The binding table entry to create the entry view for. + * \param pAsSource \c true to create the entry view as source, \c false as destination. + * \param pCreate \c true to create the entry view, \c false otherwise. + */ + FbxPropertyEntryView( FbxBindingTableEntry* pEntry, bool pAsSource, bool pCreate = false ); + + //! Destructor. + ~FbxPropertyEntryView(); + //@} + + /** Get the property name from the binding entry. + * \return The property name. + */ + const char* GetProperty() const; + + /** Set the property name to the binding entry. + * \param pPropertyName The property name to set. + */ + void SetProperty(const char* pPropertyName); + + /** Get the entry type. + * \return Entry type as string "FbxPropertyEntry". + * \remarks Always use EntryType() to get the right entry type. + */ + virtual const char* EntryType() const; +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_PROPERTY_ENTRY_VIEW_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxsemanticentryview.h b/libs/fbx/include/fbxsdk/scene/shading/fbxsemanticentryview.h new file mode 100644 index 00000000..a852cd22 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxsemanticentryview.h @@ -0,0 +1,91 @@ +/**************************************************************************************** + + 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 fbxsemanticentryview.h +#ifndef _FBXSDK_SCENE_SHADING_SEMANTIC_ENTRY_VIEW_H_ +#define _FBXSDK_SCENE_SHADING_SEMANTIC_ENTRY_VIEW_H_ + +#include + +#include +#include + +#include + +/** FbxSemanticEntryView stores a binding corresponding to + * a semantic within a shader file. + * A shader semantic is a parameter, a constant or an operator. + * So a shader semantic could bind with FbxProperty ( parameter, constant) and FbxBindingOperator (operator). + * + * Here is a code snippet to show how it used. + * \code + * FbxProperty lProp; + * FbxBindingTable lTable; + * FbxBindingTableEntry& lEntry = lBindingTable.AddNewEntry(); + * FbxPropertyEntryView lSrcView( lEntry, true, true); + * lSrcView.SetProperty( lProp.GetHierarchicalName()); + * FbxSemanticEntryView lDstView( &pEntry, false, true ); + * lDstView.SetSemantic( lProp.Getname()); + * \endcode + * + * \see FbxBindingTableEntry and FbxBindingTable. + * \nosubgrouping + */ +class FBXSDK_DLL FbxSemanticEntryView : public FbxEntryView +{ +public: + + /** Name of the entry type used in the binding entry. + * It should be "FbxSemanticEntry" in this case. + */ + static const char* sEntryType; + + /** + * \name Constructor and Destructor. + */ + //@{ + /** Constructor. + * \param pEntry The binding table entry to create the entry view for. + * \param pAsSource \c true to create the entry view as source, \c false as destination. + * \param pCreate \c true to create the entry view, \c false otherwise. + */ + FbxSemanticEntryView (FbxBindingTableEntry* pEntry, bool pAsSource, bool pCreate = false); + + //! Destructor. + virtual ~FbxSemanticEntryView(); + //@} + + /** Set the semantic to the binding entry. + * \param pSemantic The semantic string to set. + */ + void SetSemantic( const char* pSemantic ); + + /** Get the semantic from the binding entry. + * \param pAppendIndex \c true if the returned semantic append a index, \c false otherwise. + * \return The semantic. + */ + FbxString GetSemantic(bool pAppendIndex = true) const; + + /** Get the semantic index suffix. + * \return Semantic index suffix. + */ + int GetIndex() const; + + /** Get the entry type. + * \return Entry type as string "FbxSemanticEntry". + * \remarks Always use EntryType() to get the right entry type. + */ + virtual const char* EntryType() const; +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_SEMANTIC_ENTRY_VIEW_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxshadingconventions.h b/libs/fbx/include/fbxsdk/scene/shading/fbxshadingconventions.h new file mode 100644 index 00000000..010ec50e --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxshadingconventions.h @@ -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 fbxshadingconventions.h +#ifndef _FBXSDK_SCENE_SHADING_CONVENTIONS_H_ +#define _FBXSDK_SCENE_SHADING_CONVENTIONS_H_ + +#include + +#include + +//Predefined shader languages +#define FBXSDK_SHADING_LANGUAGE_HLSL "HLSL" +#define FBXSDK_SHADING_LANGUAGE_GLSL "GLSL" +#define FBXSDK_SHADING_LANGUAGE_CGFX "CGFX" +#define FBXSDK_SHADING_LANGUAGE_SFX "SFX" +#define FBXSDK_SHADING_LANGUAGE_MRSL "MentalRaySL" + +//Predefined rendering APIs +#define FBXSDK_RENDERING_API_DIRECTX "DirectX" +#define FBXSDK_RENDERING_API_OPENGL "OpenGL" +#define FBXSDK_RENDERING_API_MENTALRAY "MentalRay" +#define FBXSDK_RENDERING_API_PREVIEW "PreviewColorAPI" + +#define FBXSDK_IMPLEMENTATION_PREVIEW "ImplementationPreview" +#define FBXSDK_IMPLEMENTATION_MENTALRAY "ImplementationMentalRay" +#define FBXSDK_IMPLEMENTATION_CGFX "ImplementationCGFX" +#define FBXSDK_IMPLEMENTATION_HLSL "ImplementationHLSL" +#define FBXSDK_IMPLEMENTATION_SFX "ImplementationSFX" +#define FBXSDK_IMPLEMENTATION_OGS "ImplementaitonOGS" +#define FBXSDK_IMPLEMENTATION_NONE "ImplementationNone" + +//PROTEIN 1.0 conventions +#define FBXSDK_TYPE_ENVIRONMENT "KFbxEnvironment" +#define FBXSDK_TYPE_LIGHT "KFbxLight" +#define FBXSDK_TYPE_PROCEDURALGEOMETRY "KFbxProceduralGeometry" +#define FBXSDK_TYPE_SURFACEMATERIAL "KFbxSurfaceMaterial" +#define FBXSDK_TYPE_TEXTURE "KFbxTexture" +#define FBXSDK_TYPE_SWATCHSCENE "KFbxSwatchScene" + +//PROTEIN 2.0 conventions +#define ADSK_TYPE_ENVIRONMENT "ADSKEnvironmentDefinition" +#define ADSK_TYPE_LIGHT "ADSKLightDefinition" +#define ADSK_TYPE_PROCEDURALGEOMETRY "ADSKProceduralGeometryDefinition" +#define ADSK_TYPE_SURFACEMATERIAL "ADSKSurfaceMaterialDefinition" +#define ADSK_TYPE_TEXTURE "ADSKTextureDefinition" +#define ADSK_TYPE_SWATCHSCENE "ADSKSwatchSceneDefinition" + +//ASSET Definition conventions +#define ADSK_UI_DEFINITION_URL "UIDefinition" + +#include + +#endif /* _FBXSDK_SCENE_SHADING_CONVENTIONS_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxsurfacelambert.h b/libs/fbx/include/fbxsdk/scene/shading/fbxsurfacelambert.h new file mode 100644 index 00000000..5b8afdf8 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxsurfacelambert.h @@ -0,0 +1,143 @@ +/**************************************************************************************** + + 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 fbxsurfacelambert.h +#ifndef _FBXSDK_SCENE_SHADING_SURFACE_LAMBERT_H_ +#define _FBXSDK_SCENE_SHADING_SURFACE_LAMBERT_H_ + +#include + +#include + +#include + +/** This class contains settings for Lambert Materials. + * \nosubgrouping + */ +class FBXSDK_DLL FbxSurfaceLambert : public FbxSurfaceMaterial +{ + FBXSDK_OBJECT_DECLARE(FbxSurfaceLambert,FbxSurfaceMaterial); + +public: + /** + * \name Material properties + */ + //@{ + + //! Emissive color property. + FbxPropertyT Emissive; + + /** Emissive factor property. This factor is used to + * attenuate the emissive color. + */ + FbxPropertyT EmissiveFactor; + + //! Ambient color property. + FbxPropertyT Ambient; + + /** Ambient factor property. This factor is used to + * attenuate the ambient color. + */ + FbxPropertyT AmbientFactor; + + //! Diffuse color property. + FbxPropertyT Diffuse; + + /** Diffuse factor property. This factor is used to + * attenuate the diffuse color. + */ + FbxPropertyT DiffuseFactor; + + /** NormalMap property. This property can be used to specify the distortion of the surface + * normals and create the illusion of a bumpy surface. + */ + FbxPropertyT NormalMap; + + /** Bump property. This property is used to distort the + * surface normal and create the illusion of a bumpy surface. + */ + FbxPropertyT Bump; + + /** Bump factor property. This factor is used to + * make a surface more or less bumpy. + */ + FbxPropertyT BumpFactor; + + //! Transparent color property. + FbxPropertyT TransparentColor; + + /** Transparency factor property. This property is used to make a + * surface more or less opaque (0 = opaque, 1 = transparent). + */ + FbxPropertyT TransparencyFactor; + + //! Displacement color property. + FbxPropertyT DisplacementColor; + + //! Displacement factor property. + FbxPropertyT DisplacementFactor; + + //! Vector displacement color property. + FbxPropertyT VectorDisplacementColor; + + //! Vector displacement factor property. + FbxPropertyT VectorDisplacementFactor; + + //@} + + ////////////////////////////////////////////////////////////////////////// + // Static values + ////////////////////////////////////////////////////////////////////////// + + /** + * \name Default property values + */ + //@{ + + static const FbxDouble3 sEmissiveDefault; + static const FbxDouble sEmissiveFactorDefault; + + static const FbxDouble3 sAmbientDefault; + static const FbxDouble sAmbientFactorDefault; + + static const FbxDouble3 sDiffuseDefault; + static const FbxDouble sDiffuseFactorDefault; + + static const FbxDouble3 sBumpDefault; + static const FbxDouble3 sNormalMapDefault; + static const FbxDouble sBumpFactorDefault; + + static const FbxDouble3 sTransparentDefault; + static const FbxDouble sTransparencyFactorDefault; + + static const FbxDouble3 sDisplacementDefault; + static const FbxDouble sDisplacementFactorDefault; + + static const FbxDouble3 sVectorDisplacementDefault; + static const FbxDouble sVectorDisplacementFactorDefault; + + //@} + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); + + // Local + void Init(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_SURFACE_LAMBERT_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxsurfacematerial.h b/libs/fbx/include/fbxsdk/scene/shading/fbxsurfacematerial.h new file mode 100644 index 00000000..2683703e --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxsurfacematerial.h @@ -0,0 +1,106 @@ +/**************************************************************************************** + + 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 fbxsurfacematerial.h +#ifndef _FBXSDK_SCENE_SHADING_SURFACE_MATERIAL_H_ +#define _FBXSDK_SCENE_SHADING_SURFACE_MATERIAL_H_ + +#include + +#include + +#include + +/** This class contains material settings. + * \nosubgrouping + */ +class FBXSDK_DLL FbxSurfaceMaterial : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxSurfaceMaterial, FbxObject); + +public: + /** + * \name Standard Material Property Names + */ + //@{ + + static const char* sShadingModel; + static const char* sMultiLayer; + + static const char* sEmissive; + static const char* sEmissiveFactor; + + static const char* sAmbient; + static const char* sAmbientFactor; + + static const char* sDiffuse; + static const char* sDiffuseFactor; + + static const char* sSpecular; + static const char* sSpecularFactor; + static const char* sShininess; + + static const char* sBump; + static const char* sNormalMap; + static const char* sBumpFactor; + + static const char* sTransparentColor; + static const char* sTransparencyFactor; + + static const char* sReflection; + static const char* sReflectionFactor; + + static const char* sDisplacementColor; + static const char* sDisplacementFactor; + + static const char* sVectorDisplacementColor; + static const char* sVectorDisplacementFactor; + //@} + + /** + * \name Material Properties + */ + //@{ + FbxPropertyT ShadingModel; + FbxPropertyT MultiLayer; + //@} + + ////////////////////////////////////////////////////////////////////////// + // Static values + ////////////////////////////////////////////////////////////////////////// + + /** + * \name Default property values + */ + //@{ + + static const FbxBool sMultiLayerDefault; + static const char* sShadingModelDefault; + + //@} + +/***************************************************************************************************************************** +** 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: + bool SetColorParameter(FbxProperty pProperty, FbxColor const& pColor); + bool GetColorParameter(FbxProperty pProperty, FbxColor& pColor) const; + bool SetDoubleParameter(FbxProperty pProperty, double pDouble); + bool GetDoubleParameter(FbxProperty pProperty, double pDouble) const; + + virtual void ConstructProperties(bool pForceSet); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_SURFACE_MATERIAL_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxsurfacephong.h b/libs/fbx/include/fbxsdk/scene/shading/fbxsurfacephong.h new file mode 100644 index 00000000..e463f8e1 --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxsurfacephong.h @@ -0,0 +1,92 @@ +/**************************************************************************************** + + 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 fbxsurfacephong.h +#ifndef _FBXSDK_SCENE_SHADING_SURFACE_PHONG_H_ +#define _FBXSDK_SCENE_SHADING_SURFACE_PHONG_H_ + +#include + +#include + +#include + +/** This class contains settings for Phong Materials. + * \nosubgrouping + */ +class FBXSDK_DLL FbxSurfacePhong : public FbxSurfaceLambert +{ + FBXSDK_OBJECT_DECLARE(FbxSurfacePhong, FbxSurfaceLambert); + +public: + /** + * \name Material properties + */ + //@{ + //! Specular property. + FbxPropertyT Specular; + + /** Specular factor property. This factor is used to + * attenuate the specular color. + */ + FbxPropertyT SpecularFactor; + + /** Shininess property. This property controls the aspect + * of the shiny spot. It is the specular exponent in the Phong + * illumination model. + */ + FbxPropertyT Shininess; + + /** Reflection color property. This property is used to + * implement reflection mapping. + */ + FbxPropertyT Reflection; + + /** Reflection factor property. This property is used to + * attenuate the reflection color. + */ + FbxPropertyT ReflectionFactor; + //@} + + ////////////////////////////////////////////////////////////////////////// + // Static values + ////////////////////////////////////////////////////////////////////////// + + /** + * \name Default property values + */ + //@{ + + static const FbxDouble3 sSpecularDefault; + static const FbxDouble sSpecularFactorDefault; + + static const FbxDouble sShininessDefault; + + static const FbxDouble3 sReflectionDefault; + static const FbxDouble sReflectionFactorDefault; + + //@} + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); + + // Local + void Init(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_SCENE_SHADING_SURFACE_PHONG_H_ */ diff --git a/libs/fbx/include/fbxsdk/scene/shading/fbxtexture.h b/libs/fbx/include/fbxsdk/scene/shading/fbxtexture.h new file mode 100644 index 00000000..9e88b86c --- /dev/null +++ b/libs/fbx/include/fbxsdk/scene/shading/fbxtexture.h @@ -0,0 +1,577 @@ +/**************************************************************************************** + + 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 fbxtexture.h +#ifndef _FBXSDK_SCENE_SHADING_TEXTURE_H_ +#define _FBXSDK_SCENE_SHADING_TEXTURE_H_ + +#include + +#include + +#include + +/** This class is the base class for textures, ie classes FbxFileTexture, FbxLayeredTexture and FbxProceduralTexture. + * It describes image mapping on top of a geometry. + * \nosubgrouping + */ +class FBXSDK_DLL FbxTexture : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxTexture, FbxObject); + +public: + /** + * \name Texture Properties + */ + //@{ + /** \enum EUnifiedMappingType Internal enum for texture mapping types. + * Includes mapping types and planar mapping normal orientations. + * Use SetMappingType(), GetMappingType(), SetPlanarMappingNormal() + * and GetPlanarMappingNormal() to access these values. + */ + enum EUnifiedMappingType + { + eUMT_UV, //! Maps to EMappingType::eUV. + eUMT_XY, //! Maps to EMappingType::ePlanar and EPlanarMappingNormal::ePlanarNormalZ. + eUMT_YZ, //! Maps to EMappingType::ePlanar and EPlanarMappingNormal::ePlanarNormalX. + eUMT_XZ, //! Maps to EMappingType::ePlanar and EPlanarMappingNormal::ePlanarNormalY. + eUMT_SPHERICAL, //! Maps to EMappingType::eSpherical. + eUMT_CYLINDRICAL, //! Maps to EMappingType::eCylindrical. + eUMT_ENVIRONMENT, //! Maps to EMappingType::eEnvironment. + eUMT_PROJECTION, //! Unused. + eUMT_BOX, //! DEPRECATED! Maps to EMappingType::eBox. + eUMT_FACE, //! DEPRECATED! Maps to EMappingType::eFace. + eUMT_NO_MAPPING, //! Maps to EMappingType::eNull. + }; + + /** \enum ETextureUse6 Internal enum for texture usage. + * For example, the texture might be used as a standard texture, as a shadow map, as a bump map, etc. + * Use SetTextureUse() and GetTextureUse() to access these values. + */ + enum ETextureUse6 + { + eTEXTURE_USE_6_STANDARD, //! Maps to ETextureUse::eStandard. + eTEXTURE_USE_6_SPHERICAL_REFLEXION_MAP, //! Maps to ETextureUse::eSphericalReflectionMap. + eTEXTURE_USE_6_SPHERE_REFLEXION_MAP, //! Maps to ETextureUse::eSphereReflectionMap. + eTEXTURE_USE_6_SHADOW_MAP, //! Maps to ETextureUse::eShadowMap. + eTEXTURE_USE_6_LIGHT_MAP, //! Maps to ETextureUse::eLightMap. + eTEXTURE_USE_6_BUMP_NORMAL_MAP //! Maps to ETextureUse::eBumpNormalMap. + }; + + /** \enum EWrapMode Wrap modes. + * Use SetWrapMode(), GetWrapModeU() and GetWrapModeV() to access these values. + */ + enum EWrapMode + { + eRepeat, //! Apply the texture over and over on the model's surface until the model is covered. This is the default setting. + eClamp //! Apply the texture to a model only once, using the color at the ends of the texture as the "filter". + }; + + /** \enum EBlendMode Blend modes. + */ + enum EBlendMode + { + eTranslucent, //! The texture is transparent, depending on the Alpha settings. + eAdditive, //! The color of the texture is added to the previous texture. + eModulate, //! The color value of the texture is multiplied by the color values of all previous layers of texture. + eModulate2, //! The color value of the texture is multiplied by two and then multiplied by the color values of all previous layers of texture. + eOver //! The texture is opaque. + }; + + /** \enum EAlignMode Align indices for cropping. + */ + enum EAlignMode + { + eLeft, //! Left cropping. + eRight, //! Right cropping. + eTop, //! Top cropping. + eBottom //! Bottom cropping. + }; + + /** \enum ECoordinates Texture coordinates. + */ + enum ECoordinates + { + eU, //! U axis. + eV, //! V axis. + eW //! W axis. + }; + + // Type description + + /** This property handles the use of textures. + * Default value is eTEXTURE_USE_6_STANDARD. + */ + FbxPropertyT TextureTypeUse; + + /** This property handles the default alpha value for textures. + * Default value is 1.0 + */ + FbxPropertyT Alpha; + + + // Mapping information + + /** This property handles the texture mapping types. + * Default value is eUMT_UV. + */ + FbxPropertyT CurrentMappingType; + + /** This property handles the texture wrap modes in U. + * Default value is eRepeat. + */ + FbxPropertyT WrapModeU; + + /** This property handles the texture wrap modes in V. + * Default value is eRepeat. + */ + FbxPropertyT WrapModeV; + + /** This property handles the swap UV flag. + * If swap UV flag is enabled, the texture's width and height are swapped. + * Default value is false. + */ + FbxPropertyT UVSwap; + + /** This property handles the PremultiplyAlpha flag. + * If PremultiplyAlpha flag is true, the R, G, and B components you store have already been multiplied in with the alpha. + * Default value is true. + */ + FbxPropertyT PremultiplyAlpha; + + // Texture positioning + + /** This property handles the default translation vector. + * Default value is FbxDouble3(0.0,0.0,0.0). + */ + FbxPropertyT Translation; + + /** This property handles the default rotation vector. + * Default value is FbxDouble3(0.0,0.0,0.0). + */ + FbxPropertyT Rotation; + + /** This property handles the default scale vector. + * Default value is FbxDouble3(1.0,1.0,1.0). + */ + FbxPropertyT Scaling; + + /** This property handles the rotation pivot vector. + * Default value is FbxDouble3(0.0,0.0,0.0). + */ + FbxPropertyT RotationPivot; + + /** This property handles the scaling pivot vector. + * Default value is FbxDouble3(0.0,0.0,0.0). + */ + FbxPropertyT ScalingPivot; + + // Blend mode + /** This property handles the texture blend mode. + * Default value is eAdditive. + */ + FbxPropertyT CurrentTextureBlendMode; + + // UV set to use. + /** This property handles the use of UV sets. + * Default value is "default". + */ + FbxPropertyT UVSet; + + /** This property only used by Vector Displacement Texture so it is not added to FbxTexture. + * It is a dynamic enum property which has values : "World", "Object" and "Tangent" + * Default value is "Object". + */ + static const char* sVectorSpace ; + static const char* sVectorSpaceWorld ; + static const char* sVectorSpaceObject ; + static const char* sVectorSpaceTangent ; + + /** This property only used by Vector Displacement Texture so it is not added to FbxTexture. + * It is a dynamic enum property which has values : "Floating-point Absolute" and "Signed Encoding" + * Default value is "Floating-point Absolute". + */ + static const char* sVectorEncoding ; + static const char* sVectorEncodingFP ; + static const char* sVectorEncodingSE ; + + + /** Resets the default texture values. + */ + virtual void Reset(); + + /** Sets the swap UV flag. + * \param pSwapUV Set to \c true if the swap UV flag is enabled. + * \remarks If the swap UV flag is enabled, the texture's width and height are swapped. + */ + void SetSwapUV(bool pSwapUV); + + /** Returns the swap UV flag. + * \return \c True if the swap UV flag is enabled. + * \remarks If the swap UV flag is enabled, the texture's width and height are swapped. + */ + bool GetSwapUV() const; + + /** Sets the PremultiplyAlpha flag. + * \param pPremultiplyAlpha Set to \c true if the method of storing alpha is PremultiplyAlpha. + * \remarks If PremultiplyAlpha flag is true, the R, G, and B components you store have already been multiplied in with the alpha. + */ + void SetPremultiplyAlpha(bool pPremultiplyAlpha); + + /** Returns the PremultiplyAlpha flag. + * \return \c True if the method of storing alpha is PremultiplyAlpha. + * \remarks If PremultiplyAlpha flag is true, the R, G, and B components you store have already been multiplied in with the alpha. + */ + bool GetPremultiplyAlpha() const; + + /** \enum EAlphaSource Controls if the Alpha computation of the current texture comes from the Alpha channel, RGB Intensity channel, or if there is No Alpha. + */ + enum EAlphaSource + { + eNone, //! No Alpha. + eRGBIntensity, //! RGB Intensity (computed). + eBlack //! Alpha channel. Black is 100% transparency, white is opaque. + }; + + /** Sets the alpha source. + * \param pAlphaSource The alpha source identifier. + */ + void SetAlphaSource(EAlphaSource pAlphaSource); + + /** Returns the alpha source. + * \return The alpha source identifier for this texture. + */ + EAlphaSource GetAlphaSource() const; + + /** Sets cropping. + * \param pLeft Left cropping value. + * \param pTop Top cropping value. + * \param pRight Right cropping value. + * \param pBottom Bottom cropping value. + * \remarks The defined rectangle is not checked for invalid values. + * The caller must verify that the rectangle + * is meaningful for this texture. + */ + void SetCropping(int pLeft, int pTop, int pRight, int pBottom); + + /** Returns left cropping. + * \return The left side of the cropping rectangle. + */ + int GetCroppingLeft() const; + + /** Returns top cropping. + * \return The top side of the cropping rectangle. + */ + int GetCroppingTop() const; + + /** Returns right cropping. + * \return The right side of the cropping rectangle. + */ + int GetCroppingRight() const; + + /** Returns bottom cropping. + * \return The bottom side of the cropping rectangle. + */ + int GetCroppingBottom() const; + + /** \enum EMappingType Texture mapping types. + */ + enum EMappingType + { + eNull, //! No texture mapping defined. + ePlanar, //! Apply texture to the model viewed as a plane. + eSpherical, //! Wrap texture around the model as if it was a sphere. + eCylindrical, //! Wrap texture around the model as if it was a cylinder. + eBox, //! Wrap texture around the model as if it was a box. + eFace, //! Apply texture to the model viewed as a face. + eUV, //! Apply texture to the model according to UVs. + eEnvironment //! Texture is an environment map. + }; + + /** Sets the mapping type. + * \param pMappingType The mapping type identifier. + */ + void SetMappingType(EMappingType pMappingType); + + /** Returns the mapping type. + * \return The mapping type identifier. + */ + EMappingType GetMappingType() const; + + /** \enum EPlanarMappingNormal Planar mapping normal orientations. + */ + enum EPlanarMappingNormal + { + ePlanarNormalX, //! Normals are in the direction of the X axis, mapping plan is in the YZ axis. + ePlanarNormalY, //! Normals are in the direction of the Y axis, mapping plan is in the XZ axis. + ePlanarNormalZ //! Normals are in the direction of the Z axis, mapping plan is in the XY axis. + }; + + /** Sets the normal orientations for planar mapping. + * \param pPlanarMappingNormal The identifier for planar mapping normal orientation. + */ + void SetPlanarMappingNormal(EPlanarMappingNormal pPlanarMappingNormal); + + /** Returns the normal orientations for planar mapping. + * \return The identifier for planar mapping normal orientation. + */ + EPlanarMappingNormal GetPlanarMappingNormal() const; + + /** \enum ETextureUse Texture uses. + */ + enum ETextureUse + { + eStandard, //! Standard texture use (ex. image) + eShadowMap, //! Shadow map + eLightMap, //! Light map + eSphericalReflectionMap, //! Spherical reflection map: Object reflects the contents of the scene + eSphereReflectionMap, //! Sphere reflection map: Object reflects the contents of the scene from only one point of view + eBumpNormalMap //! Bump map: Texture contains two direction vectors, that are used to convey relief in a texture. + }; + + /** Sets the texture use. + * \param pTextureUse The texture use identifier. + */ + void SetTextureUse(ETextureUse pTextureUse); + + /** Returns the texture use. + * \return The texture use identifier. + */ + ETextureUse GetTextureUse() const; + + + /** Sets the U and V wrap mode. + * \param pWrapU Wrap mode identifier. + * \param pWrapV Wrap mode identifier. + */ + void SetWrapMode(EWrapMode pWrapU, EWrapMode pWrapV); + + /** Returns the U wrap mode. + * \return U wrap mode identifier. + */ + EWrapMode GetWrapModeU() const; + + /** Returns the V wrap mode. + * \return V wrap mode identifier. + */ + EWrapMode GetWrapModeV() const; + + + /** Sets the blend mode. + * \param pBlendMode Blend mode identifier. + */ + void SetBlendMode(EBlendMode pBlendMode); + + /** Returns the blend mode. + * \return Blend mode identifier. + */ + EBlendMode GetBlendMode() const; + + //@} + + /** + * \name Default Values Management By Vectors + * This set of functions provides direct access to the default values in vector base. + */ + //@{ + + /** Sets the default translation vector. + * \param pT The first element is the U translation applied to + * the texture. A displacement of one unit is equal to the texture + * width after the U scaling is applied. The second element is the + * V translation applied to the texture. A displacement of one unit is + * equal to the texture height after the V scaling is applied. + * The third and fourth elements have no effect on texture + * translation. + */ + inline void SetDefaultT(const FbxVector4& pT) { Translation.Set( pT ); } + + /** Returns the default translation vector. + * \param pT The first element is the U translation applied to + * the texture. A displacement of one unit is equal to the texture + * width after the U scaling is applied. The second element is the + * V translation applied to the texture. A displacement of one unit is + * equal to the texture height after the V scaling is applied. + * The third and fourth elements have no effect on texture + * translation. + * \return The input parameter completed with appropriate data. + */ + FbxVector4& GetDefaultT(FbxVector4& pT) const; + + /** Sets the default rotation vector. + * \param pR The first element is the texture rotation around the + * U axis in degrees. The second element is the texture rotation + * around the V axis in degrees. The third element is the texture + * rotation around the W axis in degrees. + * \remarks The W axis is oriented toward the result of the + * vector product of the U and V axes that is W = U x V. + */ + inline void SetDefaultR(const FbxVector4& pR) { Rotation.Set( FbxDouble3(pR[0],pR[1],pR[2]) ); } + + /** Returns the default rotation vector. + * \param pR First element is the texture rotation around the + * U axis in degrees. Second element is the texture rotation + * around the V axis in degrees. Third element is the texture + * rotation around the W axis in degrees. + * \return Input parameter filled with appropriate data. + * \remarks The W axis is oriented towards the result of the + * vector product of the U axis and V axis i.e. W = U x V. + */ + FbxVector4& GetDefaultR(FbxVector4& pR) const; + + /** Sets the default scale vector. + * \param pS The first element is scale applied to the texture width. + * The second element is scale applied to the texture height. The third + * and fourth elements have no effect on the texture. + * \remarks A scale value less than 1 stretches the texture. + * A scale value greater than 1 compresses the texture. + */ + inline void SetDefaultS(const FbxVector4& pS) { Scaling.Set( FbxDouble3(pS[0],pS[1],pS[2]) ); } + + /** Returns the default scale vector. + * \param pS The first element is scale applied to the texture width. + * The second element is scale applied to the texture height. The third + * and fourth elements have no effect on the texture. + * \remarks A scale value less than 1 stretches the texture. + * A scale value greater than 1 compresses the texture. + */ + FbxVector4& GetDefaultS(FbxVector4& pS) const; + + //@} + + /** + * \name Default Alpha Value + */ + //@{ + + /** Sets the default alpha. + * \param pAlpha A value on a scale from 0 to 1, with 0 being transparent. + */ + void SetDefaultAlpha(double pAlpha); + + /** Returns the default alpha. + * \return A value on a scale from 0 to 1, with 0 being transparent. + */ + double GetDefaultAlpha() const; + + //@} + + /** + * \name Default Values Management By Numbers + * This set of functions provides direct access to the default values in number base. + * U, V and W coordinates are mapped to the X, Y and Z coordinates of the default vectors + * found in the "Default Values By Vector" section. + */ + //@{ + + /** Sets translation. + * \param pU Horizontal translation applied to a texture. A displacement + * of one unit is equal to the texture's width after applying U scaling. + * \param pV Vertical translation applied to a texture. A displacement + * of one unit is equal to the texture's height after applying V scaling. + */ + void SetTranslation(double pU,double pV); + + /** Returns translation applied to the texture width. + * \remarks A displacement of one unit is equal to the texture's width + * after applying U scaling. + */ + double GetTranslationU() const; + + /** Returns translation applied to the texture height. + * \remarks A displacement of one unit is equal to the texture's height + * after applying V scaling. + */ + double GetTranslationV() const; + + /** Sets rotation. + * \param pU Texture rotation around the U axis in degrees. + * \param pV Texture rotation around the V axis in degrees. + * \param pW Texture rotation around the W axis in degrees. + * \remarks The W axis is oriented toward the result of the vector product of + * the U and V axes that is W = U x V. + */ + void SetRotation(double pU, double pV, double pW = 0.0); + + //! Returns the texture rotation around the U axis in degrees. + double GetRotationU() const; + + //! Returns the texture rotation around the V axis in degrees. + double GetRotationV() const; + + //! Returns the texture rotation around the W axis in degrees. + double GetRotationW() const; + + /** Sets scale. + * \param pU Scale applied to the texture width. + * \param pV Scale applied to the texture height. + * \remarks A scale value less than 1 stretches the texture. + * A scale value greater than 1 compresses the texture. + */ + void SetScale(double pU,double pV); + + /** Returns scale applied to the texture width. + * \remarks A scale value less than 1 stretches the texture. + * A scale value greater than 1 compresses the texture. + */ + double GetScaleU() const; + + /** Returns scale applied to the texture height. + * \remarks A scale value less than 1 stretches the texture. + * A scale value greater than 1 compresses the texture. + */ + double GetScaleV() 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 + virtual FbxObject& Copy(const FbxObject& pObject); + + bool operator==(FbxTexture const& pTexture) const; + + void SetUVTranslation(FbxVector2& pT); + FbxVector2& GetUVTranslation(); + void SetUVScaling(FbxVector2& pS); + FbxVector2& GetUVScaling(); + + FbxString GetTextureType(); + +protected: + virtual void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + + virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty); + + void Init(); + + int mCropping[4]; // not a prop + + EAlphaSource mAlphaSource; // now unused in MB (always set to None); not a prop + EMappingType mMappingType; // CurrentMappingType + EPlanarMappingNormal mPlanarMappingNormal; // CurrentMappingType + + // Unsupported parameters in the FBX SDK, these are declared but not accessible. + // They are used to keep imported and exported data identical. + FbxVector2 mUVScaling; // not a prop + FbxVector2 mUVTranslation; // not a prop +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +inline EFbxType FbxTypeOf(const FbxTexture::EUnifiedMappingType&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxTexture::ETextureUse6&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxTexture::EWrapMode&){ return eFbxEnum; } +inline EFbxType FbxTypeOf(const FbxTexture::EBlendMode&){ return eFbxEnum; } + +#include + +#endif /* _FBXSDK_SCENE_SHADING_TEXTURE_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxclonemanager.h b/libs/fbx/include/fbxsdk/utils/fbxclonemanager.h new file mode 100644 index 00000000..1d188262 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxclonemanager.h @@ -0,0 +1,284 @@ +/**************************************************************************************** + + 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 fbxclonemanager.h +#ifndef _FBXSDK_UTILS_CLONE_MANAGER_H_ +#define _FBXSDK_UTILS_CLONE_MANAGER_H_ + +#include + +#include +#include + +#include + +/** The clone manager is a utility for cloning entire networks of FbxObject. + * Options are available for specifying how the clones inherit the connections + * of the original. + * + * Networks of FbxObject (inter-connected objects by OO, OP, PO or PP connections) + * can be cloned. How the connections of clones are handled depends on mSrcPolicy and mExternalDstPolicy. + * + * To clone FbxObject instances and their dependents, put them into a CloneSet + * and pass the CloneSet to this class: + * \code + * FbxCloneManager cloneManager; + * FbxCloneManager::CloneSet cloneSet; + * FbxCloneManager::CloneSetElement defaultCloneOptions(FbxCloneManager::sConnectToClone, + * FbxCloneManager::sConnectToOriginal, + * FbxObject::eDeepClone); + * cloneSet.Insert(someObject, defaultCloneOptions); + * cloneManager.AddDependents(cloneSet, someObject, defaultCloneOptions); + * cloneManager.Clone(cloneSet, scene) + * \endcode + * + * \remark If cloning occurs on the same scene as the original objects, the system will contain duplicated names. Although this is acceptable in FBX, + * some applications may not behave correctly with duplicated names. It is the responsability of the caller to resolve any conflicts. + * + * \see FbxCloneManager::CloneSetElement + * \see FbxCloneManager::CloneSet + * \nosubgrouping + */ +class FBXSDK_DLL FbxCloneManager +{ +public: + + //! Maximum depth to clone dependents. + static const int sMaximumCloneDepth; + + /** Connect to objects that are connected to original object. + * This is a flag to mSrcPolicy or mExternalDstPolicy. + */ + static const int sConnectToOriginal; + + /** Connect to clones of objects that are connected to original object. + * (only if those original objects are also in the clone set) + * This is a flag to mSrcPolicy. + */ + static const int sConnectToClone; + + /** This represents an element in FbxCloneManager::CloneSet to be cloned. + * This class contains the option for specifying how connections are cloned and the + * cloned object. + * \see FbxCloneManager + * \see FbxCloneManager::CloneSet + */ + struct FBXSDK_DLL CloneSetElement + { + public: + /** Constructor. + * \param pSrcPolicy Specify how to handle source connections. Valid values are 0, sConnectToOriginal, + * sConnectToClone or sConnectToOriginal|sConnectToClone. + * \param pExternalDstPolicy Specify how to handle destination connections to objects NOT in + * the clone set. Valid values are 0 or sConnectToOriginal. + * \param pCloneType Specify the type of cloning. FbxObject::Clone uses the same parameter. + */ + CloneSetElement( int pSrcPolicy = 0, + int pExternalDstPolicy = 0, + FbxObject::ECloneType pCloneType = FbxObject::eReferenceClone ); + + //! the type of cloning to perform + FbxObject::ECloneType mType; + + /** Policy on how to handle source connections on the original object. Valid values are 0 + * or any bitwise OR'd combination of sConnectToOriginal, and sConnectToClone. + */ + int mSrcPolicy; + + /** policy on how to handle destination connections on the original object to + * objects NOT in the clone set. (Destination connections to objects in the set + * are handled by that object's source policy) Valid values are 0 or sConnectToOriginal. + */ + int mExternalDstPolicy; + + /** This is a pointer to the newly created clone. + * It is set after the call to FbxCloneManager::Clone() + */ + FbxObject* mObjectClone; + + /** Internal use. + */ + bool mLayerElementProcessed; + bool mConnectionsProcessed; + }; + + /** The CloneSet is a collection of pointers to objects that will be cloned in Clone() + * Attached to each object is a CloneSetElement. Its member variables dictate how + * the corresponding object will be cloned, and how it will inherit connections + * on the original object. + */ + typedef FbxMap CloneSet; + + /** Constructor + */ + FbxCloneManager(); + + /** Destructor + */ + virtual ~FbxCloneManager(); + + /** This function simplifies the process of cloning one object and all its depedency graph by automatically preparing + * the CloneSet and calling the Clone method using the code below. + * + * \code + * FbxCloneManager cloneManager; + * FbxCloneManager::CloneSet cloneSet; + * FbxCloneManager::CloneSetElement defaultCloneOptions(FbxCloneManager::sConnectToClone, + * FbxCloneManager::sConnectToOriginal, + * FbxObject::eDeepClone); + * FbxObject* lReturnObj = (FbxObject*)pObject; + * + * cloneManager.AddDependents(cloneSet, pObject, defaultCloneOptions, FbxCriteria::ObjectType(FbxObject::ClassId)); + * cloneSet.Insert((FbxObject*)pObject, defaultCloneOptions); + * + * // collect all the FbxCharacters, if any (these are indirect dependencies not visible by the AddDependents recursion) + * FbxArray lExtras; + * FbxCloneManager::CloneSet::RecordType* lIterator = cloneSet.Minimum(); + * while( lIterator ) + * { + * FbxObject* lObj = lIterator->GetKey(); + * cloneManager.LookForIndirectDependent(lObj, cloneSet, lExtras); + * lIterator = lIterator->Successor(); + * } + * + * // and add them to cloneSet + * for (int i = 0, c = lExtras.GetCount(); i < c; i++) + * { + * FbxObject* lObj = lExtras[i]; + * cloneManager.AddDependents(cloneSet, lObj, defaultCloneOptions); + * cloneSet.Insert(lObj, defaultCloneOptions); + * } + * + * // clone everything + * if (cloneManager.Clone(cloneSet, pContainer)) + * { + * // get the clone of pObject + * CloneSet::RecordType* lIterator = cloneSet.Find((FbxObject* const)pObject); + * if( lIterator ) + * { + * lReturnObj = lIterator->GetValue().mObjectClone; + * } + * } + * return lReturnObj; + * \endcode + * + * \param pObject Object to clone. + * \param pContainer This object (typically a scene or document) will contain the new clones. + * \return The clone of \e pObject if all its depedency graph have been cloned successfully, NULL otherwise. + * \remark It is advised not to use an FbxNode object for \e pContainer to group the cloned dependency graph. + * Some objects of the FBX SDK are not meant to be connected to FbxNode objects and if they are, the final scene + * will not comply to the FBX standard and its behavior cannot be guaranteed. + * \remark If \e pContainer is left \c NULL the cloned objects only exists in the FbxSdkManager and need to be + * manually connected to the scene in order to be saved to disk. + * + * Example: + * \code + * FbxObject* lObj2BCloned = ... + * FbxNode* myNewParent = FbxNode::Create(lNewScene, "Clone"); + * lNewScene->GetRootNode()->AddChild(lN); + * + * FbxCloneManager cloneManager; + * FbxNode *lClone = (FbxNode*)cloneManager.Clone(lObj2BCloned); + * + * // make sure the cloned object is connected to the scene + * lClone->ConnectDstObject(lNewScene); + * \endcode + */ + static FbxObject* Clone(const FbxObject* pObject, FbxObject* pContainer = NULL); + + /** Clone all objects in the set using the given policies for duplication + * of connections. Each CloneSetElement in the set will have its mObjectClone + * pointer set to the newly created clone. The following code shows how to access the cloned objects: + * + * \code + * if (cloneManager.Clone(cloneSet, pContainer)) + * { + * // access the clones + * FbxCloneManager::CloneSet::RecordType* lIterator = cloneSet.Minimum(); + * while( lIterator ) + * { + * FbxObject* lOriginalObject = lIterator->GetKey(); + * FbxObject* lClonedObject = lIterator->GetValue().mObjectClone; + * lIterator = lIterator->Successor(); + * } + * } + * \endcode + * + * \param pSet Set of objects to clone + * \param pContainer This object (typically a scene or document) will contain the new clones + * \return true if all objects were cloned, false otherwise. + * \remark It is advised not to use an FbxNode object for \e pContainer to group the cloned dependency graph. + * Some objects of the FBX SDK are not meant to be connected to FbxNode objects and if they are, the final scene + * will not comply to the FBX standard and its behavior cannot be guaranteed. + * \remark If \e pContainer is left \c NULL the cloned objects only exists in the FbxSdkManager and need to be + * manually connected to the scene in order to be saved to disk. + */ + virtual bool Clone( CloneSet& pSet, FbxObject* pContainer = NULL ) const; + + /** Add all dependents of the given object to the CloneSet. + * Dependents of items already in the set are ignored to prevent + * infinite recursion on cyclic dependencies. + * \param pSet The set to add items. + * \param pObject Object to add dependents to + * \param pCloneOptions + * \param pTypes Types of dependent objects to consider + * \param pDepth Maximum recursive depth. Valid range is [0,sMaximumCloneDepth] + * + * The following example shows how to perform multiple calls to AddDependents() to collect several + * subgraphs to be cloned: + * \code + * FbxObject* lRoot = ... // initialized with the root of the graph to be cloned + * FbxCharacter* lCharacter = ... // points to the FbxCharacter driving the character defined by "lRoot" graph + * + * FbxCloneManager cloneManager; + * FbxCloneManager::CloneSet cloneSet; + * + * cloneManager.AddDependents(cloneSet, lRoot); + * cloneSet.Insert(lRoot, defaultCloneOptions); + * + * cloneManager.AddDependents(cloneSet, lCharacter); + * cloneSet.Insert(lCharacter, defaultCloneOptions); + * + * \endcode + */ + virtual void AddDependents( CloneSet& pSet, + const FbxObject* pObject, + const CloneSetElement& pCloneOptions = CloneSetElement(), + FbxCriteria pTypes = FbxCriteria::ObjectType(FbxObject::ClassId), + int pDepth = sMaximumCloneDepth ) 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 + static FbxObject* Clone(const FbxObject* pObject, CloneSet* pSet, FbxObject* pContainer = NULL); + +private: + friend class FbxScene; + + bool ReAssignLayerElements( FbxCloneManager::CloneSet::RecordType* pIterator, const FbxCloneManager::CloneSet& pSet) const; + bool CloneConnections( CloneSet::RecordType* pIterator, const CloneSet& pSet) const; + bool CheckIfCloneOnSameScene(const FbxObject* pObject, FbxObject* pContainer) const; + + virtual void LookForIndirectDependent(const FbxObject* pObject, CloneSet& pSet, FbxArray& lIndirectDepend); + virtual bool NeedToBeExcluded(FbxObject* lObj) const; + + bool mCloneOnSameScene; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#define CloneSetCast(x) ((FbxCloneManager::CloneSet*)(x)) +#define CloneSetElementCast(x) ((FbxCloneManager::CloneSetElement*)((x!=NULL)?&(x->GetValue()):NULL)) + +#endif /* _FBXSDK_UTILS_CLONE_MANAGER_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxdeformationsevaluator.h b/libs/fbx/include/fbxsdk/utils/fbxdeformationsevaluator.h new file mode 100644 index 00000000..ada538fd --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxdeformationsevaluator.h @@ -0,0 +1,86 @@ +/**************************************************************************************** + + 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 fbxdeformationsevaluator.h +#ifndef _FBXSDK_UTILS_DEFORMATIONS_EVALUATOR_H_ +#define _FBXSDK_UTILS_DEFORMATIONS_EVALUATOR_H_ + +#include + +#include + +class FbxNode; +class FbxMesh; +class FbxTime; +class FbxAnimLayer; +class FbxPose; +class FbxCluster; +class FbxVector4; +class FbxAMatrix; +class FbxDualQuaternion; + +class FBXSDK_DLL FbxDeformationsEvaluator +{ +public: + /** Configure this object to process the given mesh. + * \param pNode Node object owner of the mesh. + * \param pMesh Processed object. + * \return \c true if \e pMesh is connected to \e pNode and the internal data allocation succeeded. */ + bool Init(const FbxNode* pNode, const FbxMesh* pMesh); + + /** If this object is properly configured, evaluates the shape deformation of the mesh at the given time. + * \param pVertexArray The result of the evaluation. + * \param pTime Current time of the evaluation. + * \return \c true if the function completed successfully and \c false in case of errors. + * \remarks \e pVertexArray must be allocated and be of size: \e mMesh->GetControlPointCount(). */ + bool ComputeShapeDeformation(FbxVector4* pVertexArray, const FbxTime& pTime); + + /** If this object is properly configured, evaluates the skin deformation of the received mesh at the given time. + * \param pVertexArray The result of the evaluation. + * \param pTime Current time of the evaluation. + * \param pGX Local to World matrix to express the returned vertices in World space. + * \param pPose If defined, use the pose to evaluate the current transform. + * \return \c true if the function completed successfully and \c false in case of errors. + * \remarks \e pVertexArray must be allocated and be of size: \e mMesh->GetControlPointCount(). */ + bool ComputeSkinDeformation(FbxVector4* pVertexArray, const FbxTime& pTime, FbxAMatrix* pGX=NULL, const FbxPose* pPose=NULL); + +/***************************************************************************************************************************** +** 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 + FbxDeformationsEvaluator(); + virtual ~FbxDeformationsEvaluator(); + +private: + void ComputeClusterDeformation(FbxVector4* pVertexArray, const FbxTime& pTime, const FbxAMatrix& pGX, FbxCluster* pCluster, FbxAMatrix& pVertexTransformMatrix, const FbxPose* pPose); + void ComputeLinearDeformation(FbxVector4* pVertexArray, const FbxTime& pTime, const FbxAMatrix& pGX, const FbxPose* pPose); + void ComputeDualQuaternionDeformation(FbxVector4* pVertexArray, const FbxTime& pTime, const FbxAMatrix& pGX, const FbxPose* pPose); + void Cleanup(); + + bool mIsConfigured; + FbxNode* mNode; + FbxMesh* mMesh; + FbxAnimLayer* mAnimLayer; + + int mVertexCount; + FbxVector4* mDstVertexArray; + FbxVector4* mVertexArrayLinear; + FbxVector4* mVertexArrayDQ; + + FbxAMatrix* mClusterDeformation; + double* mClusterWeight; + FbxDualQuaternion* mDQClusterDeformation; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_DEFORMATIONS_EVALUATOR_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxembeddedfilesaccumulator.h b/libs/fbx/include/fbxsdk/utils/fbxembeddedfilesaccumulator.h new file mode 100644 index 00000000..9656754d --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxembeddedfilesaccumulator.h @@ -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 fbxembeddedfilesaccumulator.h +#ifndef _FBXSDK_UTILS_EMBEDDED_FILES_ACCUMULATOR_H_ +#define _FBXSDK_UTILS_EMBEDDED_FILES_ACCUMULATOR_H_ + +#include + +#include + +#include + +/** This processor is used to accumulate the list of file dependencies (embedded files) in a hierarchy of objects. + * It retrieves information of embedded files from objects and accumulates them to its class member mEmbeddedFiles. + * \see FbxProcessor::ProcessCollection(FbxCollection *) + * \nosubgrouping + */ +class FBXSDK_DLL FbxEmbeddedFilesAccumulator : public FbxProcessor +{ +public: + /** + * Map the object to the property's hierarchical name. + * An object may use the same file on multiple properties, hence the + * set. + * Each property may have multiple URLs, separate by |. + * We thus need to store the index along with the property. + */ + //@{ + struct PropertyUrlIndex + { + FbxString mPropName; + int mIndex; + + PropertyUrlIndex() : mIndex(0) + { + } + + PropertyUrlIndex(const FbxString& pUrl, int pIndex) + : mPropName(pUrl) + , mIndex(pIndex) + { + } + }; + + //! Comparer for PropertyUrlIndexSet, which outputs consistent partial orders for PropertyUrlIndex pairs + struct FbxPropertyUrlIndexCompare + { + inline int operator()(const PropertyUrlIndex& pKeyA, const PropertyUrlIndex& pKeyB) const + { + if( pKeyA.mPropName < pKeyB.mPropName ) return -1; + if( pKeyB.mPropName < pKeyA.mPropName ) return 1; + if( pKeyA.mIndex < pKeyB.mIndex ) return -1; + if( pKeyB.mIndex < pKeyA.mIndex ) return 1; + return 0; + } + }; + + typedef FbxSet PropertyUrlIndexSet; + + typedef FbxMap ObjectPropertyMap; + + struct EmbeddedFileInfo + { + FbxString mOriginalPropertyUrl; + ObjectPropertyMap mConsumers; + }; + //@} + + /** + * Map the (absolute filename) to which object/properties use this file. + * To simply get the list of file dependencies, iterate through this map and query + * all the keys. + */ + //@{ + typedef FbxMap EmbeddedFilesMap; + + EmbeddedFilesMap mEmbeddedFiles; + //@} + +public: + + /** Constructor. + * The name is not important. + * The property filter is a list of strings, property names, which are automatically ignored when + * encountered. Property names must be the full hierarchical property name (ie: parent|child|child). + * + * \param pManager Reference to the SDK manager. + * \param pName Name of this object. + * \param pPropertyFilter Reference to the property filter. + */ + FbxEmbeddedFilesAccumulator(FbxManager& pManager, const char* pName, FbxSet& pPropertyFilter); + virtual ~FbxEmbeddedFilesAccumulator(); + +/***************************************************************************************************************************** +** 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 internal_ProcessObject(FbxObject* pObject); + FbxSet mPropertyFilter; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_EMBEDDED_FILES_ACCUMULATOR_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxgeometryconverter.h b/libs/fbx/include/fbxsdk/utils/fbxgeometryconverter.h new file mode 100644 index 00000000..1ecd53d2 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxgeometryconverter.h @@ -0,0 +1,345 @@ +/**************************************************************************************** + + 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 fbxgeometryconverter.h +#ifndef _FBXSDK_UTILS_GEOMETRY_CONVERTER_H_ +#define _FBXSDK_UTILS_GEOMETRY_CONVERTER_H_ + +#include + +#include + +#include + +class FbxManager; +class FbxMesh; +class FbxPatch; +class FbxNurbs; +class FbxNurbsSurface; +class FbxNurbsCurve; +class FbxWeightedMapping; +class FbxSurfaceEvaluator; +class FbxScene; +class FbxNode; +class FbxNodeAttribute; +class FbxGeometry; + +/** +* This class provides the functionality to convert geometry nodes +* attributes (FbxMesh, FbxNurbs and FbxPatch) and mainly focuses on the two +* major categories: Triangulation and conversion between NURBS and Patches surfaces. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxGeometryConverter +{ +public: + /** \name Triangulation Utilities */ + //@{ + /** Triangulate all node attributes in the scene that can be triangulated. + * \param pScene The scene to iterate through to triangulate meshes. + * \param pReplace If \c true, replace the original meshes with the new triangulated meshes on all the nodes, and delete the original meshes. Otherwise, original meshes are left untouched. + * \param pLegacy If \c true, use legacy triangulation method that does not support holes in geometry. Provided for backward compatibility. + * \return \c true if all node attributes that can be triangulated were triangulated successfully. + * \remark The function will still iterate through all meshes regardless if one fails to triangulate, but will return false in that case. This function + * currently only supports node attribute of type eMesh, ePatch, eNurbs or eNurbsSurface. */ + bool Triangulate(FbxScene* pScene, bool pReplace, bool pLegacy=false); + + /** Triangulate a node attribute, if supported, and preserve the skins and shapes animation channels. + * \param pNodeAttribute Pointer to the node containing the geometry to triangulate. + * \param pReplace If \c true, replace the original geometry with the new triangulated geometry on the nodes, and delete the original geometry. + * Otherwise, the original geometry is left untouched, the new one is added to the nodes, and becomes the default one. + * \param pLegacy If \c true, use legacy triangulation method that does not support holes in geometry. Provided for backward compatibility. + * \return The newly created node attribute if successful, otherwise NULL. If node attribute type is not supported by triangulation, it returns the original node attribute. + * \remark This function currently only supports node attribute of type eMesh, ePatch, eNurbs or eNurbsSurface. If the node attribute does not support triangulation, + * or if it is already triangulated, this function will return pNodeAttribute. */ + FbxNodeAttribute* Triangulate(FbxNodeAttribute* pNodeAttribute, bool pReplace, bool pLegacy=false); + + /** Compute a "vertex-correspondence" table that helps passing from source to destination geometry. + * \param pSrcGeom Pointer to the source geometry. + * \param pDstGeom Pointer to the destination geometry. + * \param pSrcToDstWeightedMapping Pointer to the weighted mapping table. + * \param pSwapUV Set to \c true to swap UVs. + * \return \c true on success, \c false if the function fails to compute the correspondence. + * \remark Skins and shapes are also converted to fit the alternate geometry. */ + bool ComputeGeometryControlPointsWeightedMapping(FbxGeometry* pSrcGeom, FbxGeometry* pDstGeom, FbxWeightedMapping* pSrcToDstWeightedMapping, bool pSwapUV=false); + //@} + + /** + * \name Geometry Conversion + */ + //@{ + /** Convert from patch to nurb. + * \param pPatch Pointer to the patch to convert. + * \return Created nurb or \c NULL if the conversion fails. + * \remarks The patch must be of type eBSpline, eBezier or eLinear. + */ + FbxNurbs* ConvertPatchToNurbs(FbxPatch *pPatch); + + /** Convert a patch contained in a node to a nurb. Use this function to preserve the patch's + * skins and shapes animation channels. + * \param pNode Pointer to the node containing the patch. + * \return \c true on success, \c false if the node attribute is not a patch. + * \remarks The patch must be of type eBSpline, eBezier or eLinear. + */ + bool ConvertPatchToNurbsInPlace(FbxNode* pNode); + + /** Convert a patch to nurb surface. + * \param pPatch Pointer to the patch to convert. + * \return Created nurb surface or \c NULL if conversion fails. + * \remarks The patch must be of type eBSpline, eBezier or eLinear. + */ + FbxNurbsSurface* ConvertPatchToNurbsSurface(FbxPatch *pPatch); + + /** Convert a patch contained in a node to a nurb surface. Use this function to preserve + * the patch's skins and shapes animation channels. + * \param pNode Pointer to the node containing the patch. + * \return \c true on success, \c false if the node attribute is not a patch. + * \remarks The patch must be of type eBSpline, eBezier or eLinear. + */ + bool ConvertPatchToNurbsSurfaceInPlace(FbxNode* pNode); + + /** Convert a FbxNurbs to a FbxNurbsSurface + * \param pNurbs Pointer to the original nurb + * \return A FbxNurbsSurface that is equivalent to the original nurb. + */ + FbxNurbsSurface* ConvertNurbsToNurbsSurface( FbxNurbs* pNurbs ); + + /** Convert a FbxNurbsSurface to a FbxNurbs + * \param pNurbs Pointer to the original nurbs surface + * \return A FbxNurbs that is equivalent to the original nurbs surface. + */ + FbxNurbs* ConvertNurbsSurfaceToNurbs( FbxNurbsSurface* pNurbs ); + + /** Convert a nurb, contained in a node, to a nurbs surface. Use this function to preserve + * the nurb's skins and shapes animation channels. + * \param pNode Pointer to the node containing the nurb. + * \return \c true on success, \c false otherwise + */ + bool ConvertNurbsToNurbsSurfaceInPlace(FbxNode* pNode); + + /** Convert a nurb contained in a node to a nurbs surface. Use this function to preserve + * the nurb's skins and shapes animation channels. + * \param pNode Pointer to the node containing the nurbs surface. + * \return \c true on success, \c false otherwise + */ + bool ConvertNurbsSurfaceToNurbsInPlace(FbxNode* pNode); + //@} + + /** + * \name Nurb UV and Links Swapping + */ + //@{ + /** Flip UV and/or skin clusters of a nurb. + * \param pNurbs Pointer to the Source nurb. + * \param pSwapUV Set to \c true to swap the UVs. + * \param pSwapClusters Set to \c true to swap the control point indices of clusters. + * \return A flipped FbxNurbs, or \c NULL if the function fails. + */ + FbxNurbs* FlipNurbs(FbxNurbs* pNurbs, bool pSwapUV, bool pSwapClusters); + + /** Flip UV and/or skin clusters of a nurb surface. + * \param pNurbs Pointer to the Source nurb surface. + * \param pSwapUV Set to \c true to swap the UVs. + * \param pSwapClusters Set to \c true to swap the control point indices of clusters. + * \return A flipped FbxNurbsSurface, or \c NULL if the function fails. + */ + FbxNurbsSurface* FlipNurbsSurface(FbxNurbsSurface* pNurbs, bool pSwapUV, bool pSwapClusters); + //@} + + /** + * \name Normals By Polygon Vertex Emulation + */ + //@{ + /** Emulate normals by polygon vertex mode for a mesh. + * \param pMesh Pointer to the mesh object. + * \return \c true on success, \c false if the number of normals in the + * mesh and in its associated shapes don't match the number of polygon + * vertices. + * \remarks For applications that only supports normals by control points, + * this function duplicates control points to equal the + * number of polygon vertices. skins and shapes are also converted. + * As preconditions: + * -# polygons must have been created + * -# the number of normals in the mesh and in its associated shapes must match the + * number of polygon vertices. + */ + bool EmulateNormalsByPolygonVertex(FbxMesh* pMesh); + + /** Create edge smoothing information from polygon-vertex mapped normals. + * Existing smoothing information is removed and edge data is created if + * none exists on the mesh. + * \param pMesh The mesh used to generate edge smoothing. + * \return \c true on success, \c false otherwise. + * \remarks The edge smoothing data is placed on Layer 0 of the mesh. + * Normals do not need to be on Layer 0, since the first layer with + * per polygon vertex normals is used. + */ + bool ComputeEdgeSmoothingFromNormals( FbxMesh* pMesh ) const; + + /** Convert edge smoothing to polygon smoothing group. + * Existing smoothing information is replaced. + * + * \param pMesh The mesh that contains the smoothing to be converted. + * \param pIndex The index of the layer smoothing to be converted. + * \return \c true on success, \c false otherwise. + * \remarks The smoothing group is bitwise. Each bit of the integer represents + * one smoothing group. Therefore, there is a maximum of 32 smoothing groups. + */ + bool ComputePolygonSmoothingFromEdgeSmoothing( FbxMesh* pMesh, int pIndex=0 ) const; + + /** Convert polygon smoothing group to edge smoothing. + * Existing smoothing information is replaced. + * + * \param pMesh The mesh that contains the smoothing to be converted. + * \param pIndex The index of the layer smoothing to be converted + * \return \c true on success, \c false otherwise. + */ + bool ComputeEdgeSmoothingFromPolygonSmoothing( FbxMesh* pMesh, int pIndex=0 ) const; + //@} + + /** \name Split Mesh Per Materials */ + //@{ + /** Split all the mesh in the scene per material. + * \param pScene The scene to iterate through to split meshes. + * \param pReplace If \c true, replace the original mesh with new ones and delete the original meshes, but *only* if they got split into multiple meshes, otherwise they are left untouched. + * \return \c true if all splitable mesh were successfully split, \c false otherwise. + * \remark The function will still iterate through all meshes regardless if one fails to split, but will return false in that case. */ + bool SplitMeshesPerMaterial(FbxScene* pScene, bool pReplace); + + /** Split mesh per material. + * \param pMesh The mesh that will be split if it has multiple materials assigned. + * \param pReplace If \c true, replace the original mesh with new one and delete the original mesh, but *only* if they got split into multiple meshes, otherwise left untouched. + * \return \c true on success, \c false otherwise. + * \remark The function will fail if the mapped material is not per face (FbxLayerElement::eByPolygon) or if a material is multi-layered. It will create as many meshes as + * there are materials applied to it. If one mesh have some polygons with material A, some polygons with material B, and some polygons with NO material, 3 meshes distinct + * will be created. The newly created meshes will be automatically attached to the same FbxNode that holds the original FbxMesh. If the original mesh have tangents, they will + * be regenerated on the new meshes. */ + bool SplitMeshPerMaterial(FbxMesh* pMesh, bool pReplace); + //@} + + /** Re-parent nodes at root node level under a new node to re-center them at world center. + * Basically, this function calculates the scene bounding box in world coordinates, and test if the center of that bounding box distance from the + * world center is larger or equal than the threshold. If true, a new node with the proper negative offset position will become the new parent of all nodes at root node level. + * \param pScene The scene to process. + * \param pThreshold Threshold at which all nodes will be re-centered. + * \return \c true if any nodes were re-centered, otherwise \c false. */ + bool RecenterSceneToWorldCenter(FbxScene* pScene, FbxDouble pThreshold); + + /** + * Merge multiple meshes to one mesh. + * The method will merge: + * a) mesh vertex; + * b) mesh polygon; + * c) mesh edge; + * d) all mesh elements; only the layer 0 elements is merged. + * e) if there are skins for old mesh, merge these skins. The new skin clusters link to old skeletons. + * + * \param pMeshNodes FBX nodes that hold multiple meshes. These meshes will be merged. + * \param pNodeName Name of new mesh node. + * \param pScene The scene that will contain the new mesh node. + * \return The new mesh node if merge successfully, otherwise NULL is returned. + * \remarks This method creates a new mesh, leaving the source mesh unchanged. + * The transform of new mesh node is: translate (0, 0, 0), rotation (0, 0, 0), scale (1, 1, 1). + * For layer element material, normal, smoothing, UV set, vertex color, binormal, tangent and polygon group, + * if any mesh misses these element, the merge for this kind of element is skipped. + * For layer element crease, hole, visibility and user data, if any mesh has such element, the kind of element + * will be merged. The missing element will be filled with default values. + * For meshes with skin binding, if the pose of frame 0 is different with bind pose, the new mesh will be distorted. + */ + FbxNode* MergeMeshes(FbxArray& pMeshNodes, const char* pNodeName, FbxScene* pScene); + + /** + * Cleanup or remove degenerated meshes. + * \param pScene The scene to process. + * \param pAffectedNodes The list of nodes that have been affected by this operation. + * \remarks If the cleaned-up mesh becomes invalid, it is removed entirely. + */ + void RemoveBadPolygonsFromMeshes(FbxScene* pScene, FbxArray* pAffectedNodes = NULL); + +/***************************************************************************************************************************** +** 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 + FbxGeometryConverter(FbxManager* pManager); + ~FbxGeometryConverter(); + +private: + FbxMesh* TriangulateMeshInternal(const FbxMesh* pMesh); + FbxMesh* TriangulateMeshInternalLegacy(const FbxMesh* pMesh); + FbxMesh* TriangulatePatchInternal(const FbxPatch* pPatch); + FbxMesh* TriangulateNurbsInternal(const FbxNurbs* pNurbs); + + bool AddAlternateGeometry(FbxNode* pNode, FbxGeometry* pSrcGeom, FbxGeometry* pAltGeom, FbxWeightedMapping* pSrcToAltWeightedMapping, bool pConvertDeformations); + bool ConvertGeometryAnimation(FbxNode* pNode, FbxGeometry* pSrcGeom, FbxGeometry* pDstGeom); + void ReplaceNodeAttribute(FbxNode* pNode, FbxNodeAttribute* pNewNodeAttr); + bool AddTriangulatedMeshGeometry(FbxNode* pNode, int pUVStepCoeff); + bool CreateAndCopyLayerElement(FbxMesh *pNewMesh, FbxMesh *pRefMesh); + bool SetLayerElements(FbxMesh *pNewMesh, FbxMesh *pMesh, int pPolygonIndex, int pPolyPointIndex, int pLoopIndex, bool pIsSearched, bool pIsEndPolygon); + + /** FbxTriangulation + * \param Index Output array of triangle indices + * \param pNumSide Input number of sides of the polygon to triangulate + * -- Triangulation algorithm is strip, Sorting vertex index for strip in clockwise. + * + * 2 3 4 + * 0----------0---------0 + * / ` + * / ` 5 + * 1 / 0 + * 0 / + * ` / + * ` / + * 0 0-----0-------------0 6 + * 7 + * The result of this one will be [{0,1,2},{2,3,0},{0,3,7},{3,4,7},{7,4,6},{4,5,6}] + */ + static void FbxTriangulation(int *Index, int pNumSide); + + bool ComputePatchToMeshControlPointsWeightedMapping(FbxPatch* pSrcPatch, FbxMesh* pDstMesh, FbxWeightedMapping* pMapping, bool pSwapUV=false); + bool ComputeNurbsToMeshControlPointsWeightedMapping(FbxNurbsSurface* pSrcNurbs, FbxMesh* pDstMesh, FbxWeightedMapping* pMapping, bool pRescaleUVs=false, bool pSwapUV=false); + + void InitializeWeightInControlPoints(FbxGeometryBase* pGeometry); + void InitializeWeightInNormals(FbxLayerContainer* pLayerContainer); + void TriangulateContinuousSurface(FbxMesh* pMesh, FbxSurfaceEvaluator* pSurface, FbxUInt pPointCountX, FbxUInt pPointCountY, bool ClockWise=false); + void CheckForZeroWeightInShape(FbxGeometry *pGeometry); + FbxMesh* CreateMeshFromParametricSurface(const FbxGeometry* pGeometry); + FbxNurbs* CreateNurbsFromPatch(FbxPatch* pPatch); + FbxNurbsSurface* CreateNurbsSurfaceFromPatch(FbxPatch* pPatch); + + void ConvertShapes(const FbxGeometry* pSource, FbxGeometry* pDestination, FbxSurfaceEvaluator* pEvaluator, int pUCount, int pVCount); + void ConvertShapes(const FbxGeometry* pSource, FbxGeometry* pDestination, FbxWeightedMapping* pSourceToDestinationMapping); + void ConvertClusters(const FbxGeometry* pSource, FbxGeometry* pDestination, FbxWeightedMapping* pSourceToDestinationMapping); + void ConvertClusters(FbxArray const& pSourceClusters, int pSourceControlPointsCount, FbxArray& pDestinationClusters, int pDestinationControlPointsCount, FbxWeightedMapping* pSourceToDestinationMapping); + void BuildClusterToSourceMapping(FbxArray const& pSourceClusters, FbxWeightedMapping* pClusterToSourceMapping); + void CheckClusterToSourceMapping(FbxWeightedMapping* pClusterToSourceMapping); + void ConvertCluster(int pSourceClusterIndex, FbxWeightedMapping* pClusterToSourceMapping, FbxWeightedMapping* pSourceToDestinationMapping, FbxCluster* pDestinationCluster); + void DuplicateControlPoints(FbxArray& pControlPoints, FbxArray& pPolygonVertices); + void UpdatePolygon(FbxMesh *pNewMesh, FbxMesh const *pRefMesh, int pPolygonIndex, int* pNewIndex, int &pVerticeIndexMeshTriangulated, int &pPolygonIndexMeshTriangulated); + void UpdatePolygon(FbxMesh *pNewMesh, FbxMesh const *pRefMesh, int pPolygonIndex, int* pNewIndex, int &pVerticeIndexMeshTriangulated, int &pPolygonIndexMeshTriangulated, int pTriangleNum); + void ResizePolygon(FbxMesh *pNewMesh, int pNewCountVertices = 0, int pNewCountPolygons =0, bool pClearFlag = true); + + template void ConvertNurbs(T1* pNewNurbs, T2* pOldNurb); + + bool CopyAnimationCurves(FbxNode* pNode, FbxGeometry* pNewGeometry); + bool FlipNurbsCurve(FbxNurbsCurve* pCurve) const; + void FlipControlPoints(FbxGeometryBase* pPoints, int pUCount, int pVCount) const; + bool ConvertMaterialReferenceMode(FbxMesh* pMeshRef) const; + void RevertMaterialReferenceModeConversion(FbxMesh* pMeshRef) const; + + FbxManager* mManager; + + friend class FbxWriter3ds; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_GEOMETRY_CONVERTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxmanipulators.h b/libs/fbx/include/fbxsdk/utils/fbxmanipulators.h new file mode 100644 index 00000000..7a85d1be --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxmanipulators.h @@ -0,0 +1,169 @@ +/**************************************************************************************** + + 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 fbxmanipulators.h +#ifndef _FBXSDK_UTILS_MANIPULATORS_H_ +#define _FBXSDK_UTILS_MANIPULATORS_H_ + +#include + +#include +#include +#include +#include + +#include + +class FbxCameraManipulationState; + +/** This class can be used to provide basic camera manipulation in any program using this library. + * \nosubgrouping + */ +class FBXSDK_DLL FbxCameraManipulator : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxCameraManipulator, FbxObject); + +public: + //! All possible manipulation actions that can be performed on a camera using this manipulator. + enum EAction + { + eNone, //!< No action. + eOrbit, //!< Orbiting camera around LootAt/Interest position. + eDolly, //!< Moving camera closer or away from its LookAt/Intest position. + ePan, //!< Panning camera up, down and sideways. + eFreePan //!< Panning and dollying all at once. + }; + + /** Begin manipulation of the camera. + * \param pAction The action performed for this manipulation scope. + * \param pX Begin horizontal position of the manipulation, in pixels. + * \param pY Begin vertical position of the manipulation, in pixels. */ + void Begin(EAction pAction, float pX, float pY); + + /** Notify manipulation of latest input. + * \param pTimeDelta Elapsed time since the last notify. Only used if Smoothing is enabled. + * \param pX Horizontal position of the manipulation, in pixels. + * \param pY Vertical position of the manipulation, in pixels. + * \param pScale Scaling value of the manipulation. Only used by eFreePan action. */ + void Notify(float pX, float pY, float pScale=0); + + //! End current manipulation. + void End(); + + /** Update the camera position. This must be called periodically in order for the camera to update its position. + * \param pTimeDelta Elapsed time since the last update. If Smooth is disabled, you can leave this value to zero. + * \remark Begin, Notify and End will not change the current camera position. */ + void Update(const FbxTime& pTimeDelta=FBXSDK_TIME_ZERO); + + /** Do a complete manipulation action in a single operation. This is the equivalent of calling Begin, Notify and End successively. + * \param pAction The action performed for this manipulation scope. + * \param pX Horizontal position of the manipulation, in pixels. + * \param pY Vertical position of the manipulation, in pixels. + * \param pScale Scaling value of the manipulation. Only used by eFreePan action. */ + void Action(EAction pAction, float pX, float pY, float pScale=0); + + /** Retrieve current manipulation action. + * \return The action currently performed by the camera manipulator. */ + EAction GetCurrentAction() const; + + /** Change camera position and LookAt node to frame all objects. + * \param pTime Time to use to evaluate mesh deformations. Leave at default value to cancel mesh evaluation. */ + void FrameAll(const FbxTime& pTime=FBXSDK_TIME_INFINITE); + + /** Change camera position and LookAt to frame all selected objects. + * \param pTime Time to use to evaluate mesh deformations. Leave at default value to cancel mesh evaluation. */ + void FrameSelected(const FbxTime& pTime=FBXSDK_TIME_INFINITE); + + /** Change camera position and LookAt to frame the selected position on screen. The LookAt will be placed + * at first closest intersecting geometry, and the distance between camera and LookAt will be preserved. + * \param pX The horizontal screen coordinate. + * \param pY The vertical screen coordinate. + * \param pCulling If \c true, only test triangles that are front-facing, otherwise test both sides. + * \param pTime Time to use to evaluate mesh deformations. Leave at default value to cancel mesh evaluation. */ + void FrameScreenPosition(float pX, float pY, bool pCulling=false, const FbxTime& pTime=FBXSDK_TIME_INFINITE); + + /** The camera controlled by the manipulator. */ + FbxPropertyT Camera; + + /** Width of the camera viewport, in pixels. This is used to accurately calculate to movement speed. + * \remark If this property is not correctly set, movements will be erronous. */ + FbxPropertyT ViewportWidth; + + /** Height of the camera viewport, in pixels. This is used to accurately calculate to movement speed. + * \remark If this property is not correctly set, movements will be erronous. */ + FbxPropertyT ViewportHeight; + + /** Camera manipulations will be smooth if enabled. True by default. */ + FbxPropertyT Smooth; + + /** Camera manipulations smoothing speed. Higher speed will stabilize the camera more quickly. Default is 10.0 */ + FbxPropertyT SmoothSpeed; + + /** Invert the camera horizontal manipulation direction if set to true. False by default. */ + FbxPropertyT InvertX; + + /** Invert the camera vertical manipulation direction if set to true. False by default. */ + FbxPropertyT InvertY; + + /** Restore the camera transform upon destruction of the manipulator. */ + FbxPropertyT Restore; + +/***************************************************************************************************************************** +** 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 void Construct(const FbxObject* pFrom); + virtual void Destruct(bool pRecursive); + virtual void ConstructProperties(bool pForceSet); + virtual bool ConnectNotify(const FbxConnectEvent& pEvent); + virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty); + +private: + void Reset(); + FbxCamera* GetCamera() const; + FbxNode* GetCameraNode() const; + FbxNode* GetCameraLookAtNode() const; + FbxNode* GetCameraTargetUpNode() const; + FbxVector4 GetCameraPosition() const; + void SetCameraPosition(const FbxVector4& pPosition); + FbxVector4 GetCameraRotation() const; + void SetCameraRotation(const FbxVector4& pRotation); + FbxVector4 GetCameraLookAtPosition() const; + void SetCameraLookAtPosition(const FbxVector4& pPosition); + FbxVector4 GetCameraTargetUpPosition() const; + void SetCameraTargetUpPosition(const FbxVector4& pPosition); + FbxAMatrix GetCameraRotationMatrix() const; + void SetCameraRotationMatrix(const FbxAMatrix& pRM); + + double ComputeRotationAxis(FbxVector4& pFront, FbxVector4& pUp, FbxVector4& pRight, const FbxVector4& pEye, const FbxVector4& pLookAt, const FbxVector4& pUpVector) const; + void ComputeRotationMatrix(FbxAMatrix& pRM, const FbxVector4& pEye, const FbxVector4& pLookAt, const FbxVector4& pUpVector); + void UpdateCameraRotation(); + + bool FrameObjects(bool pSelected, const FbxTime& pTime); + FbxVector4 ComputePositionToFitBBoxInFrustum(const FbxVector4& pBBoxMin, const FbxVector4& pBBoxMax, const FbxVector4& pBBoxCenter, const FbxVector4& pCameraPosition, const FbxAMatrix& pCameraRM, const FbxTime& pTime); + + EAction mCurrentAction; + FbxFloat mBeginMouse[3], mLastMouse[3]; + FbxVector4 mBeginPosition, mBeginAxis[3]; + FbxBool mBeginFlipped; + + FbxDouble mDestOrthoZoom; + FbxVector4 mDestPosition, mDestLookAt, mDestTargetUp; + FbxAMatrix mDestRotation; + + FbxVector4 mInitialPosition, mInitialRotation, mInitialLookAt; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_MANIPULATORS_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxmaterialconverter.h b/libs/fbx/include/fbxsdk/utils/fbxmaterialconverter.h new file mode 100644 index 00000000..101d2898 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxmaterialconverter.h @@ -0,0 +1,108 @@ +/**************************************************************************************** + + 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 fbxmaterialconverter.h +#ifndef _FBXSDK_UTILS_MATERIAL_CONVERTER_H_ +#define _FBXSDK_UTILS_MATERIAL_CONVERTER_H_ + +#include + +#include + +#include + +class LayerConfig; +class FbxMaterialConverter_Impl; + +/** + * \brief This class provides functions to restructure the material and textures + * applied to geometries from FBX v5 material system to v6-and-up or the other way around. + * \nosubgrouping + * \see FbxSurfaceMaterial, FbxTexture + */ +class FBXSDK_DLL FbxMaterialConverter +{ +public: + FbxMaterialConverter( FbxManager& mManager, FbxSurfaceMaterial* pDefaultMaterial = NULL); + ~FbxMaterialConverter(); + + /** Moves textures in texture layer elements to connections + * on the corresponding material's color properties, for all geometries + * in the scene.(Convert scene from FBX v5 material system to v6-and-up) + * \param pScene The scene whose geometries should be converted. + * \return true on success, false otherwise + */ + bool ConnectTexturesToMaterials( FbxScene& pScene ); + + /** Moves textures in texture layer elements to connections + * on the corresponding material's color properties, for the given geometry + * in the scene.(Convert scene from FBX v5 material system to v6-and-up) + * \param pNode The geometry node to be converted. + * \return true on success, false otherwise + */ + bool ConnectTexturesToMaterials( FbxNode* pNode ); + + /** This is the reverse operation of ConnectTexturesToMaterials() + * Textures connected to Materials' color properties are stored + * in layer elements, and their connections to the color properties + * are broken.(Convert scene from FBX v6-and-up material system to v5) + * \param pScene The scene whose geometries should be converted. + * \return true if all geometries were converted, false otherwise + */ + bool AssignTexturesToLayerElements( 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: + typedef FbxPair TexData; + + FbxMaterialConverter& operator=(const FbxMaterialConverter&); + + FbxManager& mManager; + FbxSurfaceMaterial* mDefaultMaterial; + FbxMaterialConverter_Impl* mImpl; + + + void GetTextures( int pComponent, FbxLayer* pLayer, LayerConfig& pLayerConfig ) const; + FbxSurfaceMaterial* GetMaterial( int pComponent, FbxLayer* pLayer, FbxNode* pNode, bool pLookOnNode ); + int GetMaterialOrder( int pComponent, FbxLayer* pLayer, FbxNode* pNode, bool pLookOnNode ); + + bool HasGoodMappingModes( FbxNode* pNode, FbxGeometry* pGeom ) const; + void ConnectTextures( FbxSurfaceMaterial* pMat, FbxObject* pTexture, int pTextureType ) const; + bool HasPerFaceMaterialMapping( FbxGeometry* pGeom ) const; + void SetTextureUVSets( FbxGeometry* pGeom ) const; + bool HasTextures( FbxGeometry* pGeom ) const; + + void GetTextureList( FbxArray& pTextures, FbxLayeredTexture* pTex ) const; + + FbxLayer* FindLayerForTexture( FbxTexture* pTex, + FbxLayerElement::EType pTexType, + FbxLayerElementTexture::EBlendMode pTexBlendMode, + FbxGeometry* pGeom, + int lComponentIndex, + int lStartIndex = 0 ) const; + + void InitTextureElement( FbxLayerElementTexture* pTexElm, int pComponentCount, + FbxLayerElementTexture::EBlendMode pMode) const; + + bool AssignTexturesToLayerElements( FbxNode* pNode); + + bool HasTextureLayerElements( FbxGeometry& pGeom ) const; + + void ConvertToPerFaceMapping( FbxMesh* pGeom ) const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_MATERIAL_CONVERTER_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxnamehandler.h b/libs/fbx/include/fbxsdk/utils/fbxnamehandler.h new file mode 100644 index 00000000..70bb58f4 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxnamehandler.h @@ -0,0 +1,145 @@ +/**************************************************************************************** + + 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 fbxnamehandler.h +#ifndef _FBXSDK_UTILS_NAMEHANDLER_H_ +#define _FBXSDK_UTILS_NAMEHANDLER_H_ + +#include + +#include +#include + +#include + +/** A name is a case-sensitive string ID of a property, a node, a node attribute, a texture, etc. The characters constituting a name has no specific limitation. + * An initial name is the original name (from importing a file, for example), which is saved up for reversible renaming. + * A current name is the name used in FBX. + * A namespace is a simple grouping of objects under a given name. Namespaces are primarily used to resolve + * name-clash issues in FBX, where a new object has the same name as an existing object. + * + * For example, Maya only accepts names with letters, digits, or underscores. And when a user import FBX into Maya, + * a node whose name contains whitespace will be renamed. But the connections and references to this node in FBX + * scene graph still use the original name, so users have to use the initial name to retrieve related information. + * \nosubgrouping + */ +class FBXSDK_DLL FbxNameHandler +{ +public: + /** Constructor. + * \param pInitialName Name string used to initialize both members (initialName and currentName) + * of this class. + */ + FbxNameHandler(const char* pInitialName = ""); + + /** Copy constructor. + * \param pName A FbxNameHandler copied to this one. + */ + FbxNameHandler(FbxNameHandler const& pName); + + // !Destructor + ~FbxNameHandler(); + + /** Set the initial name. + * \param pInitialName New string for the initial name. + * \remarks The current name will also be changed to this value. + */ + void SetInitialName(const char* pInitialName); + + /** Get the initial name. + * \return Pointer to the InitialName string buffer. + */ + const char* GetInitialName() const; + + /** Set the current name. + * \param pNewName New string for the current name. + * \remarks The initial name is not affected. + */ + void SetCurrentName(const char* pNewName); + + /** Get the current name. + * \return Pointer to the CurrentName string buffer. + */ + const char* GetCurrentName() const; + + /** Set the namespace. + * \param pNameSpace New string for the namespace. + * \remarks The initial name is not affected. + */ + void SetNameSpace(const char* pNameSpace); + + /** Get the namespace. + * \return Pointer to the namespace string buffer. + */ + const char* GetNameSpace() const; + + /** Check if the current name and initial name match. + * \return \c true if the current name isn't identical to the initial name. + */ + bool IsRenamed() const; + + /** Assignment operator + * \param pName FbxNameHandler assigned to this one. + */ + FbxNameHandler& operator= (FbxNameHandler const& pName); + + /** + * \name Private use for the renaming strategies classes. + * + * Some renaming strategies classes need to store the parent name to successfully apply the renaming algorithms. + * The methods in this section allow them to do so. + * \remark Because of the very specific use of the mParentName string, + * callers of the FbxNameHandler class should never assume that mParentName is correctly initialized + * nor contains a meaningful value outside the scope of the renaming strategy class that used it. + */ + //@{ + + /** Set the parent name. + * \param pParentName New string for the parent name. + * \remarks The parent name here could combine several hierarchy name. + * The full name should be "ParentName + CurrentName". + * A + * |_B + * |_C + * For the above hierarchy, the parent name of C is "AB". + * The full name of C is "ABC". + */ + void SetParentName(const char* pParentName); + + /** Get the parent name. + * \return Pointer to the ParentName string buffer. + */ + const char* GetParentName() const; + + //@} + + /** Get the namespaces in a string pointer array format. + * \return FbxArray . + * \remarks The array is filled in reverse order. For example, with a namespace string defined as: + * a:b:c:d, the filled array is: array[0]=d, array[1]=c, array[2]=b and array[3]=a + */ + FbxArray GetNameSpaceArray(char identifier); + +/***************************************************************************************************************************** +** 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: + FbxString mParentName; + FbxString mInitialName; + FbxString mCurrentName; + FbxString mNameSpace; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_NAMEHANDLER_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxprocessor.h b/libs/fbx/include/fbxsdk/utils/fbxprocessor.h new file mode 100644 index 00000000..eb2b5c86 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxprocessor.h @@ -0,0 +1,61 @@ +/**************************************************************************************** + + 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 fbxprocessor.h +#ifndef _FBXSDK_UTILS_PROCESSOR_H_ +#define _FBXSDK_UTILS_PROCESSOR_H_ + +#include + +#include + +#include + +class FbxCollection; + +/** The class and its derived classes(e.g. FbxProcessorXRefCopy, FbxProcessorXRefCopyUserLibrary, etc.) are used to process shader, library, asset, etc. + * For example, you could update object property and its value via FbxProcessor::ProcessObject(), FbxProcessor::internal_ProcessObject(), etc. + */ +class FBXSDK_DLL FbxProcessor : public FbxObject +{ + FBXSDK_OBJECT_DECLARE(FbxProcessor, FbxObject); + +public: + /** + * \name Processor management + */ + //@{ + /** Process the specified collection. + * \param pCollection + */ + bool ProcessCollection(FbxCollection *pCollection=0); + + /** Process the specified object. + * \param pCollection FbxObject to process + */ + bool ProcessObject (FbxObject *pCollection=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 +protected: + virtual bool internal_ProcessCollectionBegin (FbxCollection *pCollection); + virtual bool internal_ProcessCollectionEnd (FbxCollection *pCollection); + virtual bool internal_ProcessObject (FbxObject* pObject); + virtual bool internal_ProcessCollection (FbxCollection* pCollection); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_PROCESSOR_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxprocessorshaderdependency.h b/libs/fbx/include/fbxsdk/utils/fbxprocessorshaderdependency.h new file mode 100644 index 00000000..a0bc693e --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxprocessorshaderdependency.h @@ -0,0 +1,145 @@ +/**************************************************************************************** + + 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 fbxprocessorshaderdependency.h +#ifndef _FBXSDK_UTILS_PROCESSOR_SHADER_DEPENDENCY_H_ +#define _FBXSDK_UTILS_PROCESSOR_SHADER_DEPENDENCY_H_ + +#include + +#include +#include +#include + +#include + +/** Crawls CgFx and HLSL shader files, copies them, and all dependent + * shader files into the location specified by RootProcessPath. + */ +class FBXSDK_DLL FbxProcessorShaderDependency : public FbxProcessor +{ + FBXSDK_OBJECT_DECLARE(FbxProcessorShaderDependency, FbxProcessor); + +public: + FbxPropertyT RootProcessPath; + + FbxPropertyT CleanupOnDestroy; + + FbxPropertyT AdditionalIncludePaths; + + void ClearProcessedFiles(); + + /** + * \name Overridable internal function */ + //@{ +protected: + virtual bool internal_ProcessObject(FbxObject* pObject); + //@} + +/***************************************************************************************************************************** +** 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 +// Constructor / Destructor +protected: + virtual void ConstructProperties(bool pForceSet); + virtual void Destruct(bool pRecursive); + +public: + + class StringHash + { + public: + unsigned int operator()( const FbxString& pValue ) const + { + // from wikipedia.org + // Jenkins One-at-a-time hash + + size_t lLen = pValue.GetLen(); + unsigned int lHashValue = 0; + const char* lData = pValue.Buffer(); + for( size_t i = 0; i < lLen; ++i ) + { + lHashValue += lData[i]; + lHashValue += (lHashValue << 10); + lHashValue ^= (lHashValue >> 16); + } + lHashValue += (lHashValue << 3); + lHashValue ^= (lHashValue >> 11); + lHashValue += (lHashValue << 15); + + return lHashValue; + } + }; + +protected: + + class FileDeleter + { + public: + FileDeleter( const char* pFileUrl ) : mFileUrl( pFileUrl) {}; + ~FileDeleter() + { + if( !mFileUrl.IsEmpty() ) + { + remove( mFileUrl ); + } + }; + + void Release() { mFileUrl = ""; } + + private: FbxString mFileUrl; + }; + + // first == string as it appears in the file + // second == string URL + struct FilePathData + { + FbxString mOriginalStr; + FbxString mOriginalAbsUrl; + + FbxString mNewStr; + }; + + typedef FbxDynamicArray< FilePathData > FilePathList; + + virtual bool GetIncludePaths( FbxString& pFile, FilePathList& pPaths, FbxXRefManager& pManager ) const; + virtual bool ReplaceUrls( const FbxString& pFileUrl, const FbxString& pNewFileUrl, + const FilePathList& pPaths ) const; + +private: + struct Dependency + { + FbxString mNewUrl; + FbxString mOriginalUrl; + }; + + typedef FbxHashMap< FbxString, Dependency, StringHash > DependMap; + + DependMap mDependMap; + + FbxString mRootPath; + + FbxXRefManager mResolver; + int mSystemIndex; + + // magic number to limit the size of files we can parse =( + static const int sMaxFileSize; + + bool ParseDependencies( const FbxBindingTable& pTable ); + bool AddDependency( FbxString& pFileUrl ); + bool AddSystemPaths(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_PROCESSOR_SHADER_DEPENDENCY_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxprocessorxref.h b/libs/fbx/include/fbxsdk/utils/fbxprocessorxref.h new file mode 100644 index 00000000..dc86c6ff --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxprocessorxref.h @@ -0,0 +1,147 @@ +/**************************************************************************************** + + 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 fbxprocessorxref.h +#ifndef _FBXSDK_UTILS_PROCESSOR_XREF_H_ +#define _FBXSDK_UTILS_PROCESSOR_XREF_H_ + +#include + +#include +#include + +#include + +/** This class contains objects + * This class also provides access to global settings and take information. + */ +class FBXSDK_DLL FbxProcessorXRefCopy : public FbxProcessor +{ + FBXSDK_OBJECT_DECLARE(FbxProcessorXRefCopy, FbxProcessor); + +public: + class FBXSDK_DLL MissingUrlHandler + { + public: + virtual ~MissingUrlHandler(); + virtual void MissingUrl(const FbxString& pUrl, const FbxProperty&) = 0; + }; + + /** + * \name Properties + */ + //@{ + FbxPropertyT OutputDirectory; + + /** As we resolve xref and copy assets, do we update properties to + * now use this relative path? Defaults to TRUE. + */ + FbxPropertyT UpdateProperties; + + /** Default to FALSE -- when set, this informs the processor to track + * every properties that were modified during the scene processing. + */ + FbxPropertyT TrackUpdatedProperties; + + /** Default to TRUE -- when not set, files are only copied if one of + * the following conditions is met: + * + * 1) Target does not exist + * 2) Target has a different time + * 3) Target has a different size + */ + FbxPropertyT ForceCopy; + + /** Default to TRUE -- when copying a file, also copy its modification + * time. A bit of a requirement if you're not going to use ForceCopy. + */ + FbxPropertyT CopyFileTimes; + //@} + + /** Optional callback; when set, this will be called when an Url cannot be + * be copied because the source is not found. + * Memory is owned by the client code, and will not be freed by us. + */ + MissingUrlHandler* MissingUrlHandler; + + /** Since FbxProperty is an opaque type, we can't do an efficient operator < + * on it, and must keep the data on the object, which can be compared through + * pointers, and then we can further compare against the property name. + */ + struct PropertyUpdate + { + FbxProperty mProperty; + FbxString mOriginalValue; + + inline PropertyUpdate() {} + inline PropertyUpdate(const FbxProperty& pProp, const FbxString& pVal) : + mProperty(pProp), mOriginalValue(pVal) {} + + inline bool operator <(const PropertyUpdate& pOther) const + { + return strcmp(mProperty.GetName(), pOther.mProperty.GetName()) < 0; + } + }; + typedef FbxSet UpdateSet; + typedef FbxMap PropertyUpdateMap; + + /** All properties that were updated, with their original value. + * Will always be empty if TrackUpdatedProperties + * was not set before calling ProcessCollection/ProcessObject. + * NOT cleared before each processing run. + */ + PropertyUpdateMap& GetUpdatedProperties(); + + /** If property tracking was enabled, goes through and reverts all changes + * to the properties. Does not un-copy the files, naturally. + */ + void RevertPropertyChanges(); + + /** This is just a safety net to make sure RevertPropertyChanges is called when + * this goes out of scope. + */ + struct FBXSDK_DLL AutoRevertPropertyChanges + { + AutoRevertPropertyChanges(FbxProcessorXRefCopy* pCopy) : mXRefCopy(pCopy) {} + ~AutoRevertPropertyChanges() + { + if( mXRefCopy ) + mXRefCopy->RevertPropertyChanges(); + } + + FbxProcessorXRefCopy* mXRefCopy; + }; + +/***************************************************************************************************************************** +** 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 void Construct(const FbxObject* pFrom); + virtual void ConstructProperties(bool pForceSet); + + PropertyUpdateMap mUpdatedProperties; + + // Implements the rules specified for the ForceCopy property. + // Also checks the ForceCopy property. + bool ShouldCopyFile(const FbxString& pTarget, const FbxString& pSource) const; + + virtual bool internal_ProcessCollectionBegin (FbxCollection* pObject); + virtual bool internal_ProcessCollectionEnd (FbxCollection* pObject); + virtual bool internal_ProcessObject (FbxObject* pObject); + bool ProcessPathProperty(FbxProperty &pProperty); + virtual bool ValidPropertyForXRefCopy(FbxObject* pObject, FbxProperty& lProperty) const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_PROCESSOR_XREF_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxprocessorxrefuserlib.h b/libs/fbx/include/fbxsdk/utils/fbxprocessorxrefuserlib.h new file mode 100644 index 00000000..c7a1b983 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxprocessorxrefuserlib.h @@ -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 fbxprocessorxrefuserlib.h +#ifndef _FBXSDK_UTILS_PROCESSOR_XREF_USERLIB_H_ +#define _FBXSDK_UTILS_PROCESSOR_XREF_USERLIB_H_ + +#include + +#include + +#include + +/** + * Specialized xref copy processor + */ +class FBXSDK_DLL FbxProcessorXRefCopyUserLibrary : public FbxProcessorXRefCopy +{ + FBXSDK_OBJECT_DECLARE(FbxProcessorXRefCopyUserLibrary, FbxProcessorXRefCopy); + +public: + /** + * \name Properties + */ + //@{ + // Do we copy files even if they are in the system library? + // Defaults to FALSE. + FbxPropertyT CopyAllAssets; + + // Do we copy files even if they are not within the scene? This is + // the typical use case when creating a new library, and defaults to + // TRUE. If you want to extract assets from a specific library you + // you would set this to FALSE to ignore assets from external (user, + // system) libraries. + FbxPropertyT CopyExternalAssets; + + // Do we copy assets that use absolute paths? If true, then after + // the scene processor has run through the URL will be relative to + // the scene document. + // Defaults to TRUE. + FbxPropertyT CopyAbsoluteUrlAssets; + //@} + +/***************************************************************************************************************************** +** 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 void ConstructProperties(bool pForceSet); + virtual bool ValidPropertyForXRefCopy(FbxObject* pObject, FbxProperty& lProperty) const; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_PROCESSOR_XREF_USERLIB_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategy.h b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategy.h new file mode 100644 index 00000000..a137aaea --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategy.h @@ -0,0 +1,355 @@ +/**************************************************************************************** + + 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 fbxrenamingstrategy.h +#ifndef _FBXSDK_UTILS_RENAMINGSTRATEGY_H_ +#define _FBXSDK_UTILS_RENAMINGSTRATEGY_H_ + +#include + +#include +#include + +#include + +class FbxScene; +class FbxNode; + +/** This base class is an abstract implementation of a renaming strategy for avoiding name clashes. + * An implementation of a reader (FbxReader) or writer (FbxWriter) class must call a concrete implementation + * of "FbxRenamingStrategyInterface::Rename()" every time a name is imported or exported to avoid name clashes. + * Any class deriving from FbxRenamingStrategyInterface must implement FbxRenamingStrategyInterface::Clear(), + * FbxRenamingStrategyInterface::Rename(), and FbxRenamingStrategyInterface::Clone(). + * \nosubgrouping + * \see FbxNameHandler FbxRenamingStrategyNumber + */ +class FBXSDK_DLL FbxRenamingStrategyInterface +{ +public: + //! Constructor. + FbxRenamingStrategyInterface(); + + //! Destructor. + virtual ~FbxRenamingStrategyInterface (); + + //! Resets internal state regarding assigned names. + virtual void Clear() = 0; + + /** Rename a name if necessary to avoid name-clash issues. + * \param pName The name to be renamed. + * \return Return \c true on success, \c false otherwise. + */ + virtual bool Rename(FbxNameHandler& pName) = 0; + + /** Create a dynamic renaming strategy instance of the same type as the child class. + * \return New instance. + */ + virtual FbxRenamingStrategyInterface* Clone() = 0; +}; + +/** Implements a renaming strategy that resolves name clashes by adding number postfixes. + * For example, when there are three objects with the same name "MyObject", + * they will be renamed to "MyObject", "MyObject1" and "MyObject2". + * \nosubgrouping + * \see FbxNameHandler FbxRenamingStrategyBase + */ +class FBXSDK_DLL FbxRenamingStrategyNumber : public FbxRenamingStrategyInterface +{ +public: + //! Constructor. + FbxRenamingStrategyNumber(); + + //! Destructor. + virtual ~FbxRenamingStrategyNumber (); + + //! Resets internal state regarding assigned names. + virtual void Clear(); + + /** Rename a name if necessary to avoid name-clash issues. + * \param pName The name to be renamed. + * \return Return \c true on success, \c false otherwise. + */ + virtual bool Rename(FbxNameHandler& pName); + + /** Create a dynamic renaming strategy instance of the same type as the child class. + * \return New instance. + */ + virtual FbxRenamingStrategyInterface* Clone(); + +/***************************************************************************************************************************** +** 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: + struct NameCell + { + NameCell(const char* pName) : + mName(pName), + mInstanceCount(0) + { + } + + FbxString mName; + int mInstanceCount; + }; + + FbxArray mNameArray; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** The FbxRenamingStrategy object can be set to rename all the objects in a scene. + * It can remove name clashing, remove illegal characters, manage namespaces and manage backward compatibility. + * It is better to choose FbxSceneRenamer instead of this class to simplify the usage. + * \remark This class implements a legacy renaming strategy where unsupported characters are replaced with the + * underscore character. Improved renaming strategies solvers can be implemented using the functions provided + * by the FbxRenamingStrategyUtils class and the FbxRenamingStrategyBase. + * \nosubgrouping + * \see FbxSceneRenamer + */ +class FBXSDK_DLL FbxRenamingStrategy : public FbxRenamingStrategyInterface +{ +public: + /** \enum EDirection The mode describing the convention direction, from FBX format or to FBX format. + * - \e eToFBX Convert to FBX format from another format. + * - \e eFromFBX Convert from FBX format to another format. + */ + enum EDirection + { + eToFBX, + eFromFBX + }; + + /** Constructor. + * \param pMod The mode describing the convention direction, from FBX format or to FBX format. + * \param pOnCreationRun + */ + FbxRenamingStrategy(EDirection pMod, bool pOnCreationRun = false); + + //! Destructor. + virtual ~FbxRenamingStrategy(); + + /** Rename a name if necessary. + * \param pName The name to be renamed. + * \return Return \c true on success, \c false otherwise. + */ + virtual bool Rename(FbxNameHandler& pName); + + //! Resets internal state regarding assigned names. + virtual void Clear(); + + /** Create a dynamic renaming strategy instance of the same type as the child class. + * \return New instance. + */ + virtual FbxRenamingStrategyInterface* Clone(); + + /** \enum EClashType + * - \e eNameClashAuto + * - \e eNameClashType1 + * - \e eNameClashType2 + */ + enum EClashType + { + eNameClashAuto, + eNameClashType1, + eNameClashType2 + }; + + /** Setup the strategy to perform this algorithm + * \param pType + */ + void SetClashSolverType(EClashType pType); + + /** Get the namespace of the last renamed object. + * \return Char pointer to the namespace. + */ + virtual char* GetNameSpace() { return mNameSpace.Buffer(); } + + /** Sets the current scene namespace symbol. + * \param pNameSpaceSymbol namespace symbol. + */ + virtual void SetInNameSpaceSymbol(FbxString pNameSpaceSymbol){mInNameSpaceSymbol = pNameSpaceSymbol;} + + /** Sets the wanted scene namespace symbol. + * \param pNameSpaceSymbol namespace symbol. + */ + virtual void SetOutNameSpaceSymbol(FbxString pNameSpaceSymbol){mOutNameSpaceSymbol = pNameSpaceSymbol;} + + /** Sets case sensitivity for name clashing. + * \param pIsCaseSensitive Set to \c true to make the name clashing case sensitive. + */ + virtual void SetCaseSensibility(bool pIsCaseSensitive){mCaseSensitive = pIsCaseSensitive ;} + + /** Sets the flag for character acceptance during renaming. + * \param pReplaceNonAlphaNum Set to \c true to replace illegal characters with an underscore ("_"). + */ + virtual void SetReplaceNonAlphaNum(bool pReplaceNonAlphaNum){mReplaceNonAlphaNum = pReplaceNonAlphaNum;} + + /** Sets the flag for first character acceptance during renaming. + * \param pFirstNotNum Set to \c true to add an underscore to the name if the first character is a number. + */ + virtual void SetFirstNotNum(bool pFirstNotNum){mFirstNotNum = pFirstNotNum;} + + /** Recursively renames all the unparented namespaced objects (Prefix mode) starting from this node. + * \param pNode Parent node. + * \param pIsRoot The root node. + * \return \c true if the "_NSclash" have been added to one or more node. + * \remarks This function adds "_NSclash" when it encounters an unparented namespaced object. + */ + virtual bool RenameUnparentNameSpace(FbxNode* pNode, bool pIsRoot = false); + + /** Recursively removes all the unparented namespaced "key" starting from this node. + * \param pNode Parent node. + * \return \c true if successfully removed the "_NSclash" from one or more nodes. + * \remarks This function removes "_NSclash" when encountered. This is the opposite from RenameUnparentNameSpace. + */ + virtual bool RemoveImportNameSpaceClash(FbxNode* pNode); + + /** Recursively get all the namespace starting from this node's parent. + * \param pNode Parent node. + * \param pNameSpaceList output the namespace list from pNode's parent to the root node. + */ + virtual void GetParentsNameSpaceList(FbxNode* pNode, FbxArray &pNameSpaceList); + + /** Recursively replace the namespace starting from this node to its children. + * \param pNode Current node. + * \param OldNS The old namespace to be replaced with the NewNs. + * \param NewNS The new namespace to replace OldNs. + * \return \c true if successfull + * \remarks This function only replaces the first occurence of OldNS with NewNS. + */ + virtual bool PropagateNameSpaceChange(FbxNode* pNode, FbxString OldNS, FbxString NewNS); + +/***************************************************************************************************************************** +** 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 bool RenameToFBX(FbxNameHandler& pName); + virtual bool RenameFromFBX(FbxNameHandler& pName); + virtual FbxString& ReplaceNonAlphaNum(FbxString& pName, const char* pReplace, bool pIgnoreNameSpace); + + EDirection mMode; + EClashType mType; + + struct NameCell + { + NameCell(const char* pName) : + mName(pName), + mInstanceCount(0) + { + } + + FbxString mName; + int mInstanceCount; + }; + + FbxCharPtrSet mStringNameArray; + FbxArray mExistingNsList; + bool mOnCreationRun; + bool mCaseSensitive; + bool mReplaceNonAlphaNum; + bool mFirstNotNum; + FbxString mNameSpace; + FbxString mInNameSpaceSymbol; //symbol identifying a name space + FbxString mOutNameSpaceSymbol; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +/** The FbxSceneRenamer provides a way to easily rename objects in a scene without using the FbxRenamingStrategy class. + * FbxSceneRenamer can remove name clashing and illegal characters. It also manages namespaces. + * + * Example: + * Maya only accepts names with letters, digits, or underscores, and we want to convert + * all the names of a scene from FBX format to Maya format. + * \code + * FbxSceneRenamer lSceneRenamer(pScene); + * lSceneRenamer.RenameFor(FbxSceneRenamer::eFBX_TO_MAYA); + * \endcode + * \nosubgrouping + * \see FbxRenamingStrategy + */ +class FBXSDK_DLL FbxSceneRenamer +{ +public: + /** Constructor + * \param pScene A scene which contains objects to be renamed. + */ + FbxSceneRenamer(FbxScene* pScene) {mScene = pScene;}; + + //! Destructor. + virtual ~FbxSceneRenamer(){}; + + /** \enum ERenamingMode The Mode describing from which format to which format. + * - \e eNone + * - \e eMAYA_TO_FBX5 + * - \e eMAYA_TO_FBX_MB75 + * - \e eMAYA_TO_FBX_MB70 + * - \e eFBXMB75_TO_FBXMB70 + * - \e eFBX_TO_FBX + * - \e eMAYA_TO_FBX + * - \e eFBX_TO_MAYA + * - \e eLW_TO_FBX + * - \e eFBX_TO_LW + * - \e eXSI_TO_FBX + * - \e eFBX_TO_XSI + * - \e eMAX_TO_FBX + * - \e eFBX_TO_MAX + * - \e eMB_TO_FBX + * - \e eFBX_TO_MB + * - \e eDAE_TO_FBX + * - \e eFBX_TO_DAE + */ + enum ERenamingMode + { + eNone, + eMAYA_TO_FBX5, + eMAYA_TO_FBX_MB75, + eMAYA_TO_FBX_MB70, + eFBXMB75_TO_FBXMB70, + eFBX_TO_FBX, + eMAYA_TO_FBX, + eFBX_TO_MAYA, + eLW_TO_FBX, + eFBX_TO_LW, + eXSI_TO_FBX, + eFBX_TO_XSI, + eMAX_TO_FBX, + eFBX_TO_MAX, + eMB_TO_FBX, + eFBX_TO_MB, + eDAE_TO_FBX, + eFBX_TO_DAE + }; + + /** Rename the objects of the scene according the specific mode. + * \param pMode A mode describing from which format to which format. + */ + void RenameFor(ERenamingMode pMode); + +/***************************************************************************************************************************** +** 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 ResolveNameClashing(bool pFromFbx, bool pIgnoreNS, bool pIsCaseSensitive, + bool pReplaceNonAlphaNum, bool pFirstNotNum, + FbxString pInNameSpaceSymbol, FbxString pOutNameSpaceSymbol, + bool pNoUnparentNS/*for MB < 7.5*/, bool pRemoveNameSpaceClash); + + FbxRenamingStrategyInterface* mNodeRenamingStrategy; + FbxScene* mScene; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_RENAMINGSTRATEGY_H_ */ + diff --git a/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategybase.h b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategybase.h new file mode 100644 index 00000000..60e3d439 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategybase.h @@ -0,0 +1,92 @@ +/**************************************************************************************** + + 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 fbxrenamingstrategybase.h +#ifndef _FBXSDK_UTILS_RENAMINGSTRATEGY_BASE_H_ +#define _FBXSDK_UTILS_RENAMINGSTRATEGY_BASE_H_ + +#include + +#include +#include + +#include + +/** \brief Base class for renaming strategy. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxRenamingStrategyBase +{ +public: + + //! Default constructor + FbxRenamingStrategyBase(); + + /** Constructor. + * \param pNameSpaceSymbol + */ + FbxRenamingStrategyBase(char pNameSpaceSymbol); + + //! Destructor. + virtual ~FbxRenamingStrategyBase(); + + /** This method put all the names in the scene back to the original values + * \param pScene + * \return Returns true if some names have been modified. + */ + virtual bool DecodeScene(FbxScene* pScene)=0; + + /** This method renames all the names in the scene + * \param pScene + * \return Returns true if some names have been modified. + */ + virtual bool EncodeScene(FbxScene* pScene)=0; + + /** This method find the original name of a given string + * \param pString + * \return Returns true if the name has been modified. + */ + virtual bool DecodeString(FbxNameHandler& pString)=0; + + /** This method find the renaming name of a given string + * \param pString + * \param pIsPropertyName + * \return Returns true if the name has been modified. + */ + virtual bool EncodeString(FbxNameHandler& pString, bool pIsPropertyName=false)=0; + + //! clean up the name cells. + virtual void CleanUp(); + +/***************************************************************************************************************************** +** 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 NameCell + { + NameCell(const char* pName) : + mName(pName), + mInstanceCount(0) + { + } + + FbxString mName; + int mInstanceCount; + }; + + char mNamespaceSymbol; + FbxCharPtrSet mStringNameArray; +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_RENAMINGSTRATEGY_BASE_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyfbx5.h b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyfbx5.h new file mode 100644 index 00000000..ab438489 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyfbx5.h @@ -0,0 +1,66 @@ +/**************************************************************************************** + + 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 fbxrenamingstrategyfbx5.h +#ifndef _FBXSDK_UTILS_RENAMINGSTRATEGY_FBX5_H_ +#define _FBXSDK_UTILS_RENAMINGSTRATEGY_FBX5_H_ + +#include + +#include + +#include + +/** \brief This class contains the description of the FBX renaming strategy for fbx file format 5. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxRenamingStrategyFbx5: public FbxRenamingStrategyBase +{ +public: + + //! Default constructor + FbxRenamingStrategyFbx5(); + + //! Destructor + virtual ~FbxRenamingStrategyFbx5(); + + /** This method put all the names in the scene back to the original values + * \param pScene + * \return Returns true if some names have been modified. + */ + virtual bool DecodeScene(FbxScene* pScene); + + /** This method renames all the names in the scene + * \param pScene + * \return Returns true if some names have been modified. + */ + virtual bool EncodeScene(FbxScene* pScene); + + /** This method find the original name of a given string + * \param pName + * \return Returns true if the name has been modified. + */ + virtual bool DecodeString(FbxNameHandler& pName); + + /** This method find the renaming name of a given string + * \param pName + * \param pIsPropertyName + * \return Returns true if the name has been modified. + */ + virtual bool EncodeString(FbxNameHandler& pName, bool pIsPropertyName=false); + + //! clean up the name cells. + virtual void CleanUp(); +}; + +#include + +#endif /* _FBXSDK_UTILS_RENAMINGSTRATEGY_FBX5_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyfbx6.h b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyfbx6.h new file mode 100644 index 00000000..ec4f224c --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyfbx6.h @@ -0,0 +1,66 @@ +/**************************************************************************************** + + 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 fbxrenamingstrategyfbx6.h +#ifndef _FBXSDK_UTILS_RENAMINGSTRATEGY_FBX6_H_ +#define _FBXSDK_UTILS_RENAMINGSTRATEGY_FBX6_H_ + +#include + +#include + +#include + +/** \brief This class contains the description of the FBX renaming strategy for fbx file format 6. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxRenamingStrategyFbx6: public FbxRenamingStrategyBase +{ +public: + + //! Default constructor + FbxRenamingStrategyFbx6(); + + //! Destructor + virtual ~FbxRenamingStrategyFbx6(); + + /** This method put all the names in the scene back to the original values + * \param pScene + * \return Returns true if some names have been modified. + */ + virtual bool DecodeScene(FbxScene* pScene); + + /** This method renames all the names in the scene + * \param pScene + * \return Returns true if some names have been modified. + */ + virtual bool EncodeScene(FbxScene* pScene); + + /** This method find the original name of a given string + * \param pName + * \return Returns true if the name has been modified. + */ + virtual bool DecodeString(FbxNameHandler& pName); + + /** This method find the renaming name of a given string + * \param pName + * \param pIsPropertyName + * \return Returns true if the name has been modified. + */ + virtual bool EncodeString(FbxNameHandler& pName, bool pIsPropertyName=false); + + //! clean up the name cells. + virtual void CleanUp(); +}; + +#include + +#endif /* _FBXSDK_UTILS_RENAMINGSTRATEGY_FBX6_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyfbx7.h b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyfbx7.h new file mode 100644 index 00000000..1b7d832c --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyfbx7.h @@ -0,0 +1,37 @@ +/**************************************************************************************** + + 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 fbxrenamingstrategyfbx7.h +#ifndef _FBXSDK_UTILS_RENAMINGSTRATEGY_FBX7_H_ +#define _FBXSDK_UTILS_RENAMINGSTRATEGY_FBX7_H_ + +#include + +#include + +#include + +class FBXSDK_DLL FbxRenamingStrategyFbx7 : public FbxRenamingStrategyBase +{ +public: + FbxRenamingStrategyFbx7(); + virtual ~FbxRenamingStrategyFbx7(); + + 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); +}; + +#include + +#endif /* _FBXSDK_UTILS_RENAMINGSTRATEGY_FBX7_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyutilities.h b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyutilities.h new file mode 100644 index 00000000..a8308171 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxrenamingstrategyutilities.h @@ -0,0 +1,104 @@ +/**************************************************************************************** + + 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 fbxrenamingstrategyutilities.h +#ifndef _FBXSDK_UTILS_RENAMINGSTRATEGY_UTILITIES_H_ +#define _FBXSDK_UTILS_RENAMINGSTRATEGY_UTILITIES_H_ + +#include + +#include + +#include + +#define NAMECLASH1_KEY "_ncl1_" // name (x) +#define NAMECLASH2_KEY "_ncl2_" // Upper/lower cases clash + +#define UPPERTOLOWER_KEY "ul" +#define LOWERTOUPPER_KEY "lu" + +/** \brief This class contains a set of utilities, which are used by the FBX renaming strategy. +* \nosubgrouping +*/ +class FBXSDK_DLL FbxRenamingStrategyUtils +{ +public: + + /** Check if the string has non alphanumeric characters and replace them with a special string containing a prefix and + * the character code. + * \param pString String to be processed. The result of the conversion is also returned in this string. + * \param pFirstCharMustBeAlphaOnly This flag tells whether the first char of the string must be alpha only. Its default + * value is \c false. + * \param pPermittedChars List of non alphanumeric characters that do not require to be converted because already + * supported by the destination application. When encountered, these characters are simply + * skipped and left as is. + * \param p8bitCharsOnly When \c true, this flag tells the routine that only 8 bit coded characters can be + * represented by the encoding format (see note below). If set to \c false, the range of supported + * character is increased and the memory usage may be less. But the routine will perform slower + * because of the internal conversions required. + * \return Returns \c true if at least one character in \c pString has been encoded. + * \note The encoding string depends on the value of \c p8bitCharsOnly argument. When this parameter value is \c true, + * each non-alphanumeric character is replaced with FBXASC### (where ### is the decimal code of the character). + * Inversely, when the value is \c false, each non-alphanumeric characters is replaced with FBXCHR##### (where + * ##### is the hexadecimal representation of the character code). + */ + static bool EncodeNonAlpha(FbxString &pString, bool pFirstCharMustBeAlphaOnly=false, FbxString pPermittedChars="", bool p8bitCharsOnly = true); + + /** Take a string that has been encoded by EncodeNonAlpha and re-extract the non-alphanumeric values. + * \param pString String to be processed. The result of the conversion is also returned in this string. + * \return Returns \c true if the \c pString argument has been decoded. + */ + static bool DecodeNonAlpha(FbxString &pString); + + /** This method will add the _ncl1_ with the provided pInstanceNumber to the string + * \param pString + * \param pInstanceNumber Its default value is 0. + * \return Always returns true. + * \remarks please ALWAYS call Encode Duplicate BEFORE Encode Case Insensitive. + */ + static bool EncodeDuplicate(FbxString &pString, int pInstanceNumber=0); + + /** This method will remove the _ncl1_xxx from the given string + * \param pString + * \return Returns true if the pString has been modified + */ + static bool DecodeDuplicate(FbxString &pString); + + /** This method will compare pString and pString2, set pString to pString2 and append the ncl2 suffix to it + * \param pString + * \param pString2 + * \return Returns true if the pString has been modified + * \remarks pString and pString2 must be identical except for casing. + */ + static bool EncodeCaseInsensitive(FbxString &pString, const FbxString pString2); + + /** This method will decode a string that has a ncl2 to it + * \param pString + * \return Returns true if the pString has been modified + */ + static bool DecodeCaseInsensitive(FbxString &pString); + + /** Returns a name with its prefix removed. + * \param pName A name containing a prefix. + * \return The part of pName following the "::" + */ + static FbxString NoPrefixName(const char* pName); + + /** Returns a name with its prefix removed. + * \param pName A name containing a prefix. + * \return The part of pName following the "::" + */ + static FbxString NoPrefixName(FbxString& pName); +}; + +#include + +#endif /* _FBXSDK_UTILS_RENAMINGSTRATEGY_UTILITIES_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxrootnodeutility.h b/libs/fbx/include/fbxsdk/utils/fbxrootnodeutility.h new file mode 100644 index 00000000..1503adcf --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxrootnodeutility.h @@ -0,0 +1,78 @@ +/**************************************************************************************** + + 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 fbxrootnodeutility.h +#ifndef _FBXSDK_UTILS_ROOT_NODE_UTILITY_H_ +#define _FBXSDK_UTILS_ROOT_NODE_UTILITY_H_ + +#include + +#include + +#include + +class FbxScene; +class FbxAxisSystem; +class FbxNode; + +/** \brief This class collects static functions for manipulating Fbx_Root nodes. + * Fbx_Root nodes were used to orient and scale scenes from other graphics applications. They have been replaced by the + * conversion routines in FbxAxisSystem and FbxSystemUnit. These methods are provided for backward compatibility only + * and will eventually be removed. Use the conversion routines in FbxSystemUnit and FbxAxisSystem when possible. + */ +class FBXSDK_DLL FbxRootNodeUtility +{ +public: + + static const char* sFbxRootNodePrefix; + + /** This method strips the scene of all Fbx_Root nodes. + * \param pScene The scene to convert + * \return \c true if successful, \c false otherwise. + * \remarks Converts the children of any Fbx_Roots to the orientation + * and units that the Fbx_Root transformation represented. + * The scene should look unchanged. + */ + static bool RemoveAllFbxRoots( FbxScene* pScene ); + + /** Inserts an Fbx_Root node into the scene to orient the + * scene from its axis and unit systems to the specified ones. + * \param pScene The scene to convert + * \param pDstAxis Destination axis. + * \param pDstUnit Destination unit + * \param pUnitOptions Unit conversion options + * + */ + static bool InsertFbxRoot( FbxScene* pScene, + const FbxAxisSystem& pDstAxis, + const FbxSystemUnit& pDstUnit, + const FbxSystemUnit::ConversionOptions& pUnitOptions = FbxSystemUnit::DefaultConversionOptions ); + + /** Check if a node is an Fbx_Root node + * \param pNode The node to query + * \return \c true if pNode is a Fbx_Root node, false otherwise + */ + static bool IsFbxRootNode(FbxNode* pNode); + +/***************************************************************************************************************************** +** 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: + FbxRootNodeUtility(); + FbxRootNodeUtility(const FbxRootNodeUtility& pOther); + ~FbxRootNodeUtility(); +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_ROOT_NODE_UTILITY_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxscenecheckutility.h b/libs/fbx/include/fbxsdk/utils/fbxscenecheckutility.h new file mode 100644 index 00000000..73a65d07 --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxscenecheckutility.h @@ -0,0 +1,118 @@ +/**************************************************************************************** + + 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 fbxscenecheckutility.h +#ifndef _FBXSDK_SCENE_CHECK_UTILITY_H_ +#define _FBXSDK_SCENE_CHECK_UTILITY_H_ + +#include +#include +#include +#include + +class FbxScene; +class FbxStatus; + +/** \brief This class defines functions to check the received scene graph for issues. + * remark This is still an experimental class and it is not expected to validate + every single data object. + */ +class FBXSDK_DLL FbxSceneCheckUtility +{ +public: + enum ECheckMode { + eCheckCycles = 1, + eCheckAnimationEmptyLayers = 2, + eCheckAnimatioCurveData = 4, + eCheckAnimationData = 6, + eCheckGeometryData = 8, + eCheckOtherData = 16, + eCkeckData = 30 // includes Geometry,Animation&Other + }; + + /** Construct the object + * pScene Input scene to check + * pStatus FbxStatus object to set error codes in (optional) + * pDetails Details messages of issues found (optional) + * + * remark The Details array and its content must be cleared by the caller + */ + FbxSceneCheckUtility(const FbxScene* pScene, FbxStatus* pStatus=NULL, FbxArray* pDetails = NULL); + ~FbxSceneCheckUtility(); + + /** Check for issues in the scene + * return \false if any issue is found in the scene + * remark Depending on the check mode settings, the processing time can increase dramatically. + * remark If a status and/or details object is provided, the error code is set and, details info is + logged. + */ + bool Validate(ECheckMode pCheckMode=eCheckCycles); + +/***************************************************************************************************************************** +** 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: + bool HaveCycles(); + bool HaveInvalidData(int pCheckMode); + +private: + FbxSceneCheckUtility(); + FbxSceneCheckUtility(const FbxSceneCheckUtility& pOther); + + // Check functions return true if valid, false otherwise + bool CheckMappingMode(FbxLayerElement::EMappingMode pMappingMode, const FbxString& pPrefix); + bool CheckReferenceMode(FbxLayerElement::EReferenceMode pReferenceMode, const FbxString& pPrefix); + bool CheckSurfaceMode(FbxGeometry::ESurfaceMode pSurfaceMode, const FbxString& pPrefix); + bool CheckSurfaceType(FbxNurbs::EType pSurfaceType, const FbxString& pPrefix, const char* pDir); + + int MaxCountLimit(FbxLayerElement::EMappingMode pMappingMode, + int pCtrlPointsCount, + int pVerticesCount, + int pPolygonsCount, + int pEdgesCount, + int pElseCount); + + enum { + eNoRestriction, + eDirectOnly, + eIndexOnly, + }; + + template + bool CheckLayerElement(FbxLayerElementTemplate* pLET, + int pMaxCount, + const char* pId, + const FbxString& pPrefix, + int pRestriction = eNoRestriction); + + bool MeshHaveInvalidData(FbxGeometry* pGeom, const FbxString& pName); + bool NurbsHaveInvalidData(FbxGeometry* pGeom, const FbxString& pName); + bool GeometryHaveInvalidData(FbxGeometry* pGeom, const FbxString& pBase); + + bool GlobalSettingsHaveInvalidData(); + + bool AnimationHaveInvalidData(int pCheckMode); + bool AnimationHaveEmptyLayers(); + bool AnimationHaveInvalidCurveData(); + + const FbxScene* mScene; + + FbxStatus* mStatus; + FbxArray* mDetails; + FbxString mBuffer; + +#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ +}; + +#include + +#endif /* _FBXSDK_UTILS_ROOT_NODE_UTILITY_H_ */ diff --git a/libs/fbx/include/fbxsdk/utils/fbxusernotification.h b/libs/fbx/include/fbxsdk/utils/fbxusernotification.h new file mode 100644 index 00000000..2cfb6dcd --- /dev/null +++ b/libs/fbx/include/fbxsdk/utils/fbxusernotification.h @@ -0,0 +1,523 @@ +/**************************************************************************************** + + 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 fbxusernotification.h +#ifndef _FBXSDK_UTILS_USER_NOTIFICATION_H_ +#define _FBXSDK_UTILS_USER_NOTIFICATION_H_ + +#include + +#include +#include +#include + +#include + +class FbxLogFile; +class FbxMessageEmitter; +class FbxUserNotificationFilteredIterator; + +/** This class defines one entry object held by the FbxUserNotification class. + * \nosubgrouping + * An entry object is a message to show error, warning or information. + * Direct manipulation of this object should not be required. At most, access to + * its members can be granted for querying purposes. + */ +class FBXSDK_DLL FbxAccumulatorEntry +{ +public: + /** Category of the accumulator entry. + */ + enum EClass + { + eError=1, //!< Error message entry. + eWarning=2, //!< Warning message entry. + eInformation=4, //!< Information message entry. + eAny=7 //!< Entry that does not belong to above class. Cannot be used as a class ID + }; + + /** Constructor. + * \param pAEClass Specify the category for this entry. + * \param pName Identifies this entry (more than one object can have the same name). + * \param pDescr The description of the entry. This is the common message. The details + * are added separately by the FbxUserNotification classes. + * \param pDetail A list of detail string that will be copied into the local array. + * \param pMuteState Whether this entry is muted. + * \remarks By default the object is muted so it does not get processed by the low level + * output routines of the UserNotification accumulator. The entry gets activated + * (unmuted) by the calls to AddDetail() in the accumulator. + */ + FbxAccumulatorEntry(EClass pAEClass, const FbxString& pName, const FbxString& pDescr, + FbxString pDetail="", bool pMuteState=true); + + /** Copy Constructor. + * \param pAE Another FbxAccumulatorEntry object to be copied. + * \param pSkipDetails Flag to skip details. + */ + FbxAccumulatorEntry(const FbxAccumulatorEntry& pAE, bool pSkipDetails); + + //! Destructor. + ~FbxAccumulatorEntry(); + + //! Returns the category class of this entry. + EClass GetClass() const; + + //! Returns the name of this entry. + FbxString GetName() const; + + //! Returns the description of this entry. + FbxString GetDescription() const; + + //! Returns the number of details stored. + int GetDetailsCount() const; + + /** Returns a pointer to one specific detail string (or NULL if the id is invalid). + * Detail string is dynamic. One entry can have multiple detail strings to hold extra information. + * For example, if one entry message is related to many FBX nodes, user can add these nodes' name as details. + * \param id The detail id. + * \return Pointer to the specific detail. + */ + const FbxString* GetDetail(int id) const; + + //! Returns True if this entry is muted. + bool IsMuted() const; + +private: + FbxArray& GetDetails(); + void Mute(bool pState); + + bool mMute; + EClass mAEClass; + FbxString mName; + FbxString mDescr; + FbxArray mDetails; + + friend class FbxUserNotification; +}; + + +/** This class accumulates user notifications and sends them to any device opened by the derived classes. + * If this class is not derived, the data can only be sent to a log file. To send data to a log file, + * it must be opened before attempting to send data, otherwise, the messages will be lost. + */ +class FBXSDK_DLL FbxUserNotification +{ +public: + /** + * Create and initialize user notification object for the SDK manager. + * One SDK manager has one global user notification object. + * If the SDK manager already has global user notification object, the function will do nothing. + * + * \param pManager + * \param pLogFileName Name of the log file that will be open in the directory + * defined by the GetLogFilePath method. + * \param pSessionDescription This string is used to separate session logs in the file. + * \return the global user notification object owned by the SDK manager. + */ + static FbxUserNotification* Create(FbxManager* pManager, + const FbxString& pLogFileName, + const FbxString& pSessionDescription); + + /** + * Destroy the global user notification object owned by the SDK manager. + */ + static void Destroy(FbxManager* pManager); + + /** Instantiate a FbxUserNotification but leave it uninitialized. The caller must + * explicitly call InitAccumulator to initialize it and ClearAccumulator when finished + * using it. + * \param pManager + * \param pLogFileName Name of the log file that will be open in the directory + * defined by the GetLogFilePath method. + * \remarks If pLogFileName is an empty string the log file does not get created and any + * output sent to it is lost. + * \param pSessionDescription This string is used to separate session logs in the file. + * \remarks If the specified log file already exists, messages are appended to it. This + * class never deletes the log file. Derived classes may delete the log file + * before opening (it must be done in the constructor because the log file is + * opened in the InitAccumulator) or at the end of the processing in the + * PostTerminate method. + */ + FbxUserNotification(FbxManager* pManager, + FbxString const& pLogFileName, + FbxString const& pSessionDescription); + + //! Destructor. + virtual ~FbxUserNotification(); + + /** + * Accumulator is to hold the notification entries. User can add entries to it. + * This method must be called before using the Accumulator. It opens the log file and + * calls AccumulatorInit followed by OpenExtraDevices. Failing to call this method + * will prevent other actions except ClearAccumulator, GetLogFileName and GetLogFilePath. + */ + void InitAccumulator(); + + /** This method must be called when the Accumulator is no longer needed. It calls + * CloseExtraDevices, followed by the AccumulatorClear, and then closes the log file. + */ + void ClearAccumulator(); + + /** IDs for pre-defined message entries. + */ + enum EEntryID + { + eBindPoseInvalidObject, + eBindPoseInvalidRoot, + eBindPoseNotAllAncestorsNodes, + eBindPoseNotAllDeformingNodes, + eBindPoseNotAllAncestorsDefinitionNodes, + eBindPoseRelativeMatrix, + eEmbedMediaNotify, + eFileIONotify, //!< this is generic for reader and writer to log notifications. + eFileIONotifyMaterial, + eFileIONotifyDXFNotSupportNurbs, + eEntryStartID //!< Starting ID for any Accumulator entry added by derived classes. + }; + + /** + * \name Accumulator Management + */ + //@{ + /** Adds one entry into the accumulator. + * \param pID This entry unique ID. + * \param pName This entry name. + * \param pDescr The description of this entry. + * \param pClass The category of this entry. + * \return The ID of the newly allocated entry. This ID is pEntryId. + */ + int AddEntry(const int pID, const FbxString& pName, const FbxString& pDescr, FbxAccumulatorEntry::EClass pClass=FbxAccumulatorEntry::eWarning); + + /** Completes the accumulator entry (there can be more that one detail for each entry) and implicitly defines + * the sequence of events. Each call to this method is internally recorded, making it possible to output each + * notification in the order they have been defined. Also, when a detail is added to an entry, it is automatically unmuted + * so it can be sent to the devices (muted FbxAccumulatorEntry objects are not processed). + * \param pEntryId The entry index (as returned by AddEntry). + * \return The id of the detail in the recorded sequence of events. This Id should be used when the call to + * Output has the eSequencedDetails set as a source. If an error occurs, the returned value is -1 + */ + int AddDetail(int pEntryId); + + /** Completes the accumulator entry (there can be more that one detail for each entry) and implicitly defines + * the sequence of events. Each call to this method is internally recorded, making it possible to output each + * notification in the order they have been defined. Also, when a detail is added to an entry, it is automatically unmuted + * so it can be sent to the devices (muted FbxAccumulatorEntry objects are not processed). + * \param pEntryId The entry index (as returned by AddEntry). + * \param pString The detail string to add to the entry. + * \return The id of the detail in the recorded sequence of events. This Id should be used when the call to + * Output has the eSequencedDetails set as a source. If an error occurs, the returned value is -1 + */ + int AddDetail(int pEntryId, FbxString pString); + + /** Completes the accumulator entry (there can be more that one detail for each entry) and implicitly defines + * the sequence of events. Each call to this method is internally recorded, making it possible to output each + * notification in the order they have been defined. Also, when a detail is added to an entry, it is automatically unmuted + * so it can be sent to the devices (muted FbxAccumulatorEntry objects are not processed). + * \param pEntryId The entry index (as returned by AddEntry). + * \param pNode The node to add to the entry. + * \return The id of the detail in the recorded sequence of events. This Id should be used when the call to + * Output has the eSequencedDetails set as a source. If an error occurs, the returned value is -1 + */ + int AddDetail(int pEntryId, FbxNode* pNode); + + //! Returns the number of AccumulatorEntries currently stored in this accumulator. + int GetNbEntries() const; + + /** Get the specified FbxAccumulatorEntry. + * \param pEntryId ID of the entry to retrieve. + * \return Pointer to the specified entry, otherwise \c NULL if either the id is invalid or the Accumulator + * is not properly initialized. + */ + const FbxAccumulatorEntry* GetEntry(int pEntryId); + + /** Get the FbxAccumulatorEntry at the specified index. + * \param pEntryIndex index of the entry to retrieve. + * \return Pointer to the specified entry, otherwise \c NULL if either the index is invalid or the Accumulator + * is not properly initialized.. + */ + const FbxAccumulatorEntry* GetEntryAt(int pEntryIndex) const; + + //! Returns the number of Details recorded so far in this accumulator. + int GetNbDetails() const; + + /** Get the specified detail. + * \param pDetailId Index of the detail. This is the id-th detail of type pClass as inserted + * when the AddDetail + * \param pAE Pointer to the FbxAccumulatorEntry object that contains the requested detail. + * The returned valued can be NULL if an error occurred. + * \return The index of the detail to be used when calling the GetDetail of the FbxAccumulatorEntry. + * \remarks A value of -1 is acceptable and means that the FbxAccumulatorEntry has no details. However, + * if pAE is NULL, the return value is meaningless. + */ + int GetDetail(int pDetailId, const FbxAccumulatorEntry*& pAE) const; + + //@} + + /** + * \name Accumulator Output + */ + //@{ + /** Specify send what kind of data to output device. + */ + enum EOutputSource + { + eAccumulatorEntry, //!< Entry with its details. + eSequencedDetails //!< Details in the recorded order. + }; + + /** Send the accumulator entries to the output devices. + * This method needs to be explicitly called by the program that uses this + * class. + * \param pOutSrc Specify which data has to be sent to the output devices. Set to SEQUENCED_DETAILS + * to send the Details in the recorded order. Set to ACCUMULATOR_ENTRY to send + * each entry with its details regardless of the order in which the events occurred. + * \param pIndex If this parameter >= 0, only send the specified entry/detail index to the output devices. + * Otherwise send all of them. + * \param pExtraDevicesOnly If this parameter is True, the output is not sent to the log file. + * \remarks The pExtraDevicesOnly parameter is ignored if the log file has been disabled. + */ + bool Output(EOutputSource pOutSrc=eAccumulatorEntry, int pIndex = -1, bool pExtraDevicesOnly = false); + + /** Send the accumulator entry to the output devices. + * \param pId Send the entry/detail that matching pIdx to the output devices, + * otherwise send all of them. + * \param pOutSrc Specify which data has to be sent to the output devices. Set to SEQUENCED_DETAILS + * to send the Details in the recorded order. Set to ACCUMULATOR_ENTRY to send + * each entry with its details regardless of the order in which the events occurred.. + * \param pExtraDevicesOnly If this parameter is True, the output is not sent to the log file. + */ + bool OutputById(EEntryID pId, EOutputSource pOutSrc=eAccumulatorEntry, bool pExtraDevicesOnly = false); + + /** Send an immediate entry to the output devices. + * This method bypasses the accumulator by sending the entry directly to the output devices + * and discarding it right after. The internal accumulator lists are left unchanged by this call. + * \param pName This entry name. + * \param pDescr The description of this entry. + * \param pClass The category of this entry. + * \param pExtraDevicesOnly If this parameter is True, the output is not sent to the log file. + * \remarks The pExtraDevicesOnly parameter is ignored if the log file has been disabled. + */ + bool Output(const FbxString& pName, const FbxString& pDescr, FbxAccumulatorEntry::EClass pClass, bool pExtraDevicesOnly = false); + + /** Sends the content of the iterator to the output devices. + * This method bypasses the accumulator by sending each entry in the iterator directly to + * the output devices. The internal accumulator lists are left unchanged by this call. + * \param pAEFIter The Filtered FbxAccumulatorEntry iterator object. + * \param pExtraDevicesOnly If this parameter is True, the output is not sent to the log file. + * \remarks The pExtraDevicesOnly parameter is ignored if the log file has been disabled. + */ + bool Output(FbxUserNotificationFilteredIterator& pAEFIter, bool pExtraDevicesOnly = false); + + /** Set log message emitter. + * \param pLogMessageEmitter The new log message emitter. + */ + void SetLogMessageEmitter(FbxMessageEmitter * pLogMessageEmitter); + + /** + * \name Utilities + */ + //@{ + /** Returns the absolute path to the log file. If this method is not overridden in a derived class, it + * returns the TEMP directory. + * \param pPath The returned path. + */ + virtual void GetLogFilePath(FbxString& pPath); + + /** Returns the log file name. */ + inline FbxString GetLogFileName() { return mLogFileName; } + //@} + +protected: + /** + * Identify one detail in all accumulator entries by record the entry object and its detail id. + */ + class AESequence + { + public: + AESequence(FbxAccumulatorEntry* pAE, int pDetailId) : + mAE(pAE), + mDetailId(pDetailId) + { + }; + + //! Return the entry object the detail belongs to. + FbxAccumulatorEntry* AE() { return mAE; } + //! Return the detail id in the entry object + int DetailId() { return mDetailId; } + + private: + FbxAccumulatorEntry* mAE; + int mDetailId; + }; + + friend class FbxUserNotificationFilteredIterator; + + /** Allow a derived class to finalize processing AFTER the log file handle has been + * deleted. This may be required if the log file needs to be moved or shown. + * \returns True if the object is properly cleaned. + */ + virtual bool PostTerminate(); + + /** Allow the implementation class to perform accumulator initializations before + * the Extra devices are opened. By default this method does nothing. + */ + virtual void AccumulatorInit(); + + /** Allow the implementation class to perform accumulator clear after the Extra devices are + * closed. By default this method does nothing. + */ + virtual void AccumulatorClear(); + + /** Allow the implementation class to opens its output devices (called by InitAccumulator). + * By default this method does nothing. + */ + virtual void OpenExtraDevices(); + + /** Allow the implementation class to send all the accumulator entries to the devices. + * By default this method loop trough all the elements of the received array and + * call the SendToExtraDevices method with the appropriate FbxAccumulatorEntry element and id. + * \param pOutputNow Flag indicates whether to output now. + * \param pEntries Accumulator entries to output. + * \return \c true if successful, \c false otherwise. + */ + virtual bool SendToExtraDevices(bool pOutputNow, FbxArray& pEntries); + + /** Allow the implementation class to send all the accumulator entries to the devices. + * By default this method loop trough all the elements of the received array and + * call the SendToExtraDevices method with the appropriate FbxAccumulatorEntry element and id. + * \param pOutputNow Flag indicates whether to output now. + * \param pAESequence Accumulator entries to output. + * \return \c true if successful, \c false otherwise. + */ + virtual bool SendToExtraDevices(bool pOutputNow, FbxArray& pAESequence); + + /** Allow the implementation class to send one accumulator entry to the devices. + * By default this method does nothing. + * \param pOutputNow Flag indicates whether to output now. + * \param pAccEntry Accumulator entry to output. + * \param pDetailId Detail id. + * \return \c true if successful, \c false otherwise. + * \remarks Derived methods should check for the IsMuted() state to decide if the accumulator + * entry should get through or get discarded. See AddDetail for more details. + */ + virtual bool SendToExtraDevices(bool pOutputNow, const FbxAccumulatorEntry* pAccEntry, int pDetailId = -1); + + + /** Allow the implementation class to close it's output devices (called in the ClearAccumulator) + * By default this method does nothing. + */ + virtual void CloseExtraDevices(); + + //! Clears the Accumulator list, remove all user notification entries.. + void ResetAccumulator(); + + //! Clears the Sequence list. + void ResetSequence(); + + /** Send the pIdth element of the accumulator or sequence list to the log file. + * \param pOutSrc The output source, accumulator or sequence list. + * \param pId Element id. + */ + void SendToLog(EOutputSource pOutSrc, int pId); + + /** Send the accumulator entry to the log file. + * \param pAccEntry The accumulator entry. + * \param pDetailId Detail id. + */ + void SendToLog(const FbxAccumulatorEntry* pAccEntry, int pDetailId = -1); + +private: + FbxString mLogFileName; + FbxString* mLog; + FbxLogFile* mLogFile; + FbxMessageEmitter* mLogMessageEmitter; + + bool mProperlyInitialized; + FbxString mSessionDescription; + bool mProperlyCleaned; + + FbxMultiMap mAccuHT; // The set establish a relationship between an FbxAccumulatorEntry and it's ID + FbxArray mAccu; // The array defines the order the FbxAccumulatorEntry objects have been + // added to the accumulator (calls to AddEntry) + // Both structures share the same pointers. + FbxArray mAESequence; + FbxManager* mSdkManager; +}; + +/** This class iterates through the accumulated messages depending on the configuration + * flags (filter). The iterator keeps a local copy of the data extracted from the + * accumulator. + */ +class FBXSDK_DLL FbxUserNotificationFilteredIterator +{ +public: + /** Constructor. + * \param pAccumulator This reference is only used during construction for retrieving + * the data required to fill the iterator. + * \param pFilterClass The bitwise combination of the EClass identifiers. An FbxAccumulatorEntry + * element is copied from the accumulator if its Class matches one of the + * bits of this flag. + * \param pSrc Specify which data format is extracted from the accumulator. + * \param pNoDetail This parameter is used ONLY if pSrc == eAccumulatorEntry and, if set to + * false, the details of the FbxAccumulatorEntry are also sent to the output + * devices. If left to its default value, only the description of the + * FbxAccumulatorEntry is sent. + */ + FbxUserNotificationFilteredIterator(FbxUserNotification& pAccumulator, + int pFilterClass, + FbxUserNotification::EOutputSource pSrc = FbxUserNotification::eSequencedDetails, + bool pNoDetail = true); + + virtual ~FbxUserNotificationFilteredIterator(); + + //! Returns the number of elements contained in this iterator. + int GetNbItems() const; + + //! Put the iterator in its reset state. + void Reset(); + + /** Get this iterator's first item. + * \return NULL if the iterator is empty. + */ + FbxAccumulatorEntry* const First(); + + /** Get this iterator's previous item. + * \return NULL if the iterator reached the beginning (or is empty). + * \remarks This method will also return NULL if it is called before + * or immediately after a call to First() and reset the iterator to + * its reset state (meaning that a call to First() is mandatory + * to be able to iterate again). + */ + FbxAccumulatorEntry* const Previous(); + + /** Get this iterator's next item. + * \return NULL if the iterator reached the end (or is empty). + * \remarks This method will also return NULL if it is called while + * the iterator is in its reset state (called before + * First() or after a preceding call to Previous() reached + * beyond the beginning). + */ + FbxAccumulatorEntry* const Next(); + +protected: + // Called in the constructor. + virtual void BuildFilteredList(FbxUserNotification& pAccumulator); + + int mIterator; + int mFilterClass; + bool mNoDetail; + FbxUserNotification::EOutputSource mAccuSrcData; + FbxArray mFilteredAE; +}; + +#include + +#endif /* _FBXSDK_UTILS_USER_NOTIFICATION_H_ */ diff --git a/libs/fbx/lib/vs2015/x64/release/libfbxsdk.dll b/libs/fbx/lib/vs2015/x64/release/libfbxsdk.dll new file mode 100644 index 00000000..d4e6a015 Binary files /dev/null and b/libs/fbx/lib/vs2015/x64/release/libfbxsdk.dll differ diff --git a/libs/fbx/lib/vs2015/x64/release/libfbxsdk.lib b/libs/fbx/lib/vs2015/x64/release/libfbxsdk.lib new file mode 100644 index 00000000..c7f73278 Binary files /dev/null and b/libs/fbx/lib/vs2015/x64/release/libfbxsdk.lib differ diff --git a/libs/fbx/lib/vs2015/x86/release/libfbxsdk.dll b/libs/fbx/lib/vs2015/x86/release/libfbxsdk.dll new file mode 100644 index 00000000..656413b9 Binary files /dev/null and b/libs/fbx/lib/vs2015/x86/release/libfbxsdk.dll differ diff --git a/libs/fbx/lib/vs2015/x86/release/libfbxsdk.lib b/libs/fbx/lib/vs2015/x86/release/libfbxsdk.lib new file mode 100644 index 00000000..3ecda877 Binary files /dev/null and b/libs/fbx/lib/vs2015/x86/release/libfbxsdk.lib differ diff --git a/makefile-vc-win32 b/makefile-vc-win32 index ce5d91e8..8acd16e6 100644 --- a/makefile-vc-win32 +++ b/makefile-vc-win32 @@ -5,7 +5,7 @@ # Compiler definitions #------------------------------------------------------------------------------ -CPP = cl.exe -nologo -c -D WIN32 -D _WINDOWS +CPP = cl.exe -nologo -c -D WIN32 -D _WINDOWS -D FBXSDK_SHARED LINK = link.exe -nologo -filealign:512 -incremental:no -machine:X86 AR = link.exe -lib -nologo @@ -33,6 +33,7 @@ MAIN_FILES = \ $(OUT_1)/ExportMaterial.obj \ $(OUT_1)/ExportMd5.obj \ $(OUT_1)/ExportPsk.obj \ + $(OUT_1)/ExportFbx.obj \ $(OUT_1)/ExportSound.obj \ $(OUT_1)/ExportTexture.obj \ $(OUT_1)/ExportThirdParty.obj \ @@ -163,18 +164,18 @@ MOBILE_LIBS_FILES = \ umodel.exe : $(OUT) $(OUT_1) $(MAIN_FILES) $(NV_LIBS_FILES) $(UE3_LIBS_FILES) $(MOBILE_LIBS_FILES) echo Creating executable "umodel.exe" ... - $(LINK) -out:"umodel.exe" -libpath:./libs/SDL2/x86 SDL2.lib -debug -pdb:"umodel.pdb" -opt:ref -opt:icf $(MAIN_FILES) $(NV_LIBS_FILES) $(UE3_LIBS_FILES) $(MOBILE_LIBS_FILES) -nodefaultlib:libcmt.lib -nodefaultlib:msvcprt.lib -manifest:no ./../Libs/msvcrt/lib/Win32/msvcrt.lib ./../Libs/msvcrt/lib/Win32/wdk_msvcrt_win2000.obj -subsystem:console + $(LINK) -out:"umodel.exe" -libpath:./libs/SDL2/x86 -libpath:./libs/fbx/lib/vs2015/x86/release SDL2.lib libfbxsdk.lib -debug -pdb:"umodel.pdb" -opt:ref -opt:icf $(MAIN_FILES) $(NV_LIBS_FILES) $(UE3_LIBS_FILES) $(MOBILE_LIBS_FILES) -subsystem:console #------------------------------------------------------------------------------ # compiling source files #------------------------------------------------------------------------------ -OPT_MOBILE_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ -D OLDCRT +OPT_MOBILE_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ $(OUT)/astc_percentile_tables.obj : ./libs/astc/astc_percentile_tables.cpp $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_percentile_tables.obj" ./libs/astc/astc_percentile_tables.cpp -OPT_NV_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ -D OLDCRT -I ./libs/nvtt +OPT_NV_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ -I ./libs/nvtt $(OUT)/ColorBlock.obj : ./libs/nvtt/nvimage/ColorBlock.cpp $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/ColorBlock.obj" ./libs/nvtt/nvimage/ColorBlock.cpp @@ -185,7 +186,7 @@ $(OUT)/DirectDrawSurface.obj : ./libs/nvtt/nvimage/DirectDrawSurface.cpp $(OUT)/Image.obj : ./libs/nvtt/nvimage/Image.cpp $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/Image.obj" ./libs/nvtt/nvimage/Image.cpp -OPT_MAIN = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ -D OLDCRT -I . -I ./Core -I ./Unreal -I ./libs/include -I ./libs -I ./libs/nvtt -I ./libs/PowerVR -I ./libs/detex -I ./libs/rijndael -I ./libs/includewin32 -I UmodelTool -I UI +OPT_MAIN = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ -I . -I ./Core -I ./Unreal -I ./libs/include -I ./libs -I ./libs/fbx/include -I ./libs/nvtt -I ./libs/PowerVR -I ./libs/detex -I ./libs/rijndael -I ./libs/includewin32 -I UmodelTool -I UI DEPENDS = \ Core/Core.h \ @@ -545,7 +546,27 @@ DEPENDS = \ Unreal/GameDefines.h \ Unreal/MeshCommon.h \ Unreal/SkeletalMesh.h \ - Unreal/TypeInfo.h \ + Unreal/StaticMesh.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h + +$(OUT_1)/ExportFbx.obj : Exporters/ExportFbx.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportFbx.obj" Exporters/ExportFbx.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ Unreal/UnCore.h \ Unreal/UnMaterial.h \ Unreal/UnObject.h @@ -1432,7 +1453,7 @@ DEPENDS = \ UmodelTool/res/resource.h $(OUT_1)/umodel.res : UmodelTool/res/umodel.rc $(DEPENDS) - rc.exe -l 0x409 -i UmodelTool/res/ -i . -i ./Core -i ./Unreal -i ./libs/include -i ./libs -i ./libs/nvtt -i ./libs/PowerVR -i ./libs/detex -i ./libs/rijndael -i ./libs/includewin32 -i UmodelTool -i UI -d _USING_V110_SDK71_ -d OLDCRT -d _WIN32 -d WIN32 -fo"$(OUT_1)/umodel.res" -dNDEBUG UmodelTool/res/umodel.rc + rc.exe -l 0x409 -i UmodelTool/res/ -i . -i ./Core -i ./Unreal -i ./libs/include -i ./libs -i ./libs/nvtt -i ./libs/PowerVR -i ./libs/detex -i ./libs/rijndael -i ./libs/includewin32 -i UmodelTool -i UI -d _USING_V110_SDK71_ -d _WIN32 -d WIN32 -fo"$(OUT_1)/umodel.res" -dNDEBUG UmodelTool/res/umodel.rc DEPENDS = \ libs/PowerVR/PVRTDecompress.h \ diff --git a/makefile-vc-win64 b/makefile-vc-win64 new file mode 100644 index 00000000..b6fd678e --- /dev/null +++ b/makefile-vc-win64 @@ -0,0 +1,1761 @@ +# Makefile for VisualC/win64 target +# This file was automatically generated from "UmodelTool/umodel.project": do not edit + +#------------------------------------------------------------------------------ +# Compiler definitions +#------------------------------------------------------------------------------ + +CPP = cl.exe -nologo -c -D WIN32 -D _WINDOWS -D FBXSDK_SHARED +LINK = link.exe -nologo -filealign:512 -incremental:no -machine:X64 +AR = link.exe -lib -nologo + +#------------------------------------------------------------------------------ +# Directories +#------------------------------------------------------------------------------ + +OUT = ./obj/libs-win64 +OUT_1 = ./obj/umodel-win64 + +#------------------------------------------------------------------------------ +# symbolic targets +#------------------------------------------------------------------------------ + +ALL : MAIN +MAIN : umodel.exe + +#------------------------------------------------------------------------------ +# "umodel.exe" target +#------------------------------------------------------------------------------ + +MAIN_FILES = \ + $(OUT_1)/Export3D.obj \ + $(OUT_1)/Exporters.obj \ + $(OUT_1)/ExportMaterial.obj \ + $(OUT_1)/ExportMd5.obj \ + $(OUT_1)/ExportPsk.obj \ + $(OUT_1)/ExportFbx.obj \ + $(OUT_1)/ExportSound.obj \ + $(OUT_1)/ExportTexture.obj \ + $(OUT_1)/ExportThirdParty.obj \ + $(OUT_1)/GameDatabase.obj \ + $(OUT_1)/GameFileSystem.obj \ + $(OUT_1)/GameFileSystemGears4.obj \ + $(OUT_1)/MeshCommon.obj \ + $(OUT_1)/PackageUtils.obj \ + $(OUT_1)/SkeletalMesh.obj \ + $(OUT_1)/TypeInfo.obj \ + $(OUT_1)/UnAnim2.obj \ + $(OUT_1)/UnAnim3.obj \ + $(OUT_1)/UnAnim4.obj \ + $(OUT_1)/UnCore.obj \ + $(OUT_1)/UnCoreCompression.obj \ + $(OUT_1)/UnCoreDecrypt.obj \ + $(OUT_1)/UnCoreSerialize.obj \ + $(OUT_1)/UnHavok.obj \ + $(OUT_1)/UnMesh1.obj \ + $(OUT_1)/UnMesh2.obj \ + $(OUT_1)/UnMesh3.obj \ + $(OUT_1)/UnMesh4.obj \ + $(OUT_1)/UnMeshBatman.obj \ + $(OUT_1)/UnMeshBioshock.obj \ + $(OUT_1)/UnMeshRune.obj \ + $(OUT_1)/UnObject.obj \ + $(OUT_1)/UnPackage.obj \ + $(OUT_1)/UnPackageReader.obj \ + $(OUT_1)/UnRenderer.obj \ + $(OUT_1)/UnTexture.obj \ + $(OUT_1)/UnTexture2.obj \ + $(OUT_1)/UnTexture3.obj \ + $(OUT_1)/UnTexture4.obj \ + $(OUT_1)/UnTextureNVTT.obj \ + $(OUT_1)/UnTexturePNG.obj \ + $(OUT_1)/UnUbisoft.obj \ + $(OUT_1)/MaterialViewer.obj \ + $(OUT_1)/MeshViewer.obj \ + $(OUT_1)/ObjectViewer.obj \ + $(OUT_1)/SkelMeshViewer.obj \ + $(OUT_1)/StatMeshViewer.obj \ + $(OUT_1)/VertMeshViewer.obj \ + $(OUT_1)/MeshInstance.obj \ + $(OUT_1)/SkelMeshInstance.obj \ + $(OUT_1)/StatMeshInstance.obj \ + $(OUT_1)/VertMeshInstance.obj \ + $(OUT_1)/Core.obj \ + $(OUT_1)/CoreGL.obj \ + $(OUT_1)/CoreWin32.obj \ + $(OUT_1)/GLBind.obj \ + $(OUT_1)/GlWindow.obj \ + $(OUT_1)/Math3D.obj \ + $(OUT_1)/Memory.obj \ + $(OUT_1)/TextContainer.obj \ + $(OUT_1)/BaseDialog.obj \ + $(OUT_1)/FileControls.obj \ + $(OUT_1)/Main.obj \ + $(OUT_1)/MiscStrings.obj \ + $(OUT_1)/PackageDialog.obj \ + $(OUT_1)/PackageScanDialog.obj \ + $(OUT_1)/ProgressDialog.obj \ + $(OUT_1)/StartupDialog.obj \ + $(OUT_1)/UmodelApp.obj \ + $(OUT_1)/UmodelSettings.obj \ + $(OUT_1)/umodel.res + +NV_LIBS_FILES = \ + $(OUT)/BlockDXT.obj \ + $(OUT)/ColorBlock.obj \ + $(OUT)/DirectDrawSurface.obj \ + $(OUT)/Image.obj + +UE3_LIBS_FILES = \ + $(OUT)/lzo_init.obj \ + $(OUT)/lzo1x_d2.obj \ + $(OUT)/adler32.obj \ + $(OUT)/crc32.obj \ + $(OUT)/inffast.obj \ + $(OUT)/inflate.obj \ + $(OUT)/inftrees.obj \ + $(OUT)/uncompr.obj \ + $(OUT)/lzxd.obj \ + $(OUT)/lz4.obj \ + $(OUT)/png.obj \ + $(OUT)/pngerror.obj \ + $(OUT)/pngget.obj \ + $(OUT)/pngmem.obj \ + $(OUT)/pngpread.obj \ + $(OUT)/pngread.obj \ + $(OUT)/pngrio.obj \ + $(OUT)/pngrtran.obj \ + $(OUT)/pngrutil.obj \ + $(OUT)/pngset.obj \ + $(OUT)/pngtrans.obj \ + $(OUT)/pngwio.obj \ + $(OUT)/pngwrite.obj \ + $(OUT)/pngwtran.obj \ + $(OUT)/pngwutil.obj \ + $(OUT)/bits.obj \ + $(OUT)/bptc-tables.obj \ + $(OUT)/clamp.obj \ + $(OUT)/convert.obj \ + $(OUT)/dds.obj \ + $(OUT)/decompress-bptc-float.obj \ + $(OUT)/decompress-bptc.obj \ + $(OUT)/decompress-eac.obj \ + $(OUT)/decompress-etc.obj \ + $(OUT)/file-info.obj \ + $(OUT)/half-float.obj \ + $(OUT)/misc.obj \ + $(OUT)/texture.obj \ + $(OUT)/rijndael.obj + +MOBILE_LIBS_FILES = \ + $(OUT)/PVRTDecompress.obj \ + $(OUT)/astc_block_sizes2.obj \ + $(OUT)/astc_color_unquantize.obj \ + $(OUT)/astc_decompress_symbolic.obj \ + $(OUT)/astc_image_load_store.obj \ + $(OUT)/astc_integer_sequence.obj \ + $(OUT)/astc_misc.obj \ + $(OUT)/astc_partition_tables.obj \ + $(OUT)/astc_percentile_tables.obj \ + $(OUT)/astc_quantization.obj \ + $(OUT)/astc_symbolic_physical.obj \ + $(OUT)/astc_weight_quant_xfer_tables.obj \ + $(OUT)/softfloat.obj + +umodel.exe : $(OUT) $(OUT_1) $(MAIN_FILES) $(NV_LIBS_FILES) $(UE3_LIBS_FILES) $(MOBILE_LIBS_FILES) + echo Creating executable "umodel.exe" ... + $(LINK) -out:"umodel.exe" -libpath:./libs/SDL2/x64 -libpath:./libs/fbx/lib/vs2015/x64/release SDL2.lib libfbxsdk.lib -debug -pdb:"umodel.pdb" -opt:ref -opt:icf $(MAIN_FILES) $(NV_LIBS_FILES) $(UE3_LIBS_FILES) $(MOBILE_LIBS_FILES) -subsystem:console + +#------------------------------------------------------------------------------ +# compiling source files +#------------------------------------------------------------------------------ + +OPT_MOBILE_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ + +$(OUT)/astc_percentile_tables.obj : ./libs/astc/astc_percentile_tables.cpp + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_percentile_tables.obj" ./libs/astc/astc_percentile_tables.cpp + +OPT_NV_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ -I ./libs/nvtt + +$(OUT)/ColorBlock.obj : ./libs/nvtt/nvimage/ColorBlock.cpp + $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/ColorBlock.obj" ./libs/nvtt/nvimage/ColorBlock.cpp + +$(OUT)/DirectDrawSurface.obj : ./libs/nvtt/nvimage/DirectDrawSurface.cpp + $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/DirectDrawSurface.obj" ./libs/nvtt/nvimage/DirectDrawSurface.cpp + +$(OUT)/Image.obj : ./libs/nvtt/nvimage/Image.cpp + $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/Image.obj" ./libs/nvtt/nvimage/Image.cpp + +OPT_MAIN = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ -I . -I ./Core -I ./Unreal -I ./libs/include -I ./libs -I ./libs/fbx/include -I ./libs/nvtt -I ./libs/PowerVR -I ./libs/detex -I ./libs/rijndael -I ./libs/includewin32 -I UmodelTool -I UI + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GLBindImpl.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h + +$(OUT_1)/GLBind.obj : Core/GLBind.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GLBind.obj" Core/GLBind.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlFont.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/TextContainer.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/Shaders.h + +$(OUT_1)/GlWindow.obj : Core/GlWindow.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GlWindow.obj" Core/GlWindow.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + MeshInstance/MeshInstance.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + UmodelTool/ProgressDialog.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/PackageUtils.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/SkelMeshViewer.obj : Viewers/SkelMeshViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/SkelMeshViewer.obj" Viewers/SkelMeshViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + UmodelTool/MiscStrings.h \ + UmodelTool/UmodelApp.h \ + UmodelTool/UmodelSettings.h \ + UmodelTool/Version.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/PackageUtils.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnAnimNotify.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMaterial3.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnSound.h \ + Unreal/UnThirdParty.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/Main.obj : UmodelTool/Main.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Main.obj" UmodelTool/Main.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/StaticMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/StatMeshViewer.obj : Viewers/StatMeshViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/StatMeshViewer.obj" Viewers/StatMeshViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/MeshViewer.obj : Viewers/MeshViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MeshViewer.obj" Viewers/MeshViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/SkelMeshInstance.obj : MeshInstance/SkelMeshInstance.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/SkelMeshInstance.obj" MeshInstance/SkelMeshInstance.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMaterial3.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/MaterialViewer.obj : Viewers/MaterialViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MaterialViewer.obj" Viewers/MaterialViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/VertMeshViewer.obj : Viewers/VertMeshViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/VertMeshViewer.obj" Viewers/VertMeshViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/AboutDialog.h \ + UmodelTool/Build.h \ + UmodelTool/ErrorDialog.h \ + UmodelTool/MiscStrings.h \ + UmodelTool/PackageDialog.h \ + UmodelTool/PackageScanDialog.h \ + UmodelTool/ProgressDialog.h \ + UmodelTool/StartupDialog.h \ + UmodelTool/UE4AesKeyDialog.h \ + UmodelTool/UE4VersionDialog.h \ + UmodelTool/UmodelApp.h \ + UmodelTool/UmodelSettings.h \ + UmodelTool/res/resource.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/UmodelApp.obj : UmodelTool/UmodelApp.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UmodelApp.obj" UmodelTool/UmodelApp.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/ObjectViewer.obj : Viewers/ObjectViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ObjectViewer.obj" Viewers/ObjectViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/MeshInstance.obj : MeshInstance/MeshInstance.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MeshInstance.obj" MeshInstance/MeshInstance.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/Shaders.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMaterial3.h \ + Unreal/UnObject.h + +$(OUT_1)/UnRenderer.obj : Unreal/UnRenderer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnRenderer.obj" Unreal/UnRenderer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + Exporters/Psk.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h + +$(OUT_1)/ExportPsk.obj : Exporters/ExportPsk.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportPsk.obj" Exporters/ExportPsk.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h + +$(OUT_1)/ExportFbx.obj : Exporters/ExportFbx.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportFbx.obj" Exporters/ExportFbx.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h + +$(OUT_1)/ExportMd5.obj : Exporters/ExportMd5.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportMd5.obj" Exporters/ExportMd5.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/StaticMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/StatMeshInstance.obj : MeshInstance/StatMeshInstance.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/StatMeshInstance.obj" MeshInstance/StatMeshInstance.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/VertMeshInstance.obj : MeshInstance/VertMeshInstance.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/VertMeshInstance.obj" MeshInstance/VertMeshInstance.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMesh2.obj : Unreal/UnMesh2.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMesh2.obj" Unreal/UnMesh2.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial3.h \ + Unreal/UnMathTools.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh3.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMesh3.obj : Unreal/UnMesh3.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMesh3.obj" Unreal/UnMesh3.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial3.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMesh4.obj : Unreal/UnMesh4.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMesh4.obj" Unreal/UnMesh4.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnAnim2.obj : Unreal/UnAnim2.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnAnim2.obj" Unreal/UnAnim2.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnAnim4.obj : Unreal/UnAnim4.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnAnim4.obj" Unreal/UnAnim4.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh3.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnAnim3.obj : Unreal/UnAnim3.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnAnim3.obj" Unreal/UnAnim3.cpp + +$(OUT_1)/UnMeshBatman.obj : Unreal/UnMeshBatman.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMeshBatman.obj" Unreal/UnMeshBatman.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h + +$(OUT_1)/SkeletalMesh.obj : Unreal/SkeletalMesh.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/SkeletalMesh.obj" Unreal/SkeletalMesh.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnHavok.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMeshBioshock.obj : Unreal/UnMeshBioshock.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMeshBioshock.obj" Unreal/UnMeshBioshock.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h + +$(OUT_1)/MeshCommon.obj : Unreal/MeshCommon.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MeshCommon.obj" Unreal/MeshCommon.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + UmodelTool/UmodelSettings.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h + +$(OUT_1)/UmodelSettings.obj : UmodelTool/UmodelSettings.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UmodelSettings.obj" UmodelTool/UmodelSettings.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial3.h \ + Unreal/UnObject.h \ + Unreal/UnTextureNVTT.h + +$(OUT_1)/ExportTexture.obj : Exporters/ExportTexture.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportTexture.obj" Exporters/ExportTexture.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h + +$(OUT_1)/ExportMaterial.obj : Exporters/ExportMaterial.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportMaterial.obj" Exporters/ExportMaterial.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h + +$(OUT_1)/Export3D.obj : Exporters/Export3D.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Export3D.obj" Exporters/Export3D.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h + +$(OUT_1)/Exporters.obj : Exporters/Exporters.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Exporters.obj" Exporters/Exporters.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnSound.h + +$(OUT_1)/ExportSound.obj : Exporters/ExportSound.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportSound.obj" Exporters/ExportSound.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnThirdParty.h + +$(OUT_1)/ExportThirdParty.obj : Exporters/ExportThirdParty.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportThirdParty.obj" Exporters/ExportThirdParty.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/FileControls.h \ + UI/callback.h \ + UmodelTool/Build.h \ + UmodelTool/StartupDialog.h \ + UmodelTool/UmodelSettings.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h + +$(OUT_1)/StartupDialog.obj : UmodelTool/StartupDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/StartupDialog.obj" UmodelTool/StartupDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/FileControls.h \ + UI/callback.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h + +$(OUT_1)/FileControls.obj : UI/FileControls.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/FileControls.obj" UI/FileControls.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/AboutDialog.h \ + UmodelTool/Build.h \ + UmodelTool/MiscStrings.h \ + UmodelTool/PackageDialog.h \ + UmodelTool/PackageScanDialog.h \ + UmodelTool/ProgressDialog.h \ + UmodelTool/res/resource.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/UnCore.h \ + Unreal/UnPackage.h + +$(OUT_1)/PackageDialog.obj : UmodelTool/PackageDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/PackageDialog.obj" UmodelTool/PackageDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + UmodelTool/ProgressDialog.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h + +$(OUT_1)/ProgressDialog.obj : UmodelTool/ProgressDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ProgressDialog.obj" UmodelTool/ProgressDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + UmodelTool/ProgressDialog.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/UnCore.h + +$(OUT_1)/PackageScanDialog.obj : UmodelTool/PackageScanDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/PackageScanDialog.obj" UmodelTool/PackageScanDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h + +$(OUT_1)/BaseDialog.obj : UI/BaseDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/BaseDialog.obj" UI/BaseDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h + +$(OUT_1)/UnObject.obj : Unreal/UnObject.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnObject.obj" Unreal/UnObject.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnPackageUE3Reader.h + +$(OUT_1)/UnPackage.obj : Unreal/UnPackage.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnPackage.obj" Unreal/UnPackage.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h + +$(OUT_1)/GameDatabase.obj : Unreal/GameDatabase.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GameDatabase.obj" Unreal/GameDatabase.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h + +$(OUT_1)/CoreGL.obj : Core/CoreGL.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/CoreGL.obj" Core/CoreGL.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/GameFileSystem.h \ + Unreal/UnArchiveObb.h \ + Unreal/UnArchivePak.h \ + Unreal/UnCore.h + +$(OUT_1)/GameFileSystem.obj : Unreal/GameFileSystem.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GameFileSystem.obj" Unreal/GameFileSystem.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/GameFileSystem.h \ + Unreal/UnCore.h + +$(OUT_1)/GameFileSystemGears4.obj : Unreal/GameFileSystemGears4.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GameFileSystemGears4.obj" Unreal/GameFileSystemGears4.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h + +$(OUT_1)/PackageUtils.obj : Unreal/PackageUtils.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/PackageUtils.obj" Unreal/PackageUtils.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMeshRune.obj : Unreal/UnMeshRune.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMeshRune.obj" Unreal/UnMeshRune.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnHavok.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnHavok.obj : Unreal/UnHavok.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnHavok.obj" Unreal/UnHavok.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMesh1.obj : Unreal/UnMesh1.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMesh1.obj" Unreal/UnMesh1.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnObject.h + +$(OUT_1)/UnTexture2.obj : Unreal/UnTexture2.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexture2.obj" Unreal/UnTexture2.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnObject.h \ + Unreal/UnTextureNVTT.h \ + Unreal/UnTexturePNG.h \ + libs/astc/astc_codec_internals.h \ + libs/astc/mathlib.h \ + libs/astc/vectypes.h + +$(OUT_1)/UnTexture.obj : Unreal/UnTexture.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexture.obj" Unreal/UnTexture.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial3.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h + +$(OUT_1)/UnTexture3.obj : Unreal/UnTexture3.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexture3.obj" Unreal/UnTexture3.cpp + +$(OUT_1)/UnTexture4.obj : Unreal/UnTexture4.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexture4.obj" Unreal/UnTexture4.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h + +$(OUT_1)/TypeInfo.obj : Unreal/TypeInfo.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/TypeInfo.obj" Unreal/TypeInfo.cpp + +$(OUT_1)/UnUbisoft.obj : Unreal/UnUbisoft.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnUbisoft.obj" Unreal/UnUbisoft.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnPackageUE3Reader.h + +$(OUT_1)/UnPackageReader.obj : Unreal/UnPackageReader.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnPackageReader.obj" Unreal/UnPackageReader.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h + +$(OUT_1)/UnCore.obj : Unreal/UnCore.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnCore.obj" Unreal/UnCore.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h \ + Unreal/UnPackage.h + +$(OUT_1)/UnCoreSerialize.obj : Unreal/UnCoreSerialize.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnCoreSerialize.obj" Unreal/UnCoreSerialize.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h \ + libs/include/lzo/lzo1x.h \ + libs/include/lzo/lzoconf.h \ + libs/include/lzo/lzodefs.h \ + libs/lz4/lz4.h \ + libs/mspack/lzx.h \ + libs/mspack/mspack.h \ + libs/rijndael/rijndael.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h + +$(OUT_1)/UnCoreCompression.obj : Unreal/UnCoreCompression.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnCoreCompression.obj" Unreal/UnCoreCompression.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h \ + libs/libpng/png.h \ + libs/libpng/pngconf.h \ + libs/libpng/pnglibconf.h + +$(OUT_1)/UnTexturePNG.obj : Unreal/UnTexturePNG.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexturePNG.obj" Unreal/UnTexturePNG.cpp + +DEPENDS = \ + Core/Core.h \ + Core/Math3D.h \ + Core/TextContainer.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h + +$(OUT_1)/TextContainer.obj : Core/TextContainer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/TextContainer.obj" Core/TextContainer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/Math3D.h \ + UmodelTool/Build.h \ + UmodelTool/MiscStrings.h \ + UmodelTool/Version.h \ + Unreal/GameDefines.h + +$(OUT_1)/MiscStrings.obj : UmodelTool/MiscStrings.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MiscStrings.obj" UmodelTool/MiscStrings.cpp + +DEPENDS = \ + Core/Core.h \ + Core/Math3D.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h + +$(OUT_1)/Core.obj : Core/Core.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Core.obj" Core/Core.cpp + +$(OUT_1)/CoreWin32.obj : Core/CoreWin32.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/CoreWin32.obj" Core/CoreWin32.cpp + +$(OUT_1)/Math3D.obj : Core/Math3D.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Math3D.obj" Core/Math3D.cpp + +$(OUT_1)/Memory.obj : Core/Memory.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Memory.obj" Core/Memory.cpp + +$(OUT_1)/UnCoreDecrypt.obj : Unreal/UnCoreDecrypt.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnCoreDecrypt.obj" Unreal/UnCoreDecrypt.cpp + +DEPENDS = \ + Core/Core.h \ + Core/Math3D.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnTextureNVTT.h + +$(OUT_1)/UnTextureNVTT.obj : Unreal/UnTextureNVTT.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTextureNVTT.obj" Unreal/UnTextureNVTT.cpp + +DEPENDS = \ + UmodelTool/res/resource.h + +$(OUT_1)/umodel.res : UmodelTool/res/umodel.rc $(DEPENDS) + rc.exe -l 0x409 -i UmodelTool/res/ -i . -i ./Core -i ./Unreal -i ./libs/include -i ./libs -i ./libs/nvtt -i ./libs/PowerVR -i ./libs/detex -i ./libs/rijndael -i ./libs/includewin32 -i UmodelTool -i UI -d _USING_V110_SDK71_ -d _WIN64 -d WIN64 -fo"$(OUT_1)/umodel.res" -dNDEBUG UmodelTool/res/umodel.rc + +DEPENDS = \ + libs/PowerVR/PVRTDecompress.h \ + libs/PowerVR/PVRTGlobal.h \ + libs/PowerVR/PVRTTexture.h + +$(OUT)/PVRTDecompress.obj : ./libs/PowerVR/PVRTDecompress.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/PVRTDecompress.obj" ./libs/PowerVR/PVRTDecompress.cpp + +DEPENDS = \ + libs/astc/astc_codec_internals.h \ + libs/astc/mathlib.h \ + libs/astc/softfloat.h \ + libs/astc/vectypes.h + +$(OUT)/astc_color_unquantize.obj : ./libs/astc/astc_color_unquantize.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_color_unquantize.obj" ./libs/astc/astc_color_unquantize.cpp + +$(OUT)/astc_decompress_symbolic.obj : ./libs/astc/astc_decompress_symbolic.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_decompress_symbolic.obj" ./libs/astc/astc_decompress_symbolic.cpp + +$(OUT)/astc_image_load_store.obj : ./libs/astc/astc_image_load_store.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_image_load_store.obj" ./libs/astc/astc_image_load_store.cpp + +DEPENDS = \ + libs/astc/astc_codec_internals.h \ + libs/astc/mathlib.h \ + libs/astc/vectypes.h + +$(OUT)/astc_block_sizes2.obj : ./libs/astc/astc_block_sizes2.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_block_sizes2.obj" ./libs/astc/astc_block_sizes2.cpp + +$(OUT)/astc_integer_sequence.obj : ./libs/astc/astc_integer_sequence.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_integer_sequence.obj" ./libs/astc/astc_integer_sequence.cpp + +$(OUT)/astc_misc.obj : ./libs/astc/astc_misc.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_misc.obj" ./libs/astc/astc_misc.cpp + +$(OUT)/astc_partition_tables.obj : ./libs/astc/astc_partition_tables.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_partition_tables.obj" ./libs/astc/astc_partition_tables.cpp + +$(OUT)/astc_quantization.obj : ./libs/astc/astc_quantization.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_quantization.obj" ./libs/astc/astc_quantization.cpp + +$(OUT)/astc_symbolic_physical.obj : ./libs/astc/astc_symbolic_physical.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_symbolic_physical.obj" ./libs/astc/astc_symbolic_physical.cpp + +$(OUT)/astc_weight_quant_xfer_tables.obj : ./libs/astc/astc_weight_quant_xfer_tables.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_weight_quant_xfer_tables.obj" ./libs/astc/astc_weight_quant_xfer_tables.cpp + +DEPENDS = \ + libs/astc/softfloat.h + +$(OUT)/softfloat.obj : ./libs/astc/softfloat.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/softfloat.obj" ./libs/astc/softfloat.cpp + +DEPENDS = \ + libs/detex/bits.h \ + libs/detex/bptc-tables.h \ + libs/detex/detex.h + +$(OUT)/bptc-tables.obj : ./libs/detex/bptc-tables.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/bptc-tables.obj" ./libs/detex/bptc-tables.cpp + +$(OUT)/decompress-bptc-float.obj : ./libs/detex/decompress-bptc-float.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/decompress-bptc-float.obj" ./libs/detex/decompress-bptc-float.cpp + +$(OUT)/decompress-bptc.obj : ./libs/detex/decompress-bptc.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/decompress-bptc.obj" ./libs/detex/decompress-bptc.cpp + +DEPENDS = \ + libs/detex/bits.h \ + libs/detex/detex.h + +$(OUT)/bits.obj : ./libs/detex/bits.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/bits.obj" ./libs/detex/bits.cpp + +DEPENDS = \ + libs/detex/detex.h + +$(OUT)/clamp.obj : ./libs/detex/clamp.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/clamp.obj" ./libs/detex/clamp.cpp + +$(OUT)/decompress-eac.obj : ./libs/detex/decompress-eac.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/decompress-eac.obj" ./libs/detex/decompress-eac.cpp + +$(OUT)/decompress-etc.obj : ./libs/detex/decompress-etc.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/decompress-etc.obj" ./libs/detex/decompress-etc.cpp + +$(OUT)/misc.obj : ./libs/detex/misc.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/misc.obj" ./libs/detex/misc.cpp + +DEPENDS = \ + libs/detex/detex.h \ + libs/detex/file-info.h \ + libs/detex/misc.h + +$(OUT)/dds.obj : ./libs/detex/dds.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/dds.obj" ./libs/detex/dds.cpp + +$(OUT)/file-info.obj : ./libs/detex/file-info.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/file-info.obj" ./libs/detex/file-info.cpp + +DEPENDS = \ + libs/detex/detex.h \ + libs/detex/half-float.h + +$(OUT)/half-float.obj : ./libs/detex/half-float.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/half-float.obj" ./libs/detex/half-float.cpp + +DEPENDS = \ + libs/detex/detex.h \ + libs/detex/half-float.h \ + libs/detex/hdr.h \ + libs/detex/misc.h + +$(OUT)/convert.obj : ./libs/detex/convert.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/convert.obj" ./libs/detex/convert.cpp + +DEPENDS = \ + libs/detex/detex.h \ + libs/detex/misc.h + +$(OUT)/texture.obj : ./libs/detex/texture.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/texture.obj" ./libs/detex/texture.cpp + +OPT_UE3_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D DYNAMIC_CRC_TABLE -D BUILDFIXED -D NO_GZIP -I ./libs/include + +DEPENDS = \ + libs/include/lzo/lzo1x.h \ + libs/include/lzo/lzoconf.h \ + libs/include/lzo/lzodefs.h \ + libs/lzo/config1x.h \ + libs/lzo/lzo1_d.ch \ + libs/lzo/lzo1x_d.ch \ + libs/lzo/lzo_conf.h \ + libs/lzo/lzo_dict.h \ + libs/lzo/lzo_ptr.h \ + libs/lzo/miniacc.h + +$(OUT)/lzo1x_d2.obj : ./libs/lzo/lzo1x_d2.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/lzo1x_d2.obj" ./libs/lzo/lzo1x_d2.c + +DEPENDS = \ + libs/include/lzo/lzoconf.h \ + libs/include/lzo/lzodefs.h \ + libs/lzo/lzo_conf.h \ + libs/lzo/lzo_dll.ch \ + libs/lzo/lzo_ptr.h \ + libs/lzo/miniacc.h \ + libs/lzo/miniacc.h + +$(OUT)/lzo_init.obj : ./libs/lzo/lzo_init.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/lzo_init.obj" ./libs/lzo/lzo_init.c + +OPT_UE3_LIBS_2 = -GS- -GR- -O1 -EHs- -Z7 -D PNG_USER_CONFIG -I ./libs/include -I ./libs/zlib + +DEPENDS = \ + libs/libpng/png.h \ + libs/libpng/pngconf.h \ + libs/libpng/pngdebug.h \ + libs/libpng/pnginfo.h \ + libs/libpng/pnglibconf.h \ + libs/libpng/pngprefix.h \ + libs/libpng/pngpriv.h \ + libs/libpng/pngstruct.h \ + libs/libpng/pngusr.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h + +$(OUT)/png.obj : ./libs/libpng/png.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/png.obj" ./libs/libpng/png.c + +$(OUT)/pngerror.obj : ./libs/libpng/pngerror.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngerror.obj" ./libs/libpng/pngerror.c + +$(OUT)/pngget.obj : ./libs/libpng/pngget.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngget.obj" ./libs/libpng/pngget.c + +$(OUT)/pngmem.obj : ./libs/libpng/pngmem.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngmem.obj" ./libs/libpng/pngmem.c + +$(OUT)/pngpread.obj : ./libs/libpng/pngpread.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngpread.obj" ./libs/libpng/pngpread.c + +$(OUT)/pngread.obj : ./libs/libpng/pngread.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngread.obj" ./libs/libpng/pngread.c + +$(OUT)/pngrio.obj : ./libs/libpng/pngrio.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngrio.obj" ./libs/libpng/pngrio.c + +$(OUT)/pngrtran.obj : ./libs/libpng/pngrtran.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngrtran.obj" ./libs/libpng/pngrtran.c + +$(OUT)/pngrutil.obj : ./libs/libpng/pngrutil.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngrutil.obj" ./libs/libpng/pngrutil.c + +$(OUT)/pngset.obj : ./libs/libpng/pngset.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngset.obj" ./libs/libpng/pngset.c + +$(OUT)/pngtrans.obj : ./libs/libpng/pngtrans.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngtrans.obj" ./libs/libpng/pngtrans.c + +$(OUT)/pngwio.obj : ./libs/libpng/pngwio.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngwio.obj" ./libs/libpng/pngwio.c + +$(OUT)/pngwrite.obj : ./libs/libpng/pngwrite.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngwrite.obj" ./libs/libpng/pngwrite.c + +$(OUT)/pngwtran.obj : ./libs/libpng/pngwtran.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngwtran.obj" ./libs/libpng/pngwtran.c + +$(OUT)/pngwutil.obj : ./libs/libpng/pngwutil.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngwutil.obj" ./libs/libpng/pngwutil.c + +DEPENDS = \ + libs/lz4/lz4.h + +$(OUT)/lz4.obj : ./libs/lz4/lz4.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/lz4.obj" ./libs/lz4/lz4.c + +DEPENDS = \ + libs/mspack/lzx.h \ + libs/mspack/mspack.h \ + libs/mspack/readbits.h \ + libs/mspack/readhuff.h \ + libs/mspack/system.h + +$(OUT)/lzxd.obj : ./libs/mspack/lzxd.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/lzxd.obj" ./libs/mspack/lzxd.c + +DEPENDS = \ + libs/nvtt/nvimage/BlockDXT.h \ + libs/nvtt/nvimage/ColorBlock.h + +$(OUT)/BlockDXT.obj : ./libs/nvtt/nvimage/BlockDXT.cpp $(DEPENDS) + $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/BlockDXT.obj" ./libs/nvtt/nvimage/BlockDXT.cpp + +DEPENDS = \ + libs/rijndael/rijndael.h + +$(OUT)/rijndael.obj : ./libs/rijndael/rijndael.c $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/rijndael.obj" ./libs/rijndael/rijndael.c + +DEPENDS = \ + libs/zlib/crc32.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h \ + libs/zlib/zutil.h + +$(OUT)/crc32.obj : ./libs/zlib/crc32.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/crc32.obj" ./libs/zlib/crc32.c + +DEPENDS = \ + libs/zlib/inffast.h \ + libs/zlib/inffixed.h \ + libs/zlib/inflate.h \ + libs/zlib/inftrees.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h \ + libs/zlib/zutil.h + +$(OUT)/inflate.obj : ./libs/zlib/inflate.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/inflate.obj" ./libs/zlib/inflate.c + +DEPENDS = \ + libs/zlib/inffast.h \ + libs/zlib/inflate.h \ + libs/zlib/inftrees.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h \ + libs/zlib/zutil.h + +$(OUT)/inffast.obj : ./libs/zlib/inffast.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/inffast.obj" ./libs/zlib/inffast.c + +DEPENDS = \ + libs/zlib/inftrees.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h \ + libs/zlib/zutil.h + +$(OUT)/inftrees.obj : ./libs/zlib/inftrees.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/inftrees.obj" ./libs/zlib/inftrees.c + +DEPENDS = \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h + +$(OUT)/adler32.obj : ./libs/zlib/adler32.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/adler32.obj" ./libs/zlib/adler32.c + +$(OUT)/uncompr.obj : ./libs/zlib/uncompr.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/uncompr.obj" ./libs/zlib/uncompr.c + +#------------------------------------------------------------------------------ +# creating output directories +#------------------------------------------------------------------------------ + +$(OUT): + if not exist "$(OUT)" mkdir "$(OUT)" + +$(OUT_1): + if not exist "$(OUT_1)" mkdir "$(OUT_1)" + diff --git a/makefile-vc-win64-debug b/makefile-vc-win64-debug new file mode 100644 index 00000000..eacb07f6 --- /dev/null +++ b/makefile-vc-win64-debug @@ -0,0 +1,1761 @@ +# Makefile for VisualC/win64 target +# This file was automatically generated from "UmodelTool/umodel.project": do not edit + +#------------------------------------------------------------------------------ +# Compiler definitions +#------------------------------------------------------------------------------ + +CPP = cl.exe -nologo -c -D WIN32 -D _WINDOWS -D FBXSDK_SHARED -D MAX_DEBUG=1 +LINK = link.exe -nologo -filealign:512 -incremental:no -machine:X64 +AR = link.exe -lib -nologo + +#------------------------------------------------------------------------------ +# Directories +#------------------------------------------------------------------------------ + +OUT = ./obj/libs-win64 +OUT_1 = ./obj/umodel-win64 + +#------------------------------------------------------------------------------ +# symbolic targets +#------------------------------------------------------------------------------ + +ALL : MAIN +MAIN : umodel.exe + +#------------------------------------------------------------------------------ +# "umodel.exe" target +#------------------------------------------------------------------------------ + +MAIN_FILES = \ + $(OUT_1)/Export3D.obj \ + $(OUT_1)/Exporters.obj \ + $(OUT_1)/ExportMaterial.obj \ + $(OUT_1)/ExportMd5.obj \ + $(OUT_1)/ExportPsk.obj \ + $(OUT_1)/ExportFbx.obj \ + $(OUT_1)/ExportSound.obj \ + $(OUT_1)/ExportTexture.obj \ + $(OUT_1)/ExportThirdParty.obj \ + $(OUT_1)/GameDatabase.obj \ + $(OUT_1)/GameFileSystem.obj \ + $(OUT_1)/GameFileSystemGears4.obj \ + $(OUT_1)/MeshCommon.obj \ + $(OUT_1)/PackageUtils.obj \ + $(OUT_1)/SkeletalMesh.obj \ + $(OUT_1)/TypeInfo.obj \ + $(OUT_1)/UnAnim2.obj \ + $(OUT_1)/UnAnim3.obj \ + $(OUT_1)/UnAnim4.obj \ + $(OUT_1)/UnCore.obj \ + $(OUT_1)/UnCoreCompression.obj \ + $(OUT_1)/UnCoreDecrypt.obj \ + $(OUT_1)/UnCoreSerialize.obj \ + $(OUT_1)/UnHavok.obj \ + $(OUT_1)/UnMesh1.obj \ + $(OUT_1)/UnMesh2.obj \ + $(OUT_1)/UnMesh3.obj \ + $(OUT_1)/UnMesh4.obj \ + $(OUT_1)/UnMeshBatman.obj \ + $(OUT_1)/UnMeshBioshock.obj \ + $(OUT_1)/UnMeshRune.obj \ + $(OUT_1)/UnObject.obj \ + $(OUT_1)/UnPackage.obj \ + $(OUT_1)/UnPackageReader.obj \ + $(OUT_1)/UnRenderer.obj \ + $(OUT_1)/UnTexture.obj \ + $(OUT_1)/UnTexture2.obj \ + $(OUT_1)/UnTexture3.obj \ + $(OUT_1)/UnTexture4.obj \ + $(OUT_1)/UnTextureNVTT.obj \ + $(OUT_1)/UnTexturePNG.obj \ + $(OUT_1)/UnUbisoft.obj \ + $(OUT_1)/MaterialViewer.obj \ + $(OUT_1)/MeshViewer.obj \ + $(OUT_1)/ObjectViewer.obj \ + $(OUT_1)/SkelMeshViewer.obj \ + $(OUT_1)/StatMeshViewer.obj \ + $(OUT_1)/VertMeshViewer.obj \ + $(OUT_1)/MeshInstance.obj \ + $(OUT_1)/SkelMeshInstance.obj \ + $(OUT_1)/StatMeshInstance.obj \ + $(OUT_1)/VertMeshInstance.obj \ + $(OUT_1)/Core.obj \ + $(OUT_1)/CoreGL.obj \ + $(OUT_1)/CoreWin32.obj \ + $(OUT_1)/GLBind.obj \ + $(OUT_1)/GlWindow.obj \ + $(OUT_1)/Math3D.obj \ + $(OUT_1)/Memory.obj \ + $(OUT_1)/TextContainer.obj \ + $(OUT_1)/BaseDialog.obj \ + $(OUT_1)/FileControls.obj \ + $(OUT_1)/Main.obj \ + $(OUT_1)/MiscStrings.obj \ + $(OUT_1)/PackageDialog.obj \ + $(OUT_1)/PackageScanDialog.obj \ + $(OUT_1)/ProgressDialog.obj \ + $(OUT_1)/StartupDialog.obj \ + $(OUT_1)/UmodelApp.obj \ + $(OUT_1)/UmodelSettings.obj \ + $(OUT_1)/umodel.res + +NV_LIBS_FILES = \ + $(OUT)/BlockDXT.obj \ + $(OUT)/ColorBlock.obj \ + $(OUT)/DirectDrawSurface.obj \ + $(OUT)/Image.obj + +UE3_LIBS_FILES = \ + $(OUT)/lzo_init.obj \ + $(OUT)/lzo1x_d2.obj \ + $(OUT)/adler32.obj \ + $(OUT)/crc32.obj \ + $(OUT)/inffast.obj \ + $(OUT)/inflate.obj \ + $(OUT)/inftrees.obj \ + $(OUT)/uncompr.obj \ + $(OUT)/lzxd.obj \ + $(OUT)/lz4.obj \ + $(OUT)/png.obj \ + $(OUT)/pngerror.obj \ + $(OUT)/pngget.obj \ + $(OUT)/pngmem.obj \ + $(OUT)/pngpread.obj \ + $(OUT)/pngread.obj \ + $(OUT)/pngrio.obj \ + $(OUT)/pngrtran.obj \ + $(OUT)/pngrutil.obj \ + $(OUT)/pngset.obj \ + $(OUT)/pngtrans.obj \ + $(OUT)/pngwio.obj \ + $(OUT)/pngwrite.obj \ + $(OUT)/pngwtran.obj \ + $(OUT)/pngwutil.obj \ + $(OUT)/bits.obj \ + $(OUT)/bptc-tables.obj \ + $(OUT)/clamp.obj \ + $(OUT)/convert.obj \ + $(OUT)/dds.obj \ + $(OUT)/decompress-bptc-float.obj \ + $(OUT)/decompress-bptc.obj \ + $(OUT)/decompress-eac.obj \ + $(OUT)/decompress-etc.obj \ + $(OUT)/file-info.obj \ + $(OUT)/half-float.obj \ + $(OUT)/misc.obj \ + $(OUT)/texture.obj \ + $(OUT)/rijndael.obj + +MOBILE_LIBS_FILES = \ + $(OUT)/PVRTDecompress.obj \ + $(OUT)/astc_block_sizes2.obj \ + $(OUT)/astc_color_unquantize.obj \ + $(OUT)/astc_decompress_symbolic.obj \ + $(OUT)/astc_image_load_store.obj \ + $(OUT)/astc_integer_sequence.obj \ + $(OUT)/astc_misc.obj \ + $(OUT)/astc_partition_tables.obj \ + $(OUT)/astc_percentile_tables.obj \ + $(OUT)/astc_quantization.obj \ + $(OUT)/astc_symbolic_physical.obj \ + $(OUT)/astc_weight_quant_xfer_tables.obj \ + $(OUT)/softfloat.obj + +umodel.exe : $(OUT) $(OUT_1) $(MAIN_FILES) $(NV_LIBS_FILES) $(UE3_LIBS_FILES) $(MOBILE_LIBS_FILES) + echo Creating executable "umodel.exe" ... + $(LINK) -out:"umodel.exe" -libpath:./libs/SDL2/x64 -libpath:./libs/fbx/lib/vs2015/x64/release SDL2.lib libfbxsdk.lib -debug -pdb:"umodel.pdb" -opt:ref -opt:icf $(MAIN_FILES) $(NV_LIBS_FILES) $(UE3_LIBS_FILES) $(MOBILE_LIBS_FILES) -subsystem:console + +#------------------------------------------------------------------------------ +# compiling source files +#------------------------------------------------------------------------------ + +OPT_MOBILE_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ + +$(OUT)/astc_percentile_tables.obj : ./libs/astc/astc_percentile_tables.cpp + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_percentile_tables.obj" ./libs/astc/astc_percentile_tables.cpp + +OPT_NV_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ -I ./libs/nvtt + +$(OUT)/ColorBlock.obj : ./libs/nvtt/nvimage/ColorBlock.cpp + $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/ColorBlock.obj" ./libs/nvtt/nvimage/ColorBlock.cpp + +$(OUT)/DirectDrawSurface.obj : ./libs/nvtt/nvimage/DirectDrawSurface.cpp + $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/DirectDrawSurface.obj" ./libs/nvtt/nvimage/DirectDrawSurface.cpp + +$(OUT)/Image.obj : ./libs/nvtt/nvimage/Image.cpp + $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/Image.obj" ./libs/nvtt/nvimage/Image.cpp + +OPT_MAIN = -GS- -GR- -O1 -EHs- -Z7 -D _USING_V110_SDK71_ -I . -I ./Core -I ./Unreal -I ./libs/include -I ./libs -I ./libs/fbx/include -I ./libs/nvtt -I ./libs/PowerVR -I ./libs/detex -I ./libs/rijndael -I ./libs/includewin32 -I UmodelTool -I UI + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GLBindImpl.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h + +$(OUT_1)/GLBind.obj : Core/GLBind.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GLBind.obj" Core/GLBind.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlFont.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/TextContainer.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/Shaders.h + +$(OUT_1)/GlWindow.obj : Core/GlWindow.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GlWindow.obj" Core/GlWindow.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + MeshInstance/MeshInstance.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + UmodelTool/ProgressDialog.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/PackageUtils.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/SkelMeshViewer.obj : Viewers/SkelMeshViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/SkelMeshViewer.obj" Viewers/SkelMeshViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + UmodelTool/MiscStrings.h \ + UmodelTool/UmodelApp.h \ + UmodelTool/UmodelSettings.h \ + UmodelTool/Version.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/PackageUtils.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnAnimNotify.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMaterial3.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnSound.h \ + Unreal/UnThirdParty.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/Main.obj : UmodelTool/Main.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Main.obj" UmodelTool/Main.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/StaticMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/StatMeshViewer.obj : Viewers/StatMeshViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/StatMeshViewer.obj" Viewers/StatMeshViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/MeshViewer.obj : Viewers/MeshViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MeshViewer.obj" Viewers/MeshViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/SkelMeshInstance.obj : MeshInstance/SkelMeshInstance.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/SkelMeshInstance.obj" MeshInstance/SkelMeshInstance.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMaterial3.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/MaterialViewer.obj : Viewers/MaterialViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MaterialViewer.obj" Viewers/MaterialViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/VertMeshViewer.obj : Viewers/VertMeshViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/VertMeshViewer.obj" Viewers/VertMeshViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/AboutDialog.h \ + UmodelTool/Build.h \ + UmodelTool/ErrorDialog.h \ + UmodelTool/MiscStrings.h \ + UmodelTool/PackageDialog.h \ + UmodelTool/PackageScanDialog.h \ + UmodelTool/ProgressDialog.h \ + UmodelTool/StartupDialog.h \ + UmodelTool/UE4AesKeyDialog.h \ + UmodelTool/UE4VersionDialog.h \ + UmodelTool/UmodelApp.h \ + UmodelTool/UmodelSettings.h \ + UmodelTool/res/resource.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/UmodelApp.obj : UmodelTool/UmodelApp.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UmodelApp.obj" UmodelTool/UmodelApp.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h \ + Viewers/ObjectViewer.h + +$(OUT_1)/ObjectViewer.obj : Viewers/ObjectViewer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ObjectViewer.obj" Viewers/ObjectViewer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/MeshInstance.obj : MeshInstance/MeshInstance.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MeshInstance.obj" MeshInstance/MeshInstance.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/GlWindow.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/Shaders.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMaterial3.h \ + Unreal/UnObject.h + +$(OUT_1)/UnRenderer.obj : Unreal/UnRenderer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnRenderer.obj" Unreal/UnRenderer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + Exporters/Psk.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h + +$(OUT_1)/ExportPsk.obj : Exporters/ExportPsk.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportPsk.obj" Exporters/ExportPsk.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h + +$(OUT_1)/ExportFbx.obj : Exporters/ExportFbx.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportFbx.obj" Exporters/ExportFbx.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h + +$(OUT_1)/ExportMd5.obj : Exporters/ExportMd5.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportMd5.obj" Exporters/ExportMd5.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/StaticMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/StatMeshInstance.obj : MeshInstance/StatMeshInstance.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/StatMeshInstance.obj" MeshInstance/StatMeshInstance.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + MeshInstance/MeshInstance.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/VertMeshInstance.obj : MeshInstance/VertMeshInstance.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/VertMeshInstance.obj" MeshInstance/VertMeshInstance.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMesh2.obj : Unreal/UnMesh2.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMesh2.obj" Unreal/UnMesh2.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial3.h \ + Unreal/UnMathTools.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh3.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMesh3.obj : Unreal/UnMesh3.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMesh3.obj" Unreal/UnMesh3.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/StaticMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial3.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMesh4.obj : Unreal/UnMesh4.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMesh4.obj" Unreal/UnMesh4.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnAnim2.obj : Unreal/UnAnim2.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnAnim2.obj" Unreal/UnAnim2.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh3.h \ + Unreal/UnMesh4.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnAnim4.obj : Unreal/UnAnim4.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnAnim4.obj" Unreal/UnAnim4.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh3.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnAnim3.obj : Unreal/UnAnim3.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnAnim3.obj" Unreal/UnAnim3.cpp + +$(OUT_1)/UnMeshBatman.obj : Unreal/UnMeshBatman.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMeshBatman.obj" Unreal/UnMeshBatman.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/SkeletalMesh.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h + +$(OUT_1)/SkeletalMesh.obj : Unreal/SkeletalMesh.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/SkeletalMesh.obj" Unreal/SkeletalMesh.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnHavok.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnMeshTypes.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMeshBioshock.obj : Unreal/UnMeshBioshock.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMeshBioshock.obj" Unreal/UnMeshBioshock.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/MathSSE.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/MeshCommon.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMathTools.h \ + Unreal/UnObject.h + +$(OUT_1)/MeshCommon.obj : Unreal/MeshCommon.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MeshCommon.obj" Unreal/MeshCommon.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + UmodelTool/UmodelSettings.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h + +$(OUT_1)/UmodelSettings.obj : UmodelTool/UmodelSettings.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UmodelSettings.obj" UmodelTool/UmodelSettings.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial3.h \ + Unreal/UnObject.h \ + Unreal/UnTextureNVTT.h + +$(OUT_1)/ExportTexture.obj : Exporters/ExportTexture.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportTexture.obj" Exporters/ExportTexture.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h + +$(OUT_1)/ExportMaterial.obj : Exporters/ExportMaterial.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportMaterial.obj" Exporters/ExportMaterial.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h + +$(OUT_1)/Export3D.obj : Exporters/Export3D.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Export3D.obj" Exporters/Export3D.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h + +$(OUT_1)/Exporters.obj : Exporters/Exporters.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Exporters.obj" Exporters/Exporters.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnSound.h + +$(OUT_1)/ExportSound.obj : Exporters/ExportSound.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportSound.obj" Exporters/ExportSound.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + Exporters/Exporters.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnThirdParty.h + +$(OUT_1)/ExportThirdParty.obj : Exporters/ExportThirdParty.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ExportThirdParty.obj" Exporters/ExportThirdParty.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/FileControls.h \ + UI/callback.h \ + UmodelTool/Build.h \ + UmodelTool/StartupDialog.h \ + UmodelTool/UmodelSettings.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h + +$(OUT_1)/StartupDialog.obj : UmodelTool/StartupDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/StartupDialog.obj" UmodelTool/StartupDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/FileControls.h \ + UI/callback.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h + +$(OUT_1)/FileControls.obj : UI/FileControls.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/FileControls.obj" UI/FileControls.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/AboutDialog.h \ + UmodelTool/Build.h \ + UmodelTool/MiscStrings.h \ + UmodelTool/PackageDialog.h \ + UmodelTool/PackageScanDialog.h \ + UmodelTool/ProgressDialog.h \ + UmodelTool/res/resource.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/UnCore.h \ + Unreal/UnPackage.h + +$(OUT_1)/PackageDialog.obj : UmodelTool/PackageDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/PackageDialog.obj" UmodelTool/PackageDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + UmodelTool/ProgressDialog.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h + +$(OUT_1)/ProgressDialog.obj : UmodelTool/ProgressDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/ProgressDialog.obj" UmodelTool/ProgressDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + UmodelTool/ProgressDialog.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/UnCore.h + +$(OUT_1)/PackageScanDialog.obj : UmodelTool/PackageScanDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/PackageScanDialog.obj" UmodelTool/PackageScanDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UI/BaseDialog.h \ + UI/callback.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h + +$(OUT_1)/BaseDialog.obj : UI/BaseDialog.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/BaseDialog.obj" UI/BaseDialog.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h + +$(OUT_1)/UnObject.obj : Unreal/UnObject.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnObject.obj" Unreal/UnObject.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnPackageUE3Reader.h + +$(OUT_1)/UnPackage.obj : Unreal/UnPackage.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnPackage.obj" Unreal/UnPackage.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDatabase.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h + +$(OUT_1)/GameDatabase.obj : Unreal/GameDatabase.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GameDatabase.obj" Unreal/GameDatabase.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h + +$(OUT_1)/CoreGL.obj : Core/CoreGL.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/CoreGL.obj" Core/CoreGL.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/GameFileSystem.h \ + Unreal/UnArchiveObb.h \ + Unreal/UnArchivePak.h \ + Unreal/UnCore.h + +$(OUT_1)/GameFileSystem.obj : Unreal/GameFileSystem.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GameFileSystem.obj" Unreal/GameFileSystem.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/GameFileSystem.h \ + Unreal/UnCore.h + +$(OUT_1)/GameFileSystemGears4.obj : Unreal/GameFileSystemGears4.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/GameFileSystemGears4.obj" Unreal/GameFileSystemGears4.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/PackageUtils.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h + +$(OUT_1)/PackageUtils.obj : Unreal/PackageUtils.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/PackageUtils.obj" Unreal/PackageUtils.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeConvert.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMeshRune.obj : Unreal/UnMeshRune.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMeshRune.obj" Unreal/UnMeshRune.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnHavok.h \ + Unreal/UnMaterial.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnHavok.obj : Unreal/UnHavok.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnHavok.obj" Unreal/UnHavok.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnMesh.h \ + Unreal/UnMesh2.h \ + Unreal/UnObject.h \ + Unreal/UnrealClasses.h + +$(OUT_1)/UnMesh1.obj : Unreal/UnMesh1.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnMesh1.obj" Unreal/UnMesh1.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnObject.h + +$(OUT_1)/UnTexture2.obj : Unreal/UnTexture2.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexture2.obj" Unreal/UnTexture2.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial2.h \ + Unreal/UnObject.h \ + Unreal/UnTextureNVTT.h \ + Unreal/UnTexturePNG.h \ + libs/astc/astc_codec_internals.h \ + libs/astc/mathlib.h \ + libs/astc/vectypes.h + +$(OUT_1)/UnTexture.obj : Unreal/UnTexture.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexture.obj" Unreal/UnTexture.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnMaterial.h \ + Unreal/UnMaterial3.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h + +$(OUT_1)/UnTexture3.obj : Unreal/UnTexture3.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexture3.obj" Unreal/UnTexture3.cpp + +$(OUT_1)/UnTexture4.obj : Unreal/UnTexture4.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexture4.obj" Unreal/UnTexture4.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h + +$(OUT_1)/TypeInfo.obj : Unreal/TypeInfo.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/TypeInfo.obj" Unreal/TypeInfo.cpp + +$(OUT_1)/UnUbisoft.obj : Unreal/UnUbisoft.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnUbisoft.obj" Unreal/UnUbisoft.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/TypeInfo.h \ + Unreal/UnCore.h \ + Unreal/UnObject.h \ + Unreal/UnPackage.h \ + Unreal/UnPackageUE3Reader.h + +$(OUT_1)/UnPackageReader.obj : Unreal/UnPackageReader.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnPackageReader.obj" Unreal/UnPackageReader.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h + +$(OUT_1)/UnCore.obj : Unreal/UnCore.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnCore.obj" Unreal/UnCore.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h \ + Unreal/UnPackage.h + +$(OUT_1)/UnCoreSerialize.obj : Unreal/UnCoreSerialize.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnCoreSerialize.obj" Unreal/UnCoreSerialize.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h \ + libs/include/lzo/lzo1x.h \ + libs/include/lzo/lzoconf.h \ + libs/include/lzo/lzodefs.h \ + libs/lz4/lz4.h \ + libs/mspack/lzx.h \ + libs/mspack/mspack.h \ + libs/rijndael/rijndael.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h + +$(OUT_1)/UnCoreCompression.obj : Unreal/UnCoreCompression.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnCoreCompression.obj" Unreal/UnCoreCompression.cpp + +DEPENDS = \ + Core/Core.h \ + Core/CoreGL.h \ + Core/GLBind.h \ + Core/Math3D.h \ + Core/Win32Types.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnCore.h \ + libs/libpng/png.h \ + libs/libpng/pngconf.h \ + libs/libpng/pnglibconf.h + +$(OUT_1)/UnTexturePNG.obj : Unreal/UnTexturePNG.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTexturePNG.obj" Unreal/UnTexturePNG.cpp + +DEPENDS = \ + Core/Core.h \ + Core/Math3D.h \ + Core/TextContainer.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h + +$(OUT_1)/TextContainer.obj : Core/TextContainer.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/TextContainer.obj" Core/TextContainer.cpp + +DEPENDS = \ + Core/Core.h \ + Core/Math3D.h \ + UmodelTool/Build.h \ + UmodelTool/MiscStrings.h \ + UmodelTool/Version.h \ + Unreal/GameDefines.h + +$(OUT_1)/MiscStrings.obj : UmodelTool/MiscStrings.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/MiscStrings.obj" UmodelTool/MiscStrings.cpp + +DEPENDS = \ + Core/Core.h \ + Core/Math3D.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h + +$(OUT_1)/Core.obj : Core/Core.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Core.obj" Core/Core.cpp + +$(OUT_1)/CoreWin32.obj : Core/CoreWin32.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/CoreWin32.obj" Core/CoreWin32.cpp + +$(OUT_1)/Math3D.obj : Core/Math3D.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Math3D.obj" Core/Math3D.cpp + +$(OUT_1)/Memory.obj : Core/Memory.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/Memory.obj" Core/Memory.cpp + +$(OUT_1)/UnCoreDecrypt.obj : Unreal/UnCoreDecrypt.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnCoreDecrypt.obj" Unreal/UnCoreDecrypt.cpp + +DEPENDS = \ + Core/Core.h \ + Core/Math3D.h \ + UmodelTool/Build.h \ + Unreal/GameDefines.h \ + Unreal/UnTextureNVTT.h + +$(OUT_1)/UnTextureNVTT.obj : Unreal/UnTextureNVTT.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MAIN) -Fo"$(OUT_1)/UnTextureNVTT.obj" Unreal/UnTextureNVTT.cpp + +DEPENDS = \ + UmodelTool/res/resource.h + +$(OUT_1)/umodel.res : UmodelTool/res/umodel.rc $(DEPENDS) + rc.exe -l 0x409 -i UmodelTool/res/ -i . -i ./Core -i ./Unreal -i ./libs/include -i ./libs -i ./libs/nvtt -i ./libs/PowerVR -i ./libs/detex -i ./libs/rijndael -i ./libs/includewin32 -i UmodelTool -i UI -d _USING_V110_SDK71_ -d _WIN64 -d WIN64 -fo"$(OUT_1)/umodel.res" -dNDEBUG UmodelTool/res/umodel.rc + +DEPENDS = \ + libs/PowerVR/PVRTDecompress.h \ + libs/PowerVR/PVRTGlobal.h \ + libs/PowerVR/PVRTTexture.h + +$(OUT)/PVRTDecompress.obj : ./libs/PowerVR/PVRTDecompress.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/PVRTDecompress.obj" ./libs/PowerVR/PVRTDecompress.cpp + +DEPENDS = \ + libs/astc/astc_codec_internals.h \ + libs/astc/mathlib.h \ + libs/astc/softfloat.h \ + libs/astc/vectypes.h + +$(OUT)/astc_color_unquantize.obj : ./libs/astc/astc_color_unquantize.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_color_unquantize.obj" ./libs/astc/astc_color_unquantize.cpp + +$(OUT)/astc_decompress_symbolic.obj : ./libs/astc/astc_decompress_symbolic.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_decompress_symbolic.obj" ./libs/astc/astc_decompress_symbolic.cpp + +$(OUT)/astc_image_load_store.obj : ./libs/astc/astc_image_load_store.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_image_load_store.obj" ./libs/astc/astc_image_load_store.cpp + +DEPENDS = \ + libs/astc/astc_codec_internals.h \ + libs/astc/mathlib.h \ + libs/astc/vectypes.h + +$(OUT)/astc_block_sizes2.obj : ./libs/astc/astc_block_sizes2.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_block_sizes2.obj" ./libs/astc/astc_block_sizes2.cpp + +$(OUT)/astc_integer_sequence.obj : ./libs/astc/astc_integer_sequence.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_integer_sequence.obj" ./libs/astc/astc_integer_sequence.cpp + +$(OUT)/astc_misc.obj : ./libs/astc/astc_misc.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_misc.obj" ./libs/astc/astc_misc.cpp + +$(OUT)/astc_partition_tables.obj : ./libs/astc/astc_partition_tables.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_partition_tables.obj" ./libs/astc/astc_partition_tables.cpp + +$(OUT)/astc_quantization.obj : ./libs/astc/astc_quantization.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_quantization.obj" ./libs/astc/astc_quantization.cpp + +$(OUT)/astc_symbolic_physical.obj : ./libs/astc/astc_symbolic_physical.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_symbolic_physical.obj" ./libs/astc/astc_symbolic_physical.cpp + +$(OUT)/astc_weight_quant_xfer_tables.obj : ./libs/astc/astc_weight_quant_xfer_tables.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/astc_weight_quant_xfer_tables.obj" ./libs/astc/astc_weight_quant_xfer_tables.cpp + +DEPENDS = \ + libs/astc/softfloat.h + +$(OUT)/softfloat.obj : ./libs/astc/softfloat.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/softfloat.obj" ./libs/astc/softfloat.cpp + +DEPENDS = \ + libs/detex/bits.h \ + libs/detex/bptc-tables.h \ + libs/detex/detex.h + +$(OUT)/bptc-tables.obj : ./libs/detex/bptc-tables.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/bptc-tables.obj" ./libs/detex/bptc-tables.cpp + +$(OUT)/decompress-bptc-float.obj : ./libs/detex/decompress-bptc-float.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/decompress-bptc-float.obj" ./libs/detex/decompress-bptc-float.cpp + +$(OUT)/decompress-bptc.obj : ./libs/detex/decompress-bptc.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/decompress-bptc.obj" ./libs/detex/decompress-bptc.cpp + +DEPENDS = \ + libs/detex/bits.h \ + libs/detex/detex.h + +$(OUT)/bits.obj : ./libs/detex/bits.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/bits.obj" ./libs/detex/bits.cpp + +DEPENDS = \ + libs/detex/detex.h + +$(OUT)/clamp.obj : ./libs/detex/clamp.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/clamp.obj" ./libs/detex/clamp.cpp + +$(OUT)/decompress-eac.obj : ./libs/detex/decompress-eac.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/decompress-eac.obj" ./libs/detex/decompress-eac.cpp + +$(OUT)/decompress-etc.obj : ./libs/detex/decompress-etc.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/decompress-etc.obj" ./libs/detex/decompress-etc.cpp + +$(OUT)/misc.obj : ./libs/detex/misc.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/misc.obj" ./libs/detex/misc.cpp + +DEPENDS = \ + libs/detex/detex.h \ + libs/detex/file-info.h \ + libs/detex/misc.h + +$(OUT)/dds.obj : ./libs/detex/dds.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/dds.obj" ./libs/detex/dds.cpp + +$(OUT)/file-info.obj : ./libs/detex/file-info.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/file-info.obj" ./libs/detex/file-info.cpp + +DEPENDS = \ + libs/detex/detex.h \ + libs/detex/half-float.h + +$(OUT)/half-float.obj : ./libs/detex/half-float.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/half-float.obj" ./libs/detex/half-float.cpp + +DEPENDS = \ + libs/detex/detex.h \ + libs/detex/half-float.h \ + libs/detex/hdr.h \ + libs/detex/misc.h + +$(OUT)/convert.obj : ./libs/detex/convert.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/convert.obj" ./libs/detex/convert.cpp + +DEPENDS = \ + libs/detex/detex.h \ + libs/detex/misc.h + +$(OUT)/texture.obj : ./libs/detex/texture.cpp $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/texture.obj" ./libs/detex/texture.cpp + +OPT_UE3_LIBS = -GS- -GR- -O1 -EHs- -Z7 -D DYNAMIC_CRC_TABLE -D BUILDFIXED -D NO_GZIP -I ./libs/include + +DEPENDS = \ + libs/include/lzo/lzo1x.h \ + libs/include/lzo/lzoconf.h \ + libs/include/lzo/lzodefs.h \ + libs/lzo/config1x.h \ + libs/lzo/lzo1_d.ch \ + libs/lzo/lzo1x_d.ch \ + libs/lzo/lzo_conf.h \ + libs/lzo/lzo_dict.h \ + libs/lzo/lzo_ptr.h \ + libs/lzo/miniacc.h + +$(OUT)/lzo1x_d2.obj : ./libs/lzo/lzo1x_d2.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/lzo1x_d2.obj" ./libs/lzo/lzo1x_d2.c + +DEPENDS = \ + libs/include/lzo/lzoconf.h \ + libs/include/lzo/lzodefs.h \ + libs/lzo/lzo_conf.h \ + libs/lzo/lzo_dll.ch \ + libs/lzo/lzo_ptr.h \ + libs/lzo/miniacc.h \ + libs/lzo/miniacc.h + +$(OUT)/lzo_init.obj : ./libs/lzo/lzo_init.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/lzo_init.obj" ./libs/lzo/lzo_init.c + +OPT_UE3_LIBS_2 = -GS- -GR- -O1 -EHs- -Z7 -D PNG_USER_CONFIG -I ./libs/include -I ./libs/zlib + +DEPENDS = \ + libs/libpng/png.h \ + libs/libpng/pngconf.h \ + libs/libpng/pngdebug.h \ + libs/libpng/pnginfo.h \ + libs/libpng/pnglibconf.h \ + libs/libpng/pngprefix.h \ + libs/libpng/pngpriv.h \ + libs/libpng/pngstruct.h \ + libs/libpng/pngusr.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h + +$(OUT)/png.obj : ./libs/libpng/png.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/png.obj" ./libs/libpng/png.c + +$(OUT)/pngerror.obj : ./libs/libpng/pngerror.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngerror.obj" ./libs/libpng/pngerror.c + +$(OUT)/pngget.obj : ./libs/libpng/pngget.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngget.obj" ./libs/libpng/pngget.c + +$(OUT)/pngmem.obj : ./libs/libpng/pngmem.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngmem.obj" ./libs/libpng/pngmem.c + +$(OUT)/pngpread.obj : ./libs/libpng/pngpread.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngpread.obj" ./libs/libpng/pngpread.c + +$(OUT)/pngread.obj : ./libs/libpng/pngread.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngread.obj" ./libs/libpng/pngread.c + +$(OUT)/pngrio.obj : ./libs/libpng/pngrio.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngrio.obj" ./libs/libpng/pngrio.c + +$(OUT)/pngrtran.obj : ./libs/libpng/pngrtran.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngrtran.obj" ./libs/libpng/pngrtran.c + +$(OUT)/pngrutil.obj : ./libs/libpng/pngrutil.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngrutil.obj" ./libs/libpng/pngrutil.c + +$(OUT)/pngset.obj : ./libs/libpng/pngset.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngset.obj" ./libs/libpng/pngset.c + +$(OUT)/pngtrans.obj : ./libs/libpng/pngtrans.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngtrans.obj" ./libs/libpng/pngtrans.c + +$(OUT)/pngwio.obj : ./libs/libpng/pngwio.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngwio.obj" ./libs/libpng/pngwio.c + +$(OUT)/pngwrite.obj : ./libs/libpng/pngwrite.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngwrite.obj" ./libs/libpng/pngwrite.c + +$(OUT)/pngwtran.obj : ./libs/libpng/pngwtran.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngwtran.obj" ./libs/libpng/pngwtran.c + +$(OUT)/pngwutil.obj : ./libs/libpng/pngwutil.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS_2) -Fo"$(OUT)/pngwutil.obj" ./libs/libpng/pngwutil.c + +DEPENDS = \ + libs/lz4/lz4.h + +$(OUT)/lz4.obj : ./libs/lz4/lz4.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/lz4.obj" ./libs/lz4/lz4.c + +DEPENDS = \ + libs/mspack/lzx.h \ + libs/mspack/mspack.h \ + libs/mspack/readbits.h \ + libs/mspack/readhuff.h \ + libs/mspack/system.h + +$(OUT)/lzxd.obj : ./libs/mspack/lzxd.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/lzxd.obj" ./libs/mspack/lzxd.c + +DEPENDS = \ + libs/nvtt/nvimage/BlockDXT.h \ + libs/nvtt/nvimage/ColorBlock.h + +$(OUT)/BlockDXT.obj : ./libs/nvtt/nvimage/BlockDXT.cpp $(DEPENDS) + $(CPP) -MD $(OPT_NV_LIBS) -Fo"$(OUT)/BlockDXT.obj" ./libs/nvtt/nvimage/BlockDXT.cpp + +DEPENDS = \ + libs/rijndael/rijndael.h + +$(OUT)/rijndael.obj : ./libs/rijndael/rijndael.c $(DEPENDS) + $(CPP) -MD $(OPT_MOBILE_LIBS) -Fo"$(OUT)/rijndael.obj" ./libs/rijndael/rijndael.c + +DEPENDS = \ + libs/zlib/crc32.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h \ + libs/zlib/zutil.h + +$(OUT)/crc32.obj : ./libs/zlib/crc32.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/crc32.obj" ./libs/zlib/crc32.c + +DEPENDS = \ + libs/zlib/inffast.h \ + libs/zlib/inffixed.h \ + libs/zlib/inflate.h \ + libs/zlib/inftrees.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h \ + libs/zlib/zutil.h + +$(OUT)/inflate.obj : ./libs/zlib/inflate.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/inflate.obj" ./libs/zlib/inflate.c + +DEPENDS = \ + libs/zlib/inffast.h \ + libs/zlib/inflate.h \ + libs/zlib/inftrees.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h \ + libs/zlib/zutil.h + +$(OUT)/inffast.obj : ./libs/zlib/inffast.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/inffast.obj" ./libs/zlib/inffast.c + +DEPENDS = \ + libs/zlib/inftrees.h \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h \ + libs/zlib/zutil.h + +$(OUT)/inftrees.obj : ./libs/zlib/inftrees.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/inftrees.obj" ./libs/zlib/inftrees.c + +DEPENDS = \ + libs/zlib/zconf.h \ + libs/zlib/zlib.h + +$(OUT)/adler32.obj : ./libs/zlib/adler32.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/adler32.obj" ./libs/zlib/adler32.c + +$(OUT)/uncompr.obj : ./libs/zlib/uncompr.c $(DEPENDS) + $(CPP) -MD $(OPT_UE3_LIBS) -Fo"$(OUT)/uncompr.obj" ./libs/zlib/uncompr.c + +#------------------------------------------------------------------------------ +# creating output directories +#------------------------------------------------------------------------------ + +$(OUT): + if not exist "$(OUT)" mkdir "$(OUT)" + +$(OUT_1): + if not exist "$(OUT_1)" mkdir "$(OUT_1)" + diff --git a/umodel.exe b/umodel.exe index 23317e7e..3e786c37 100644 Binary files a/umodel.exe and b/umodel.exe differ diff --git a/umodel.sln b/umodel.sln new file mode 100644 index 00000000..7ad2864e --- /dev/null +++ b/umodel.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "umodel", "umodel.vcxproj", "{47B5DBF5-B0B0-4AB7-9A45-3721E37186A6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {47B5DBF5-B0B0-4AB7-9A45-3721E37186A6}.Debug|Win32.ActiveCfg = Debug|Win32 + {47B5DBF5-B0B0-4AB7-9A45-3721E37186A6}.Debug|Win32.Build.0 = Debug|Win32 + {47B5DBF5-B0B0-4AB7-9A45-3721E37186A6}.Debug|x64.ActiveCfg = Debug|x64 + {47B5DBF5-B0B0-4AB7-9A45-3721E37186A6}.Debug|x64.Build.0 = Debug|x64 + {47B5DBF5-B0B0-4AB7-9A45-3721E37186A6}.Release|Win32.ActiveCfg = Release|Win32 + {47B5DBF5-B0B0-4AB7-9A45-3721E37186A6}.Release|Win32.Build.0 = Release|Win32 + {47B5DBF5-B0B0-4AB7-9A45-3721E37186A6}.Release|x64.ActiveCfg = Release|x64 + {47B5DBF5-B0B0-4AB7-9A45-3721E37186A6}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/umodel.vcxproj b/umodel.vcxproj new file mode 100644 index 00000000..7224d4b7 --- /dev/null +++ b/umodel.vcxproj @@ -0,0 +1,228 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {47B5DBF5-B0B0-4AB7-9A45-3721E37186A6} + MakeFileProj + + + + Makefile + true + v140 + + + Makefile + false + v140 + + + Makefile + true + v140 + + + Makefile + false + v140 + + + + + + + + + + + + + + + + + + + + + umodel.exe + WIN32;_DEBUG;$(NMakePreprocessorDefinitions) + nmake.exe makefile-vc-win32 + + + umodel.exe + WIN32;NDEBUG;$(NMakePreprocessorDefinitions) + nmake.exe makefile-vc-win32 + + + nmake.exe makefile-vc-win64-debug + $(SolutionDir) + + + nmake.exe makefile-vc-win64 + $(SolutionDir) + + + + + + + \ No newline at end of file diff --git a/umodel.vcxproj.filters b/umodel.vcxproj.filters new file mode 100644 index 00000000..287b4b30 --- /dev/null +++ b/umodel.vcxproj.filters @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/umodel.vcxproj.user b/umodel.vcxproj.user new file mode 100644 index 00000000..a11cd7f9 --- /dev/null +++ b/umodel.vcxproj.user @@ -0,0 +1,6 @@ + + + + true + + \ No newline at end of file