Merge pull request #88288 from KoBeWi/uninspectorable
Rework how script is edited when clicking icon
This commit is contained in:
commit
351a869af6
|
@ -2250,21 +2250,15 @@ void EditorNode::push_item(Object *p_object, const String &p_property, bool p_in
|
|||
hide_unused_editors();
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectID id = p_object->get_instance_id();
|
||||
if (id != editor_history.get_current()) {
|
||||
if (p_inspector_only) {
|
||||
editor_history.add_object(id, String(), true);
|
||||
} else if (p_property.is_empty()) {
|
||||
editor_history.add_object(id);
|
||||
} else {
|
||||
editor_history.add_object(id, p_property);
|
||||
}
|
||||
}
|
||||
|
||||
_add_to_history(p_object, p_property, p_inspector_only);
|
||||
_edit_current();
|
||||
}
|
||||
|
||||
void EditorNode::push_item_no_inspector(Object *p_object) {
|
||||
_add_to_history(p_object, "", false);
|
||||
_edit_current(false, true);
|
||||
}
|
||||
|
||||
void EditorNode::save_default_environment() {
|
||||
Ref<Environment> fallback = get_tree()->get_root()->get_world_3d()->get_fallback_environment();
|
||||
|
||||
|
@ -2328,7 +2322,20 @@ static bool overrides_external_editor(Object *p_object) {
|
|||
return script->get_language()->overrides_external_editor();
|
||||
}
|
||||
|
||||
void EditorNode::_edit_current(bool p_skip_foreign) {
|
||||
void EditorNode::_add_to_history(const Object *p_object, const String &p_property, bool p_inspector_only) {
|
||||
ObjectID id = p_object->get_instance_id();
|
||||
if (id != editor_history.get_current()) {
|
||||
if (p_inspector_only) {
|
||||
editor_history.add_object(id, String(), true);
|
||||
} else if (p_property.is_empty()) {
|
||||
editor_history.add_object(id);
|
||||
} else {
|
||||
editor_history.add_object(id, p_property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update) {
|
||||
ObjectID current_id = editor_history.get_current();
|
||||
Object *current_obj = current_id.is_valid() ? ObjectDB::get_instance(current_id) : nullptr;
|
||||
|
||||
|
@ -2377,11 +2384,13 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
|
|||
Resource *current_res = Object::cast_to<Resource>(current_obj);
|
||||
ERR_FAIL_NULL(current_res);
|
||||
|
||||
InspectorDock::get_inspector_singleton()->edit(current_res);
|
||||
SceneTreeDock::get_singleton()->set_selected(nullptr);
|
||||
NodeDock::get_singleton()->set_node(nullptr);
|
||||
InspectorDock::get_singleton()->update(nullptr);
|
||||
ImportDock::get_singleton()->set_edit_path(current_res->get_path());
|
||||
if (!p_skip_inspector_update) {
|
||||
InspectorDock::get_inspector_singleton()->edit(current_res);
|
||||
SceneTreeDock::get_singleton()->set_selected(nullptr);
|
||||
NodeDock::get_singleton()->set_node(nullptr);
|
||||
InspectorDock::get_singleton()->update(nullptr);
|
||||
ImportDock::get_singleton()->set_edit_path(current_res->get_path());
|
||||
}
|
||||
|
||||
int subr_idx = current_res->get_path().find("::");
|
||||
if (subr_idx != -1) {
|
||||
|
|
|
@ -518,7 +518,8 @@ private:
|
|||
|
||||
void _dialog_action(String p_file);
|
||||
|
||||
void _edit_current(bool p_skip_foreign = false);
|
||||
void _add_to_history(const Object *p_object, const String &p_property, bool p_inspector_only);
|
||||
void _edit_current(bool p_skip_foreign = false, bool p_skip_inspector_update = false);
|
||||
void _dialog_display_save_error(String p_file, Error p_error);
|
||||
void _dialog_display_load_error(String p_file, Error p_error);
|
||||
|
||||
|
@ -752,6 +753,7 @@ public:
|
|||
void show_about() { _menu_option_confirm(HELP_ABOUT, false); }
|
||||
|
||||
void push_item(Object *p_object, const String &p_property = "", bool p_inspector_only = false);
|
||||
void push_item_no_inspector(Object *p_object);
|
||||
void edit_item(Object *p_object, Object *p_editing_owner);
|
||||
void push_node_item(Node *p_node);
|
||||
void hide_unused_editors(const Object *p_editing_owner = nullptr);
|
||||
|
|
|
@ -1578,9 +1578,7 @@ void SceneTreeDock::_load_request(const String &p_path) {
|
|||
}
|
||||
|
||||
void SceneTreeDock::_script_open_request(const Ref<Script> &p_script) {
|
||||
if (ScriptEditor::get_singleton()->edit(p_script, true)) {
|
||||
EditorNode::get_singleton()->editor_select(EditorNode::EDITOR_SCRIPT);
|
||||
}
|
||||
EditorNode::get_singleton()->push_item_no_inspector(p_script.ptr());
|
||||
}
|
||||
|
||||
void SceneTreeDock::_push_item(Object *p_object) {
|
||||
|
|
Loading…
Reference in New Issue