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-01-10 06:30:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-10 06:30:27 +0300
commit91db8f601294792fb4926e6f626f719655a5310f (patch)
treef1ba955780460e9ed359582b06809bc3416a1c1c /source/blender/editors/object/object_constraint.c
parentd9c6f51ee25e4c3d56a9e06fb8e544f230174744 (diff)
add constraint operator
- report an error if adding a pose constraint with no active pose channel. - dont run update_pose_constraint_flags() when adding an object constrant to an armature object.
Diffstat (limited to 'source/blender/editors/object/object_constraint.c')
-rw-r--r--source/blender/editors/object/object_constraint.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 5076fec4fa3..9322886266a 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1245,11 +1245,18 @@ 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
+ }
+ 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.");
+ return OPERATOR_CANCELLED;
+ }
+ }
/* check if constraint to be added is valid for the given constraints stack */
if (type == CONSTRAINT_TYPE_NULL) {
return OPERATOR_CANCELLED;
@@ -1332,11 +1339,11 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
/* make sure all settings are valid - similar to above checks, but sometimes can be wrong */
object_test_constraints(ob);
-
- if (ob->pose)
+
+ if (pchan)
update_pose_constraint_flags(ob->pose);
-
-
+
+
/* force depsgraph to get recalculated since new relationships added */
DAG_scene_sort(bmain, scene); /* sort order of objects */