svn merge -r40197:40311 ^/trunk/blender
[blender.git] / source / blender / blenkernel / intern / armature.c
index 08a9547..4682c4c 100644 (file)
@@ -2464,3 +2464,32 @@ void where_is_pose (Scene *scene, Object *ob)
                }
        }
 }
+
+/* Jason was here */
+/* Returns total selected vgroups */
+int get_selected_defgroups(Object *ob, char *dg_selection, int defbase_len)
+{
+       bDeformGroup *defgroup;
+       unsigned int i;
+       Object *armob= object_pose_armature_get(ob);
+       int dg_flags_sel_tot= 0;
+
+       if(armob) {
+               bPose *pose= armob->pose;
+               for (i= 0, defgroup= ob->defbase.first; i < defbase_len && defgroup; defgroup = defgroup->next, i++) {
+                       bPoseChannel *pchan= get_pose_channel(pose, defgroup->name);
+                       if(pchan && (pchan->bone->flag & BONE_SELECTED)) {
+                               dg_selection[i]= TRUE;
+                               dg_flags_sel_tot++;
+                       }
+                       else {
+                               dg_selection[i]= FALSE;
+                       }
+               }
+       }
+       else {
+               memset(dg_selection, FALSE, sizeof(char) * defbase_len);
+       }
+
+       return dg_flags_sel_tot;
+}