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:
authorDaniel M. Basso <danielmbasso@gmail.com>2012-07-11 17:59:22 +0400
committerDaniel M. Basso <danielmbasso@gmail.com>2012-07-11 17:59:22 +0400
commit1328d1c884565e20f72ea51033902412eeea3a91 (patch)
treef79b6f55666dac58a48b4de8e4aa735e8454067a /io_anim_c3d
parent1dd571efee1758e622f48a42f46ce8dbc1a507af (diff)
added option to convert from Y-up coordinates
Diffstat (limited to 'io_anim_c3d')
-rw-r--r--io_anim_c3d/__init__.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/io_anim_c3d/__init__.py b/io_anim_c3d/__init__.py
index 605ebf63..ffd3658c 100644
--- a/io_anim_c3d/__init__.py
+++ b/io_anim_c3d/__init__.py
@@ -25,7 +25,7 @@
bl_info = {
'name': "C3D Graphics Lab Motion Capture file (.c3d)",
'author': "Daniel Monteiro Basso <daniel@basso.inf.br>",
- 'version': (2012, 7, 10, 1),
+ 'version': (2012, 7, 11, 1),
'blender': (2, 6, 3),
'location': "File > Import",
'description': "Imports C3D Graphics Lab Motion Capture files",
@@ -62,6 +62,7 @@ class C3DAnimateCloud(bpy.types.Operator):
fskip = 0
scale = 0
timer = None
+ Y_up = False
def modal(self, context, event):
if event.type == 'ESC':
@@ -78,7 +79,8 @@ class C3DAnimateCloud(bpy.types.Operator):
name = self.unames[self.prefix + ml]
o = bpy.context.scene.objects[name]
m = self.markerset.getMarker(ml, self.curframe)
- o.location = Vector(m.position) * self.scale
+ p = Vector(m.position) * self.scale
+ o.location = Vector((p[0], -p[2], p[1])) if self.Y_up else p
if m.confidence >= self.confidence:
o.keyframe_insert('location', frame=fno)
self.curframe += self.fskip
@@ -106,6 +108,11 @@ class C3DImporter(bpy.types.Operator):
filepath = StringProperty(
subtype='FILE_PATH',
)
+ Y_up = BoolProperty(
+ name="Up vector is Y axis",
+ default=False,
+ description="Convert to Blender coordinates",
+ )
from_inches = BoolProperty(
name="Convert from inches to metric",
default=False,
@@ -176,6 +183,7 @@ class C3DImporter(bpy.types.Operator):
(only works for standing poses)
"""
zmin = None
+ hidx = 1 if self.properties.Y_up else 2
for ml in ms.markerLabels:
if 'LTOE' in ml:
hd = ml.replace('LTOE', 'LFHD')
@@ -183,10 +191,10 @@ class C3DImporter(bpy.types.Operator):
break
pmin_idx = ms.markerLabels.index(ml)
pmax_idx = ms.markerLabels.index(hd)
- zmin = ms.frames[0][pmin_idx].position[2]
- zmax = ms.frames[0][pmax_idx].position[2]
+ zmin = ms.frames[0][pmin_idx].position[hidx]
+ zmax = ms.frames[0][pmax_idx].position[hidx]
if zmin is None: # could not find named markers, get extremes
- allz = [m.position[2] for m in ms.frames[0]]
+ allz = [m.position[hidx] for m in ms.frames[0]]
zmin, zmax = min(allz), max(allz)
return abs(zmax - zmin)
@@ -243,6 +251,7 @@ class C3DImporter(bpy.types.Operator):
C3DAnimateCloud.markerset = ms
C3DAnimateCloud.unames = unames
C3DAnimateCloud.scale = scale
+ C3DAnimateCloud.Y_up = self.properties.Y_up
C3DAnimateCloud.fskip = self.properties.frame_skip
C3DAnimateCloud.prefix = self.properties.prefix
C3DAnimateCloud.use_frame_no = self.properties.use_frame_no