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 | |
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')
28 files changed, 69 insertions, 67 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 630db07e4d9..1464a905c80 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -50,12 +50,12 @@ typedef struct Global { /** Last used location for library link/append. */ char lib[1024]; - /** When set: `G_MAIN->name` contains valid relative base path. */ + /** When set: `G_MAIN->filepath` contains valid relative base path. */ bool relbase_valid; /** * When set: - * - Saving writes to `G_MAIN->name` without prompting for a file-path. - * - The title-bar displays `G_MAIN->name`. + * - Saving writes to `G_MAIN->filepath` without prompting for a file-path. + * - The title-bar displays `G_MAIN->filepath`. */ bool save_over; diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 0976671c64c..df5c542db1e 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -116,12 +116,13 @@ enum { typedef struct Main { struct Main *next, *prev; - char name[1024]; /* 1024 = FILE_MAX */ + char filepath[1024]; /* 1024 = FILE_MAX */ short versionfile, subversionfile; /* see BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION */ short minversionfile, minsubversionfile; uint64_t build_commit_timestamp; /* commit's timestamp from buildinfo */ char build_hash[16]; /* hash from buildinfo */ - char recovered; /* indicate the main->name (file) is the recovered one */ + /** Indicate the #Main.filepath (file) is the recovered one. */ + char recovered; /** All current ID's exist in the last memfile undo step. */ char is_memfile_undo_written; /** diff --git a/source/blender/blenkernel/intern/asset_library.cc b/source/blender/blenkernel/intern/asset_library.cc index 68e43852a21..74de9b93c25 100644 --- a/source/blender/blenkernel/intern/asset_library.cc +++ b/source/blender/blenkernel/intern/asset_library.cc @@ -71,7 +71,7 @@ bool BKE_asset_library_find_suitable_root_path_from_path(const char *input_path, bool BKE_asset_library_find_suitable_root_path_from_main(const Main *bmain, char *r_library_path) { - return BKE_asset_library_find_suitable_root_path_from_path(bmain->name, r_library_path); + return BKE_asset_library_find_suitable_root_path_from_path(bmain->filepath, r_library_path); } blender::bke::AssetCatalogService *BKE_asset_library_get_catalog_service( @@ -168,7 +168,7 @@ void AssetLibrary::on_blend_save_post(struct Main *main, } if (save_catalogs_when_file_is_saved) { - this->catalog_service->write_to_disk(main->name); + this->catalog_service->write_to_disk(main->filepath); } } diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index 411ece21599..6c443a94def 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -68,7 +68,7 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu, bContext *C) { Main *bmain = CTX_data_main(C); - char mainstr[sizeof(bmain->name)]; + char mainstr[sizeof(bmain->filepath)]; int success = 0, fileflags; BLI_strncpy(mainstr, BKE_main_blendfile_path(bmain), sizeof(mainstr)); /* temporal store */ @@ -101,7 +101,7 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu, /* Restore, bmain has been re-allocated. */ bmain = CTX_data_main(C); - BLI_strncpy(bmain->name, mainstr, sizeof(bmain->name)); + STRNCPY(bmain->filepath, mainstr); G.fileflags = fileflags; if (success) { diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 5ba25d603b8..6ae19c8036f 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -360,12 +360,12 @@ static void setup_app_data(bContext *C, /* startup.blend or recovered startup */ if (is_startup) { - bmain->name[0] = '\0'; + bmain->filepath[0] = '\0'; } else if (recover) { - /* In case of autosave or quit.blend, use original filename instead. */ + /* In case of autosave or quit.blend, use original filepath instead. */ bmain->recovered = 1; - BLI_strncpy(bmain->name, bfd->filename, FILE_MAX); + STRNCPY(bmain->filepath, bfd->filepath); } /* baseflags, groups, make depsgraph, etc */ @@ -858,8 +858,8 @@ bool BKE_blendfile_write_partial(Main *bmain_src, BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE); /* This is needed to be able to load that file as a real one later - * (otherwise main->name will not be set at read time). */ - BLI_strncpy(bmain_dst->name, bmain_src->name, sizeof(bmain_dst->name)); + * (otherwise `main->filepath` will not be set at read time). */ + STRNCPY(bmain_dst->filepath, bmain_src->filepath); BLO_main_expander(blendfile_write_partial_cb); BLO_expand_main(NULL, bmain_src); diff --git a/source/blender/blenkernel/intern/bpath_test.cc b/source/blender/blenkernel/intern/bpath_test.cc index ee921cc2135..121d47af75f 100644 --- a/source/blender/blenkernel/intern/bpath_test.cc +++ b/source/blender/blenkernel/intern/bpath_test.cc @@ -76,7 +76,7 @@ class BPathTest : public testing::Test { void SetUp() override { bmain = BKE_main_new(); - BLI_strncpy(bmain->name, BLENDFILE_PATH, sizeof(bmain->name)); + STRNCPY(bmain->filepath, BLENDFILE_PATH); BKE_id_new(bmain, ID_TXT, nullptr); BKE_id_new(bmain, ID_MC, nullptr); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 1efaa9a8c3d..cc6854d2f2e 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -908,7 +908,7 @@ Image *BKE_image_load_exists_ex(Main *bmain, const char *filepath, bool *r_exist char str[FILE_MAX], strtest[FILE_MAX]; STRNCPY(str, filepath); - BLI_path_abs(str, bmain->name); + BLI_path_abs(str, bmain->filepath); /* first search an identical filepath */ for (ima = bmain->images.first; ima; ima = ima->id.next) { diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c index 7254d5d50ee..64731be57ac 100644 --- a/source/blender/blenkernel/intern/main.c +++ b/source/blender/blenkernel/intern/main.c @@ -560,7 +560,7 @@ void BKE_main_thumbnail_create(struct Main *bmain) const char *BKE_main_blendfile_path(const Main *bmain) { - return bmain->name; + return bmain->filepath; } const char *BKE_main_blendfile_path_from_global(void) diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index f86528db452..8fe0907deab 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -74,7 +74,7 @@ typedef struct BlendFileData { int fileflags; int globalf; - char filename[1024]; /* 1024 = FILE_MAX */ + char filepath[1024]; /* 1024 = FILE_MAX */ struct bScreen *curscreen; /* TODO: think this isn't needed anymore? */ struct Scene *curscene; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3532918c3b6..ed6687bfa38 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -631,7 +631,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab // printf("blo_find_main: converted to %s\n", name1); for (m = mainlist->first; m; m = m->next) { - const char *libname = (m->curlib) ? m->curlib->filepath_abs : m->name; + const char *libname = (m->curlib) ? m->curlib->filepath_abs : m->filepath; if (BLI_path_cmp(name1, libname) == 0) { if (G.debug & G_DEBUG) { @@ -2848,7 +2848,7 @@ static void lib_link_library(BlendLibReader *UNUSED(reader), Library *UNUSED(lib * in relation to the blend file. */ static void fix_relpaths_library(const char *basepath, Main *main) { - /* BLO_read_from_memory uses a blank filename */ + /* #BLO_read_from_memory uses a blank file-path. */ if (basepath == NULL || basepath[0] == '\0') { LISTBASE_FOREACH (Library *, lib, &main->libraries) { /* when loading a linked lib into a file which has not been saved, @@ -3502,25 +3502,25 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead) bfd->fileflags = fg->fileflags; bfd->globalf = fg->globalf; - BLI_strncpy(bfd->filename, fg->filename, sizeof(bfd->filename)); + STRNCPY(bfd->filepath, fg->filepath); - /* Error in 2.65 and older: main->name was not set if you save from startup + /* Error in 2.65 and older: `main->filepath` was not set if you save from startup * (not after loading file). */ - if (bfd->filename[0] == 0) { + if (bfd->filepath[0] == 0) { if (fd->fileversion < 265 || (fd->fileversion == 265 && fg->subversion < 1)) { if ((G.fileflags & G_FILE_RECOVER_READ) == 0) { - BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename)); + STRNCPY(bfd->filepath, BKE_main_blendfile_path(bfd->main)); } } - /* early 2.50 version patch - filename not in FileGlobal struct at all */ + /* early 2.50 version patch - filepath not in FileGlobal struct at all */ if (fd->fileversion <= 250) { - BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename)); + STRNCPY(bfd->filepath, BKE_main_blendfile_path(bfd->main)); } } if (G.fileflags & G_FILE_RECOVER_READ) { - BLI_strncpy(fd->relabase, fg->filename, sizeof(fd->relabase)); + BLI_strncpy(fd->relabase, fg->filepath, sizeof(fd->relabase)); } bfd->curscreen = fg->curscreen; @@ -3616,7 +3616,7 @@ static void do_versions_after_linking(Main *main, ReportList *reports) CLOG_INFO(&LOG, 2, "Processing %s (%s), %d.%d", - main->curlib ? main->curlib->filepath : main->name, + main->curlib ? main->curlib->filepath : main->filepath, main->curlib ? "LIB" : "MAIN", main->versionfile, main->subversionfile); @@ -3854,7 +3854,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) if ((fd->skip_flags & BLO_READ_SKIP_DATA) == 0) { BLI_addtail(&mainlist, bfd->main); fd->mainlist = &mainlist; - BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)); + STRNCPY(bfd->main->filepath, filepath); } if (G.background) { @@ -4511,7 +4511,7 @@ static void split_main_newid(Main *mainptr, Main *main_newid) /* We only copy the necessary subset of data in this temp main. */ main_newid->versionfile = mainptr->versionfile; main_newid->subversionfile = mainptr->subversionfile; - BLI_strncpy(main_newid->name, mainptr->name, sizeof(main_newid->name)); + STRNCPY(main_newid->filepath, mainptr->filepath); main_newid->curlib = mainptr->curlib; ListBase *lbarray[INDEX_ID_MAX]; diff --git a/source/blender/blenloader/intern/readfile_tempload.c b/source/blender/blenloader/intern/readfile_tempload.c index 1b1cbb29ef5..311732adf99 100644 --- a/source/blender/blenloader/intern/readfile_tempload.c +++ b/source/blender/blenloader/intern/readfile_tempload.c @@ -39,7 +39,7 @@ TempLibraryContext *BLO_library_temp_load_id(struct Main *real_main, temp_lib_ctx->bf_reports.reports = reports; /* Copy the file path so any path remapping is performed properly. */ - STRNCPY(temp_lib_ctx->bmain_base->name, real_main->name); + STRNCPY(temp_lib_ctx->bmain_base->filepath, real_main->filepath); temp_lib_ctx->blendhandle = BLO_blendhandle_from_file(blend_file_path, &temp_lib_ctx->bf_reports); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index f8f5dab8797..45258a50961 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1028,7 +1028,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar) /* prevent mem checkers from complaining */ memset(fg._pad, 0, sizeof(fg._pad)); - memset(fg.filename, 0, sizeof(fg.filename)); + memset(fg.filepath, 0, sizeof(fg.filepath)); memset(fg.build_hash, 0, sizeof(fg.build_hash)); fg._pad1 = NULL; @@ -1045,7 +1045,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar) fg.globalf = G.f; /* Write information needed for recovery. */ if (fileflags & G_FILE_RECOVER_WRITE) { - BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename)); + STRNCPY(fg.filepath, mainvar->filepath); } sprintf(subvstr, "%4d", BLENDER_FILE_SUBVERSION); memcpy(fg.subvstr, subvstr, 4); @@ -1362,12 +1362,12 @@ bool BLO_write_file(Main *mainvar, char dir_src[FILE_MAX]; char dir_dst[FILE_MAX]; - BLI_split_dir_part(mainvar->name, dir_src, sizeof(dir_src)); + BLI_split_dir_part(mainvar->filepath, dir_src, sizeof(dir_src)); BLI_split_dir_part(filepath, dir_dst, sizeof(dir_dst)); /* Just in case there is some subtle difference. */ - BLI_path_normalize(mainvar->name, dir_dst); - BLI_path_normalize(mainvar->name, dir_src); + BLI_path_normalize(mainvar->filepath, dir_dst); + BLI_path_normalize(mainvar->filepath, dir_src); /* Only for relative, not relative-all, as this means making existing paths relative. */ if (remap_mode == BLO_WRITE_PATH_REMAP_RELATIVE) { 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 { diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h index 50ebacbd6e8..90dbc259038 100644 --- a/source/blender/freestyle/intern/system/PythonInterpreter.h +++ b/source/blender/freestyle/intern/system/PythonInterpreter.h @@ -71,7 +71,7 @@ class PythonInterpreter : public Interpreter { bool ok = BPY_run_filepath(_context, fn, reports); #else bool ok; - Text *text = BKE_text_load(&_freestyle_bmain, fn, G_MAIN->name); + Text *text = BKE_text_load(&_freestyle_bmain, fn, G_MAIN->filepath); if (text) { ok = BPY_run_text(_context, text, reports, false); BKE_id_delete(&_freestyle_bmain, text); diff --git a/source/blender/io/alembic/exporter/abc_archive.cc b/source/blender/io/alembic/exporter/abc_archive.cc index e066704cd24..c070539fc94 100644 --- a/source/blender/io/alembic/exporter/abc_archive.cc +++ b/source/blender/io/alembic/exporter/abc_archive.cc @@ -51,7 +51,7 @@ static MetaData create_abc_metadata(const Main *bmain, double scene_fps) { MetaData abc_metadata; - std::string abc_user_description(bmain->name); + std::string abc_user_description(bmain->filepath); if (abc_user_description.empty()) { abc_user_description = "unknown"; } diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h index a0285215ff9..3b6fb60cc2e 100644 --- a/source/blender/makesdna/DNA_fileglobal_types.h +++ b/source/blender/makesdna/DNA_fileglobal_types.h @@ -50,7 +50,7 @@ typedef struct FileGlobal { /** Hash from buildinfo. */ char build_hash[16]; /** File path where this was saved, for recover (1024 = FILE_MAX). */ - char filename[1024]; + char filepath[1024]; } FileGlobal; /* minversion: in file, the oldest past blender version you can use compliant */ diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h index e302441afe1..c5769d7eee4 100644 --- a/source/blender/makesdna/intern/dna_rename_defs.h +++ b/source/blender/makesdna/intern/dna_rename_defs.h @@ -82,6 +82,7 @@ DNA_STRUCT_RENAME_ELEM(Editing, over_border, overlay_frame_rect) DNA_STRUCT_RENAME_ELEM(Editing, over_cfra, overlay_frame_abs) DNA_STRUCT_RENAME_ELEM(Editing, over_flag, overlay_frame_flag) DNA_STRUCT_RENAME_ELEM(Editing, over_ofs, overlay_frame_ofs) +DNA_STRUCT_RENAME_ELEM(FileGlobal, filename, filepath) DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, cache_frame_pause_guiding, cache_frame_pause_guide) DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, guiding_alpha, guide_alpha) DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, guiding_beta, guide_beta) diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 464abc6b543..93d7059d2a6 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -76,20 +76,20 @@ static bool rna_Main_is_dirty_get(PointerRNA *ptr) static void rna_Main_filepath_get(PointerRNA *ptr, char *value) { Main *bmain = (Main *)ptr->data; - BLI_strncpy(value, bmain->name, sizeof(bmain->name)); + BLI_strncpy(value, bmain->filepath, sizeof(bmain->filepath)); } static int rna_Main_filepath_length(PointerRNA *ptr) { Main *bmain = (Main *)ptr->data; - return strlen(bmain->name); + return strlen(bmain->filepath); } # if 0 static void rna_Main_filepath_set(PointerRNA *ptr, const char *value) { Main *bmain = (Main *)ptr->data; - BLI_strncpy(bmain->name, value, sizeof(bmain->name)); + STRNCPY(bmain->filepath, value); } # endif diff --git a/source/blender/python/intern/bpy_rna_data.c b/source/blender/python/intern/bpy_rna_data.c index 639999b69d4..c781fe4a4e7 100644 --- a/source/blender/python/intern/bpy_rna_data.c +++ b/source/blender/python/intern/bpy_rna_data.c @@ -177,7 +177,7 @@ static PyObject *bpy_rna_data_temp_data(PyObject *UNUSED(self), PyObject *args, ret = PyObject_GC_New(BPy_DataContext, &bpy_rna_data_context_Type); - STRNCPY(ret->filepath, filepath ? filepath : G_MAIN->name); + STRNCPY(ret->filepath, filepath ? filepath : G_MAIN->filepath); return (PyObject *)ret; } diff --git a/source/blender/sequencer/intern/disk_cache.c b/source/blender/sequencer/intern/disk_cache.c index 06d27717bdd..2db6a3cc8ee 100644 --- a/source/blender/sequencer/intern/disk_cache.c +++ b/source/blender/sequencer/intern/disk_cache.c @@ -148,7 +148,7 @@ bool seq_disk_cache_is_enabled(Main *bmain) { return (U.sequencer_disk_cache_dir[0] != '\0' && U.sequencer_disk_cache_size_limit != 0 && (U.sequencer_disk_cache_flag & SEQ_CACHE_DISK_CACHE_ENABLE) != 0 && - bmain->name[0] != '\0'); + bmain->filepath[0] != '\0'); } static DiskCacheFile *seq_disk_cache_add_file_to_list(SeqDiskCache *disk_cache, const char *path) diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index a2a09f9b0bc..e753c083805 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1356,7 +1356,7 @@ void wm_homefile_read_ex(bContext *C, if (use_data) { WM_check(C); /* opens window(s), checks keymaps */ - bmain->name[0] = '\0'; + bmain->filepath[0] = '\0'; /* start with save preference untitled.blend */ G.save_over = 0; @@ -1828,7 +1828,7 @@ static bool wm_file_write(bContext *C, /* First time saving. */ /* XXX(ton): temp solution to solve bug, real fix coming. */ if ((BKE_main_blendfile_path(bmain)[0] == '\0') && (use_save_as_copy == false)) { - BLI_strncpy(bmain->name, filepath, sizeof(bmain->name)); + STRNCPY(bmain->filepath, filepath); } /* XXX(ton): temp solution to solve bug, real fix coming. */ @@ -1849,7 +1849,7 @@ static bool wm_file_write(bContext *C, if (use_save_as_copy == false) { G.relbase_valid = 1; - BLI_strncpy(bmain->name, filepath, sizeof(bmain->name)); /* is guaranteed current file */ + STRNCPY(bmain->filepath, filepath); /* is guaranteed current file */ G.save_over = 1; /* disable untitled.blend convention */ } @@ -3035,21 +3035,21 @@ static void save_set_filepath(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); PropertyRNA *prop; - char name[FILE_MAX]; + char filepath[FILE_MAX]; prop = RNA_struct_find_property(op->ptr, "filepath"); if (!RNA_property_is_set(op->ptr, prop)) { /* if not saved before, get the name of the most recently used .blend file */ if (BKE_main_blendfile_path(bmain)[0] == '\0' && G.recent_files.first) { struct RecentFile *recent = G.recent_files.first; - BLI_strncpy(name, recent->filepath, FILE_MAX); + STRNCPY(filepath, recent->filepath); } else { - BLI_strncpy(name, bmain->name, FILE_MAX); + STRNCPY(filepath, bmain->filepath); } - wm_filepath_default(name); - RNA_property_string_set(op->ptr, prop, name); + wm_filepath_default(filepath); + RNA_property_string_set(op->ptr, prop, filepath); } } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 4b3bc009388..2f87e5789fe 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -314,9 +314,9 @@ void WM_init(bContext *C, int argc, const char **argv) NULL, ¶ms_file_read_post); - /* NOTE: leave `G_MAIN->name` set to an empty string since this + /* NOTE: leave `G_MAIN->filepath` set to an empty string since this * matches behavior after loading a new file. */ - BLI_assert(G_MAIN->name[0] == '\0'); + BLI_assert(G_MAIN->filepath[0] == '\0'); /* Call again to set from preferences. */ BLT_lang_set(NULL); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 35f971e72e4..86abfe881ff 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -429,7 +429,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) else if (win->ghostwin) { /* this is set to 1 if you don't have startup.blend open */ if (G.save_over && BKE_main_blendfile_path_from_global()[0]) { - char str[sizeof(((Main *)NULL)->name) + 24]; + char str[sizeof(((Main *)NULL)->filepath) + 24]; BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", |