[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48661] branches/soc-2012-bratwurst/source /blender/collada: Armature animation improvements.
Sukhitha Jayathilake
pr.jayathilake at gmail.com
Thu Jul 5 21:19:52 CEST 2012
Revision: 48661
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48661
Author: phabtar
Date: 2012-07-05 19:19:50 +0000 (Thu, 05 Jul 2012)
Log Message:
-----------
Armature animation improvements.
Modified Paths:
--------------
branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.cpp
branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.h
branches/soc-2012-bratwurst/source/blender/collada/AnimationImporter.cpp
branches/soc-2012-bratwurst/source/blender/collada/ArmatureImporter.cpp
branches/soc-2012-bratwurst/source/blender/collada/CMakeLists.txt
branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.cpp
Modified: branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.cpp
===================================================================
--- branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.cpp 2012-07-05 18:33:52 UTC (rev 48660)
+++ branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.cpp 2012-07-05 19:19:50 UTC (rev 48661)
@@ -410,19 +410,21 @@
FCurve *fcu = (FCurve *)ob_arm->adt->action->curves.first;
//Check if there is a fcurve in the armature for the bone in param
- while (fcu) {
+ //when baking this check is not needed, solve every bone for every frame.
+ /*while (fcu) {
std::string bone_name = getObjectBoneName(ob_arm, fcu);
int val = BLI_strcasecmp((char *)bone_name.c_str(), bone->name);
if (val == 0) break;
fcu = fcu->next;
}
- if (!(fcu)) return;
+ if (!(fcu)) return;*/
bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name);
if (!pchan)
return;
+ //every inserted keyframe of bones.
find_frames(ob_arm, fra);
if (flag & ARM_RESTPOS) {
@@ -848,6 +850,15 @@
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ANIM);
if (bone){
+ /* 4a. if we find an IK root, we handle it separated */
+ if (pchan->flag & POSE_IKTREE) {
+ BIK_execute_tree(scene, ob, pchan, ctime);
+ }
+ ///* 4b. if we find a Spline IK root, we handle it separated too */
+ //else if (pchan->flag & POSE_IKSPLINE) {
+ // splineik_execute_tree(scene, ob, pchan, ctime);
+ //}
+
BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
// compute bone local mat
if (bone->parent) {
Modified: branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.h 2012-07-05 18:33:52 UTC (rev 48660)
+++ branches/soc-2012-bratwurst/source/blender/collada/AnimationExporter.h 2012-07-05 19:19:50 UTC (rev 48661)
@@ -43,6 +43,7 @@
#include "BKE_animsys.h"
#include "BKE_scene.h"
#include "BKE_object.h"
+
#ifdef NAN_BUILDINFO
extern char build_rev[];
#endif
@@ -54,6 +55,7 @@
#include "BKE_armature.h"
#include "BKE_object.h"
#include "BKE_constraint.h"
+#include "BIK_api.h"
#include "BLI_math.h"
#include "BLI_string.h"
Modified: branches/soc-2012-bratwurst/source/blender/collada/AnimationImporter.cpp
===================================================================
--- branches/soc-2012-bratwurst/source/blender/collada/AnimationImporter.cpp 2012-07-05 18:33:52 UTC (rev 48660)
+++ branches/soc-2012-bratwurst/source/blender/collada/AnimationImporter.cpp 2012-07-05 19:19:50 UTC (rev 48661)
@@ -857,7 +857,6 @@
else {
if (is_joint) {
-
add_bone_animation_sampled(ob, animcurves, root, node, transform);
}
else {
Modified: branches/soc-2012-bratwurst/source/blender/collada/ArmatureImporter.cpp
===================================================================
--- branches/soc-2012-bratwurst/source/blender/collada/ArmatureImporter.cpp 2012-07-05 18:33:52 UTC (rev 48660)
+++ branches/soc-2012-bratwurst/source/blender/collada/ArmatureImporter.cpp 2012-07-05 19:19:50 UTC (rev 48661)
@@ -138,7 +138,7 @@
copy_v3_v3(parent->tail, bone->head);
// not setting BONE_CONNECTED because this would lock child bone location with respect to parent
- // bone->flag |= BONE_CONNECTED;
+ bone->flag |= BONE_CONNECTED;
// XXX increase this to prevent "very" small bones?
const float epsilon = 0.000001f;
@@ -314,6 +314,8 @@
void ArmatureImporter::create_armature_bones( )
{
std::vector<COLLADAFW::Node *>::iterator ri;
+
+ leaf_bone_length = FLT_MAX;
//if there is an armature created for root_joint next root_joint
for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
if (get_armature_for_joint(*ri) != NULL) continue;
@@ -325,12 +327,10 @@
ED_armature_to_edit(ob_arm);
- // create unskinned bones
/*
* TODO:
* check if bones have already been created for a given joint
*/
- leaf_bone_length = FLT_MAX;
create_bone(NULL, *ri , NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature *)ob_arm->data);
Modified: branches/soc-2012-bratwurst/source/blender/collada/CMakeLists.txt
===================================================================
--- branches/soc-2012-bratwurst/source/blender/collada/CMakeLists.txt 2012-07-05 18:33:52 UTC (rev 48660)
+++ branches/soc-2012-bratwurst/source/blender/collada/CMakeLists.txt 2012-07-05 19:19:50 UTC (rev 48661)
@@ -36,6 +36,7 @@
../windowmanager
../imbuf
../../../intern/guardedalloc
+ ../ikplugin
)
set(INC_SYS
Modified: branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.cpp
===================================================================
--- branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.cpp 2012-07-05 18:33:52 UTC (rev 48660)
+++ branches/soc-2012-bratwurst/source/blender/collada/DocumentImporter.cpp 2012-07-05 19:19:50 UTC (rev 48661)
@@ -252,7 +252,7 @@
{
// The split in #29246, rootmap must point at actual root when
- // calculating bones in apply_curves_as_matrix.
+ // calculating bones in apply_curves_as_matrix. - actual root is the root node.
// This has to do with inverse bind poses being world space
// (the sources for skinned bones' restposes) and the way
// non-skinning nodes have their "restpose" recursively calculated.
@@ -261,7 +261,7 @@
if (par) { // && par->getType() == COLLADAFW::Node::JOINT) {
// par is root if there's no corresp. key in root_map
if (root_map.find(par->getUniqueId()) == root_map.end())
- root_map[node->getUniqueId()] = par;
+ root_map[node->getUniqueId()] = node;
else
root_map[node->getUniqueId()] = root_map[par->getUniqueId()];
}
More information about the Bf-blender-cvs
mailing list