Make sub-inspectors not listen to node removals, since they never edit nodes. Fixes #23554
This commit is contained in:
@ -1899,13 +1899,13 @@ int EditorInspector::get_scroll_offset() const {
|
|||||||
return get_v_scroll();
|
return get_v_scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorInspector::set_use_sub_inspector_bg(bool p_enable) {
|
void EditorInspector::set_sub_inspector(bool p_enable) {
|
||||||
|
|
||||||
use_sub_inspector_bg = p_enable;
|
sub_inspector = p_enable;
|
||||||
if (!is_inside_tree())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (use_sub_inspector_bg) {
|
if (sub_inspector) {
|
||||||
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
|
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
|
||||||
} else {
|
} else {
|
||||||
add_style_override("bg", get_stylebox("bg", "Tree"));
|
add_style_override("bg", get_stylebox("bg", "Tree"));
|
||||||
@ -2126,16 +2126,18 @@ void EditorInspector::_notification(int p_what) {
|
|||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||||
|
|
||||||
get_tree()->connect("node_removed", this, "_node_removed");
|
if (sub_inspector) {
|
||||||
if (use_sub_inspector_bg) {
|
|
||||||
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
|
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
|
||||||
} else if (is_inside_tree()) {
|
} else {
|
||||||
add_style_override("bg", get_stylebox("bg", "Tree"));
|
add_style_override("bg", get_stylebox("bg", "Tree"));
|
||||||
|
get_tree()->connect("node_removed", this, "_node_removed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
if (p_what == NOTIFICATION_EXIT_TREE) {
|
||||||
|
|
||||||
get_tree()->disconnect("node_removed", this, "_node_removed");
|
if (!sub_inspector) {
|
||||||
|
get_tree()->disconnect("node_removed", this, "_node_removed");
|
||||||
|
}
|
||||||
edit(NULL);
|
edit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2184,7 +2186,7 @@ void EditorInspector::_notification(int p_what) {
|
|||||||
|
|
||||||
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||||
|
|
||||||
if (use_sub_inspector_bg) {
|
if (sub_inspector) {
|
||||||
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
|
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
|
||||||
} else if (is_inside_tree()) {
|
} else if (is_inside_tree()) {
|
||||||
add_style_override("bg", get_stylebox("bg", "Tree"));
|
add_style_override("bg", get_stylebox("bg", "Tree"));
|
||||||
@ -2280,7 +2282,7 @@ EditorInspector::EditorInspector() {
|
|||||||
_prop_edited = "property_edited";
|
_prop_edited = "property_edited";
|
||||||
set_process(true);
|
set_process(true);
|
||||||
property_focusable = -1;
|
property_focusable = -1;
|
||||||
use_sub_inspector_bg = false;
|
sub_inspector = false;
|
||||||
|
|
||||||
get_v_scrollbar()->connect("value_changed", this, "_vscroll_changed");
|
get_v_scrollbar()->connect("value_changed", this, "_vscroll_changed");
|
||||||
update_scroll_request = -1;
|
update_scroll_request = -1;
|
||||||
|
|||||||
@ -281,7 +281,7 @@ class EditorInspector : public ScrollContainer {
|
|||||||
bool update_all_pending;
|
bool update_all_pending;
|
||||||
bool read_only;
|
bool read_only;
|
||||||
bool keying;
|
bool keying;
|
||||||
bool use_sub_inspector_bg;
|
bool sub_inspector;
|
||||||
|
|
||||||
float refresh_countdown;
|
float refresh_countdown;
|
||||||
bool update_tree_pending;
|
bool update_tree_pending;
|
||||||
@ -375,7 +375,7 @@ public:
|
|||||||
void set_object_class(const String &p_class);
|
void set_object_class(const String &p_class);
|
||||||
String get_object_class() const;
|
String get_object_class() const;
|
||||||
|
|
||||||
void set_use_sub_inspector_bg(bool p_enable);
|
void set_sub_inspector(bool p_enable);
|
||||||
|
|
||||||
EditorInspector();
|
EditorInspector();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2448,7 +2448,7 @@ void EditorPropertyResource::update_property() {
|
|||||||
sub_inspector->set_enable_v_scroll(false);
|
sub_inspector->set_enable_v_scroll(false);
|
||||||
sub_inspector->set_use_doc_hints(true);
|
sub_inspector->set_use_doc_hints(true);
|
||||||
|
|
||||||
sub_inspector->set_use_sub_inspector_bg(true);
|
sub_inspector->set_sub_inspector(true);
|
||||||
sub_inspector->set_enable_capitalize_paths(true);
|
sub_inspector->set_enable_capitalize_paths(true);
|
||||||
|
|
||||||
sub_inspector->connect("property_keyed", this, "_sub_inspector_property_keyed");
|
sub_inspector->connect("property_keyed", this, "_sub_inspector_property_keyed");
|
||||||
|
|||||||
Reference in New Issue
Block a user