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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-05 00:45:22 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-17 21:03:26 +0300
commit3022dd2b27fdfd8aca369bfb0e390965de448b7a (patch)
treeeea6afe132dd000bcf57cc5a35fc3261588d73ec /source/blender/blenkernel/intern/bpath.c
parent60a4342557f19dab8e17825800bca4fbb3cccb85 (diff)
Images: changes to avoid losing new images that have not been saved
The basic idea is that such new images will be packed into the .blend file when saving all modified images from the quit dialog. To make this workflow nicer a number of changes were made to how this type of packed image is handled. * "Save Modified Images" now packs generated images into the .blend file. * "Save As" for packed images now automatically unpacks the image, so that it's easy to save automatically packed images. "Save Copy" keeps it packed. * "Save" for packed images now re-saves the image into the .blend file, so that it's effectively the equivalent of "Save" for non-packed images. * Empty image filepaths are no longer remapped when saving the .blend file. Previously it would become e.g. "//../../" which makes no sense for generated images with no filepath yet. * Hide unpack button and filepath for such packed images with no filepath. Unpacking does not work in a predictable way without a filepath, better to just "Save As".
Diffstat (limited to 'source/blender/blenkernel/intern/bpath.c')
-rw-r--r--source/blender/blenkernel/intern/bpath.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index 6f0c1891b05..fa7af53df2d 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -450,7 +450,10 @@ void BKE_bpath_traverse_id(
Image *ima;
ima = (Image *)id;
if (BKE_image_has_packedfile(ima) == false || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
- if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ /* Skip empty file paths, these are typically from generated images and
+ * don't make sense to add directories to until the image has been saved
+ * once to give it a meaningful value. */
+ if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) && ima->name[0]) {
if (rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data)) {
if (flag & BKE_BPATH_TRAVERSE_RELOAD_EDITED) {
if (!BKE_image_has_packedfile(ima) &&