From d75fd16b24e3d69f9592da9804c26603071f0aa5 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 10 Dec 2018 23:56:43 -0500 Subject: [PATCH] Fix some noisy tracebacks in the UI draw code --- korman/ui/ui_image.py | 6 +++--- korman/ui/ui_texture.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/korman/ui/ui_image.py b/korman/ui/ui_image.py index d50a895..aa17f8b 100644 --- a/korman/ui/ui_image.py +++ b/korman/ui/ui_image.py @@ -20,6 +20,6 @@ class PlasmaImageEditorHeader(bpy.types.Header): def draw(self, context): layout, image = self.layout, context.space_data.image - settings = image.plasma_image - - layout.prop(settings, "texcache_method", text="") + if image is not None: + settings = image.plasma_image + layout.prop(settings, "texcache_method", text="") diff --git a/korman/ui/ui_texture.py b/korman/ui/ui_texture.py index 80b5d20..7ae39ac 100644 --- a/korman/ui/ui_texture.py +++ b/korman/ui/ui_texture.py @@ -55,14 +55,15 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel): bl_label = "Plasma Layer Options" def draw(self, context): - texture, slot = context.texture, context.texture_slot + texture, slot = context.texture, getattr(context, "texture_slot", None) + use_stencil = slot.use_stencil if slot is not None else False layer_props = texture.plasma_layer layout = self.layout split = layout.split() col = split.column() col.label("Animation:") - col.active = self._has_animation_data(context) and not slot.use_stencil + col.active = self._has_animation_data(context) and not use_stencil col.prop(layer_props, "anim_auto_start") col.prop(layer_props, "anim_loop") col.separator() @@ -71,7 +72,7 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel): col = split.column() col.label("Miscellaneous:") - col.active = not slot.use_stencil + col.active = not use_stencil col.prop(layer_props, "opacity", text="Opacity") col.separator()