Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Update all properties when a property is changed #49035

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,6 @@ void EditorInspector::_clear() {
property_focusable = -1;
editor_property_map.clear();
sections.clear();
pending.clear();
restart_request_props.clear();
}

Expand Down Expand Up @@ -1961,11 +1960,8 @@ void EditorInspector::_edit_request_change(Object *p_object, const String &p_pro
return;
}

if (p_property == String()) {
update_tree_pending = true;
} else {
pending.insert(p_property);
}
update_tree_pending |= p_property.empty();
update_properties |= !update_all_pending;
}

void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field) {
Expand Down Expand Up @@ -2198,20 +2194,16 @@ void EditorInspector::_notification(int p_what) {

if (update_tree_pending) {
update_tree();
update_properties = false;
update_tree_pending = false;
pending.clear();

} else {
while (pending.size()) {
StringName prop = pending.front()->get();
if (editor_property_map.has(prop)) {
for (List<EditorProperty *>::Element *E = editor_property_map[prop].front(); E; E = E->next()) {
E->get()->update_property();
E->get()->update_reload_status();
}
} else if (update_properties) {
for (Map<StringName, List<EditorProperty *>>::Element *E = editor_property_map.front(); E; E = E->next()) {
for (List<EditorProperty *>::Element *F = E->value().front(); F; F = F->next()) {
F->get()->update_property();
F->get()->update_reload_status();
}
pending.erase(pending.front());
}
update_properties = false;
}

changing--;
Expand Down Expand Up @@ -2307,6 +2299,7 @@ EditorInspector::EditorInspector() {
use_folding = false;
update_all_pending = false;
update_tree_pending = false;
update_properties = false;
refresh_countdown = 0;
read_only = false;
search_box = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ class EditorInspector : public ScrollContainer {
//map use to cache the instanced editors
Map<StringName, List<EditorProperty *>> editor_property_map;
List<EditorInspectorSection *> sections;
Set<StringName> pending;

void _clear();
Object *object;
Expand All @@ -279,6 +278,7 @@ class EditorInspector : public ScrollContainer {
bool use_folding;
int changing;
bool update_all_pending;
bool update_properties;
bool read_only;
bool keying;
bool sub_inspector;
Expand Down