|
@@ -1977,11 +1977,19 @@ static bool overrides_external_editor(Object *p_object) {
|
|
return script->get_language()->overrides_external_editor();
|
|
return script->get_language()->overrides_external_editor();
|
|
}
|
|
}
|
|
|
|
|
|
-void EditorNode::_edit_current() {
|
|
|
|
|
|
+void EditorNode::_edit_current(bool p_skip_foreign) {
|
|
uint32_t current = editor_history.get_current();
|
|
uint32_t current = editor_history.get_current();
|
|
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : nullptr;
|
|
Object *current_obj = current > 0 ? 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;
|
|
this->current = current_obj;
|
|
|
|
|
|
if (!current_obj) {
|
|
if (!current_obj) {
|
|
@@ -2112,8 +2120,8 @@ void EditorNode::_edit_current() {
|
|
|
|
|
|
if (main_plugin) {
|
|
if (main_plugin) {
|
|
// special case if use of external editor is true
|
|
// special case if use of external editor is true
|
|
- Resource *res = Object::cast_to<Resource>(current_obj);
|
|
|
|
- if (main_plugin->get_name() == "Script" && current_obj->get_class_name() != StringName("VisualScript") && res && !res->get_path().empty() && res->get_path().find("::") == -1 && (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
|
|
|
|
|
|
+ Resource *current_res = Object::cast_to<Resource>(current_obj);
|
|
|
|
+ if (main_plugin->get_name() == "Script" && current_obj->get_class_name() != StringName("VisualScript") && current_res && !current_res->get_path().empty() && current_res->get_path().find("::") == -1 && (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
|
|
if (!changing_scene) {
|
|
if (!changing_scene) {
|
|
main_plugin->edit(current_obj);
|
|
main_plugin->edit(current_obj);
|
|
}
|
|
}
|
|
@@ -3475,7 +3483,7 @@ void EditorNode::set_current_scene(int p_idx) {
|
|
}
|
|
}
|
|
|
|
|
|
Dictionary state = editor_data.restore_edited_scene_state(editor_selection, &editor_history);
|
|
Dictionary state = editor_data.restore_edited_scene_state(editor_selection, &editor_history);
|
|
- _edit_current();
|
|
|
|
|
|
+ _edit_current(true);
|
|
|
|
|
|
_update_title();
|
|
_update_title();
|
|
|
|
|