Correct vertex scaling for blender 2.62+

This also abandons support for older versions of blender.
This commit is contained in:
Bill Currie 2012-04-14 18:10:25 +09:00
parent bbd277cb72
commit ab4aec47a7

View file

@ -33,15 +33,12 @@ def make_verts(mdl, framenum, subframenum=0):
verts = [] verts = []
s = Vector(mdl.scale) s = Vector(mdl.scale)
o = Vector(mdl.scale_origin) o = Vector(mdl.scale_origin)
m = Matrix(((s.x, 0, 0, 0), m = Matrix(((s.x, 0, 0,o.x),
( 0,s.y, 0, 0), ( 0,s.y, 0,o.y),
( 0, 0,s.z, 0), ( 0, 0,s.z,o.z),
(o.x,o.y,o.z, 1))) ( 0, 0, 0, 1)))
for v in frame.verts: for v in frame.verts:
try: #FIXME verts.append(m * Vector(v.r))
verts.append(Vector(v.r) * m)
except ValueError:
verts.append(m * Vector(v.r))
return verts return verts
def make_faces(mdl): def make_faces(mdl):
@ -139,15 +136,12 @@ def make_shape_key(mdl, framenum, subframenum=0):
mdl.keys.append (frame.key) mdl.keys.append (frame.key)
s = Vector(mdl.scale) s = Vector(mdl.scale)
o = Vector(mdl.scale_origin) o = Vector(mdl.scale_origin)
m = Matrix(((s.x, 0, 0, 0), m = Matrix(((s.x, 0, 0,o.x),
( 0,s.y, 0, 0), ( 0,s.y, 0,o.y),
( 0, 0,s.z, 0), ( 0, 0,s.z,o.z),
(o.x,o.y,o.z, 1))) ( 0, 0, 0, 1)))
for i, v in enumerate(frame.verts): for i, v in enumerate(frame.verts):
try: #FIXME frame.key.data[i].co = m * Vector(v.r)
frame.key.data[i].co = Vector(v.r) * m
except ValueError:
frame.key.data[i].co = m * Vector(v.r)
def build_shape_keys(mdl): def build_shape_keys(mdl):
mdl.keys = [] mdl.keys = []