Skip to content
Snippets Groups Projects
Commit 67c39f21 authored by Ken Nign's avatar Ken Nign
Browse files

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
parent 7d151799
No related branches found
No related tags found
No related merge requests found
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment