summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/editor_node.cpp6
-rw-r--r--editor/editor_node.h1
-rw-r--r--editor/editor_properties.cpp9
-rw-r--r--editor/inspector_dock.cpp2
4 files changed, 16 insertions, 2 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 57998b7778..bcdd54edd4 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3755,6 +3755,11 @@ void EditorNode::open_request(const String &p_path) {
load_scene(p_path); // as it will be opened in separate tab
}
+void EditorNode::edit_foreign_resource(RES p_resource) {
+ load_scene(p_resource->get_path().get_slice("::", 0));
+ InspectorDock::get_singleton()->call_deferred("edit_resource", p_resource);
+}
+
void EditorNode::request_instance_scene(const String &p_path) {
SceneTreeDock::get_singleton()->instantiate(p_path);
}
@@ -5740,6 +5745,7 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method("_get_scene_metadata", &EditorNode::_get_scene_metadata);
ClassDB::bind_method("set_edited_scene", &EditorNode::set_edited_scene);
ClassDB::bind_method("open_request", &EditorNode::open_request);
+ ClassDB::bind_method("edit_foreign_resource", &EditorNode::edit_foreign_resource);
ClassDB::bind_method("_close_messages", &EditorNode::_close_messages);
ClassDB::bind_method("_show_messages", &EditorNode::_show_messages);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 0c9df16b2e..785baee6c1 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -756,6 +756,7 @@ public:
void select_editor_by_name(const String &p_name);
void open_request(const String &p_path);
+ void edit_foreign_resource(RES p_resource);
bool is_changing_scene() const;
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index cdb96bd0c8..c6b369f201 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2975,6 +2975,12 @@ void EditorPropertyResource::_set_read_only(bool p_read_only) {
};
void EditorPropertyResource::_resource_selected(const RES &p_resource, bool p_edit) {
+ if (p_resource->is_built_in() && !p_resource->get_path().is_empty() && p_resource->get_path().get_slice("::", 0) != EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path()) {
+ // If the resource belongs to another scene, edit it in that scene instead.
+ EditorNode::get_singleton()->call_deferred("edit_foreign_resource", p_resource);
+ return;
+ }
+
if (!p_edit && use_sub_inspector) {
bool unfold = !get_edited_object()->editor_is_section_unfolded(get_edited_property());
get_edited_object()->editor_set_section_unfold(get_edited_property(), unfold);
@@ -3172,9 +3178,8 @@ void EditorPropertyResource::_viewport_selected(const NodePath &p_path) {
void EditorPropertyResource::setup(Object *p_object, const String &p_path, const String &p_base_type) {
if (resource_picker) {
- resource_picker->disconnect("resource_selected", callable_mp(this, &EditorPropertyResource::_resource_selected));
- resource_picker->disconnect("resource_changed", callable_mp(this, &EditorPropertyResource::_resource_changed));
memdelete(resource_picker);
+ resource_picker = nullptr;
}
if (p_path == "script" && p_base_type == "Script" && Object::cast_to<Node>(p_object)) {
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index b6dba7ec36..821e4dde11 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -451,6 +451,8 @@ void InspectorDock::_bind_methods() {
ClassDB::bind_method("_menu_collapseall", &InspectorDock::_menu_collapseall);
ClassDB::bind_method("_menu_expandall", &InspectorDock::_menu_expandall);
+ ClassDB::bind_method("edit_resource", &InspectorDock::edit_resource);
+
ADD_SIGNAL(MethodInfo("request_help"));
}