diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-01-04 10:01:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 10:01:53 +0100 |
commit | b609ab3b9c92cc0ef1827380700001cf79ca668e (patch) | |
tree | 146d9d28143bacb8451cbb9ca206d36d4e69268a | |
parent | 7f66c16c03ceaaceac1871e72df4419e59c64c64 (diff) | |
parent | 363a9c674a13376daeb8689489bf5366b9db10d3 (diff) |
Merge pull request #52611 from KoBeWi/outsider_resources
-rw-r--r-- | editor/editor_node.cpp | 14 | ||||
-rw-r--r-- | editor/editor_node.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 49840d2c1c..715f62b3df 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2129,11 +2129,19 @@ static bool overrides_external_editor(Object *p_object) { return script->get_language()->overrides_external_editor(); } -void EditorNode::_edit_current() { +void EditorNode::_edit_current(bool p_skip_foreign) { ObjectID current = editor_history.get_current(); Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; - bool inspector_only = editor_history.is_current_inspector_only(); + RES res = Object::cast_to<Resource>(current_obj); + if (p_skip_foreign && res.is_valid()) { + if (res->get_path().find("::") > -1 && res->get_path().get_slice("::", 0) != editor_data.get_scene_path(get_current_tab())) { + // Trying to edit resource that belongs to another scene; abort. + current_obj = nullptr; + } + } + + bool inspector_only = editor_history.is_current_inspector_only(); this->current = current_obj; if (!current_obj) { @@ -3494,7 +3502,7 @@ void EditorNode::set_current_scene(int p_idx) { } Dictionary state = editor_data.restore_edited_scene_state(editor_selection, &editor_history); - _edit_current(); + _edit_current(true); _update_title(); diff --git a/editor/editor_node.h b/editor/editor_node.h index 9be65bb26a..7ecdb7c263 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -459,7 +459,7 @@ private: void _dialog_action(String p_file); - void _edit_current(); + void _edit_current(bool p_skip_foreign = false); void _dialog_display_save_error(String p_file, Error p_error); void _dialog_display_load_error(String p_file, Error p_error); |