From a21cdd9369243596c632314eea94b67a6744eb1f Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 27 Jan 2009 21:19:19 +0000 Subject: [PATCH] Fix for bug #18183: crash when using "Bake Constraints" script. The constraint remove function was not working correct, this code uses a pretty bad hack, did not clean it up, but at least it should work now. --- source/blender/python/api2_2x/Constraint.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/python/api2_2x/Constraint.c b/source/blender/python/api2_2x/Constraint.c index b0b9aa04a08..1845ce6f0de 100644 --- a/source/blender/python/api2_2x/Constraint.c +++ b/source/blender/python/api2_2x/Constraint.c @@ -2291,6 +2291,7 @@ static PyObject *ConstraintSeq_remove( BPy_ConstraintSeq *self, BPy_Constraint * { bConstraint *con = locate_constr(self, value); bPoseChannel *active= NULL; + int tmpflag= 0; /* if we can't locate the constraint, return (exception already set) */ if (!con) @@ -2304,6 +2305,11 @@ static PyObject *ConstraintSeq_remove( BPy_ConstraintSeq *self, BPy_Constraint * if (active) active->bone->flag &= ~BONE_ACTIVE; self->pchan->bone->flag |= BONE_ACTIVE; } + + if(!(self->obj->flag & OB_POSEMODE)) { + self->obj->flag |= OB_POSEMODE; + tmpflag= 1; + } } /* del_constr_func() frees constraint + its data */ @@ -2314,6 +2320,8 @@ static PyObject *ConstraintSeq_remove( BPy_ConstraintSeq *self, BPy_Constraint * if (active) active->bone->flag |= BONE_ACTIVE; self->pchan->bone->flag &= ~BONE_ACTIVE; } + if(tmpflag) + self->obj->flag &= ~OB_POSEMODE; /* erase the link to the constraint */ value->con = NULL;