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
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if context.active_object.type == 'MESH':
|
if context.active_object and context.active_object.type == 'MESH':
|
||||||
return context.active_object
|
return context.active_object
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
@ -92,7 +92,7 @@ class SMBLoadMesh(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.active_object is not None
|
return True
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
data = json.load(open(self.filepath, 'r'))
|
data = json.load(open(self.filepath, 'r'))
|
||||||
@ -103,6 +103,7 @@ class SMBLoadMesh(bpy.types.Operator, ExportHelper):
|
|||||||
for v_co in data['vertices']:
|
for v_co in data['vertices']:
|
||||||
bm.verts.new(v_co)
|
bm.verts.new(v_co)
|
||||||
|
|
||||||
|
if 'faces' in data:
|
||||||
for f_idx in data['faces']:
|
for f_idx in data['faces']:
|
||||||
bm.faces.new([bm.verts[i] for i in f_idx])
|
bm.faces.new([bm.verts[i] for i in f_idx])
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ class SMBPanel(bpy.types.Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return (context.object is not None)
|
return True
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
Loading…
Reference in New Issue
Block a user