Fix #102574: Don't Show "Rename" for Volume and & System lists #106873

Merged
Harley Acheson merged 2 commits from Harley/blender:FileListHints into main 2023-05-19 01:17:34 +02:00
2 changed files with 12 additions and 4 deletions

View File

@ -644,7 +644,12 @@ static void *uilist_item_use_dynamic_tooltip(PointerRNA *itemptr, const char *pr
static char *uilist_item_tooltip_func(bContext * /*C*/, void *argN, const char *tip) static char *uilist_item_tooltip_func(bContext * /*C*/, void *argN, const char *tip)
{ {
char *dyn_tooltip = static_cast<char *>(argN); char *dyn_tooltip = static_cast<char *>(argN);
return BLI_sprintfN("%s - %s", tip, dyn_tooltip); std::string tooltip_string = dyn_tooltip;
if (tip && tip[0]) {
tooltip_string += '\n';
tooltip_string += tip;
}
return BLI_strdupn(tooltip_string.c_str(), tooltip_string.size());
} }
/** /**
@ -745,6 +750,9 @@ static void ui_template_list_layout_draw(const bContext *C,
int i = 0; int i = 0;
if (input_data->dataptr.data && input_data->prop) { if (input_data->dataptr.data && input_data->prop) {
const bool editable = (RNA_property_flag(input_data->prop) & PROP_EDITABLE);
/* create list items */ /* create list items */
for (i = visual_info.start_idx; i < visual_info.end_idx; i++) { for (i = visual_info.start_idx; i < visual_info.end_idx; i++) {
PointerRNA *itemptr = &items->item_vec[i].item; PointerRNA *itemptr = &items->item_vec[i].item;
@ -775,7 +783,7 @@ static void ui_template_list_layout_draw(const bContext *C,
org_i, org_i,
0, 0,
0, 0,
TIP_("Double click to rename")); editable ? TIP_("Double click to rename") : "");
if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr, if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr,
input_data->item_dyntip_propname))) { input_data->item_dyntip_propname))) {
UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data, MEM_freeN); UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data, MEM_freeN);

View File

@ -7165,7 +7165,7 @@ static void rna_def_space_filebrowser(BlenderRNA *brna)
NULL, NULL,
NULL, NULL,
NULL); NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_EDITABLE);
prop = RNA_def_int(srna, prop = RNA_def_int(srna,
"bookmarks_active", "bookmarks_active",
@ -7196,7 +7196,7 @@ static void rna_def_space_filebrowser(BlenderRNA *brna)
NULL, NULL,
NULL, NULL,
NULL); NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_EDITABLE);
prop = RNA_def_int(srna, prop = RNA_def_int(srna,
"recent_folders_active", "recent_folders_active",