From 688407dc825d7166e1aaf8211e061cf2a2054b20 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 31 Aug 2018 21:20:12 -0400 Subject: [PATCH] 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. --- korman/operators/op_export.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/korman/operators/op_export.py b/korman/operators/op_export.py index 76e16f0..27b19e1 100644 --- a/korman/operators/op_export.py +++ b/korman/operators/op_export.py @@ -164,6 +164,11 @@ class _UiHelper: self.frame_num = scene.frame_current scene.frame_set(scene.frame_start) 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 def __exit__(self, type, value, traceback):