diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-08-06 16:18:18 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-08-06 16:20:39 +0300 |
commit | 9cff9f9f5df034ca27848875c25471dd952c34c4 (patch) | |
tree | dbee329e85d8dd332a11bf905c43c2970c576a0c | |
parent | 2796ee7da049bbea3d83efdd42c3eaf1af1ebb2c (diff) |
Cleanup: rename `FileList::asset_library` → `asset_library_ref`
In the `FileList` struct, rename the `AssetLibraryReference
*asset_library` field to `asset_library_ref` -- it's a description of
which asset library is used, and not the asset library itself.
This is to make space for a future `AssetLibrary *asset_library` field,
which will point to an actual asset library struct/class.
No functional changes.
Reviewed by: Severin
Differential Revision: https://developer.blender.org/D12151
25 files changed, 103 insertions, 77 deletions
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 9f70d26c71b..00ac69595c7 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -37,9 +37,9 @@ class FILEBROWSER_HT_header(Header): params = space_data.params row = layout.row(align=True) - row.prop(params, "asset_library", text="") + row.prop(params, "asset_library_ref", text="") # External libraries don't auto-refresh, add refresh button. - if params.asset_library != 'LOCAL': + if params.asset_library_ref != 'LOCAL': row.operator("file.refresh", text="", icon='FILE_REFRESH') layout.separator_spacer() @@ -678,8 +678,8 @@ class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel): layout.label(text="No asset selected", icon='INFO') return - asset_library = context.asset_library - asset_lib_path = bpy.types.AssetHandle.get_full_library_path(asset_file_handle, asset_library) + asset_library_ref = context.asset_library_ref + asset_lib_path = bpy.types.AssetHandle.get_full_library_path(asset_file_handle, asset_library_ref) if asset_file_handle.local_id: # If the active file is an ID, use its name directly so renaming is possible from right here. diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 8917580689d..eda6a03fa1a 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -360,7 +360,7 @@ int CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list); int CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list); int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list); -const struct AssetLibraryReference *CTX_wm_asset_library(const bContext *C); +const struct AssetLibraryReference *CTX_wm_asset_library_ref(const bContext *C); struct AssetHandle CTX_wm_asset_handle(const bContext *C, bool *r_is_valid); bool CTX_wm_interface_locked(const bContext *C); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index dced945bea0..7763bb9ca08 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -1448,9 +1448,9 @@ int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list) return ctx_data_collection_get(C, "editable_gpencil_strokes", list); } -const AssetLibraryReference *CTX_wm_asset_library(const bContext *C) +const AssetLibraryReference *CTX_wm_asset_library_ref(const bContext *C) { - return ctx_data_pointer_get(C, "asset_library"); + return ctx_data_pointer_get(C, "asset_library_ref"); } AssetHandle CTX_wm_asset_handle(const bContext *C, bool *r_is_valid) diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 059dc68b1dc..329633c6759 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -58,7 +58,7 @@ static void workspace_init_data(ID *id) { WorkSpace *workspace = (WorkSpace *)id; - BKE_asset_library_reference_init_default(&workspace->asset_library); + BKE_asset_library_reference_init_default(&workspace->asset_library_ref); } static void workspace_free_data(ID *id) diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 42af8f4bda2..862ef99fca5 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -657,12 +657,12 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) if (!DNA_struct_elem_find( fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library")) { LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) { - BKE_asset_library_reference_init_default(&workspace->asset_library); + BKE_asset_library_reference_init_default(&workspace->asset_library_ref); } } if (!DNA_struct_elem_find( - fd->filesdna, "FileAssetSelectParams", "AssetLibraryReference", "asset_library")) { + fd->filesdna, "FileAssetSelectParams", "AssetLibraryReference", "asset_library_ref")) { LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) { @@ -671,7 +671,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) if (sfile->browse_mode != FILE_BROWSE_MODE_ASSETS) { continue; } - BKE_asset_library_reference_init_default(&sfile->asset_params->asset_library); + BKE_asset_library_reference_init_default(&sfile->asset_params->asset_library_ref); } } } @@ -749,5 +749,31 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) */ { /* Keep this block, even when empty. */ + + if (!DNA_struct_elem_find( + fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library_ref")) { + LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) { + BKE_asset_library_reference_init_default(&workspace->asset_library_ref); + } + } + + if (!DNA_struct_elem_find( + fd->filesdna, "FileAssetSelectParams", "AssetLibraryReference", "asset_library_ref")) { + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) { + if (space->spacetype != SPACE_FILE) { + continue; + } + + SpaceFile *sfile = (SpaceFile *)space; + if (sfile->browse_mode != FILE_BROWSE_MODE_ASSETS) { + continue; + } + BKE_asset_library_reference_init_default(&sfile->asset_params->asset_library_ref); + } + } + } + } } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 12839a155e4..225548f3832 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -757,8 +757,8 @@ static void write_userdef(BlendWriter *writer, const UserDef *userdef) BLO_write_struct(writer, bPathCompare, path_cmp); } - LISTBASE_FOREACH (const bUserAssetLibrary *, asset_library, &userdef->asset_libraries) { - BLO_write_struct(writer, bUserAssetLibrary, asset_library); + LISTBASE_FOREACH (const bUserAssetLibrary *, asset_library_ref, &userdef->asset_libraries) { + BLO_write_struct(writer, bUserAssetLibrary, asset_library_ref); } LISTBASE_FOREACH (const uiStyle *, style, &userdef->uistyles) { diff --git a/source/blender/editors/armature/pose_lib_2.c b/source/blender/editors/armature/pose_lib_2.c index 32440f941ba..5b6100c9785 100644 --- a/source/blender/editors/armature/pose_lib_2.c +++ b/source/blender/editors/armature/pose_lib_2.c @@ -299,16 +299,16 @@ static void poselib_tempload_exit(PoseBlendData *pbd) static bAction *poselib_blend_init_get_action(bContext *C, wmOperator *op) { bool asset_handle_valid; - const AssetLibraryReference *asset_library = CTX_wm_asset_library(C); + const AssetLibraryReference *asset_library_ref = CTX_wm_asset_library_ref(C); const AssetHandle asset_handle = CTX_wm_asset_handle(C, &asset_handle_valid); /* Poll callback should check. */ - BLI_assert((asset_library != NULL) && asset_handle_valid); + BLI_assert((asset_library_ref != NULL) && asset_handle_valid); PoseBlendData *pbd = op->customdata; pbd->temp_id_consumer = ED_asset_temp_id_consumer_create(&asset_handle); return (bAction *)ED_asset_temp_id_consumer_ensure_local_id( - pbd->temp_id_consumer, C, asset_library, ID_AC, CTX_data_main(C), op->reports); + pbd->temp_id_consumer, C, asset_library_ref, ID_AC, CTX_data_main(C), op->reports); } static bAction *flip_pose(bContext *C, Object *ob, bAction *action) @@ -540,10 +540,10 @@ static bool poselib_asset_in_context(bContext *C) { bool asset_handle_valid; /* Check whether the context provides the asset data needed to add a pose. */ - const AssetLibraryReference *asset_library = CTX_wm_asset_library(C); + const AssetLibraryReference *asset_library_ref = CTX_wm_asset_library_ref(C); AssetHandle asset_handle = CTX_wm_asset_handle(C, &asset_handle_valid); - return (asset_library != NULL) && asset_handle_valid && + return (asset_library_ref != NULL) && asset_handle_valid && (ED_asset_handle_get_id_type(&asset_handle) == ID_AC); } diff --git a/source/blender/editors/asset/ED_asset_handle.h b/source/blender/editors/asset/ED_asset_handle.h index c51ce422c25..efb99410d3d 100644 --- a/source/blender/editors/asset/ED_asset_handle.h +++ b/source/blender/editors/asset/ED_asset_handle.h @@ -36,7 +36,7 @@ struct ID *ED_asset_handle_get_local_id(const struct AssetHandle *asset); ID_Type ED_asset_handle_get_id_type(const struct AssetHandle *asset); int ED_asset_handle_get_preview_icon_id(const struct AssetHandle *asset); void ED_asset_handle_get_full_library_path(const struct bContext *C, - const struct AssetLibraryReference *asset_library, + const struct AssetLibraryReference *asset_library_ref, const struct AssetHandle *asset, char r_full_lib_path[]); diff --git a/source/blender/editors/asset/ED_asset_temp_id_consumer.h b/source/blender/editors/asset/ED_asset_temp_id_consumer.h index 9af08c5c52b..7c10d88262e 100644 --- a/source/blender/editors/asset/ED_asset_temp_id_consumer.h +++ b/source/blender/editors/asset/ED_asset_temp_id_consumer.h @@ -39,7 +39,7 @@ void ED_asset_temp_id_consumer_free(AssetTempIDConsumer **consumer); struct ID *ED_asset_temp_id_consumer_ensure_local_id( AssetTempIDConsumer *consumer, const struct bContext *C, - const struct AssetLibraryReference *asset_library, + const struct AssetLibraryReference *asset_library_ref, ID_Type id_type, struct Main *bmain, struct ReportList *reports); diff --git a/source/blender/editors/asset/intern/asset_handle.cc b/source/blender/editors/asset/intern/asset_handle.cc index aae85e61372..5c8d0b1349c 100644 --- a/source/blender/editors/asset/intern/asset_handle.cc +++ b/source/blender/editors/asset/intern/asset_handle.cc @@ -60,13 +60,13 @@ int ED_asset_handle_get_preview_icon_id(const AssetHandle *asset) } void ED_asset_handle_get_full_library_path(const bContext *C, - const AssetLibraryReference *asset_library, + const AssetLibraryReference *asset_library_ref, const AssetHandle *asset, char r_full_lib_path[FILE_MAX_LIBEXTRA]) { *r_full_lib_path = '\0'; - std::string asset_path = ED_assetlist_asset_filepath_get(C, *asset_library, *asset); + std::string asset_path = ED_assetlist_asset_filepath_get(C, *asset_library_ref, *asset); if (asset_path.empty()) { return; } diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc index 579803f7ff7..dc418a1b3d5 100644 --- a/source/blender/editors/asset/intern/asset_ops.cc +++ b/source/blender/editors/asset/intern/asset_ops.cc @@ -266,7 +266,7 @@ static void ASSET_OT_clear(wmOperatorType *ot) static bool asset_list_refresh_poll(bContext *C) { - const AssetLibraryReference *library = CTX_wm_asset_library(C); + const AssetLibraryReference *library = CTX_wm_asset_library_ref(C); if (!library) { return false; } @@ -276,7 +276,7 @@ static bool asset_list_refresh_poll(bContext *C) static int asset_list_refresh_exec(bContext *C, wmOperator *UNUSED(unused)) { - const AssetLibraryReference *library = CTX_wm_asset_library(C); + const AssetLibraryReference *library = CTX_wm_asset_library_ref(C); ED_assetlist_clear(library, C); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/asset/intern/asset_temp_id_consumer.cc b/source/blender/editors/asset/intern/asset_temp_id_consumer.cc index bed35fdeeb5..f664eab5cbb 100644 --- a/source/blender/editors/asset/intern/asset_temp_id_consumer.cc +++ b/source/blender/editors/asset/intern/asset_temp_id_consumer.cc @@ -60,14 +60,14 @@ class AssetTemporaryIDConsumer : NonCopyable, NonMovable { } ID *import_id(const bContext *C, - const AssetLibraryReference &asset_library, + const AssetLibraryReference &asset_library_ref, ID_Type id_type, Main &bmain, ReportList &reports) { const char *asset_name = ED_asset_handle_get_name(&handle_); char blend_file_path[FILE_MAX_LIBEXTRA]; - ED_asset_handle_get_full_library_path(C, &asset_library, &handle_, blend_file_path); + ED_asset_handle_get_full_library_path(C, &asset_library_ref, &handle_, blend_file_path); temp_lib_context_ = BLO_library_temp_load_id( &bmain, blend_file_path, id_type, asset_name, &reports); @@ -99,12 +99,12 @@ void ED_asset_temp_id_consumer_free(AssetTempIDConsumer **consumer) ID *ED_asset_temp_id_consumer_ensure_local_id(AssetTempIDConsumer *consumer_, const bContext *C, - const AssetLibraryReference *asset_library, + const AssetLibraryReference *asset_library_ref, ID_Type id_type, Main *bmain, ReportList *reports) { - if (!(consumer_ && asset_library && bmain && reports)) { + if (!(consumer_ && asset_library_ref && bmain && reports)) { return nullptr; } AssetTemporaryIDConsumer *consumer = reinterpret_cast<AssetTemporaryIDConsumer *>(consumer_); @@ -112,5 +112,5 @@ ID *ED_asset_temp_id_consumer_ensure_local_id(AssetTempIDConsumer *consumer_, if (ID *local_id = consumer->get_local_id()) { return local_id; } - return consumer->import_id(C, *asset_library, id_type, *bmain, *reports); + return consumer->import_id(C, *asset_library_ref, id_type, *bmain, *reports); } diff --git a/source/blender/editors/interface/interface_template_asset_view.cc b/source/blender/editors/interface/interface_template_asset_view.cc index b4ba6a7feab..9b601727e29 100644 --- a/source/blender/editors/interface/interface_template_asset_view.cc +++ b/source/blender/editors/interface/interface_template_asset_view.cc @@ -44,7 +44,7 @@ #include "interface_intern.h" struct AssetViewListData { - AssetLibraryReference asset_library; + AssetLibraryReference asset_library_ref; bScreen *screen; }; @@ -62,7 +62,7 @@ static void asset_view_item_but_drag_set(uiBut *but, /* Context can be null here, it's only needed for a File Browser specific hack that should go * away before too long. */ ED_asset_handle_get_full_library_path( - nullptr, &list_data->asset_library, asset_handle, blend_path); + nullptr, &list_data->asset_library_ref, asset_handle, blend_path); if (blend_path[0]) { ImBuf *imbuf = ED_assetlist_asset_image_get(asset_handle); @@ -136,7 +136,7 @@ static void asset_view_listener(uiList *ui_list, wmRegionListenerParams *params) } } - if (ED_assetlist_listen(&list_data->asset_library, params->notifier)) { + if (ED_assetlist_listen(&list_data->asset_library_ref, params->notifier)) { ED_region_tag_redraw(params->region); } } @@ -153,7 +153,7 @@ uiListType *UI_UL_asset_view() } static void asset_view_template_refresh_asset_collection( - const AssetLibraryReference &asset_library, + const AssetLibraryReference &asset_library_ref, const AssetFilterSettings &filter_settings, PointerRNA &assets_dataptr, const char *assets_propname) @@ -175,7 +175,7 @@ static void asset_view_template_refresh_asset_collection( RNA_property_collection_clear(&assets_dataptr, assets_prop); - ED_assetlist_iterate(&asset_library, [&](AssetHandle asset) { + ED_assetlist_iterate(&asset_library_ref, [&](AssetHandle asset) { if (!ED_asset_filter_matches_asset(&filter_settings, &asset)) { /* Don't do anything else, but return true to continue iterating. */ return true; @@ -216,25 +216,25 @@ void uiTemplateAssetView(uiLayout *layout, PropertyRNA *asset_library_prop = RNA_struct_find_property(asset_library_dataptr, asset_library_propname); - AssetLibraryReference asset_library = ED_asset_library_reference_from_enum_value( + AssetLibraryReference asset_library_ref = ED_asset_library_reference_from_enum_value( RNA_property_enum_get(asset_library_dataptr, asset_library_prop)); uiLayout *row = uiLayoutRow(col, true); uiItemFullR(row, asset_library_dataptr, asset_library_prop, RNA_NO_INDEX, 0, 0, "", 0); - if (asset_library.type != ASSET_LIBRARY_LOCAL) { + if (asset_library_ref.type != ASSET_LIBRARY_LOCAL) { uiItemO(row, "", ICON_FILE_REFRESH, "ASSET_OT_list_refresh"); } - ED_assetlist_storage_fetch(&asset_library, C); - ED_assetlist_ensure_previews_job(&asset_library, C); - const int tot_items = ED_assetlist_size(&asset_library); + ED_assetlist_storage_fetch(&asset_library_ref, C); + ED_assetlist_ensure_previews_job(&asset_library_ref, C); + const int tot_items = ED_assetlist_size(&asset_library_ref); asset_view_template_refresh_asset_collection( - asset_library, *filter_settings, *assets_dataptr, assets_propname); + asset_library_ref, *filter_settings, *assets_dataptr, assets_propname); AssetViewListData *list_data = (AssetViewListData *)MEM_mallocN(sizeof(*list_data), "AssetViewListData"); - list_data->asset_library = asset_library; + list_data->asset_library_ref = asset_library_ref; list_data->screen = CTX_wm_screen(C); /* TODO can we have some kind of model-view API to handle referencing, filtering and lazy loading diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 8123d8bb104..b0181de96a0 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -113,7 +113,7 @@ const char *screen_context_dir[] = { "active_editable_fcurve", "selected_editable_keyframes", "ui_list", - "asset_library", + "asset_library_ref", NULL, }; @@ -1031,7 +1031,7 @@ static eContextResult screen_ctx_asset_library(const bContext *C, bContextDataRe { WorkSpace *workspace = CTX_wm_workspace(C); CTX_data_pointer_set( - result, &workspace->id, &RNA_AssetLibraryReference, &workspace->asset_library); + result, &workspace->id, &RNA_AssetLibraryReference, &workspace->asset_library_ref); return CTX_RESULT_OK; } @@ -1118,7 +1118,7 @@ static void ensure_ed_screen_context_functions(void) register_context_function("selected_visible_fcurves", screen_ctx_selected_visible_fcurves); register_context_function("active_editable_fcurve", screen_ctx_active_editable_fcurve); register_context_function("selected_editable_keyframes", screen_ctx_selected_editable_keyframes); - register_context_function("asset_library", screen_ctx_asset_library); + register_context_function("asset_library_ref", screen_ctx_asset_library); register_context_function("ui_list", screen_ctx_ui_list); } diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 7d9b8583838..9a46579780e 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -1106,7 +1106,7 @@ bool file_draw_hint_if_invalid(const SpaceFile *sfile, const ARegion *region) return false; } /* Check if the library exists. */ - if ((asset_params->asset_library.type == ASSET_LIBRARY_LOCAL) || + if ((asset_params->asset_library_ref.type == ASSET_LIBRARY_LOCAL) || filelist_is_dir(sfile->files, asset_params->base_params.dir)) { return false; } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 630c9aed157..4eb58642bba 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -384,7 +384,7 @@ typedef struct FileList { eFileSelectType type; /* The library this list was created for. Stored here so we know when to re-read. */ - AssetLibraryReference *asset_library; + AssetLibraryReference *asset_library_ref; short flags; @@ -1065,28 +1065,28 @@ static bool filelist_compare_asset_libraries(const AssetLibraryReference *librar } /** - * \param asset_library: May be NULL to unset the library. + * \param asset_library_ref: May be NULL to unset the library. */ -void filelist_setlibrary(FileList *filelist, const AssetLibraryReference *asset_library) +void filelist_setlibrary(FileList *filelist, const AssetLibraryReference *asset_library_ref) { /* Unset if needed. */ - if (!asset_library) { - if (filelist->asset_library) { - MEM_SAFE_FREE(filelist->asset_library); + if (!asset_library_ref) { + if (filelist->asset_library_ref) { + MEM_SAFE_FREE(filelist->asset_library_ref); filelist->flags |= FL_FORCE_RESET; } return; } - if (!filelist->asset_library) { - filelist->asset_library = MEM_mallocN(sizeof(*filelist->asset_library), - "filelist asset library"); - *filelist->asset_library = *asset_library; + if (!filelist->asset_library_ref) { + filelist->asset_library_ref = MEM_mallocN(sizeof(*filelist->asset_library_ref), + "filelist asset library"); + *filelist->asset_library_ref = *asset_library_ref; filelist->flags |= FL_FORCE_RESET; } - else if (!filelist_compare_asset_libraries(filelist->asset_library, asset_library)) { - *filelist->asset_library = *asset_library; + else if (!filelist_compare_asset_libraries(filelist->asset_library_ref, asset_library_ref)) { + *filelist->asset_library_ref = *asset_library_ref; filelist->flags |= FL_FORCE_RESET; } } @@ -1791,7 +1791,7 @@ void filelist_free(struct FileList *filelist) filelist->selection_state = NULL; } - MEM_SAFE_FREE(filelist->asset_library); + MEM_SAFE_FREE(filelist->asset_library_ref); memset(&filelist->filter_data, 0, sizeof(filelist->filter_data)); @@ -1867,7 +1867,7 @@ bool filelist_is_dir(struct FileList *filelist, const char *path) */ void filelist_setdir(struct FileList *filelist, char *r_dir) { - const bool allow_invalid = filelist->asset_library != NULL; + const bool allow_invalid = filelist->asset_library_ref != NULL; BLI_assert(strlen(r_dir) < FILE_MAX_LIBEXTRA); BLI_path_normalize_dir(BKE_main_blendfile_path_from_global(), r_dir); @@ -3381,7 +3381,7 @@ static void filelist_readjob_startjob(void *flrjv, short *stop, short *do_update flrj->tmp_filelist->libfiledata = NULL; memset(&flrj->tmp_filelist->filelist_cache, 0, sizeof(flrj->tmp_filelist->filelist_cache)); flrj->tmp_filelist->selection_state = NULL; - flrj->tmp_filelist->asset_library = NULL; + flrj->tmp_filelist->asset_library_ref = NULL; BLI_mutex_unlock(&flrj->lock); diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index 6915e853681..d67cd89200b 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -73,7 +73,7 @@ void filelist_setfilter_options(struct FileList *filelist, const char *filter_search); void filelist_filter(struct FileList *filelist); void filelist_setlibrary(struct FileList *filelist, - const struct AssetLibraryReference *asset_library); + const struct AssetLibraryReference *asset_library_ref); void filelist_init_icons(void); void filelist_free_icons(void); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 89142b6669b..72e7e0716db 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -118,8 +118,8 @@ static void fileselect_ensure_updated_asset_params(SpaceFile *sfile) asset_params = sfile->asset_params = MEM_callocN(sizeof(*asset_params), "FileAssetSelectParams"); asset_params->base_params.details_flags = U_default.file_space_data.details_flags; - asset_params->asset_library.type = ASSET_LIBRARY_LOCAL; - asset_params->asset_library.custom_library_index = -1; + asset_params->asset_library_ref.type = ASSET_LIBRARY_LOCAL; + asset_params->asset_library_ref.custom_library_index = -1; asset_params->import_type = FILE_ASSET_IMPORT_APPEND; } @@ -415,7 +415,7 @@ FileAssetSelectParams *ED_fileselect_get_asset_params(const SpaceFile *sfile) static void fileselect_refresh_asset_params(FileAssetSelectParams *asset_params) { - AssetLibraryReference *library = &asset_params->asset_library; + AssetLibraryReference *library = &asset_params->asset_library_ref; FileSelectParams *base_params = &asset_params->base_params; bUserAssetLibrary *user_library = NULL; diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 756fc179e31..0b3349f5751 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -338,7 +338,7 @@ static void file_refresh(const bContext *C, ScrArea *area) filelist_setdir(sfile->files, params->dir); filelist_setrecursion(sfile->files, params->recursion_level); filelist_setsorting(sfile->files, params->sort, params->flag & FILE_SORT_INVERT); - filelist_setlibrary(sfile->files, asset_params ? &asset_params->asset_library : NULL); + filelist_setlibrary(sfile->files, asset_params ? &asset_params->asset_library_ref : NULL); filelist_setfilter_options( sfile->files, (params->flag & FILE_FILTER) != 0, @@ -863,7 +863,7 @@ static void file_space_subtype_item_extend(bContext *UNUSED(C), static const char *file_context_dir[] = { "active_file", - "asset_library", + "asset_library_ref", "id", NULL, }; @@ -897,14 +897,14 @@ static int /*eContextResult*/ file_context(const bContext *C, CTX_data_pointer_set(result, &screen->id, &RNA_FileSelectEntry, file); return CTX_RESULT_OK; } - if (CTX_data_equals(member, "asset_library")) { + if (CTX_data_equals(member, "asset_library_ref")) { FileAssetSelectParams *asset_params = ED_fileselect_get_asset_params(sfile); if (!asset_params) { return CTX_RESULT_NO_DATA; } CTX_data_pointer_set( - result, &screen->id, &RNA_AssetLibraryReference, &asset_params->asset_library); + result, &screen->id, &RNA_AssetLibraryReference, &asset_params->asset_library_ref); return CTX_RESULT_OK; } if (CTX_data_equals(member, "id")) { diff --git a/source/blender/makesdna/DNA_asset_types.h b/source/blender/makesdna/DNA_asset_types.h index ca16e6728dd..2975915eccd 100644 --- a/source/blender/makesdna/DNA_asset_types.h +++ b/source/blender/makesdna/DNA_asset_types.h @@ -81,7 +81,7 @@ typedef enum eAssetLibraryType { // ASSET_LIBRARY_PROJECT = 2, /** Display assets from custom asset libraries, as defined in the preferences - * (#bUserAssetLibrary). The name will be taken from #FileSelectParams.asset_library.idname + * (#bUserAssetLibrary). The name will be taken from #FileSelectParams.asset_library_ref.idname * then. * In RNA, we add the index of the custom library to this to identify it by index. So keep * this last! */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 27d5d83c7cb..863c53615c1 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -763,7 +763,7 @@ typedef struct FileSelectParams { typedef struct FileAssetSelectParams { FileSelectParams base_params; - AssetLibraryReference asset_library; + AssetLibraryReference asset_library_ref; short import_type; /* eFileAssetImportType */ char _pad[6]; diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h index 2bac040ea90..e0294d3534c 100644 --- a/source/blender/makesdna/DNA_workspace_types.h +++ b/source/blender/makesdna/DNA_workspace_types.h @@ -139,7 +139,7 @@ typedef struct WorkSpace { /** Workspace-wide active asset library, for asset UIs to use (e.g. asset view UI template). The * Asset Browser has its own and doesn't use this. */ - AssetLibraryReference asset_library; + AssetLibraryReference asset_library_ref; } WorkSpace; /** diff --git a/source/blender/makesrna/intern/rna_asset.c b/source/blender/makesrna/intern/rna_asset.c index 80b2594d0c9..3b3a04e1128 100644 --- a/source/blender/makesrna/intern/rna_asset.c +++ b/source/blender/makesrna/intern/rna_asset.c @@ -273,7 +273,7 @@ static void rna_def_asset_handle_api(StructRNA *srna) parm = RNA_def_pointer(func, "asset_file_handle", "FileSelectEntry", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, - "asset_library", + "asset_library_ref", "AssetLibraryReference", "", "The asset library containing the given asset, only valid if the asset " @@ -329,7 +329,7 @@ PropertyRNA *rna_def_asset_library_reference_common(struct StructRNA *srna, const char *get, const char *set) { - PropertyRNA *prop = RNA_def_property(srna, "asset_library", PROP_ENUM, PROP_NONE); + PropertyRNA *prop = RNA_def_property(srna, "asset_library_ref", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, DummyRNA_NULL_items); RNA_def_property_enum_funcs(prop, get, set, "rna_asset_library_reference_itemf"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index c7a5c43255a..8c62484f229 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2582,13 +2582,13 @@ static int rna_FileAssetSelectParams_asset_library_get(PointerRNA *ptr) /* Just an extra sanity check to ensure this isn't somehow called for RNA_FileSelectParams. */ BLI_assert(ptr->type == &RNA_FileAssetSelectParams); - return ED_asset_library_reference_to_enum_value(¶ms->asset_library); + return ED_asset_library_reference_to_enum_value(¶ms->asset_library_ref); } static void rna_FileAssetSelectParams_asset_library_set(PointerRNA *ptr, int value) { FileAssetSelectParams *params = ptr->data; - params->asset_library = ED_asset_library_reference_from_enum_value(value); + params->asset_library_ref = ED_asset_library_reference_from_enum_value(value); } static void rna_FileAssetSelectParams_asset_category_set(PointerRNA *ptr, uint64_t value) diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index 95f62d7de16..d76ad254140 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -112,13 +112,13 @@ static void rna_WorkSpace_owner_ids_clear(WorkSpace *workspace) static int rna_WorkSpace_asset_library_get(PointerRNA *ptr) { const WorkSpace *workspace = ptr->data; - return ED_asset_library_reference_to_enum_value(&workspace->asset_library); + return ED_asset_library_reference_to_enum_value(&workspace->asset_library_ref); } static void rna_WorkSpace_asset_library_set(PointerRNA *ptr, int value) { WorkSpace *workspace = ptr->data; - workspace->asset_library = ED_asset_library_reference_from_enum_value(value); + workspace->asset_library_ref = ED_asset_library_reference_from_enum_value(value); } static bToolRef *rna_WorkSpace_tools_from_tkey(WorkSpace *workspace, |