Browse Source

Fix some bugs in the GLTF importer

Panagiotis Christopoulos Charitos 2 years ago
parent
commit
4edb404342

+ 1 - 1
AnKi/Importer/GltfImporterAnimation.cpp

@@ -161,7 +161,7 @@ Error GltfImporter::writeAnimation(const cgltf_animation& anim)
 	}
 	}
 
 
 	// Gather the keys
 	// Gather the keys
-	ImporterDynamicArray<GltfAnimChannel> tempChannels;
+	ImporterDynamicArray<GltfAnimChannel> tempChannels(m_pool);
 	tempChannels.resize(channelCount, m_pool);
 	tempChannels.resize(channelCount, m_pool);
 	channelCount = 0;
 	channelCount = 0;
 	for(auto it = channelMap.getBegin(); it != channelMap.getEnd(); ++it)
 	for(auto it = channelMap.getBegin(); it != channelMap.getEnd(); ++it)

+ 1 - 1
Samples/SkeletalAnimation/Assets/Scene.lua

@@ -1,4 +1,4 @@
--- Generated by: C:\src\anki\out\build\x64-Release\Bin\GltfImporter.exe droid.gltf C:/src/anki/Samples/SkeletalAnimation/Assets/ -rpath Assets -texrpath Assets -v
+-- Generated by: C:\src\anki\out\build\x64-Debug\Binaries\GltfImporter.exe E:/etc/blender/characters/animated_droid/gltf/droid.gltf C:/src/anki/Samples/SkeletalAnimation/Assets/ -rpath Assets -texrpath Assets -v -import-textures 1
 local scene = getSceneGraph()
 local scene = getSceneGraph()
 local events = getEventManager()
 local events = getEventManager()
 
 

+ 4 - 4
Tools/GltfImporter/Main.cpp

@@ -7,7 +7,7 @@
 
 
 using namespace anki;
 using namespace anki;
 
 
-static const char* USAGE = R"(Usage: %s in_file out_dir [options]
+static constexpr char* kUsage = R"(Usage: %s in_file out_dir [options]
 Options:
 Options:
 -rpath <string>            : Replace all absolute paths of assets with that path
 -rpath <string>            : Replace all absolute paths of assets with that path
 -texrpath <string>         : Same as rpath but for textures
 -texrpath <string>         : Same as rpath but for textures
@@ -17,7 +17,7 @@ Options:
 -lod-count <1|2|3>         : The number of geometry LODs to generate. Default is 1
 -lod-count <1|2|3>         : The number of geometry LODs to generate. Default is 1
 -lod-factor <float>        : The decimate factor for each LOD. Default 0.25
 -lod-factor <float>        : The decimate factor for each LOD. Default 0.25
 -light-scale <float>       : Multiply the light intensity with this number. Default is 1.0
 -light-scale <float>       : Multiply the light intensity with this number. Default is 1.0
--import-testures <0|1>     : Import textures. Default is 0
+-import-textures <0|1>     : Import textures. Default is 0
 -v                         : Enable verbose log
 -v                         : Enable verbose log
 )";
 )";
 
 
@@ -227,14 +227,14 @@ int myMain(int argc, char** argv)
 		{
 		{
 			DefaultMemoryPool::freeSingleton();
 			DefaultMemoryPool::freeSingleton();
 		}
 		}
-	};
+	} cleanup;
 
 
 	DefaultMemoryPool::allocateSingleton(allocAligned, nullptr);
 	DefaultMemoryPool::allocateSingleton(allocAligned, nullptr);
 
 
 	CmdLineArgs cmdArgs;
 	CmdLineArgs cmdArgs;
 	if(parseCommandLineArgs(argc, argv, cmdArgs))
 	if(parseCommandLineArgs(argc, argv, cmdArgs))
 	{
 	{
-		ANKI_IMPORTER_LOGE(USAGE, argv[0]);
+		ANKI_IMPORTER_LOGE(kUsage, argv[0]);
 		return 1;
 		return 1;
 	}
 	}