diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-12-13 08:22:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-12-13 08:22:19 +0300 |
commit | 8ad2642c4717dcfad31626f7eebac325a9827b73 (patch) | |
tree | 2d2ba09f1cd3849adb45eb51a590783a5a9eca02 /source/blender/editors | |
parent | 27231afce5e4d0832113415f4d3cdeed480b165f (diff) |
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).
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/armature/pose_transform.c | 4 | ||||
-rw-r--r-- | source/blender/editors/asset/intern/asset_catalog.cc | 2 | ||||
-rw-r--r-- | source/blender/editors/asset/intern/asset_ops.cc | 10 | ||||
-rw-r--r-- | source/blender/editors/render/render_preview.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/workspace_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_ops.c | 4 |
6 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 70d6fa93104..7c52e4fafdd 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -787,7 +787,7 @@ static int pose_copy_exec(bContext *C, wmOperator *op) * any datablock expansion? */ Main *temp_bmain = BKE_main_new(); - STRNCPY(temp_bmain->name, BKE_main_blendfile_path_from_global()); + STRNCPY(temp_bmain->filepath, BKE_main_blendfile_path_from_global()); Object ob_copy = *ob; ob_copy.adt = NULL; @@ -856,7 +856,7 @@ static int pose_paste_exec(bContext *C, wmOperator *op) /* Read copy buffer .blend file. */ char str[FILE_MAX]; Main *tmp_bmain = BKE_main_new(); - STRNCPY(tmp_bmain->name, BKE_main_blendfile_path_from_global()); + STRNCPY(tmp_bmain->filepath, BKE_main_blendfile_path_from_global()); BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer_pose.blend"); if (!BKE_copybuffer_read(tmp_bmain, str, op->reports, FILTER_ID_OB)) { 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; } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index c37d7131347..e1121aa4b1e 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -461,7 +461,7 @@ static Scene *preview_prepare_scene( Scene *sce; Main *pr_main = sp->pr_main; - memcpy(pr_main->name, BKE_main_blendfile_path(bmain), sizeof(pr_main->name)); + memcpy(pr_main->filepath, BKE_main_blendfile_path(bmain), sizeof(pr_main->filepath)); sce = preview_get_scene(pr_main); if (sce) { diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 333a1fae99a..125b345a1ed 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -373,7 +373,7 @@ static void workspace_append_button(uiLayout *layout, const Main *from_main) { const ID *id = (ID *)workspace; - const char *filepath = from_main->name; + const char *filepath = from_main->filepath; if (strlen(filepath) == 0) { filepath = BLO_EMBEDDED_STARTUP_BLEND; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index b1f8949871b..57fa54582dd 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -209,7 +209,7 @@ static int open_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "directory", dir_only); if (relative) { - BLI_path_rel(dir_only, bmain->name); + BLI_path_rel(dir_only, bmain->filepath); } prop = RNA_struct_find_property(op->ptr, "files"); @@ -285,7 +285,7 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event) if (clip) { BLI_strncpy(path, clip->filepath, sizeof(path)); - BLI_path_abs(path, CTX_data_main(C)->name); + BLI_path_abs(path, CTX_data_main(C)->filepath); BLI_path_parent_dir(path); } else { |