From 8ad2642c4717dcfad31626f7eebac325a9827b73 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 13 Dec 2021 16:22:19 +1100 Subject: Cleanup: use "filepath" term for Main, BlendFileData & FileGlobal Use "filepath" which is the current convention for naming full paths. - Main use "name" which isn't obviously a file path. - BlendFileData & FileGlobal used "filename" which is often used for the name component of a path (without the directory). --- source/blender/editors/asset/intern/asset_catalog.cc | 2 +- source/blender/editors/asset/intern/asset_ops.cc | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/asset/intern') diff --git a/source/blender/editors/asset/intern/asset_catalog.cc b/source/blender/editors/asset/intern/asset_catalog.cc index 787593d0a16..f6c02f86f0a 100644 --- a/source/blender/editors/asset/intern/asset_catalog.cc +++ b/source/blender/editors/asset/intern/asset_catalog.cc @@ -173,7 +173,7 @@ void ED_asset_catalogs_save_from_main_path(::AssetLibrary *library, const Main * /* Since writing to disk also means loading any on-disk changes, it may be a good idea to store * an undo step. */ catalog_service->undo_push(); - catalog_service->write_to_disk(bmain->name); + catalog_service->write_to_disk(bmain->filepath); } void ED_asset_catalogs_set_save_catalogs_when_file_is_saved(const bool should_save) diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc index 4fec6e3d055..e4edff19a21 100644 --- a/source/blender/editors/asset/intern/asset_ops.cc +++ b/source/blender/editors/asset/intern/asset_ops.cc @@ -637,7 +637,7 @@ static bool asset_catalogs_save_poll(bContext *C) } const Main *bmain = CTX_data_main(C); - if (!bmain->name[0]) { + if (!bmain->filepath[0]) { CTX_wm_operator_poll_msg_set(C, "Cannot save asset catalogs before the Blender file is saved"); return false; } @@ -703,7 +703,7 @@ static bool asset_bundle_install_poll(bContext *C) /* Check whether this file is already located inside any asset library. */ const struct bUserAssetLibrary *asset_lib = BKE_preferences_asset_library_containing_path( - &U, bmain->name); + &U, bmain->filepath); if (asset_lib) { return false; } @@ -779,7 +779,7 @@ static int asset_bundle_install_exec(bContext *C, wmOperator *op) BKE_reportf(op->reports, RPT_INFO, R"(Saved "%s" to asset library "%s")", - BLI_path_basename(bmain->name), + BLI_path_basename(bmain->filepath), lib->name); return OPERATOR_FINISHED; } @@ -830,7 +830,7 @@ static void ASSET_OT_bundle_install(struct wmOperatorType *ot) * referenced. */ static bool could_be_asset_bundle(const Main *bmain) { - return fnmatch("*_bundle.blend", bmain->name, FNM_CASEFOLD) == 0; + return fnmatch("*_bundle.blend", bmain->filepath, FNM_CASEFOLD) == 0; } static const bUserAssetLibrary *selected_asset_library(struct wmOperator *op) @@ -864,7 +864,7 @@ static bool set_filepath_for_asset_lib(const Main *bmain, struct wmOperator *op) } /* Concatenate the filename of the current blend file. */ - const char *blend_filename = BLI_path_basename(bmain->name); + const char *blend_filename = BLI_path_basename(bmain->filepath); if (blend_filename == nullptr || blend_filename[0] == '\0') { return false; } -- cgit v1.2.3