bl.message('no active object !')
-if isBlender24():
- # for 2.4
- def execute_24(filename):
- scene=Blender.Scene.GetCurrent()
- bl.initialize('mqo_export', scene)
- __execute(
- filename.decode(bl.INTERNAL_ENCODING),
- scene, False)
- bl.finalize()
-
- # execute
- Blender.Window.FileSelector(
- execute_24,
- 'Export Metasequoia MQO',
- Blender.sys.makename(ext='.mqo'))
-
-else:
- # for 2.5
- def execute_25(path, scene, scale, apply_modifier):
- bl.initialize('mqo_export', scene)
- __execute(path, scene, scale, apply_modifier)
- bl.finalize()
-
- # operator
- class EXPORT_OT_mqo(bpy.types.Operator):
- '''Save a Metasequoia MQO file.'''
- bl_idname = "export_scene.mqo"
- bl_label = 'Export MQO'
-
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
- filepath = bpy.props.StringProperty()
- filename = bpy.props.StringProperty()
- directory = bpy.props.StringProperty()
-
- scale = bpy.props.FloatProperty(
- name="Scale",
- description="Scale the MQO by this value",
- min=0.0001, max=1000000.0,
- soft_min=0.001, soft_max=100.0, default=10.0)
-
- apply_modifier = bpy.props.BoolProperty(
- name="ApplyModifier",
- description="Would apply modifiers",
- default=False)
-
- def execute(self, context):
- execute_25(
- self.properties.filepath,
- context.scene,
- self.properties.scale,
- self.properties.apply_modifier)
- return 'FINISHED'
-
- def invoke(self, context, event):
- wm=context.window_manager
- try:
- wm.fileselect_add(self)
- except:
- wm.add_fileselect(self)
- return 'RUNNING_MODAL'
-
- # register menu
- def menu_func(self, context):
- default_path=bpy.data.filepath.replace(".blend", ".mqo")
- self.layout.operator(
- EXPORT_OT_mqo.bl_idname,
- text="Metasequoia (.mqo)",
- icon='PLUGIN'
- ).filepath=default_path
-
- def register():
- bpy.types.INFO_MT_file_export.append(menu_func)
-
- def unregister():
- bpy.types.INFO_MT_file_export.remove(menu_func)
-
- if __name__ == "__main__":
- register()
-