Hi all,
Last year I worked on a very large web GL project that involved a lot of baked lightmaps. To speed up scene editing I set up python scripts to run the bake commands, however there was no way in the python API to specify the destination image and the only way to control it was to make sure the last highlighted node in the material editor was the image you wanted to bake to, which required a lot of manual adding unconnected image nodes to the material, making duplicate materials to bake different objects and also making sure to re-select the image every time a material change was made to avoid overwriting the diffuse texture by mistake.
At the time I read the discussions around the lack of external image baking, and how this was partly due to trying to figure out the best way to support baking multiple objects into a single texture. Now that I have some time to actually dive in to code I’d like to propose a solution; which is that instead of internal/external baking there is an optional image object parameter that you can pass to the bake command and which will use that image as the bake target. That way you can bake to an existing image, you can create a new image in the script and just save that (equivalent to the external baking) and you can pass the same image to multiple different bake commands to bake several objects into one image.
I’m happy to look at the implementation of this, but want to run it past everyone to make sure it’ll be accepted and in case there is already something in the pipeline for Blender 3.0
Thanks.