From f87a9b9efee9fc3c5265727ca720dfebd5f673c2 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 13 Aug 2018 20:08:44 -0400 Subject: [PATCH] Maintain the current selection after exporting --- korman/operators/op_export.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/korman/operators/op_export.py b/korman/operators/op_export.py index 49029c3..ebcb1d8 100644 --- a/korman/operators/op_export.py +++ b/korman/operators/op_export.py @@ -105,7 +105,7 @@ class ExportOperator(bpy.types.Operator): # Separate blender operator and actual export logic for my sanity ageName = path.stem - with _UiHelper() as _ui: + with _UiHelper(context) as _ui: e = exporter.Exporter(self) try: if self.profile_export: @@ -151,10 +151,11 @@ class ExportOperator(bpy.types.Operator): class _UiHelper: """This fun little helper makes sure that we don't wreck the UI""" - def __enter__(self): - self.active_object = bpy.context.object - self.selected_objects = bpy.context.selected_objects + def __init__(self, context): + self.active_object = context.active_object + self.selected_objects = context.selected_objects + def __enter__(self): scene = bpy.context.scene self.layers = tuple(scene.layers) self.frame_num = scene.frame_current