summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/editor_node.cpp7
-rw-r--r--editor/editor_node.h1
-rw-r--r--editor/scene_tree_dock.cpp9
3 files changed, 16 insertions, 1 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0405749147..fe62d9dda0 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2136,6 +2136,13 @@ void EditorNode::edit_item(Object *p_object, Object *p_editing_owner) {
}
}
+void EditorNode::push_node_item(Node *p_node) {
+ if (p_node || Object::cast_to<Node>(InspectorDock::get_inspector_singleton()->get_edited_object())) {
+ // Don't push null if the currently edited object is not a Node.
+ push_item(p_node);
+ }
+}
+
void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) {
if (!p_object) {
InspectorDock::get_inspector_singleton()->edit(nullptr);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 3967f64c6b..914dab0254 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -798,6 +798,7 @@ public:
void push_item(Object *p_object, const String &p_property = "", bool p_inspector_only = false);
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);
void select_editor_by_name(const String &p_name);
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 86e77fbbbe..d8f1d92e44 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1427,7 +1427,14 @@ void SceneTreeDock::_script_open_request(const Ref<Script> &p_script) {
}
void SceneTreeDock::_push_item(Object *p_object) {
- EditorNode::get_singleton()->push_item(p_object);
+ Node *node = Object::cast_to<Node>(p_object);
+ if (node || !p_object) {
+ // Assume that null object is a Node.
+ EditorNode::get_singleton()->push_node_item(node);
+ } else {
+ EditorNode::get_singleton()->push_item(p_object);
+ }
+
if (p_object == nullptr) {
EditorNode::get_singleton()->hide_unused_editors(this);
}