# 需要導入模塊: from bpy_extras import io_utils [as 別名]
# 或者: from bpy_extras.io_utils import ImportHelper [as 別名]
def execute(self,context):
scn = bpy.context.scene
selected = bpy.context.selected_objects
shippart = selected.pop(0)
bpy.ops.object.select_all(action = 'DESELECT')
shippart.select = True
shipname = shippart["ship"]
mergelist = []
for obj in scn.objects:
if obj.type == 'MESH' and obj["ship"] == shipname and not obj.hide:
mergelist.append(obj)
bpy.ops.object.select_all(action = 'DESELECT')
for obj in mergelist:
obj.select = True
bpy.ops.object.join()
bpy.ops.object.parent_clear(type='CLEAR')
result = bpy.context.active_object
result.name = "RESULT"
#result.scale = (10,10,10)
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.remove_doubles(threshold = 0.001)
bpy.ops.mesh.normals_make_consistent(inside = False)
bpy.ops.object.mode_set(mode='OBJECT')
return {'FINISHED'}
##class LoadFlagPartOperator(bpy.types.Operator, ImportHelper):
## bl_idname = "object.loadflag"
## bl_label = "Load Flag"
##
## filename_ext = "Image file"
## filter_glob = StringProperty(default="*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.bmp;*.BMP;*.tiff;*.TIFF", options={'HIDDEN'})
## #Add more file types if necessary, I guess
##
## def execute(self, context):
## from . import load_flag
##
##