Changeset View
Changeset View
Standalone View
Standalone View
io_shape_mdd/__init__.py
| Show All 16 Lines | |||||
| # ##### END GPL LICENSE BLOCK ##### | # ##### END GPL LICENSE BLOCK ##### | ||||
| # <pep8 compliant> | # <pep8 compliant> | ||||
| bl_info = { | bl_info = { | ||||
| "name": "NewTek MDD format", | "name": "NewTek MDD format", | ||||
| "author": "Bill L.Nieuwendorp", | "author": "Bill L.Nieuwendorp", | ||||
| "version": (1, 0, 1), | "version": (1, 0, 1), | ||||
| "blender": (2, 57, 0), | "blender": (2, 80, 0), | ||||
| "location": "File > Import-Export", | "location": "File > Import-Export", | ||||
| "description": "Import-Export MDD as mesh shape keys", | "description": "Import-Export MDD as mesh shape keys", | ||||
| "warning": "", | "warning": "", | ||||
| "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/" | "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/" | ||||
| "Scripts/Import-Export/NewTek_OBJ", | "Scripts/Import-Export/NewTek_OBJ", | ||||
| "support": 'OFFICIAL', | "support": 'OFFICIAL', | ||||
| "category": "Import-Export"} | "category": "Import-Export"} | ||||
| Show All 18 Lines | |||||
| class ImportMDD(bpy.types.Operator, ImportHelper): | class ImportMDD(bpy.types.Operator, ImportHelper): | ||||
| """Import MDD vertex keyframe file to shape keys""" | """Import MDD vertex keyframe file to shape keys""" | ||||
| bl_idname = "import_shape.mdd" | bl_idname = "import_shape.mdd" | ||||
| bl_label = "Import MDD" | bl_label = "Import MDD" | ||||
| bl_options = {'UNDO'} | bl_options = {'UNDO'} | ||||
| filename_ext = ".mdd" | filename_ext = ".mdd" | ||||
| filter_glob = StringProperty( | filter_glob: StringProperty( | ||||
| default="*.mdd", | default="*.mdd", | ||||
| options={'HIDDEN'}, | options={'HIDDEN'}, | ||||
| ) | ) | ||||
| frame_start = IntProperty( | frame_start: IntProperty( | ||||
| name="Start Frame", | name="Start Frame", | ||||
| description="Start frame for inserting animation", | description="Start frame for inserting animation", | ||||
| min=-300000, max=300000, | min=-300000, max=300000, | ||||
| default=0, | default=0, | ||||
| ) | ) | ||||
| frame_step = IntProperty( | frame_step: IntProperty( | ||||
| name="Step", | name="Step", | ||||
| min=1, max=1000, | min=1, max=1000, | ||||
| default=1, | default=1, | ||||
| ) | ) | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| obj = context.active_object | obj = context.active_object | ||||
| Show All 13 Lines | |||||
| class ExportMDD(bpy.types.Operator, ExportHelper): | class ExportMDD(bpy.types.Operator, ExportHelper): | ||||
| """Animated mesh to MDD vertex keyframe file""" | """Animated mesh to MDD vertex keyframe file""" | ||||
| bl_idname = "export_shape.mdd" | bl_idname = "export_shape.mdd" | ||||
| bl_label = "Export MDD" | bl_label = "Export MDD" | ||||
| filename_ext = ".mdd" | filename_ext = ".mdd" | ||||
| filter_glob = StringProperty(default="*.mdd", options={'HIDDEN'}) | filter_glob: StringProperty(default="*.mdd", options={'HIDDEN'}) | ||||
| # get first scene to get min and max properties for frames, fps | # get first scene to get min and max properties for frames, fps | ||||
| minframe = 0 | minframe = 0 | ||||
| maxframe = 300000 | maxframe = 300000 | ||||
| minfps = 1.0 | minfps = 1.0 | ||||
| maxfps = 120.0 | maxfps = 120.0 | ||||
| # List of operator properties, the attributes will be assigned | # List of operator properties, the attributes will be assigned | ||||
| # to the class instance from the operator settings before calling. | # to the class instance from the operator settings before calling. | ||||
| fps = FloatProperty( | fps: FloatProperty( | ||||
| name="Frames Per Second", | name="Frames Per Second", | ||||
| description="Number of frames/second", | description="Number of frames/second", | ||||
| min=minfps, max=maxfps, | min=minfps, max=maxfps, | ||||
| default=25.0, | default=25.0, | ||||
| ) | ) | ||||
| frame_start = IntProperty( | frame_start: IntProperty( | ||||
| name="Start Frame", | name="Start Frame", | ||||
| description="Start frame for baking", | description="Start frame for baking", | ||||
| min=minframe, max=maxframe, | min=minframe, max=maxframe, | ||||
| default=1, | default=1, | ||||
| ) | ) | ||||
| frame_end = IntProperty( | frame_end: IntProperty( | ||||
| name="End Frame", | name="End Frame", | ||||
| description="End frame for baking", | description="End frame for baking", | ||||
| min=minframe, max=maxframe, | min=minframe, max=maxframe, | ||||
| default=250, | default=250, | ||||
| ) | ) | ||||
| use_rest_frame = BoolProperty( | use_rest_frame: BoolProperty( | ||||
| name="Rest Frame", | name="Rest Frame", | ||||
| description="Write the rest state at the first frame", | description="Write the rest state at the first frame", | ||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| obj = context.active_object | obj = context.active_object | ||||
| Show All 21 Lines | |||||
| def menu_func_export(self, context): | def menu_func_export(self, context): | ||||
| self.layout.operator(ExportMDD.bl_idname, | self.layout.operator(ExportMDD.bl_idname, | ||||
| text="Lightwave Point Cache (.mdd)", | text="Lightwave Point Cache (.mdd)", | ||||
| ) | ) | ||||
| classes = ( | |||||
| ImportMDD, | |||||
| ExportMDD | |||||
| ) | |||||
| def register(): | def register(): | ||||
| bpy.utils.register_module(__name__) | for cls in classes: | ||||
| bpy.utils.register_class(cls) | |||||
| bpy.types.INFO_MT_file_import.append(menu_func_import) | bpy.types.TOPBAR_MT_file_import.append(menu_func_import) | ||||
| bpy.types.INFO_MT_file_export.append(menu_func_export) | bpy.types.TOPBAR_MT_file_export.append(menu_func_export) | ||||
| def unregister(): | def unregister(): | ||||
| bpy.utils.unregister_module(__name__) | for cls in classes: | ||||
| bpy.utils.unregister_class(cls) | |||||
| bpy.types.INFO_MT_file_import.remove(menu_func_import) | bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) | ||||
| bpy.types.INFO_MT_file_export.remove(menu_func_export) | bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) | ||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||
| register() | register() | ||||