Fixed some usability issues
- no objects made the buttons disappear
This commit is contained in:
parent
f69f9e0224
commit
8b540012c1
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user