From 8b540012c1ff7ddd8dfa21013ede8b8f47fd8a75 Mon Sep 17 00:00:00 2001 From: "Stephen M. McQuay" Date: Tue, 8 May 2012 21:13:25 -0600 Subject: [PATCH] Fixed some usability issues - no objects made the buttons disappear --- blender/surf.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/blender/surf.py b/blender/surf.py index 09bb346..f7a1d21 100644 --- a/blender/surf.py +++ b/blender/surf.py @@ -20,7 +20,7 @@ class SMBDumpMesh(bpy.types.Operator, ExportHelper): @classmethod def poll(cls, context): - if context.active_object.type == 'MESH': + if context.active_object and context.active_object.type == 'MESH': return context.active_object else: return None @@ -92,7 +92,7 @@ class SMBLoadMesh(bpy.types.Operator, ExportHelper): @classmethod def poll(cls, context): - return context.active_object is not None + return True def execute(self, context): data = json.load(open(self.filepath, 'r')) @@ -103,8 +103,9 @@ class SMBLoadMesh(bpy.types.Operator, ExportHelper): for v_co in data['vertices']: bm.verts.new(v_co) - for f_idx in data['faces']: - bm.faces.new([bm.verts[i] for i in f_idx]) + if 'faces' in data: + for f_idx in data['faces']: + bm.faces.new([bm.verts[i] for i in f_idx]) bm.to_mesh(mesh) mesh.update() @@ -129,7 +130,7 @@ class SMBPanel(bpy.types.Panel): @classmethod def poll(cls, context): - return (context.object is not None) + return True def register():