From 77ef3bb5726e1bbe8741f62dc43691861de9386c Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 24 Jun 2016 16:02:47 -0400 Subject: [PATCH] Fix traceback when viewing Lamp texture UI --- korman/ui/ui_texture.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/korman/ui/ui_texture.py b/korman/ui/ui_texture.py index 78190fa..b5613ba 100644 --- a/korman/ui/ui_texture.py +++ b/korman/ui/ui_texture.py @@ -69,8 +69,7 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel): split = layout.split() col = split.column() col.label("Animation:") - col.enabled = context.texture.animation_data is not None or \ - context.material.animation_data is not None + col.enabled = self._has_animation_data(context) col.prop(layer_props, "anim_auto_start") col.prop(layer_props, "anim_loop") @@ -78,3 +77,16 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel): col.label("General:") col.prop(layer_props, "opacity", text="Opacity") col.prop(layer_props, "alpha_halo") + + def _has_animation_data(self, context): + tex = getattr(context, "texture", None) + if tex is not None: + if tex.animation_data is not None: + return True + + mat = getattr(context, "material", None) + if mat is not None: + if mat.animation_data is not None: + return True + + return False