diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-14 06:04:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-14 06:04:26 +0400 |
commit | 98961c9f192125c3d87ea3b2ae1bfca212d5d33c (patch) | |
tree | 8184c859564c51302142093ebbebc65d10adb435 /source/blender/blenkernel/intern/armature.c | |
parent | c3a718702fb15a3517e5c54c92af032b21fc5d86 (diff) |
initial cleanup for weight paint branch
- move get_selected_defgroups & count_selected_defgroups into blenkernel
- split calc_weightpaint_vert_color() logic so its more obvious whats default and multipaint behavior
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 62ce184a2d7..38c7b55cf51 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2465,3 +2465,42 @@ void where_is_pose (Scene *scene, Object *ob) } } } + +/* Jason was here */ +char* get_selected_defgroups(Object *ob, int defcnt) +{ + bPoseChannel *chan; + bPose *pose; + bDeformGroup *defgroup; + //Bone *bone; + char *dg_flags = MEM_callocN(defcnt*sizeof(char), "dg_selected_flags"); + int i; + Object *armob = object_pose_armature_get(ob); + + if(armob) { + pose = armob->pose; + for (chan=pose->chanbase.first; chan; chan=chan->next) { + for (i = 0, defgroup = ob->defbase.first; i < defcnt && defgroup; defgroup = defgroup->next, i++) { + if(!strcmp(defgroup->name, chan->bone->name)) { + dg_flags[i] = (chan->bone->flag & BONE_SELECTED); + } + } + } + } + + return dg_flags; +} + +/* TODO move duplicates to header */ +/* Jason was here duplicate function */ +int count_selected_defgroups(const char *list, int len) +{ + int i; + int cnt = 0; + for(i = 0; i < len; i++) { + if (list[i]) { + cnt++; + } + } + return cnt; +} |