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.
This commit is contained in:
Julian Eisel
2023-09-19 16:27:07 +02:00
parent ca58f97cda
commit 974d70918b
8 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ class FILEBROWSER_HT_header(Header):
layout.separator_spacer() 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.prop(params, "import_type", text="")
layout.separator_spacer() layout.separator_spacer()
+1 -1
View File
@@ -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) const AssetLibraryReference *CTX_wm_asset_library_ref(const bContext *C)
{ {
return static_cast<AssetLibraryReference *>(ctx_data_pointer_get(C, "asset_library_ref")); return static_cast<AssetLibraryReference *>(ctx_data_pointer_get(C, "asset_library_reference"));
} }
static AssetHandle ctx_wm_asset_handle(const bContext *C, bool *r_is_valid) static AssetHandle ctx_wm_asset_handle(const bContext *C, bool *r_is_valid)
@@ -817,7 +817,7 @@ static void ASSET_OT_bundle_install(wmOperatorType *ot)
ot->invoke = asset_bundle_install_invoke; ot->invoke = asset_bundle_install_invoke;
ot->poll = asset_bundle_install_poll; 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_property_flag(ot->prop, PROP_HIDDEN);
RNA_def_enum_funcs(ot->prop, rna_asset_library_reference_itemf); 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) 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 AssetLibraryReference lib_ref = ED_asset_library_reference_from_enum_value(enum_value);
const bUserAssetLibrary *lib = BKE_preferences_asset_library_find_index( const bUserAssetLibrary *lib = BKE_preferences_asset_library_find_index(
&U, lib_ref.custom_library_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. * \return true if ok, false if error.
*/ */
static bool set_filepath_for_asset_lib(const Main *bmain, wmOperator *op) static bool set_filepath_for_asset_lib(const Main *bmain, wmOperator *op)
@@ -508,7 +508,7 @@ int ED_asset_shelf_context(const bContext *C, const char *member, bContextDataRe
{ {
static const char *context_dir[] = { static const char *context_dir[] = {
"asset_shelf", "asset_shelf",
"asset_library_ref", "asset_library_reference",
"active_file", /* XXX yuk... */ "active_file", /* XXX yuk... */
nullptr, nullptr,
}; };
@@ -544,7 +544,7 @@ int ED_asset_shelf_context(const bContext *C, const char *member, bContextDataRe
return CTX_RESULT_OK; 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, CTX_data_pointer_set(result,
&screen->id, &screen->id,
&RNA_AssetLibraryReference, &RNA_AssetLibraryReference,
@@ -114,7 +114,7 @@ const char *screen_context_dir[] = {
"selected_editable_keyframes", "selected_editable_keyframes",
"ui_list", "ui_list",
"property", "property",
"asset_library_ref", "asset_library_reference",
nullptr, 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("selected_visible_fcurves", screen_ctx_selected_visible_fcurves);
register_context_function("active_editable_fcurve", screen_ctx_active_editable_fcurve); 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("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("ui_list", screen_ctx_ui_list);
register_context_function("property", screen_ctx_property); register_context_function("property", screen_ctx_property);
} }
@@ -19,7 +19,7 @@
const char *file_context_dir[] = { const char *file_context_dir[] = {
"active_file", "active_file",
"selected_files", "selected_files",
"asset_library_ref", "asset_library_reference",
"selected_assets", "selected_assets",
"id", "id",
"selected_ids", "selected_ids",
@@ -69,7 +69,7 @@ int /*eContextResult*/ file_context(const bContext *C,
return CTX_RESULT_OK; 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); FileAssetSelectParams *asset_params = ED_fileselect_get_asset_params(sfile);
if (!asset_params) { if (!asset_params) {
return CTX_RESULT_NO_DATA; return CTX_RESULT_NO_DATA;
@@ -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); PointerRNA params_ptr = RNA_pointer_create(&screen->id, &RNA_FileAssetSelectParams, params);
uiItemR(row, &params_ptr, "asset_library_ref", UI_ITEM_NONE, "", ICON_NONE); uiItemR(row, &params_ptr, "asset_library_reference", UI_ITEM_NONE, "", ICON_NONE);
if (params->asset_library_ref.type == ASSET_LIBRARY_LOCAL) { if (params->asset_library_ref.type == ASSET_LIBRARY_LOCAL) {
bContext *mutable_ctx = CTX_copy(C); bContext *mutable_ctx = CTX_copy(C);
if (WM_operator_name_poll(mutable_ctx, "asset.bundle_install")) { 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, uiItemMenuEnumO(col,
C, C,
"asset.bundle_install", "asset.bundle_install",
"asset_library_ref", "asset_library_reference",
"Copy Bundle to Asset Library...", "Copy Bundle to Asset Library...",
ICON_IMPORT); ICON_IMPORT);
} }
+1 -1
View File
@@ -675,7 +675,7 @@ PropertyRNA *rna_def_asset_library_reference_common(StructRNA *srna,
const char *get, const char *get,
const char *set) 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_items(prop, rna_enum_dummy_NULL_items);
RNA_def_property_enum_funcs(prop, get, set, "rna_asset_library_reference_itemf"); RNA_def_property_enum_funcs(prop, get, set, "rna_asset_library_reference_itemf");