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

@ -4949,7 +4949,9 @@ bool EditorNode::is_object_of_custom_type(const Object *p_object, const StringNa
}
void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {
if (singleton->cmdline_export_mode) {
if (!singleton) {
return;
} else if (singleton->cmdline_export_mode) {
print_line(p_task + ": begin: " + p_label + " steps: " + itos(p_steps));
} else if (singleton->progress_dialog) {
singleton->progress_dialog->add_task(p_task, p_label, p_steps, p_can_cancel);
@ -4957,7 +4959,9 @@ void EditorNode::progress_add_task(const String &p_task, const String &p_label,
}
bool EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
if (singleton->cmdline_export_mode) {
if (!singleton) {
return false;
} else if (singleton->cmdline_export_mode) {
print_line("\t" + p_task + ": step " + itos(p_step) + ": " + p_state);
return false;
} else if (singleton->progress_dialog) {
@ -4968,7 +4972,9 @@ bool EditorNode::progress_task_step(const String &p_task, const String &p_state,
}
void EditorNode::progress_end_task(const String &p_task) {
if (singleton->cmdline_export_mode) {
if (!singleton) {
return;
} else if (singleton->cmdline_export_mode) {
print_line(p_task + ": end");
} else if (singleton->progress_dialog) {
singleton->progress_dialog->end_task(p_task);