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.
This commit is contained in:
Joshua Leung
2011-02-08 05:51:20 +00:00
parent 53afd19808
commit 9d6f9e74d4
2 changed files with 17 additions and 14 deletions

View File

@@ -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;
}

View File

@@ -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