From 2cb3fe3dfd830386633e5642d35108be8b6b6a17 Mon Sep 17 00:00:00 2001 From: Domino Marama Date: Sun, 5 Feb 2012 16:19:28 +0000 Subject: =?UTF-8?q?Patch=20#30050=20by=20Juha=20M=C3=A4ki-Kanto=20(kanttor?= =?UTF-8?q?i)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes for Collada exporter. Adds Second Life compatibility for armatures Adds objects parentinverse to exported transform if it's non-identity Fix mismatch between add_inv_bind_mats and add_joints_source accessor counts Fix bone exports in world space should be local space --- source/blender/collada/AnimationExporter.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source/blender/collada/AnimationExporter.cpp') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 7b57ed243a1..c2d8c356aae 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -773,6 +773,27 @@ std::string AnimationExporter::create_4x4_source(std::vector &frames , Ob copy_m4_m4(mat, pchan->pose_mat); UnitConverter converter; + // SECOND_LIFE_COMPATIBILITY + // AFAIK animation to second life is via BVH, but no + // reason to not have the collada-animation be correct + if(export_settings->second_life) + { + float temp[4][4]; + copy_m4_m4(temp, bone->arm_mat); + temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; + invert_m4(temp); + + mult_m4_m4m4(mat, mat, temp); + + if(bone->parent) + { + copy_m4_m4(temp, bone->parent->arm_mat); + temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; + + mult_m4_m4m4(mat, temp, mat); + } + } + float outmat[4][4]; converter.mat4_to_dae(outmat,mat); -- cgit v1.2.3