Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-12-13 08:22:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-12-13 08:22:19 +0300
commit8ad2642c4717dcfad31626f7eebac325a9827b73 (patch)
tree2d2ba09f1cd3849adb45eb51a590783a5a9eca02 /source/blender/blenkernel
parent27231afce5e4d0832113415f4d3cdeed480b165f (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/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_global.h6
-rw-r--r--source/blender/blenkernel/BKE_main.h5
-rw-r--r--source/blender/blenkernel/intern/asset_library.cc4
-rw-r--r--source/blender/blenkernel/intern/blender_undo.c4
-rw-r--r--source/blender/blenkernel/intern/blendfile.c10
-rw-r--r--source/blender/blenkernel/intern/bpath_test.cc2
-rw-r--r--source/blender/blenkernel/intern/image.c2
-rw-r--r--source/blender/blenkernel/intern/main.c2
8 files changed, 18 insertions, 17 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)