diff options
author | Matt Ebb <matt@mke3.net> | 2010-04-26 07:42:38 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-04-26 07:42:38 +0400 |
commit | f85fe4d633a565106048f1e9511894d2539e78a6 (patch) | |
tree | 46af608051dc8cf1f93873ec4675757e207dcc5c /source/blender/blenkernel | |
parent | 47e1f253c59c3108159732c30da89a7ad154261b (diff) |
Pass constraint names as operator properties in constraint operators
This is similar to commit revision 22078, but for constraint operators rather
than modifiers, making it possible to use them from scripting.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_constraint.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 9c5e89bff76..94863e15e46 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -130,7 +130,8 @@ void free_constraint_data(struct bConstraint *con); /* Constraint API function prototypes */ struct bConstraint *constraints_get_active(struct ListBase *list); void constraints_set_active(ListBase *list, struct bConstraint *con); - +struct bConstraint *constraints_findByName(struct ListBase *list, const char *name); + struct bConstraint *add_ob_constraint(struct Object *ob, const char *name, short type); struct bConstraint *add_pose_constraint(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 6941742a0c9..9dab2c1c07e 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -36,6 +36,7 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" +#include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_editVert.h" @@ -4162,6 +4163,11 @@ void copy_constraints (ListBase *dst, const ListBase *src) /* ......... */ +bConstraint *constraints_findByName(ListBase *list, const char *name) +{ + return BLI_findstring(list, name, offsetof(bConstraint, name)); +} + /* finds the 'active' constraint in a constraint stack */ bConstraint *constraints_get_active (ListBase *list) { |