Prevent wrong unedit when clicking editor viewport
This commit is contained in:
parent
0810ecaafd
commit
360c71c3f6
3 changed files with 16 additions and 1 deletions
|
@ -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) {
|
void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) {
|
||||||
if (!p_object) {
|
if (!p_object) {
|
||||||
InspectorDock::get_inspector_singleton()->edit(nullptr);
|
InspectorDock::get_inspector_singleton()->edit(nullptr);
|
||||||
|
|
|
@ -798,6 +798,7 @@ public:
|
||||||
|
|
||||||
void push_item(Object *p_object, const String &p_property = "", bool p_inspector_only = false);
|
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 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 hide_unused_editors(const Object *p_editing_owner = nullptr);
|
||||||
|
|
||||||
void select_editor_by_name(const String &p_name);
|
void select_editor_by_name(const String &p_name);
|
||||||
|
|
|
@ -1427,7 +1427,14 @@ void SceneTreeDock::_script_open_request(const Ref<Script> &p_script) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneTreeDock::_push_item(Object *p_object) {
|
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) {
|
if (p_object == nullptr) {
|
||||||
EditorNode::get_singleton()->hide_unused_editors(this);
|
EditorNode::get_singleton()->hide_unused_editors(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue