From ca475479eb26b4798857b4e67f03eea89324da4b Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 21 Jan 2021 21:40:25 +0100 Subject: Fix Asset Browser showing old name after renaming data-block The "Current File" asset library didn't get refreshed after the data-block name changed. But rather than entirely refreshing the file list, or doing possibly problematic partial refreshes, reference the data-block name directly, so a simple redraw gets the new name displayed. Addresses T83751 --- source/blender/editors/space_file/space_file.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_file/space_file.c') diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 193b141d528..9fe380e382f 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -463,6 +463,12 @@ static void file_main_region_listener(const wmRegionListenerParams *params) break; } break; + case NC_ID: + if (ELEM(wmn->action, NA_RENAME)) { + /* In case the filelist shows ID names. */ + ED_region_tag_redraw(region); + } + break; } } @@ -650,6 +656,21 @@ static void file_tools_region_listener(const wmRegionListenerParams *UNUSED(para { } +static void file_tool_props_region_listener(const wmRegionListenerParams *params) +{ + const wmNotifier *wmn = params->notifier; + ARegion *region = params->region; + + switch (wmn->category) { + case NC_ID: + if (ELEM(wmn->action, NA_RENAME)) { + /* In case the filelist shows ID names. */ + ED_region_tag_redraw(region); + } + break; + } +} + /* add handlers, stuff you only do once or on area/region changes */ static void file_header_region_init(wmWindowManager *wm, ARegion *region) { @@ -916,7 +937,7 @@ void ED_spacetype_file(void) art->prefsizex = 240; art->prefsizey = 60; art->keymapflag = ED_KEYMAP_UI; - art->listener = file_tools_region_listener; + art->listener = file_tool_props_region_listener; art->init = file_tools_region_init; art->draw = file_tools_region_draw; BLI_addhead(&st->regiontypes, art); -- cgit v1.2.3