浏览代码

Merge pull request #101275 from aaronfranke/gltf-target-names-unused

GLTF: Don't write unused `"targetNames"` on meshes
Rémi Verschelde 5 月之前
父节点
当前提交
0db55e7e2e
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      modules/gltf/gltf_document.cpp

+ 5 - 3
modules/gltf/gltf_document.cpp

@@ -3193,9 +3193,11 @@ Error GLTFDocument::_serialize_meshes(Ref<GLTFState> p_state) {
 			primitives.push_back(primitive);
 		}
 
-		Dictionary e;
-		e["targetNames"] = target_names;
-		gltf_mesh["extras"] = e;
+		if (!target_names.is_empty()) {
+			Dictionary e;
+			e["targetNames"] = target_names;
+			gltf_mesh["extras"] = e;
+		}
 		_attach_meta_to_extras(import_mesh, gltf_mesh);
 
 		weights.resize(target_names.size());