Import/export GLTF extras to node->meta

This is useful for custom tagging of objects with properties (for example in Blender) and having this available in the editor for scripting.

- Adds import logic to propagate the parsed GLTF extras all the way to the resulting Node->meta
- Adds export logic to save Godot Object meta into GLTF extras
- Supports `nodes`, `meshes` and `materials` (in GLTF sense of the words)
This commit is contained in:
demolke
2024-01-11 20:47:31 +01:00
parent fd7239cfab
commit c409e6d722
7 changed files with 253 additions and 7 deletions

View File

@@ -1023,6 +1023,14 @@ void Object::remove_meta(const StringName &p_name) {
set_meta(p_name, Variant());
}
void Object::merge_meta_from(const Object *p_src) {
List<StringName> meta_keys;
p_src->get_meta_list(&meta_keys);
for (const StringName &key : meta_keys) {
set_meta(key, p_src->get_meta(key));
}
}
TypedArray<Dictionary> Object::_get_property_list_bind() const {
List<PropertyInfo> lpi;
get_property_list(&lpi);