Ver código fonte

Updated the encoder to always write material names in the GPB file
Material names will now be written in the GPB even if "-m" is not passed as an argument.
The purpose of this change is that people could use "-m" to create their initial material file but then later update their GPB file without needing to overwrite their material file.

Darryl Gough 12 anos atrás
pai
commit
0e8642b35a
1 arquivos alterados com 12 adições e 6 exclusões
  1. 12 6
      tools/encoder/src/FBXSceneEncoder.cpp

+ 12 - 6
tools/encoder/src/FBXSceneEncoder.cpp

@@ -61,11 +61,8 @@ void FBXSceneEncoder::write(const string& filepath, const EncoderArguments& argu
 
     print("Loading Scene.");
     loadScene(fbxScene);
-    if (arguments.outputMaterialEnabled())
-    {
-        print("Load materials");
-        loadMaterials(fbxScene);
-    }
+    print("Load materials");
+    loadMaterials(fbxScene);
     print("Loading animations.");
     loadAnimations(fbxScene, arguments);
     sdkManager->Destroy();
@@ -934,7 +931,16 @@ void FBXSceneEncoder::loadMaterial(FbxNode* fbxNode)
         }
         else
         {
-            material = createMaterial(materialName, fbxMaterial, node);
+            if (EncoderArguments::getInstance()->outputMaterialEnabled())
+            {
+                material = createMaterial(materialName, fbxMaterial, node);
+            }
+            else
+            {
+                // If outputMaterialEnabled() is not enabled then only create the materials for the purpose of writing 
+                // the material name in the GPB file. There is no need to load uniforms and samplers for the material.
+                material = new Material(materialName);
+            }
             _materials[materialName] = material;
         }