diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-07-09 12:27:31 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-07-09 12:28:40 +0400 |
commit | 08eac0c3675ff4baff4ad3d0aae4d5ab10a8a133 (patch) | |
tree | 491addec2ce6b240d86a2e70aecf5dcb32a252f2 /source/blender/editors/armature/pose_group.c | |
parent | 02eb03f8687c30f598147082857a3b1d5dd1f007 (diff) |
Add bone_groups.new() and bone_groups.remove() methods to RNA.
To do so, matching BKE 'API' was also refactored a bit:
* Get Pose data instead of Object, as parameter;
* Removed some sanity checks not needed at such a low level (callers are supposed to do that);
* You can now remove an arbitrary bone group, not only the active one.
Based on patch by pkrime (Paolo Acampora), with own edits.
Reviewers: #python, pkrime, aligorith
Reviewed By: aligorith
Differential Revision: https://developer.blender.org/D522
Diffstat (limited to 'source/blender/editors/armature/pose_group.c')
-rw-r--r-- | source/blender/editors/armature/pose_group.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 376c1bc0838..50d9d300d15 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -62,12 +62,12 @@ static int pose_group_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_pose_object_from_context(C); - /* only continue if there's an object */ - if (ob == NULL) + /* only continue if there's an object and pose */ + if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; /* for now, just call the API function for this */ - BKE_pose_add_group(ob); + BKE_pose_add_group(ob->pose, NULL); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); @@ -95,12 +95,12 @@ static int pose_group_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_pose_object_from_context(C); - /* only continue if there's an object */ - if (ob == NULL) + /* only continue if there's an object and pose */ + if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; /* for now, just call the API function for this */ - BKE_pose_remove_group(ob); + BKE_pose_remove_group_index(ob->pose, ob->pose->active_group); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); @@ -189,7 +189,7 @@ static int pose_group_assign_exec(bContext *C, wmOperator *op) */ pose->active_group = RNA_int_get(op->ptr, "type"); if (pose->active_group == 0) - BKE_pose_add_group(ob); + BKE_pose_add_group(ob->pose, NULL); /* add selected bones to group then */ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) |