diff --git a/modules/material_maker/editor/mat_maker_gd_editor.cpp b/modules/material_maker/editor/mat_maker_gd_editor.cpp index 94c162064..f03da3a04 100644 --- a/modules/material_maker/editor/mat_maker_gd_editor.cpp +++ b/modules/material_maker/editor/mat_maker_gd_editor.cpp @@ -115,15 +115,21 @@ void MatMakerGDEditor::recreate() { _recreation_in_progress = true; _graph_edit->clear_connections(); + LocalVector nodes; + for (int i = 0; i < _graph_edit->get_child_count(); ++i) { MMGraphNode *c = Object::cast_to(_graph_edit->get_child(i)); if (c) { - _graph_edit->remove_child(c); c->queue_delete(); + nodes.push_back(c); } } + for (int i = 0; i < nodes.size(); ++i) { + _graph_edit->remove_child(nodes[i]); + } + if (!_material.is_valid()) { return; }