本文整理汇总了Python中bpy_extras.io_utils.ImportHelper方法的典型用法代码示例。如果您正苦于以下问题:Python io_utils.ImportHelper方法的具体用法?Python io_utils.ImportHelper怎么用?Python io_utils.ImportHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bpy_extras.io_utils
的用法示例。
在下文中一共展示了io_utils.ImportHelper方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_some_data
# 需要导入模块: from bpy_extras import io_utils [as 别名]
# 或者: from bpy_extras.io_utils import ImportHelper [as 别名]
def read_some_data(context, filepath, use_some_setting):
print("running read_some_data...")
f = open(filepath, 'r', encoding='utf-8')
data = f.read()
f.close()
# would normally load the data here
print(data)
return {'FINISHED'}
# ImportHelper is a helper class, defines filename and
# invoke() function which calls the file selector.
示例2: execute
# 需要导入模块: 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
##
##