From b98d315115cb28755dbbe6e2b5e30cd8c9cb0f59 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 15 Feb 2020 18:45:01 -0500 Subject: [PATCH] Add cubemap builder to Plasma Image menu. --- korman/operators/op_image.py | 13 +++++-------- korman/ui/ui_menus.py | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/korman/operators/op_image.py b/korman/operators/op_image.py index 1d9450e..93925c3 100644 --- a/korman/operators/op_image.py +++ b/korman/operators/op_image.py @@ -127,15 +127,8 @@ class PlasmaBuildCubeMapOperator(bpy.types.Operator): default="", options={"HIDDEN"}) - def __init__(self): - self._report = ExportProgressLogger() - self._report.progress_add_step("Finding Face Images") - self._report.progress_add_step("Loading Face Images") - self._report.progress_add_step("Scaling Face Images") - self._report.progress_add_step("Generating Cube Map") - def execute(self, context): - with ConsoleToggler(True) as _: + with ConsoleToggler(True), ExportProgressLogger() as self._report: try: self._execute() except ExportError as error: @@ -145,6 +138,10 @@ class PlasmaBuildCubeMapOperator(bpy.types.Operator): return {"FINISHED"} def _execute(self): + self._report.progress_add_step("Finding Face Images") + self._report.progress_add_step("Loading Face Images") + self._report.progress_add_step("Scaling Face Images") + self._report.progress_add_step("Generating Cube Map") self._report.progress_start("BUILDING CUBE MAP") if not Path(self.filepath).is_file(): raise ExportError("No cube image found at '{}'".format(self.filepath)) diff --git a/korman/ui/ui_menus.py b/korman/ui/ui_menus.py index e9ee128..18a9a31 100644 --- a/korman/ui/ui_menus.py +++ b/korman/ui/ui_menus.py @@ -42,6 +42,7 @@ class PlasmaImageMenu(PlasmaMenu, bpy.types.Menu): layout = self.layout layout.operator("image.plasma_bake_image_alpha", icon="IMAGE_RGB_ALPHA") + layout.operator("image.plasma_build_cube_map", icon="MATCUBE") def _build_plasma_menu(menu_operator, self, context):