mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
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:
parent
28174d531b
commit
7a8b11ee14
6 changed files with 28 additions and 12 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue