Fix issue with 3D scene drag and drop preview node

(cherry picked from commit 834ccb9698)
This commit is contained in:
oeelis 2023-11-19 15:50:39 +02:00 committed by Rémi Verschelde
parent 7fb0ec04c2
commit 4ddcfb5fb3
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -4152,6 +4152,7 @@ Node *Node3DEditorViewport::_sanitize_preview_node(Node *p_node) const {
}
void Node3DEditorViewport::_create_preview_node(const Vector<String> &files) const {
bool add_preview = false;
for (int i = 0; i < files.size(); i++) {
String path = files[i];
Ref<Resource> res = ResourceLoader::load(path);
@ -4172,9 +4173,13 @@ void Node3DEditorViewport::_create_preview_node(const Vector<String> &files) con
}
}
}
EditorNode::get_singleton()->get_scene_root()->add_child(preview_node);
add_preview = true;
}
}
if (add_preview) {
EditorNode::get_singleton()->get_scene_root()->add_child(preview_node);
}
*preview_bounds = _calculate_spatial_bounds(preview_node);
}