From 08eac0c3675ff4baff4ad3d0aae4d5ab10a8a133 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 9 Jul 2014 10:27:31 +0200 Subject: 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 --- source/blender/editors/armature/pose_group.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/armature/pose_group.c') 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) -- cgit v1.2.3