From 98e9ace3ef706e6966d5a16f7265686f8c451d9b Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Wed, 8 Jan 2025 01:02:14 -0800 Subject: [PATCH] GLTF: Don't write unused targetNames on meshes --- modules/gltf/gltf_document.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 4c999c07e12..c8eaaa0b698 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -3193,9 +3193,11 @@ Error GLTFDocument::_serialize_meshes(Ref 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());