diff options
author | Ken Nign <ken@virginpi.com> | 2010-09-21 05:23:50 +0400 |
---|---|---|
committer | Ken Nign <ken@virginpi.com> | 2010-09-21 05:23:50 +0400 |
commit | 67c39f2162f55d6d6ec96bcd6ef5967b5c417719 (patch) | |
tree | 550af609a606a0b9d0b3b847435c621de8cd81a7 /io_import_scene_lwo.py | |
parent | 7d15179979daca70848e05428c3b897e66f86896 (diff) |
added tracker URL to info
changed skelegon up-vector to bone roll conversion, should better match now
switch to Object mode before adding meshes/armatures, prevents new bones from being added into the currently edited armature
Diffstat (limited to 'io_import_scene_lwo.py')
-rw-r--r-- | io_import_scene_lwo.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/io_import_scene_lwo.py b/io_import_scene_lwo.py index 3923e9d5..c02f7bca 100644 --- a/io_import_scene_lwo.py +++ b/io_import_scene_lwo.py @@ -29,7 +29,8 @@ bl_addon_info= { "warning": "", "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\ "Scripts/File_I-O/LightWave_Object", - "tracker_url": "", + "tracker_url": "https://projects.blender.org/tracker/index.php?"\ + "func=detail&aid=23623&group_id=153&atid=469", "category": "Import/Export"} # Copyright (c) Ken Nign 2010 @@ -967,13 +968,12 @@ def build_armature(layer_data, bones): if skb_idx in layer_data.bone_rolls: xyz= layer_data.bone_rolls[skb_idx].split(' ') - vec= mathutils.Vector() - vec.x= float(xyz[0]) - vec.y= float(xyz[1]) - vec.z= float(xyz[2]) + vec= mathutils.Vector((float(xyz[0]), float(xyz[1]), float(xyz[2]))) quat= vec.to_track_quat('Y', 'Z') - nb.roll= quat.to_euler('XYZ')[2] * -1 - # XXX: This code may need a second look and test. + nb.roll= max(quat.to_euler('YZX')) + if nb.roll == 0.0: + nb.roll= min(quat.to_euler('YZX')) * -1 + # YZX order seems to produce the correct roll value. else: nb.roll= 0.0 @@ -1018,6 +1018,10 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub else: print("Building %d Objects" % len(object_layers)) + # Before adding any meshes or armatures go into Object mode. + if bpy.ops.object.mode_set.poll(): + bpy.ops.object.mode_set(mode='OBJECT') + for layer_data in object_layers: me= bpy.data.meshes.new(layer_data.name) me.vertices.add(len(layer_data.pnts)) |