I’m cleaning up my Paper Model script to blender 2.80 cleaning up its mesh access. I’d like to do all mesh processing in Edit Mode and BMesh since it allows me to read and modify all the necessary data directly.
The problem I encountered now is that UV layers created in Edit Mode are not seen by the Bake Render operator until I switch to Object Mode. More precisely, I do this:
- Switch a Mesh object to Edit Mode
- Add a new UV layer
bpy.ops.object.bake()with appropriate parameters
- Get an error:
No active UV layer found in the object.
I understand that not all data is updated while within Edit Mode. What I don’t understand in this case is that the UV layer is already listed in
bpy.context.object.data.uv_layers. How come that RNA sees it but the Bake operator (= CustomData API) does not? Is this all right or is it a bug?
Can I somehow update the UV Layers structure without doing a Object <-> Edit Mode switch?
The issue apparently is not related to 2.80 nor BMesh – 2.79 throws exactly the same error.