Commit: 4bf16bdf8a7792386d44106443f8a0b74b41d99e
Author: Dalai Felinto
Date:   Sun Apr 27 18:11:52 2014 -0300
https://developer.blender.org/rB4bf16bdf8a7792386d44106443f8a0b74b41d99e

Cycles-Bake: external saving is working again (though there is no UI)

Right now you can set it via the operator or via the scene properties:
bpy.ops.object.bake(filepath="/tmp/baked.png", save_mode='EXTERNAL', 
use_split_materials=True, ...)

bpy.context.scene.render.bake.filepath = "/tmp/baked.png"
bpy.context.scene.render.bake.save_mode = 'EXTERNAL'
bpy.context.scene.render.bake.use_split_materials = True # or False

===================================================================

M       source/blender/editors/object/object_bake_api.c

===================================================================

diff --git a/source/blender/editors/object/object_bake_api.c 
b/source/blender/editors/object/object_bake_api.c
index ded001d..e485c21 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -393,10 +393,8 @@ static int bake_exec(bContext *C, wmOperator *op)
                        goto cleanup;
                }
                else {
-#if 0
                        /* baking externally without splitting materials */
-                       tot_images = 1;
-#endif
+                       tot_materials = 1;
                }
        }
 
@@ -419,19 +417,28 @@ static int bake_exec(bContext *C, wmOperator *op)
                }
        }
        else {
-#if 0
-               num_pixels = 0;
-               for (i = 0; i < tot_images; i++) {
-                       images.data[i].width = RNA_int_get(op->ptr, "width");
-                       images.data[i].height = RNA_int_get(op->ptr, "height");
-                       images.data[i].offset = (is_split_materials ? 
num_pixels : 0);
-                       images.data[i].image = NULL;
-
-                       num_pixels += images.data[i].width * 
images.data[i].height;
+               int width, height;
+
+               /* when saving extenally always use the size specified in the 
UI */
+               width = RNA_int_get(op->ptr, "width");
+               height = RNA_int_get(op->ptr, "height");
+
+               num_pixels = width * height * bake_images.size;
+
+               for (i = 0; i < bake_images.size; i++) {
+                       bake_images.data[i].width = width;
+                       bake_images.data[i].height = height;
+                       bake_images.data[i].offset = (is_split_materials ? 
num_pixels : 0);
+                       bake_images.data[i].image = NULL;
+
+                       num_pixels += width * bake_images.data[i].height;
                }
 
-               BLI_assert(num_pixels == tot_images * images.data[0].width * 
images.data[0].height);
-#endif
+               if (!is_split_materials) {
+                       /* saving a single image */
+                       for (i = 0; i < tot_materials; i++)
+                               bake_images.lookup[i] = 0;
+               }
        }
 
        if (use_selected_to_active) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to