diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-16 14:11:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-16 14:11:16 +0300 |
commit | 567ee32f14304a462e59bde2de92b10861ad7c86 (patch) | |
tree | 29e95d2fe7945d976fc0d01722f400134b4e775a /source/blender/editors/object/object_constraint.c | |
parent | d2ca3e55820258361aa1f4cd9db1c1084b1e3f23 (diff) |
- fcurve modifiers.new()/remove()/active
- renamed .add() to .new() for rna collection functions since they dont add an existing item.
- remove 'name' as an argument from the new driver target function, better to keep the api minimal and let scripters use the data api for editing values after.
- added some api functions to keep rna api from becoming a mess.
Diffstat (limited to 'source/blender/editors/object/object_constraint.c')
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index dbc7973b67b..33cee59f0a8 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -101,18 +101,7 @@ ListBase *get_active_constraints (Object *ob) /* single constraint */ bConstraint *get_active_constraint (Object *ob) { - ListBase *lb= get_active_constraints(ob); - - if (lb) { - bConstraint *con; - - for (con= lb->first; con; con=con->next) { - if (con->flag & CONSTRAINT_ACTIVE) - return con; - } - } - - return NULL; + return find_active_constraint(get_active_constraints(ob)); } /* -------------- Constraint Management (Add New, Remove, Rename) -------------------- */ /* ------------- PyConstraints ------------------ */ @@ -655,22 +644,12 @@ void ED_object_constraint_rename(Object *ob, bConstraint *con, char *oldname) void ED_object_constraint_set_active(Object *ob, bConstraint *con) -{ - ListBase *lb; - bConstraint *origcon= con; - +{ /* lets be nice and escape if its active already */ if(con && (con->flag & CONSTRAINT_ACTIVE)) return ; - lb= get_active_constraints(ob); - if(lb == NULL) - return; - - for(con= lb->first; con; con= con->next) { - if(con==origcon) con->flag |= CONSTRAINT_ACTIVE; - else con->flag &= ~CONSTRAINT_ACTIVE; - } + set_active_constraint(get_active_constraints(ob), con); } void ED_object_constraint_update(Object *ob) @@ -1373,8 +1352,7 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *op) for (con= pchan->constraints.first; con; con= next) { next= con->next; if (con->type==CONSTRAINT_TYPE_KINEMATIC) { - free_constraint_data(con); - BLI_freelinkN(&pchan->constraints, con); + remove_constraint(&pchan->constraints, con); } } pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET); |