First, thank you! This is what I’m doing manually and it’s a pain. I was considering ways to script it, but this is very, very handy if it works the way I think.
This appears to be baking everything except normals with emit? If so, you should set the samples to 1 as you don’t need more than one when baking emission. Normals should have a good sample rate though if you’re going to bake that way.
FWIW, it is possible to bake tangent normal maps using emission as long as it isn’t selected to active: https://www.blendswap.com/blends/view/88681
Selected to active with that can require some troubleshooting if it works at all and your displacement has to be set to bump only to get anything useful out of it. And it then has to be merged with geometry normals. Overall, it’s a pain.
My workflow is bake a selected -> active normal, save as 32-bit full float exr and then merge other normals on top of that base to bake the final textures. I also convert that to a curvature for material mixing, but that’s another matter.
Does this work with more than one material at a time? I’ve only had a brief glance at the code.
Output even with exr appears to be 8 bit. Is this a bug? I don’t see a bit depth setting anywhere.