Refactor auto-instantiation of Object properties in editor

Auto-instantiation is used by the create dialog, but should also be
used by the editor inspector.

This refactors object properties auto-instantiation into a dedicated
method to be reused throughout editor (and possibly scripting).
This commit is contained in:
Andrii Doroshenko (Xrayez) 2020-10-22 22:02:57 +03:00
parent 28174d531b
commit 7a8b11ee14
6 changed files with 28 additions and 12 deletions

View file

@ -269,7 +269,9 @@ void CustomPropertyEditor::_menu_option(int p_which) {
res->call("set_instance_base_type", owner->get_class());
}
EditorNode::get_editor_data().instantiate_object_properties(obj);
v = obj;
emit_signal(SNAME("variant_changed"));
} break;
@ -1080,7 +1082,9 @@ void CustomPropertyEditor::_type_create_selected(int p_idx) {
ERR_FAIL_COND(!obj);
ERR_FAIL_COND(!Object::cast_to<Resource>(obj));
EditorNode::get_editor_data().instantiate_object_properties(obj);
v = obj;
emit_signal(SNAME("variant_changed"));
hide();
}
@ -1270,7 +1274,9 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
ERR_BREAK(!obj);
ERR_BREAK(!Object::cast_to<Resource>(obj));
EditorNode::get_editor_data().instantiate_object_properties(obj);
v = obj;
emit_signal(SNAME("variant_changed"));
hide();
}