diff options
author | Joshua Leung <aligorith@gmail.com> | 2012-05-17 14:28:30 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2012-05-17 14:28:30 +0400 |
commit | f9043865a23f42b2705c66ffcdf7b9f4e6f6072d (patch) | |
tree | d4715afac91547e3a7ba03d817d72c7e161299f4 /source | |
parent | c7c937547b0ceb622262ea064db71364f61669c6 (diff) |
Disable setting non-object actions as the action used by the Action Constraint
(... I could've sworn there used to be some dynamic enums for filtering actions
by root type)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 21 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 1 |
2 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index d73b53deecc..7cc11fa0209 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -356,8 +356,15 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) bActionConstraint *data = curcon->data; /* validate action */ - if (data->act == NULL) + if (data->act == NULL) { + /* must have action */ curcon->flag |= CONSTRAINT_DISABLE; + } + else if (data->act->idroot != ID_OB) { + /* only object-rooted actions can be used */ + data->act = NULL; + curcon->flag |= CONSTRAINT_DISABLE; + } } else if (curcon->type == CONSTRAINT_TYPE_FOLLOWPATH) { bFollowPathConstraint *data = curcon->data; @@ -409,12 +416,12 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) if (data->clip != NULL && data->track[0]) { MovieTracking *tracking = &data->clip->tracking; MovieTrackingObject *tracking_object; - + if (data->object[0]) tracking_object = BKE_tracking_named_object(tracking, data->object); else tracking_object = BKE_tracking_get_camera_object(tracking); - + if (!tracking_object) { curcon->flag |= CONSTRAINT_DISABLE; } @@ -428,14 +435,14 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) } else if (curcon->type == CONSTRAINT_TYPE_CAMERASOLVER) { bCameraSolverConstraint *data = curcon->data; - - if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL) + + if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && (data->clip == NULL)) curcon->flag |= CONSTRAINT_DISABLE; } else if (curcon->type == CONSTRAINT_TYPE_OBJECTSOLVER) { bObjectSolverConstraint *data = curcon->data; - - if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL) + + if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && (data->clip == NULL)) curcon->flag |= CONSTRAINT_DISABLE; } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 7c981149aca..e1f1ab97726 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1105,6 +1105,7 @@ static void rna_def_constraint_action(BlenderRNA *brna) prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act"); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll"); RNA_def_property_ui_text(prop, "Action", "The constraining action"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); |