Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-08-15 15:56:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-15 15:56:36 +0400
commit01ef1c9b2c80e87cec0644aade7c1e4deb949901 (patch)
tree0b470d8099b7026fb9418f0e9fdb55579e7dd205 /io_anim_bvh/__init__.py
parentd81579030fc948f4283606ced8cb55fcdd93616b (diff)
bvh export
- add option to export root transform only (may help with secondlife compatibility) - operators are now pep8 compliant. - frame is set back to the original when export is done.
Diffstat (limited to 'io_anim_bvh/__init__.py')
-rw-r--r--io_anim_bvh/__init__.py130
1 files changed, 89 insertions, 41 deletions
diff --git a/io_anim_bvh/__init__.py b/io_anim_bvh/__init__.py
index 94d048f6..b06eb58a 100644
--- a/io_anim_bvh/__init__.py
+++ b/io_anim_bvh/__init__.py
@@ -16,7 +16,7 @@
#
# ##### END GPL LICENSE BLOCK #####
-# <pep8 compliant>
+# <pep8-80 compliant>
bl_info = {
"name": "BioVision Motion Capture (BVH) format",
@@ -26,13 +26,12 @@ bl_info = {
"location": "File > Import-Export",
"description": "Import-Export BVH from armature objects",
"warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
- "Scripts/Import-Export/MotionCapture_BVH",
+ "wiki_url": ("http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+ "Scripts/Import-Export/MotionCapture_BVH"),
"tracker_url": "",
"support": 'OFFICIAL',
"category": "Import-Export"}
-# To support reload properly, try to access a package var, if it's there, reload everything
if "bpy" in locals():
import imp
if "import_bvh" in locals():
@@ -41,7 +40,12 @@ if "bpy" in locals():
imp.reload(export_bvh)
import bpy
-from bpy.props import StringProperty, FloatProperty, IntProperty, BoolProperty, EnumProperty
+from bpy.props import (StringProperty,
+ FloatProperty,
+ IntProperty,
+ BoolProperty,
+ EnumProperty,
+ )
from bpy_extras.io_utils import ImportHelper, ExportHelper
@@ -62,26 +66,45 @@ class ImportBVH(bpy.types.Operator, ImportHelper):
description="Import target type.",
default='ARMATURE')
- 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(name="Start Frame", description="Starting frame for the animation", default=1)
- use_cyclic = BoolProperty(name="Loop", description="Loop the animation playback", default=False)
- rotate_mode = EnumProperty(items=(
- ('QUATERNION', "Quaternion", "Convert rotations to quaternions"),
- ('NATIVE', "Euler (Native)", "Use the rotation order defined in the BVH file"),
- ('XYZ', "Euler (XYZ)", "Convert rotations to euler XYZ"),
- ('XZY', "Euler (XZY)", "Convert rotations to euler XZY"),
- ('YXZ', "Euler (YXZ)", "Convert rotations to euler YXZ"),
- ('YZX', "Euler (YZX)", "Convert rotations to euler YZX"),
- ('ZXY', "Euler (ZXY)", "Convert rotations to euler ZXY"),
- ('ZYX', "Euler (ZYX)", "Convert rotations to euler ZYX"),
- ),
- name="Rotation",
- description="Rotation conversion.",
- default='NATIVE')
+ 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(
+ name="Start Frame",
+ description="Starting frame for the animation",
+ default=1,
+ )
+ use_cyclic = BoolProperty(
+ name="Loop",
+ description="Loop the animation playback",
+ default=False,
+ )
+ rotate_mode = EnumProperty(
+ name="Rotation",
+ description="Rotation conversion.",
+ items=(('QUATERNION', "Quaternion",
+ "Convert rotations to quaternions"),
+ ('NATIVE', "Euler (Native)", ("Use the rotation order "
+ "defined in the BVH file")),
+ ('XYZ', "Euler (XYZ)", "Convert rotations to euler XYZ"),
+ ('XZY', "Euler (XZY)", "Convert rotations to euler XZY"),
+ ('YXZ', "Euler (YXZ)", "Convert rotations to euler YXZ"),
+ ('YZX', "Euler (YZX)", "Convert rotations to euler YZX"),
+ ('ZXY', "Euler (ZXY)", "Convert rotations to euler ZXY"),
+ ('ZYX', "Euler (ZYX)", "Convert rotations to euler ZYX"),
+ ),
+ default='NATIVE',
+ )
def execute(self, context):
+ keywords = self.as_keywords(ignore=("filter_glob",))
+
from . import import_bvh
- return import_bvh.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
+ return import_bvh.load(self, context, **keywords)
class ExportBVH(bpy.types.Operator, ExportHelper):
@@ -90,24 +113,47 @@ class ExportBVH(bpy.types.Operator, ExportHelper):
bl_label = "Export BVH"
filename_ext = ".bvh"
- filter_glob = StringProperty(default="*.bvh", options={'HIDDEN'})
-
- 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(name="Start Frame", description="Starting frame to export", default=0)
- frame_end = IntProperty(name="End Frame", description="End frame to export", default=0)
-
- rotate_mode = EnumProperty(items=(
- ('NATIVE', "Euler (Native)", "Use the rotation order defined in the BVH file"),
- ('XYZ', "Euler (XYZ)", "Convert rotations to euler XYZ"),
- ('XZY', "Euler (XZY)", "Convert rotations to euler XZY"),
- ('YXZ', "Euler (YXZ)", "Convert rotations to euler YXZ"),
- ('YZX', "Euler (YZX)", "Convert rotations to euler YZX"),
- ('ZXY', "Euler (ZXY)", "Convert rotations to euler ZXY"),
- ('ZYX', "Euler (ZYX)", "Convert rotations to euler ZYX"),
- ),
- name="Rotation",
- description="Rotation conversion.",
- default='NATIVE')
+ filter_glob = StringProperty(
+ default="*.bvh",
+ options={'HIDDEN'},
+ )
+
+ 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(
+ name="Start Frame",
+ description="Starting frame to export",
+ default=0,
+ )
+ frame_end = IntProperty(
+ name="End Frame",
+ description="End frame to export",
+ default=0,
+ )
+ rotate_mode = EnumProperty(
+ name="Rotation",
+ description="Rotation conversion.",
+ items=(('NATIVE', "Euler (Native)",
+ "Use the rotation order defined in the BVH file"),
+ ('XYZ', "Euler (XYZ)", "Convert rotations to euler XYZ"),
+ ('XZY', "Euler (XZY)", "Convert rotations to euler XZY"),
+ ('YXZ', "Euler (YXZ)", "Convert rotations to euler YXZ"),
+ ('YZX', "Euler (YZX)", "Convert rotations to euler YZX"),
+ ('ZXY', "Euler (ZXY)", "Convert rotations to euler ZXY"),
+ ('ZYX', "Euler (ZYX)", "Convert rotations to euler ZYX"),
+ ),
+ default='NATIVE',
+ )
+ root_transform_only = BoolProperty(
+ name="Root Transform Only",
+ description="Only write out transform channels for the root bone",
+ default=False,
+ )
@classmethod
def poll(cls, context):
@@ -125,8 +171,10 @@ 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"))
+
from . import export_bvh
- return export_bvh.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
+ return export_bvh.save(self, context, **keywords)
def menu_func_import(self, context):