Fixed some usability issues

- no objects made the buttons disappear
This commit is contained in:
Stephen M. McQuay 2012-05-08 21:13:25 -06:00
parent f69f9e0224
commit 8b540012c1
1 changed files with 6 additions and 5 deletions

View File

@ -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():