diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-09-24 20:20:34 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-09-24 20:20:34 -0300 |
commit | 46135affac29a09200fc01a34dd8408a3d83d493 (patch) | |
tree | b48f53917cd7d15bb47a937f0e7a56375b87ecb0 | |
parent | cf04e1a827cadb597d8cbed534a4cc04a0ada4fc (diff) | |
parent | c53dc526bffb2ee497b9d0c092466af2b793bc06 (diff) |
Merge pull request #726 from rollenrolm/collada_exporter
Collada exporter
-rw-r--r-- | tools/export/blender25/io_scene_dae/export_dae.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py index 38c5c3b723..867b0a00e7 100644 --- a/tools/export/blender25/io_scene_dae/export_dae.py +++ b/tools/export/blender25/io_scene_dae/export_dae.py @@ -1059,6 +1059,8 @@ class DaeExporter: #Collada starts from 0, blender usually from 1 #The last frame must be included also + frame_orig = self.scene.frame_current + frame_len = 1.0 / self.scene.render.fps frame_total = end - start + 1 frame_sub = 0 @@ -1126,6 +1128,7 @@ class DaeExporter: xform_cache[bone_name].append( (key,mtx) ) + self.scene.frame_set(frame_orig) #export animation xml for nid in xform_cache: @@ -1141,10 +1144,17 @@ class DaeExporter: if (self.config["use_anim_action_all"] and len(self.skeletons)): + cached_actions = {} + + for s in self.skeletons: + if s.animation_data and s.animation_data.action: + cached_actions[s] = s.animation_data.action.name + + self.writel(S_ANIM_CLIPS,0,'<library_animation_clips>') for x in bpy.data.actions[:]: - if x in self.action_constraints: + if x.users==0 or x in self.action_constraints: continue bones=[] @@ -1185,6 +1195,11 @@ class DaeExporter: self.writel(S_ANIM_CLIPS,0,'</library_animation_clips>') + for s in self.skeletons: + if s in cached_actions: + s.animation_data.action = bpy.data.actions[cached_actions[s]] + else: + s.animation_data.action = None else: self.export_animation(self.scene.frame_start,self.scene.frame_end) |