[Bf-blender-cvs] [d40ac45] master: Fix (unreported) `load_file()` func from creator.c not setting G.save_over correctly.
Bastien Montagne
noreply at git.blender.org
Thu Feb 12 17:43:52 CET 2015
Commit: d40ac45610edef50885ce73034f7c035f48cc9c1
Author: Bastien Montagne
Date: Thu Feb 12 17:30:19 2015 +0100
Branches: master
https://developer.blender.org/rBd40ac45610edef50885ce73034f7c035f48cc9c1
Fix (unreported) `load_file()` func from creator.c not setting G.save_over correctly.
This was rather annoying, since if you were script-editing a .blend file in background
mode, opened through this commandline option system, and wanted to save over,
a mere `bpy.ops.wm.save_mainfile()` *would not* overwrite expected file,
but instead write/replace the dummy `untitled.blend` one!
===================================================================
M source/creator/creator.c
===================================================================
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 1540648..23a32af 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1241,7 +1241,14 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
CTX_wm_manager_set(C, NULL); /* remove wm to force check */
WM_check(C);
- G.relbase_valid = 1;
+ if (bmain->name[0]) {
+ G.save_over = 1;
+ G.relbase_valid = 1;
+ }
+ else {
+ G.save_over = 0;
+ G.relbase_valid = 0;
+ }
if (CTX_wm_manager(C) == NULL) CTX_wm_manager_set(C, wm); /* reset wm */
/* WM_file_read would call normally */
More information about the Bf-blender-cvs
mailing list