From 974d70918b582cff41b12b29105a0f85786b27fe Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 19 Sep 2023 16:27:07 +0200 Subject: [PATCH] RNA/BPY: Replace `asset_library_ref` with `asset_library_reference` This is a compatibility breaking change to rename all usages of the name `asset_library_ref` with `asset_library_reference`. Brecht recently suggested that such abbreviations should be avoided in public API names. --- scripts/startup/bl_ui/space_filebrowser.py | 2 +- source/blender/blenkernel/intern/context.cc | 2 +- source/blender/editors/asset/intern/asset_ops.cc | 6 +++--- source/blender/editors/asset/intern/asset_shelf.cc | 4 ++-- source/blender/editors/screen/screen_context.cc | 4 ++-- source/blender/editors/space_file/file_context.cc | 4 ++-- source/blender/editors/space_file/file_panels.cc | 4 ++-- source/blender/makesrna/intern/rna_asset.cc | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/startup/bl_ui/space_filebrowser.py b/scripts/startup/bl_ui/space_filebrowser.py index 995722b1093..d45ae30af86 100644 --- a/scripts/startup/bl_ui/space_filebrowser.py +++ b/scripts/startup/bl_ui/space_filebrowser.py @@ -24,7 +24,7 @@ class FILEBROWSER_HT_header(Header): layout.separator_spacer() - if params.asset_library_ref not in {'LOCAL', 'ESSENTIALS'}: + if params.asset_library_reference not in {'LOCAL', 'ESSENTIALS'}: layout.prop(params, "import_type", text="") layout.separator_spacer() diff --git a/source/blender/blenkernel/intern/context.cc b/source/blender/blenkernel/intern/context.cc index fc1759c755c..005df9a7c9c 100644 --- a/source/blender/blenkernel/intern/context.cc +++ b/source/blender/blenkernel/intern/context.cc @@ -1484,7 +1484,7 @@ bool CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list) const AssetLibraryReference *CTX_wm_asset_library_ref(const bContext *C) { - return static_cast(ctx_data_pointer_get(C, "asset_library_ref")); + return static_cast(ctx_data_pointer_get(C, "asset_library_reference")); } static AssetHandle ctx_wm_asset_handle(const bContext *C, bool *r_is_valid) diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc index 7315b8cd763..981d6ef8728 100644 --- a/source/blender/editors/asset/intern/asset_ops.cc +++ b/source/blender/editors/asset/intern/asset_ops.cc @@ -817,7 +817,7 @@ static void ASSET_OT_bundle_install(wmOperatorType *ot) ot->invoke = asset_bundle_install_invoke; ot->poll = asset_bundle_install_poll; - ot->prop = RNA_def_property(ot->srna, "asset_library_ref", PROP_ENUM, PROP_NONE); + ot->prop = RNA_def_property(ot->srna, "asset_library_reference", PROP_ENUM, PROP_NONE); RNA_def_property_flag(ot->prop, PROP_HIDDEN); RNA_def_enum_funcs(ot->prop, rna_asset_library_reference_itemf); @@ -840,7 +840,7 @@ static bool could_be_asset_bundle(const Main *bmain) static const bUserAssetLibrary *selected_asset_library(wmOperator *op) { - const int enum_value = RNA_enum_get(op->ptr, "asset_library_ref"); + const int enum_value = RNA_enum_get(op->ptr, "asset_library_reference"); const AssetLibraryReference lib_ref = ED_asset_library_reference_from_enum_value(enum_value); const bUserAssetLibrary *lib = BKE_preferences_asset_library_find_index( &U, lib_ref.custom_library_index); @@ -857,7 +857,7 @@ static bool is_contained_in_selected_asset_library(wmOperator *op, const char *f } /** - * Set the "filepath" RNA property based on selected "asset_library_ref". + * Set the "filepath" RNA property based on selected "asset_library_reference". * \return true if ok, false if error. */ static bool set_filepath_for_asset_lib(const Main *bmain, wmOperator *op) diff --git a/source/blender/editors/asset/intern/asset_shelf.cc b/source/blender/editors/asset/intern/asset_shelf.cc index a5df7bd16c8..e87e5acd170 100644 --- a/source/blender/editors/asset/intern/asset_shelf.cc +++ b/source/blender/editors/asset/intern/asset_shelf.cc @@ -508,7 +508,7 @@ int ED_asset_shelf_context(const bContext *C, const char *member, bContextDataRe { static const char *context_dir[] = { "asset_shelf", - "asset_library_ref", + "asset_library_reference", "active_file", /* XXX yuk... */ nullptr, }; @@ -544,7 +544,7 @@ int ED_asset_shelf_context(const bContext *C, const char *member, bContextDataRe return CTX_RESULT_OK; } - if (CTX_data_equals(member, "asset_library_ref")) { + if (CTX_data_equals(member, "asset_library_reference")) { CTX_data_pointer_set(result, &screen->id, &RNA_AssetLibraryReference, diff --git a/source/blender/editors/screen/screen_context.cc b/source/blender/editors/screen/screen_context.cc index 1d0fafdb1d3..af2624e2387 100644 --- a/source/blender/editors/screen/screen_context.cc +++ b/source/blender/editors/screen/screen_context.cc @@ -114,7 +114,7 @@ const char *screen_context_dir[] = { "selected_editable_keyframes", "ui_list", "property", - "asset_library_ref", + "asset_library_reference", nullptr, }; @@ -1380,7 +1380,7 @@ static void ensure_ed_screen_context_functions() 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_ref", screen_ctx_asset_library); + register_context_function("asset_library_reference", screen_ctx_asset_library); register_context_function("ui_list", screen_ctx_ui_list); register_context_function("property", screen_ctx_property); } diff --git a/source/blender/editors/space_file/file_context.cc b/source/blender/editors/space_file/file_context.cc index 08148f6e3d5..61f20aee9de 100644 --- a/source/blender/editors/space_file/file_context.cc +++ b/source/blender/editors/space_file/file_context.cc @@ -19,7 +19,7 @@ const char *file_context_dir[] = { "active_file", "selected_files", - "asset_library_ref", + "asset_library_reference", "selected_assets", "id", "selected_ids", @@ -69,7 +69,7 @@ int /*eContextResult*/ file_context(const bContext *C, return CTX_RESULT_OK; } - if (CTX_data_equals(member, "asset_library_ref")) { + if (CTX_data_equals(member, "asset_library_reference")) { FileAssetSelectParams *asset_params = ED_fileselect_get_asset_params(sfile); if (!asset_params) { return CTX_RESULT_NO_DATA; diff --git a/source/blender/editors/space_file/file_panels.cc b/source/blender/editors/space_file/file_panels.cc index c1390f49f85..6505b4853a7 100644 --- a/source/blender/editors/space_file/file_panels.cc +++ b/source/blender/editors/space_file/file_panels.cc @@ -234,7 +234,7 @@ static void file_panel_asset_catalog_buttons_draw(const bContext *C, Panel *pane PointerRNA params_ptr = RNA_pointer_create(&screen->id, &RNA_FileAssetSelectParams, params); - uiItemR(row, ¶ms_ptr, "asset_library_ref", UI_ITEM_NONE, "", ICON_NONE); + uiItemR(row, ¶ms_ptr, "asset_library_reference", UI_ITEM_NONE, "", ICON_NONE); if (params->asset_library_ref.type == ASSET_LIBRARY_LOCAL) { bContext *mutable_ctx = CTX_copy(C); if (WM_operator_name_poll(mutable_ctx, "asset.bundle_install")) { @@ -242,7 +242,7 @@ static void file_panel_asset_catalog_buttons_draw(const bContext *C, Panel *pane uiItemMenuEnumO(col, C, "asset.bundle_install", - "asset_library_ref", + "asset_library_reference", "Copy Bundle to Asset Library...", ICON_IMPORT); } diff --git a/source/blender/makesrna/intern/rna_asset.cc b/source/blender/makesrna/intern/rna_asset.cc index 0e5c18fd208..cf5305eaa14 100644 --- a/source/blender/makesrna/intern/rna_asset.cc +++ b/source/blender/makesrna/intern/rna_asset.cc @@ -675,7 +675,7 @@ PropertyRNA *rna_def_asset_library_reference_common(StructRNA *srna, const char *get, const char *set) { - PropertyRNA *prop = RNA_def_property(srna, "asset_library_ref", PROP_ENUM, PROP_NONE); + PropertyRNA *prop = RNA_def_property(srna, "asset_library_reference", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_enum_dummy_NULL_items); RNA_def_property_enum_funcs(prop, get, set, "rna_asset_library_reference_itemf");