Fix Asset Browser showing oudated list for changes done while browser is hidden
Steps to reproduce were: * Open an Asset Browser * "Mark Asset" on some data-block * Change the Asset Browser into a different editor (not File Browser!) * "Clear Asset" on the data-block again, or mark another asset * Change back to the Asset Browser, it will show an outdated list Now the file-browser reloads local file data after spaces were changed. Note that the current notifier code doesn't limit the space-change notifiers to the affected spaces, so changing any visible space will trigger this. That's an issue to be fixed separately.
This commit is contained in:
@@ -420,6 +420,15 @@ static void file_on_reload_callback_call(SpaceFile *sfile)
|
|||||||
sfile->runtime->on_reload_custom_data = NULL;
|
sfile->runtime->on_reload_custom_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void file_reset_filelist_showing_main_data(ScrArea *area, SpaceFile *sfile)
|
||||||
|
{
|
||||||
|
if (sfile->files && filelist_needs_reset_on_main_changes(sfile->files)) {
|
||||||
|
/* Full refresh of the file list if local asset data was changed. Refreshing this view
|
||||||
|
* is cheap and users expect this to be updated immediately. */
|
||||||
|
file_tag_reset_list(area, sfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void file_listener(const wmSpaceTypeListenerParams *params)
|
static void file_listener(const wmSpaceTypeListenerParams *params)
|
||||||
{
|
{
|
||||||
ScrArea *area = params->area;
|
ScrArea *area = params->area;
|
||||||
@@ -446,6 +455,11 @@ static void file_listener(const wmSpaceTypeListenerParams *params)
|
|||||||
ED_area_tag_refresh(area);
|
ED_area_tag_refresh(area);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ND_SPACE_CHANGED:
|
||||||
|
/* If the space was just turned into a file/asset browser, the file-list may need to be
|
||||||
|
* updated to reflect latest changes in main data. */
|
||||||
|
file_reset_filelist_showing_main_data(area, sfile);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
switch (wmn->action) {
|
switch (wmn->action) {
|
||||||
case NA_JOB_FINISHED:
|
case NA_JOB_FINISHED:
|
||||||
@@ -462,11 +476,7 @@ static void file_listener(const wmSpaceTypeListenerParams *params)
|
|||||||
case NA_ADDED:
|
case NA_ADDED:
|
||||||
case NA_REMOVED:
|
case NA_REMOVED:
|
||||||
case NA_EDITED:
|
case NA_EDITED:
|
||||||
if (sfile->files && filelist_needs_reset_on_main_changes(sfile->files)) {
|
file_reset_filelist_showing_main_data(area, sfile);
|
||||||
/* Full refresh of the file list if local asset data was changed. Refreshing this view
|
|
||||||
* is cheap and users expect this to be updated immediately. */
|
|
||||||
file_tag_reset_list(area, sfile);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -890,13 +900,11 @@ static void file_id_remap(ScrArea *area, SpaceLink *sl, ID *UNUSED(old_id), ID *
|
|||||||
{
|
{
|
||||||
SpaceFile *sfile = (SpaceFile *)sl;
|
SpaceFile *sfile = (SpaceFile *)sl;
|
||||||
|
|
||||||
/* If the file shows main data (IDs), tag it for reset. */
|
/* If the file shows main data (IDs), tag it for reset.
|
||||||
if (sfile->files && filelist_needs_reset_on_main_changes(sfile->files)) {
|
* Full reset of the file list if main data was changed, don't even attempt remap pointers.
|
||||||
/* Full refresh of the file list if main data was changed, don't even attempt remap pointers.
|
* We could give file list types a id-remap callback, but it's probably not worth it.
|
||||||
* We could give file list types a id-remap callback, but it's probably not worth it.
|
* Refreshing local file lists is relatively cheap. */
|
||||||
* Refreshing local file lists is relatively cheap. */
|
file_reset_filelist_showing_main_data(area, sfile);
|
||||||
file_tag_reset_list(area, sfile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only called once, from space/spacetypes.c */
|
/* only called once, from space/spacetypes.c */
|
||||||
|
|||||||
Reference in New Issue
Block a user