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-03-11 16:34:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-03-11 16:40:25 +0300
commitf7616c6eaf8d983e84aeb838d51fe67e4fa98e16 (patch)
tree2154811d77a2ce3b8a7c8e9165a84477b8534999 /source/blender/blenkernel
parent93f8c9b8238b4f69c34b605b7e08dfe113f4023d (diff)
Cleanup: file loading/recover checks
- Don't set G.relbase_valid until the file is loaded. - Remove unnecessary string pointer comparison. - Remove unused filename being passed to 'setup_app_data'.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/blendfile.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index a7af0eccb49..c3edd84fd43 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -132,11 +132,9 @@ static void setup_app_userdef(BlendFileData *bfd)
* should be avoided or check (mode != LOAD_UNDO).
*
* \param bfd: Blend file data, freed by this function on exit.
- * \param filepath: File path or identifier.
*/
static void setup_app_data(bContext *C,
BlendFileData *bfd,
- const char *filepath,
const struct BlendFileReadParams *params,
ReportList *reports)
{
@@ -350,16 +348,10 @@ static void setup_app_data(bContext *C,
if (is_startup) {
bmain->name[0] = '\0';
}
- else if (recover && G.relbase_valid) {
- /* in case of autosave or quit.blend, use original filename instead
- * use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */
- filepath = bfd->filename;
+ else if (recover) {
+ /* In case of autosave or quit.blend, use original filename instead. */
bmain->recovered = 1;
-
- /* these are the same at times, should never copy to the same location */
- if (bmain->name != filepath) {
- BLI_strncpy(bmain->name, filepath, FILE_MAX);
- }
+ BLI_strncpy(bmain->name, bfd->filename, FILE_MAX);
}
/* baseflags, groups, make depsgraph, etc */
@@ -413,7 +405,6 @@ static void setup_app_data(bContext *C,
static void setup_app_blend_file_data(bContext *C,
BlendFileData *bfd,
- const char *filepath,
const struct BlendFileReadParams *params,
ReportList *reports)
{
@@ -421,7 +412,7 @@ static void setup_app_blend_file_data(bContext *C,
setup_app_userdef(bfd);
}
if ((params->skip_flags & BLO_READ_SKIP_DATA) == 0) {
- setup_app_data(C, bfd, filepath, params, reports);
+ setup_app_data(C, bfd, params, reports);
}
}
@@ -460,7 +451,7 @@ bool BKE_blendfile_read_ex(bContext *C,
BLO_update_defaults_startup_blend(bfd->main, startup_app_template);
}
}
- setup_app_blend_file_data(C, bfd, filepath, params, reports);
+ setup_app_blend_file_data(C, bfd, params, reports);
BLO_blendfiledata_free(bfd);
}
else {
@@ -493,7 +484,7 @@ bool BKE_blendfile_read_from_memory_ex(bContext *C,
BLO_update_defaults_startup_blend(bfd->main, startup_app_template);
}
}
- setup_app_blend_file_data(C, bfd, "<memory2>", params, reports);
+ setup_app_blend_file_data(C, bfd, params, reports);
BLO_blendfiledata_free(bfd);
}
else {
@@ -529,7 +520,7 @@ bool BKE_blendfile_read_from_memfile(bContext *C,
BLI_assert(BLI_listbase_is_empty(&bfd->main->workspaces));
BLI_assert(BLI_listbase_is_empty(&bfd->main->screens));
- setup_app_blend_file_data(C, bfd, "<memory1>", params, reports);
+ setup_app_blend_file_data(C, bfd, params, reports);
BLO_blendfiledata_free(bfd);
}
else {