Fix part of T53080: all material previews re-rendering after undo.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 26 Jan 2018 06:54:09 +0000 (07:54 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 26 Jan 2018 07:41:19 +0000 (08:41 +0100)
This reverts commit dc2617130b2e1d7d2b9892fbd7c6e7b60caafb66, which disabled
writing of previews for undo. While this uses some memory, re-rendering all
previews is very expensive, especially if for example you have lots of materials
using high-res image textures.

source/blender/blenloader/intern/writefile.c

index d7d2dd529f92ba4e82fab652bddac60794038a77..c2820ac6e30ae07e3c0ffed55fe0a2da4cddac82 100644 (file)
@@ -679,8 +679,10 @@ static void write_iddata(void *wd, const ID *id)
 
 static void write_previews(WriteData *wd, const PreviewImage *prv_orig)
 {
-       /* Never write previews when doing memsave (i.e. undo/redo)! */
-       if (prv_orig && !wd->current) {
+       /* Note we write previews also for undo steps. It takes up some memory,
+        * but not doing so would causes all previews to be re-rendered after
+        * undo which is too expensive. */
+       if (prv_orig) {
                PreviewImage prv = *prv_orig;
 
                /* don't write out large previews if not requested */