diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-02-08 08:51:20 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-02-08 08:51:20 +0300 |
commit | 9d6f9e74d4ad76269146e36697a21679c7d5aaa5 (patch) | |
tree | 1fdce9c4b981edcb37b510ad7144217161c7da2d /source/blender | |
parent | 53afd198084e4bca72d6694708d801a799a2f76f (diff) |
Bugfix [#25814] ChildOf constraint: double transformation in object
mode with drivers
ChildOf constraints added using the PoseBone.constraints.new() method
via Python scripts instead of using the operator (this latter method
is still the preferred/recommended method) were not getting some
critical flags set, causing errors arising from space conversions
being performed more than once.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 15 | ||||
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 16 |
2 files changed, 17 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 1e3ff7142a1..be9e7609a64 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -4148,6 +4148,21 @@ static bConstraint *add_new_constraint (Object *ob, bPoseChannel *pchan, const c constraints_set_active(list, con); } + /* set type+owner specific immutable settings */ + // TODO: does action constraint need anything here - i.e. spaceonce? + switch (type) { + case CONSTRAINT_TYPE_CHILDOF: + { + /* if this constraint is being added to a posechannel, make sure + * the constraint gets evaluated in pose-space */ + if (pchan) { + con->ownspace = CONSTRAINT_SPACE_POSE; + con->flag |= CONSTRAINT_SPACEONCE; + } + } + break; + } + return con; } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index e92d73a3e67..f3346bf200c 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1272,12 +1272,12 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase bPoseChannel *pchan; bConstraint *con; - if(list == &ob->constraints) { + if (list == &ob->constraints) { pchan= NULL; } else { pchan= get_active_posechannel(ob); - + /* ensure not to confuse object/pose adding */ if (pchan == NULL) { BKE_report(op->reports, RPT_ERROR, "No active pose bone to add a constraint to."); @@ -1327,19 +1327,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase } /* do type-specific tweaking to the constraint settings */ - // TODO: does action constraint need anything here - i.e. spaceonce? switch (type) { - case CONSTRAINT_TYPE_CHILDOF: - { - /* if this constraint is being added to a posechannel, make sure - * the constraint gets evaluated in pose-space */ - if (pchan) { - con->ownspace = CONSTRAINT_SPACE_POSE; - con->flag |= CONSTRAINT_SPACEONCE; - } - } - break; - case CONSTRAINT_TYPE_PYTHON: // FIXME: this code is not really valid anymore { #ifdef WITH_PYTHON |