@@ -44,7 +44,7 @@ def dot_nodeanim(ob, doc, xmlnode):
4444 return
4545
4646 anim = ob .animation_data
47-
47+
4848 if anim is None or anim .nla_tracks is None :
4949 return
5050
@@ -109,15 +109,15 @@ def write_animation(ob, action, frame_start, frame_end, doc, xmlnode):
109109 a .setAttribute ("rotationInterpolationMode" , "linear" )
110110 a .setAttribute ("length" , '%6f' % ((frame_end ) / _fps ))
111111 aa .appendChild (a )
112-
112+
113113 frame_current = bpy .context .scene .frame_current
114114
115115 initial_location = mathutils .Vector ((0 , 0 , 0 ))
116116 initial_rotation = mathutils .Quaternion ((1 , 0 , 0 , 0 ))
117117 initial_scale = mathutils .Vector ((1 , 1 , 1 ))
118-
118+
119119 frames = range (int (frame_start ), int (frame_end ) + 1 )
120-
120+
121121 # If NODE_KEYFRAMES is True, then use only the keyframes to export the animation
122122 #if config.get('NODE_KEYFRAMES'):
123123 # frames = get_keyframes(action)
@@ -129,7 +129,7 @@ def write_animation(ob, action, frame_start, frame_end, doc, xmlnode):
129129 a .appendChild (kf )
130130
131131 bpy .context .scene .frame_set (frame )
132-
132+
133133 translation = mathutils .Vector ((0 , 0 , 0 ))
134134 rotation_quat = mathutils .Quaternion ((1 , 0 , 0 , 0 ))
135135 scale = mathutils .Vector ((1 , 1 , 1 ))
@@ -146,46 +146,46 @@ def write_animation(ob, action, frame_start, frame_end, doc, xmlnode):
146146 scale .x = current_scale .x / initial_scale .x
147147 scale .y = current_scale .y / initial_scale .y
148148 scale .z = current_scale .z / initial_scale .z
149-
149+
150150 t = doc .createElement ('position' )
151151 t .setAttribute ("x" , '%6f' % translation .x )
152152 t .setAttribute ("y" , '%6f' % translation .y )
153153 t .setAttribute ("z" , '%6f' % translation .z )
154154 kf .appendChild (t )
155-
155+
156156 q = doc .createElement ('rotation' )
157157 q .setAttribute ("qw" , '%6f' % rotation_quat .w )
158158 q .setAttribute ("qx" , '%6f' % rotation_quat .x )
159159 q .setAttribute ("qy" , '%6f' % rotation_quat .y )
160160 q .setAttribute ("qz" , '%6f' % rotation_quat .z )
161161 kf .appendChild (q )
162-
162+
163163 s = doc .createElement ('scale' )
164164 s .setAttribute ("x" , '%6f' % scale .x )
165165 s .setAttribute ("y" , '%6f' % scale .y )
166166 s .setAttribute ("z" , '%6f' % scale .z )
167167 kf .appendChild (s )
168-
168+
169169 bpy .context .scene .frame_set (frame_current )
170170
171171def calc_scale (matrix_local ):
172172 # Scale is different in Ogre from blender - rotation is removed
173173 ri = matrix_local .to_quaternion ().inverted ().to_matrix ()
174174 scale = ri .to_4x4 () * matrix_local
175175 v = util .swap ( scale .to_scale () )
176-
176+
177177 return mathutils .Vector ((abs (v .x ), abs (v .y ), abs (v .z )))
178178
179179def get_keyframes (action ):
180180
181181 keyframes = {}
182-
182+
183183 for fcurve in action .fcurves :
184184
185185 for keyframe in fcurve .keyframe_points :
186-
186+
187187 frame , value = keyframe .co
188-
188+
189189 # Add Keyframe if it does not exist
190190 if frame not in keyframes :
191191 keyframes [frame ] = frame
0 commit comments