diff options
Diffstat (limited to 'editor/inspector_dock.cpp')
-rw-r--r-- | editor/inspector_dock.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index a509cf3d8f..c0cb3fb174 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -453,6 +453,9 @@ void InspectorDock::_bind_methods() { ClassDB::bind_method("edit_resource", &InspectorDock::edit_resource); + ClassDB::bind_method("store_script_properties", &InspectorDock::store_script_properties); + ClassDB::bind_method("apply_script_properties", &InspectorDock::apply_script_properties); + ADD_SIGNAL(MethodInfo("request_help")); } @@ -565,6 +568,31 @@ EditorPropertyNameProcessor::Style InspectorDock::get_property_name_style() cons return property_name_style; } +void InspectorDock::store_script_properties(Object *p_object) { + ERR_FAIL_NULL(p_object); + ScriptInstance *si = p_object->get_script_instance(); + if (!si) { + return; + } + si->get_property_state(stored_properties); +} + +void InspectorDock::apply_script_properties(Object *p_object) { + ERR_FAIL_NULL(p_object); + ScriptInstance *si = p_object->get_script_instance(); + if (!si) { + return; + } + + for (const Pair<StringName, Variant> &E : stored_properties) { + Variant current; + if (si->get(E.first, current) && current.get_type() == E.second.get_type()) { + si->set(E.first, E.second); + } + } + stored_properties.clear(); +} + InspectorDock::InspectorDock(EditorData &p_editor_data) { singleton = this; set_name("Inspector"); |