force a transform clear after an armature action being exporter

This commit is contained in:
Jason0214
2019-03-31 11:07:35 -07:00
parent c96db28df4
commit b23d995ef5
5 changed files with 23 additions and 8 deletions

View File

@@ -2,6 +2,8 @@
AnimationPlayer as well as distribute Blender action into various
action exporting functions"""
import bpy
import mathutils
from .action import (
export_camera_action,
export_shapekey_action,
@@ -93,6 +95,7 @@ class ObjectAnimationExporter:
ActionStrip(active_action),
self.animation_player.active_animation
)
self.clear_action_effect()
if not self.need_baking:
# here export unmuted nla_tracks into animation resource,
@@ -108,6 +111,7 @@ class ObjectAnimationExporter:
ActionStrip(strip),
self.animation_player.active_animation
)
self.clear_action_effect()
def export_active_action_from_nla(self, escn_file, export_settings):
"""Export all unmute nla_tracks into an active action.
@@ -127,6 +131,7 @@ class ObjectAnimationExporter:
ActionStrip(strip),
self.animation_player.active_animation
)
self.clear_action_effect()
def export_stashed_track(self, escn_file, export_settings, stashed_track):
"""Export a muted nla_track, track with all its contained action
@@ -158,6 +163,7 @@ class ObjectAnimationExporter:
ActionStrip(strip),
anim_resource
)
self.clear_action_effect()
if self.need_baking:
stashed_track.mute = True
@@ -173,6 +179,15 @@ class ObjectAnimationExporter:
ActionStrip(strip),
anim_resource
)
self.clear_action_effect()
def clear_action_effect(self):
"""Clear side effect of exporting an action"""
if (isinstance(self.blender_object, bpy.types.Object) and
self.blender_object.pose is not None):
for pose_bone in self.blender_object.pose.bones:
rest_bone = pose_bone.bone
pose_bone.matrix_basis = mathutils.Matrix.Identity(4)
def export_animation_data(escn_file, export_settings, godot_node,

View File

@@ -49,13 +49,13 @@ bones/0/bound_children = []
bones/1/name = "Bone.001"
bones/1/parent = 0
bones/1/rest = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 3.42285e-08, 0.0, -3.42285e-08, 1.0, 0.0, 0.0, -1.0)
bones/1/pose = Transform(0.949509, 0.207304, 0.235496, -0.189531, 0.97717, -0.096008, -0.250022, 0.0465267, 0.967122, 0.0, 0.0, 0.0)
bones/1/pose = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
bones/1/enabled = true
bones/1/bound_children = []
bones/2/name = "Bone.002"
bones/2/parent = 1
bones/2/rest = Transform(1.0, 0.0, 0.0, 0.0, 1.0, -3.55271e-15, 0.0, 3.55271e-15, 1.0, 0.0, 0.0, -1.30874)
bones/2/pose = Transform(0.830409, 0.381597, 0.405961, -0.321902, 0.923317, -0.20944, -0.454752, 0.0432416, 0.889567, 0.0, 0.0, 0.0)
bones/2/pose = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
bones/2/enabled = true
bones/2/bound_children = []

View File

@@ -55,7 +55,7 @@ bones/0/bound_children = []
bones/1/name = "Bone.002"
bones/1/parent = -1
bones/1/rest = Transform(-0.454064, -0.868627, -0.198275, -0.0311123, 0.23786, -0.970801, 0.890426, -0.434637, -0.135029, 0.00854362, 2.58513, -0.0545189)
bones/1/pose = Transform(0.999995, 0.00328448, 0.000475731, -0.00328036, 0.999959, -0.00841181, -0.00050334, 0.0084102, 0.999965, 0.0, 0.0, 0.0)
bones/1/pose = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
bones/1/enabled = true
bones/1/bound_children = []

View File

@@ -64,7 +64,7 @@ bones/0/bound_children = []
bones/1/name = "bone"
bones/1/parent = 0
bones/1/rest = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, -1.0)
bones/1/pose = Transform(0.99961, -0.00771234, -0.0268356, 0.00777253, 0.999968, 0.00213956, 0.0268182, -0.0023473, 0.999638, 0.0, 0.0, 0.0)
bones/1/pose = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
bones/1/enabled = true
bones/1/bound_children = []
bones/2/name = "bone001"

View File

@@ -87,13 +87,13 @@ bones/0/bound_children = []
bones/1/name = "Bone.003"
bones/1/parent = 0
bones/1/rest = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, -3.25295)
bones/1/pose = Transform(0.915486, -0.40227, -0.00805298, 0.401138, 0.910989, 0.0958551, -0.0312235, -0.0909843, 0.995363, 0.0, 0.0, 0.0)
bones/1/pose = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
bones/1/enabled = true
bones/1/bound_children = []
bones/2/name = "Bone.004"
bones/2/parent = 1
bones/2/rest = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, -1.47006)
bones/2/pose = Transform(0.916484, -0.373658, 0.142955, 0.390535, 0.758028, -0.522375, 0.0868252, 0.534577, 0.840648, 0.0, 0.0, 0.0)
bones/2/pose = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
bones/2/enabled = true
bones/2/bound_children = []
@@ -116,13 +116,13 @@ transform = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, -0.82603
bones/0/name = "Bone.001"
bones/0/parent = -1
bones/0/rest = Transform(1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0)
bones/0/pose = Transform(0.994451, -0.09531, -0.0445356, 0.0818319, 0.966848, -0.241885, 0.0661132, 0.236898, 0.969282, 0.0, 0.0, 0.0)
bones/0/pose = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
bones/0/enabled = true
bones/0/bound_children = []
bones/1/name = "Bone.002"
bones/1/parent = 0
bones/1/rest = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, -0.984039)
bones/1/pose = Transform(0.999994, -0.00299644, -0.00185484, 0.00298136, 0.999963, -0.00808109, 0.00187899, 0.00807551, 0.999966, 0.0, 0.0, 0.0)
bones/1/pose = Transform(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)
bones/1/enabled = true
bones/1/bound_children = []
bones/2/name = "Bone.003"