Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2007-05-09 15:16:32 +0400
committerTon Roosendaal <ton@blender.org>2007-05-09 15:16:32 +0400
commitc8c8a92ab693a589f2897c25f28738d8397646bd (patch)
tree525095986451254ab054573a85d3d2d89eaf9933
parent5dc38787077a084bbb0ab95ce4718189d7af8d3d (diff)
In very rare cases, an offset-bone could not exist, whilst the action
channel does. Then it crashes... This commit adds a NULL test, but now trying to solve how this case can happen.
-rw-r--r--source/blender/blenkernel/intern/action.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 3427d794870..8ecdedc329e 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -987,20 +987,22 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
/* bring it into armature space */
VecSubf(min, max, min);
bone= get_named_bone(ob->data, strip->offs_bone); /* weak */
- Mat4Mul3Vecfl(bone->arm_mat, min);
-
- /* dominant motion, cyclic_offset was cleared in rest_pose */
- if (strip->flag & (ACTSTRIP_CYCLIC_USEX | ACTSTRIP_CYCLIC_USEY | ACTSTRIP_CYCLIC_USEZ)) {
- if (strip->flag & ACTSTRIP_CYCLIC_USEX) pose->cyclic_offset[0]= time*min[0];
- if (strip->flag & ACTSTRIP_CYCLIC_USEY) pose->cyclic_offset[1]= time*min[1];
- if (strip->flag & ACTSTRIP_CYCLIC_USEZ) pose->cyclic_offset[2]= time*min[2];
- } else {
- if( fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2]))
- pose->cyclic_offset[0]= time*min[0];
- else if( fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2]))
- pose->cyclic_offset[1]= time*min[1];
- else
- pose->cyclic_offset[2]= time*min[2];
+ if(bone) {
+ Mat4Mul3Vecfl(bone->arm_mat, min);
+
+ /* dominant motion, cyclic_offset was cleared in rest_pose */
+ if (strip->flag & (ACTSTRIP_CYCLIC_USEX | ACTSTRIP_CYCLIC_USEY | ACTSTRIP_CYCLIC_USEZ)) {
+ if (strip->flag & ACTSTRIP_CYCLIC_USEX) pose->cyclic_offset[0]= time*min[0];
+ if (strip->flag & ACTSTRIP_CYCLIC_USEY) pose->cyclic_offset[1]= time*min[1];
+ if (strip->flag & ACTSTRIP_CYCLIC_USEZ) pose->cyclic_offset[2]= time*min[2];
+ } else {
+ if( fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2]))
+ pose->cyclic_offset[0]= time*min[0];
+ else if( fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2]))
+ pose->cyclic_offset[1]= time*min[1];
+ else
+ pose->cyclic_offset[2]= time*min[2];
+ }
}
}
}