Browse Source

Ensure the export always has an active_object

Some operators, namely the bake operator, require there to be an
active_object. The lightmap operator manages the selection, so this only
fixes Blender whining about the context being incorrect due to a
technicality.
pull/121/head v0.07
Adam Johnson 6 years ago
parent
commit
688407dc82
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 5
      korman/operators/op_export.py

5
korman/operators/op_export.py

@ -164,6 +164,11 @@ class _UiHelper:
self.frame_num = scene.frame_current self.frame_num = scene.frame_current
scene.frame_set(scene.frame_start) scene.frame_set(scene.frame_start)
scene.update() scene.update()
# Some operators require there be an active_object even though they
# don't actually use it...
if scene.objects.active is None:
scene.objects.active = scene.objects[0]
return self return self
def __exit__(self, type, value, traceback): def __exit__(self, type, value, traceback):

Loading…
Cancel
Save