Merge pull request #113753 from arkology/unique-right

Fix unique button for `EditorAudioStreamPicker`
This commit is contained in:
Thaddeus Crews 2025-12-15 08:01:16 -06:00
commit 2da239fa22
No known key found for this signature in database
GPG Key ID: 8C6E5FEB5FC03CCC
1 changed files with 54 additions and 51 deletions

View File

@ -94,7 +94,30 @@ void EditorResourcePicker::_update_resource() {
assign_button->set_button_icon(Ref<Texture2D>());
assign_button->set_text(TTR("<empty>"));
assign_button->set_tooltip_text("");
make_unique_button->set_disabled(true);
} else {
assign_button->set_button_icon(EditorNode::get_singleton()->get_object_icon(edited_resource.operator->()));
if (!edited_resource->get_name().is_empty()) {
assign_button->set_text(edited_resource->get_name());
} else if (edited_resource->get_path().is_resource_file()) {
assign_button->set_text(edited_resource->get_path().get_file());
} else {
assign_button->set_text(class_name);
}
if (edited_resource->get_path().is_resource_file()) {
resource_path = edited_resource->get_path() + "\n";
}
assign_button->set_tooltip_text(resource_path + TTR("Type:") + " " + class_name);
// Preview will override the above, so called at the end.
EditorResourcePreview::get_singleton()->queue_edited_resource_preview(edited_resource, callable_mp(this, &EditorResourcePicker::_update_resource_preview).bind(edited_resource->get_instance_id()));
}
} else if (edited_resource.is_valid()) {
assign_button->set_tooltip_text(resource_path + TTR("Type:") + " " + edited_resource->get_class());
}
if (edited_resource.is_null()) {
make_unique_button->set_visible(false);
} else {
Ref<Resource> parent_res = _has_parent_resource();
@ -146,26 +169,6 @@ void EditorResourcePicker::_update_resource() {
}
make_unique_button->set_tooltip_text(tooltip);
assign_button->set_button_icon(EditorNode::get_singleton()->get_object_icon(edited_resource.operator->()));
if (!edited_resource->get_name().is_empty()) {
assign_button->set_text(edited_resource->get_name());
} else if (edited_resource->get_path().is_resource_file()) {
assign_button->set_text(edited_resource->get_path().get_file());
} else {
assign_button->set_text(class_name);
}
if (edited_resource->get_path().is_resource_file()) {
resource_path = edited_resource->get_path() + "\n";
}
assign_button->set_tooltip_text(resource_path + TTR("Type:") + " " + class_name);
// Preview will override the above, so called at the end.
EditorResourcePreview::get_singleton()->queue_edited_resource_preview(edited_resource, callable_mp(this, &EditorResourcePicker::_update_resource_preview).bind(edited_resource->get_instance_id()));
}
} else if (edited_resource.is_valid()) {
assign_button->set_tooltip_text(resource_path + TTR("Type:") + " " + edited_resource->get_class());
}
assign_button->set_disabled(!editable && edited_resource.is_null());