[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41612] trunk/blender/source/blender: Bugfix [#29064] armature with curve contraint - crash
Joshua Leung
aligorith at gmail.com
Mon Nov 7 14:25:18 CET 2011
Revision: 41612
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41612
Author: aligorith
Date: 2011-11-07 13:25:17 +0000 (Mon, 07 Nov 2011)
Log Message:
-----------
Bugfix [#29064] armature with curve contraint - crash
Spline IK and Auto-IK working together on the same bone chain could
crash due to the somewhat hacky way that they were sharing the same
list for the "iktree" forest. Resolved by doing what I should have
done from the beginning, and made Spline-IK save its ik chains off
into a separate list.
While this fixes the crash, it might be worth investigating outright
disabling this from working in this case, since it can be a bit
confusing to have it appear to not work.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/armature.c
trunk/blender/source/blender/blenloader/intern/readfile.c
trunk/blender/source/blender/ikplugin/intern/iksolver_plugin.c
trunk/blender/source/blender/makesdna/DNA_action_types.h
Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/armature.c 2011-11-07 12:56:05 UTC (rev 41611)
+++ trunk/blender/source/blender/blenkernel/intern/armature.c 2011-11-07 13:25:17 UTC (rev 41612)
@@ -1818,7 +1818,7 @@
tree->ikData= ikData;
/* AND! link the tree to the root */
- BLI_addtail(&pchanRoot->iktree, tree);
+ BLI_addtail(&pchanRoot->siktree, tree);
}
/* mark root channel having an IK tree */
@@ -2045,27 +2045,24 @@
tSplineIK_Tree *tree;
/* for each pose-tree, execute it if it is spline, otherwise just free it */
- for (tree= pchan_root->iktree.first; tree; tree= pchan_root->iktree.first) {
- /* only evaluate if tagged for Spline IK */
- if (tree->type == CONSTRAINT_TYPE_SPLINEIK) {
- int i;
-
- /* walk over each bone in the chain, calculating the effects of spline IK
- * - the chain is traversed in the opposite order to storage order (i.e. parent to children)
- * so that dependencies are correct
- */
- for (i= tree->chainlen-1; i >= 0; i--) {
- bPoseChannel *pchan= tree->chain[i];
- splineik_evaluate_bone(tree, scene, ob, pchan, i, ctime);
- }
-
- /* free the tree info specific to SplineIK trees now */
- if (tree->chain) MEM_freeN(tree->chain);
- if (tree->free_points) MEM_freeN(tree->points);
+ while ((tree = pchan_root->siktree.first) != NULL) {
+ int i;
+
+ /* walk over each bone in the chain, calculating the effects of spline IK
+ * - the chain is traversed in the opposite order to storage order (i.e. parent to children)
+ * so that dependencies are correct
+ */
+ for (i= tree->chainlen-1; i >= 0; i--) {
+ bPoseChannel *pchan= tree->chain[i];
+ splineik_evaluate_bone(tree, scene, ob, pchan, i, ctime);
}
+ /* free the tree info specific to SplineIK trees now */
+ if (tree->chain) MEM_freeN(tree->chain);
+ if (tree->free_points) MEM_freeN(tree->points);
+
/* free this tree */
- BLI_freelinkN(&pchan_root->iktree, tree);
+ BLI_freelinkN(&pchan_root->siktree, tree);
}
}
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2011-11-07 12:56:05 UTC (rev 41611)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2011-11-07 13:25:17 UTC (rev 41612)
@@ -4064,6 +4064,7 @@
direct_link_motionpath(fd, pchan->mpath);
pchan->iktree.first= pchan->iktree.last= NULL;
+ pchan->siktree.first= pchan->siktree.last= NULL;
/* incase this value changes in future, clamp else we get undefined behavior */
CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
Modified: trunk/blender/source/blender/ikplugin/intern/iksolver_plugin.c
===================================================================
--- trunk/blender/source/blender/ikplugin/intern/iksolver_plugin.c 2011-11-07 12:56:05 UTC (rev 41611)
+++ trunk/blender/source/blender/ikplugin/intern/iksolver_plugin.c 2011-11-07 13:25:17 UTC (rev 41612)
@@ -526,12 +526,14 @@
/* 6. apply the differences to the channels,
we need to calculate the original differences first */
- for(a=0; a<tree->totchannel; a++)
+ for(a=0; a<tree->totchannel; a++) {
make_dmats(tree->pchan[a]);
+ }
- for(a=0; a<tree->totchannel; a++)
+ for(a=0; a<tree->totchannel; a++) {
/* sets POSE_DONE */
where_is_ik_bone(tree->pchan[a], tree->basis_change[a]);
+ }
/* 7. and free */
BLI_remlink(&pchan->iktree, tree);
Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h 2011-11-07 12:56:05 UTC (rev 41611)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h 2011-11-07 13:25:17 UTC (rev 41612)
@@ -198,8 +198,10 @@
struct Bone *bone; /* set on read file or rebuild pose */
struct bPoseChannel *parent; /* set on read file or rebuild pose */
struct bPoseChannel *child; /* set on read file or rebuild pose, the 'ik' child, for b-bones */
- struct ListBase iktree; /* only while evaluating pose */
+ struct ListBase iktree; /* "IK trees" - only while evaluating pose */
+ struct ListBase siktree; /* Spline-IK "trees" - only while evaluating pose */
+
bMotionPath *mpath; /* motion path cache for this bone */
struct Object *custom; /* draws custom object instead of default bone shape */
struct bPoseChannel *custom_tx; /* odd feature, display with another bones transform. needed in rare cases for advanced rigs, since the alternative is highly complicated - campbell */
More information about the Bf-blender-cvs
mailing list