Display the actual used theme items in the Inspector

Closes: godotengine/godot-proposals#4439.

Allows viewing the default values ​​of the currently used theme item
in the Inspector.

For theme item properties of resource type, editing the default
resource does not make sense. Use **Make Unique** to create a copy
before editing.
This commit is contained in:
风青山
2025-02-03 23:06:15 +08:00
parent f60f69aa57
commit bef64baa18
5 changed files with 76 additions and 11 deletions

View File

@@ -1320,7 +1320,7 @@ void EditorPropertyInteger::_value_changed(int64_t val) {
}
void EditorPropertyInteger::update_property() {
int64_t val = get_edited_property_value();
int64_t val = get_edited_property_display_value();
spin->set_value_no_signal(val);
#ifdef DEBUG_ENABLED
// If spin (currently EditorSplinSlider : Range) is changed so that it can use int64_t, then the below warning wouldn't be a problem.
@@ -2628,7 +2628,7 @@ void EditorPropertyColor::_notification(int p_what) {
}
void EditorPropertyColor::update_property() {
picker->set_pick_color(get_edited_property_value());
picker->set_pick_color(get_edited_property_display_value());
const Color color = picker->get_pick_color();
// Add a tooltip to display each channel's values without having to click the ColorPickerButton
@@ -3008,7 +3008,7 @@ void EditorPropertyResource::_resource_selected(const Ref<Resource> &p_resource,
bool unfold = !get_edited_object()->editor_is_section_unfolded(get_edited_property());
get_edited_object()->editor_set_section_unfold(get_edited_property(), unfold);
update_property();
} else {
} else if (!is_checkable() || is_checked()) {
emit_signal(SNAME("resource_selected"), get_edited_property(), p_resource);
}
}
@@ -3269,7 +3269,7 @@ void EditorPropertyResource::setup(Object *p_object, const String &p_path, const
}
void EditorPropertyResource::update_property() {
Ref<Resource> res = get_edited_property_value();
Ref<Resource> res = get_edited_property_display_value();
if (use_sub_inspector) {
if (res.is_valid() != resource_picker->is_toggle_mode()) {
@@ -3321,6 +3321,8 @@ void EditorPropertyResource::update_property() {
}
}
sub_inspector->set_read_only(is_checkable() && !is_checked());
if (res.ptr() != sub_inspector->get_edited_object()) {
sub_inspector->edit(res.ptr());
_update_property_bg();