diff options
Diffstat (limited to 'io_anim_bvh/__init__.py')
-rw-r--r-- | io_anim_bvh/__init__.py | 73 |
1 files changed, 41 insertions, 32 deletions
diff --git a/io_anim_bvh/__init__.py b/io_anim_bvh/__init__.py index 4a4983ff..dd9c2037 100644 --- a/io_anim_bvh/__init__.py +++ b/io_anim_bvh/__init__.py @@ -22,7 +22,7 @@ bl_info = { "name": "BioVision Motion Capture (BVH) format", "author": "Campbell Barton", "version": (1, 0, 0), - "blender": (2, 74, 0), + "blender": (2, 80, 0), "location": "File > Import-Export", "description": "Import-Export BVH from armature objects", "warning": "", @@ -52,24 +52,22 @@ from bpy.props import ( from bpy_extras.io_utils import ( ImportHelper, ExportHelper, - orientation_helper_factory, + orientation_helper, axis_conversion, ) -ImportBVHOrientationHelper = orientation_helper_factory("ImportBVHOrientationHelper", axis_forward='-Z', axis_up='Y') - - -class ImportBVH(bpy.types.Operator, ImportHelper, ImportBVHOrientationHelper): +@orientation_helper(axis_forward='-Z', axis_up='Y') +class ImportBVH(bpy.types.Operator, ImportHelper): """Load a BVH motion capture file""" bl_idname = "import_anim.bvh" bl_label = "Import BVH" bl_options = {'REGISTER', 'UNDO'} filename_ext = ".bvh" - filter_glob = StringProperty(default="*.bvh", options={'HIDDEN'}) + filter_glob: StringProperty(default="*.bvh", options={'HIDDEN'}) - target = EnumProperty( + target: EnumProperty( items=( ('ARMATURE', "Armature", ""), ('OBJECT', "Object", ""), @@ -78,20 +76,19 @@ class ImportBVH(bpy.types.Operator, ImportHelper, ImportBVHOrientationHelper): description="Import target type", default='ARMATURE', ) - - global_scale = FloatProperty( + global_scale: FloatProperty( name="Scale", description="Scale the BVH by this value", min=0.0001, max=1000000.0, soft_min=0.001, soft_max=100.0, default=1.0, ) - frame_start = IntProperty( + frame_start: IntProperty( name="Start Frame", description="Starting frame for the animation", default=1, ) - use_fps_scale = BoolProperty( + use_fps_scale: BoolProperty( name="Scale FPS", description=( "Scale the framerate from the BVH to the current scenes, " @@ -99,25 +96,25 @@ class ImportBVH(bpy.types.Operator, ImportHelper, ImportBVHOrientationHelper): ), default=False, ) - update_scene_fps = BoolProperty( + update_scene_fps: BoolProperty( name="Update Scene FPS", description=( "Set the scene framerate to that of the BVH file (note that this " "nullifies the 'Scale FPS' option, as the scale will be 1:1)" ), - default=False + default=False, ) - update_scene_duration = BoolProperty( + update_scene_duration: BoolProperty( name="Update Scene Duration", description="Extend the scene's duration to the BVH duration (never shortens the scene)", default=False, ) - use_cyclic = BoolProperty( + use_cyclic: BoolProperty( name="Loop", description="Loop the animation playback", default=False, ) - rotate_mode = EnumProperty( + rotate_mode: EnumProperty( name="Rotation", description="Rotation conversion", items=( @@ -143,7 +140,6 @@ class ImportBVH(bpy.types.Operator, ImportHelper, ImportBVHOrientationHelper): "filter_glob", ) ) - global_matrix = axis_conversion( from_forward=self.axis_forward, from_up=self.axis_up, @@ -161,29 +157,29 @@ class ExportBVH(bpy.types.Operator, ExportHelper): bl_label = "Export BVH" filename_ext = ".bvh" - filter_glob = StringProperty( + filter_glob: StringProperty( default="*.bvh", options={'HIDDEN'}, ) - global_scale = FloatProperty( + global_scale: FloatProperty( name="Scale", description="Scale the BVH by this value", min=0.0001, max=1000000.0, soft_min=0.001, soft_max=100.0, default=1.0, ) - frame_start = IntProperty( + frame_start: IntProperty( name="Start Frame", description="Starting frame to export", default=0, ) - frame_end = IntProperty( + frame_end: IntProperty( name="End Frame", description="End frame to export", default=0, ) - rotate_mode = EnumProperty( + rotate_mode: EnumProperty( name="Rotation", description="Rotation conversion", items=( @@ -198,7 +194,7 @@ class ExportBVH(bpy.types.Operator, ExportHelper): ), default='NATIVE', ) - root_transform_only = BoolProperty( + root_transform_only: BoolProperty( name="Root Translation Only", description="Only write out translation channels for the root bone", default=False, @@ -220,7 +216,14 @@ class ExportBVH(bpy.types.Operator, ExportHelper): self.frame_start = context.scene.frame_start self.frame_end = context.scene.frame_end - keywords = self.as_keywords(ignore=("check_existing", "filter_glob")) + keywords = self.as_keywords( + ignore=( + "axis_forward", + "axis_up", + "check_existing", + "filter_glob", + ) + ) from . import export_bvh return export_bvh.save(context, **keywords) @@ -234,19 +237,25 @@ def menu_func_export(self, context): self.layout.operator(ExportBVH.bl_idname, text="Motion Capture (.bvh)") +classes = ( + ImportBVH, + ExportBVH +) + 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.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): - bpy.utils.unregister_module(__name__) - - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + for cls in classes: + bpy.utils.unregister_class(cls) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) if __name__ == "__main__": register() |