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:
authorCampbell Barton <ideasman42@gmail.com>2011-05-04 09:52:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-04 09:52:14 +0400
commitea5b43d862a4004280660405d50560d576f6fed9 (patch)
tree00c3419ef8a7f3af173b18ce5a4729fb3693e910 /source/blender/editors/object/object_constraint.c
parentb5c2598a6b31f63ee6d52c61d6ab5195a576ec56 (diff)
fix [#26920] working with bones causes segmetation fault.
ITASC IK solver data wasn't being cleared when constraints were removed, would access freed memory and crash.
Diffstat (limited to 'source/blender/editors/object/object_constraint.c')
-rw-r--r--source/blender/editors/object/object_constraint.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index b0f931fac35..450bd70a568 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -844,7 +844,8 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
Object *ob= ptr.id.data;
bConstraint *con= ptr.data;
ListBase *lb = get_constraint_lb(ob, con, NULL);
-
+ const short is_ik= ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
+
/* free the constraint */
if (remove_constraint(lb, con)) {
/* there's no active constraint now, so make sure this is the case */
@@ -852,6 +853,11 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
ED_object_constraint_update(ob); /* needed to set the flags on posebones correctly */
+ /* ITASC needs to be rebuilt once a constraint is removed [#26920] */
+ if(is_ik) {
+ BIK_clear_data(ob->pose);
+ }
+
/* notifiers */
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, ob);
@@ -993,6 +999,8 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
/* force depsgraph to get recalculated since relationships removed */
DAG_scene_sort(bmain, scene); /* sort order of objects */
+ /* note, calling BIK_clear_data() isnt needed here */
+
/* do updates */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
@@ -1003,7 +1011,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
void POSE_OT_constraints_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Clear Constraints";
+ ot->name = "Clear Pose Constraints";
ot->idname= "POSE_OT_constraints_clear";
ot->description= "Clear all the constraints for the selected bones";
@@ -1038,7 +1046,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_constraints_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Clear Constraints";
+ ot->name = "Clear Object Constraints";
ot->idname= "OBJECT_OT_constraints_clear";
ot->description= "Clear all the constraints for the active Object only";