Hello, when trying to bake an object to an external texture, Blender seems to ignore the "save_mode" and bakes the texture to an internal buffer. I've tried two ways:
import bpy
# Bake selected objects
for obj in filter(lambda x: x.type == 'MESH', bpy.data.objects):
print('Selected: ' + obj.name)
# Select current object
bpy.ops.object.select_all(action='DESELECT')
obj.select = True
bpy.context.scene.objects.active = obj
# Bake
bpy.ops.object.bake(type='COMBINED', save_mode='EXTERNAL', filepath='E:\\baked.png', use_automatic_name=True, width=512, height=512)
# Other version, doesn't work either
# bpy.ops.object.bake(filepath="//baked.png", save_mode='EXTERNAL')And also setting the parameters in a different way:
bpy.context.scene.render.bake.filepath = 'E:\\baked.png' bpy.context.scene.render.bake.save_mode = 'EXTERNAL' bpy.context.scene.render.bake.use_split_materials = False
Always, the execution of the previous code returns the following and does not create an image file:
Selected: Cube Info: Baking map saved to internal image, save it externally or pack it Selected: Floor Info: Baking map saved to internal image, save it externally or pack it
Tried with different paths and parameters for the bake funcion, also creating image nodes and selecting / deselecting them in the node editor for the material.
Also, I found someone who had the same problem as me, and found no solution:
https://blenderartists.org/t/bake-to-external-file-in-cycles/676562
Exact steps for others to reproduce the error
Find attached a blend file:
It's a simple cycles scene with a cube and a floor, Cycles renderer. It bakes correctly to textures (internal buffer).
- Open the blend file or create your own scene
- Run the code written above
- Blender won't create a bake file, in the console you'll see "Baking map saved to internal image, save it externally or pack it"
System Information
Windows 10, nVidia Quadro K5100M
Blender Version
Broken: 2.79b f4dc9f9d68b, 2.77a abf6f08
Thank you
