Blender Git Loki

Git Commits -> Revision 8dbd406

Revision 8dbd406 by Campbell Barton (master)
December 16, 2021, 05:27 (GMT)
WM: various changes to file writing behavior

Saving with only a filename (from Python) wasn't being prevented,
while it would successfully write the file to the working-directory,
path remapping and setting relative paths wouldn't work afterwards
as `Main.filepath` would have no directory component.

Disallow this since it's a corner case which only ever occurs
when path names without any directories are used from Python,
the overhead of expanding the working-directory for all data saving
operations isn't worthwhile.

The following changes have been made:

- bpy.ops.wm.save_mainfile() without a filepath argument
fails & reports and error when the file hasn't been saved.

Previously it would write to "untitled.blend" and set the
`G.main->filepath` to this as well.

- bpy.ops.wm.save_mainfile(filepath="untitled.blend")
fails & reports and error as the filename has no directory component.

- `BLI_path_is_abs_from_cwd` was added to check if the path would
attempt to expand to the CWD.

Commit Details:

Full Hash: 8dbd406ea0f495b3d404a7433a32b4781953e55a
Parent Commit: 15c3617
Lines Changed: +49, -16

4 Modified Paths:

/source/blender/blenlib/BLI_path_util.h (+7, -1) (Diff)
/source/blender/blenlib/intern/path_util.c (+18, -12) (Diff)
/source/blender/blenloader/intern/writefile.c (+1, -0) (Diff)
/source/blender/windowmanager/intern/wm_files.c (+23, -3) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021