diff options
author | Julian Eisel <julian@blender.org> | 2021-07-14 17:01:53 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-07-15 17:12:36 +0300 |
commit | 788d38046032736531cb77507e397cbea7993549 (patch) | |
tree | f13c551bb2f95a0b3b7481d4b8dc211b20e106cf /source/blender/blenkernel/intern | |
parent | 6e01b52100f3f9674c49127cbcc445e7e5c987d2 (diff) |
UI: UI list refactor & preparations for asset view template
This is more of a first-pass refactor for the UI list template. More
improvements could be done, but that's better done separately. Main
purpose of this is to make the UI list code more manageable and ready
for the asset view template.
No functional changes for users.
* Split the huge template function into more manageable functions, with
clear names and a few structs with high coherency.
* Move runtime data management to the template code, with a free
callback called from BKE. This is UI data and should be managed at
that level.
* Replace boolean arguments with bit-flags (easily extendable and more
readable from the caller).
* Allow passing custom-data to the UI list for callbacks to access.
* Make list grip button for resizing optional.
* Put logic for generating the internal UI list identifier (stored in
.blends) into function. This is a quite important bit and a later
commit adds a related function. Good to have a clear API for this.
* Improve naming, comments, etc.
As part of further cleanups I'd like to move this to an own file.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 73658c3184e..c3885b5dcf7 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -682,19 +682,13 @@ void BKE_area_region_free(SpaceType *st, ARegion *region) BKE_area_region_panels_free(®ion->panels); LISTBASE_FOREACH (uiList *, uilst, ®ion->ui_lists) { - if (uilst->dyn_data) { - uiListDyn *dyn_data = uilst->dyn_data; - if (dyn_data->items_filter_flags) { - MEM_freeN(dyn_data->items_filter_flags); - } - if (dyn_data->items_filter_neworder) { - MEM_freeN(dyn_data->items_filter_neworder); - } - MEM_freeN(dyn_data); + if (uilst->dyn_data && uilst->dyn_data->free_runtime_data_fn) { + uilst->dyn_data->free_runtime_data_fn(uilst); } if (uilst->properties) { IDP_FreeProperty(uilst->properties); } + MEM_SAFE_FREE(uilst->dyn_data); } if (region->gizmo_map != NULL) { |