ForestKatsch / VertexOven

Vertex color baking addon for Blender
https://blendermarket.com/products/vertex-oven
GNU General Public License v3.0
61 stars 7 forks source link

VertexOven throws an error if the mesh is in edit mode when the AO calculation finishes #10

Open zardini123 opened 4 years ago

zardini123 commented 4 years ago

This is the error that is thrown:

Traceback (most recent call last):
  File "/Users/a/Library/Application Support/Blender/2.82/scripts/addons/VertexOven/__init__.py", line 795, in modal
    is_completed = self._bake.bake(50000 / self.sample_count)
  File "/Users/a/Library/Application Support/Blender/2.82/scripts/addons/VertexOven/__init__.py", line 590, in bake
    self.finish_object()
  File "/Users/a/Library/Application Support/Blender/2.82/scripts/addons/VertexOven/__init__.py", line 603, in finish_object
    self.apply_vertex_colors()
  File "/Users/a/Library/Application Support/Blender/2.82/scripts/addons/VertexOven/__init__.py", line 448, in apply_vertex_colors
    color = list(layer.data[point.loop_index].color)
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0

location: <unknown location>:-1
ForestKatsch commented 4 years ago

This is because vertex color data cannot be written in edit mode, and I don't believe there's a way to prevent the user from entering edit mode while baking is in progress (apart from locking the entire interface while baking.) A workaround would be to automatically switch to Object Mode to apply the vertex color data, then switch back to the previous mode. I'll try to find a solution to this.