diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2013-06-12 13:52:37 +0400 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2013-06-12 13:52:37 +0400 |
commit | 1d1bf3b2babd885a94422d6430af1b211109d7ae (patch) | |
tree | d1b8d92829180d87809c8492b680ff9834e8e49b /source/blender | |
parent | 31e667c10eec08aadf1a8fc156ffefcaf63a24ec (diff) |
prepared local vgroup selection function for more general usage
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/include/ED_object.h | 16 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 31 |
2 files changed, 25 insertions, 22 deletions
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 00b8fc4535d..b2810031474 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -200,6 +200,22 @@ int ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v); /* object_select.c */ void ED_object_select_linked_by_id(struct bContext *C, struct ID *id); +/* object_vgroup.c */ +typedef enum eVGroupSelect { + WT_VGROUP_ACTIVE = 1, + WT_VGROUP_BONE_SELECT = 2, + WT_VGROUP_BONE_DEFORM = 3, + WT_VGROUP_ALL = 4, +} eVGroupSelect; + +#define WT_VGROUP_MASK_ALL \ + ((1 << WT_VGROUP_ACTIVE) | \ + (1 << WT_VGROUP_BONE_SELECT) | \ + (1 << WT_VGROUP_BONE_DEFORM) | \ + (1 << WT_VGROUP_ALL)) + +bool *ED_vgroup_subset_from_select_type(struct Object *ob, eVGroupSelect subset_type, int *r_vgroup_tot, int *r_subset_count); + #ifdef __cplusplus } #endif diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 1089df2e00d..74f1515fe74 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -430,19 +430,6 @@ typedef enum WT_ReplaceMode { WT_REPLACE_EMPTY_WEIGHTS = 2 } WT_ReplaceMode; -typedef enum WT_VertexGroupSelect { - WT_VGROUP_ACTIVE = 1, - WT_VGROUP_BONE_SELECT = 2, - WT_VGROUP_BONE_DEFORM = 3, - WT_VGROUP_ALL = 4, -} WT_VertexGroupSelect; - -#define WT_VGROUP_MASK_ALL \ - ((1 << WT_VGROUP_ACTIVE) | \ - (1 << WT_VGROUP_BONE_SELECT) | \ - (1 << WT_VGROUP_BONE_DEFORM) | \ - (1 << WT_VGROUP_ALL)) - static EnumPropertyItem WT_vertex_group_mode_item[] = { {WT_REPLACE_ACTIVE_VERTEX_GROUP, "WT_REPLACE_ACTIVE_VERTEX_GROUP", 0, "Active", "Transfer active vertex group from selected to active mesh"}, @@ -1179,7 +1166,7 @@ static void vgroup_duplicate(Object *ob) /** * Return the subset type of the Vertex Group Selection */ -static bool *vgroup_subset_from_select_type(Object *ob, WT_VertexGroupSelect subset_type, int *r_vgroup_tot, int *r_subset_count) +bool *ED_vgroup_subset_from_select_type(Object *ob, eVGroupSelect subset_type, int *r_vgroup_tot, int *r_subset_count) { bool *vgroup_validmap = NULL; *r_vgroup_tot = BLI_countlist(&ob->defbase); @@ -3010,11 +2997,11 @@ static int vertex_group_levels_exec(bContext *C, wmOperator *op) float offset = RNA_float_get(op->ptr, "offset"); float gain = RNA_float_get(op->ptr, "gain"); - WT_VertexGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); + eVGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); int subset_count, vgroup_tot; - bool *vgroup_validmap = vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); + bool *vgroup_validmap = ED_vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); vgroup_levels_subset(ob, vgroup_validmap, vgroup_tot, subset_count, offset, gain); MEM_freeN(vgroup_validmap); @@ -3192,11 +3179,11 @@ static int vertex_group_invert_exec(bContext *C, wmOperator *op) bool auto_assign = RNA_boolean_get(op->ptr, "auto_assign"); bool auto_remove = RNA_boolean_get(op->ptr, "auto_remove"); - WT_VertexGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); + eVGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); int subset_count, vgroup_tot; - bool *vgroup_validmap = vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); + bool *vgroup_validmap = ED_vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); vgroup_invert_subset(ob, vgroup_validmap, vgroup_tot, subset_count, auto_assign, auto_remove); MEM_freeN(vgroup_validmap); @@ -3300,11 +3287,11 @@ static int vertex_group_clean_exec(bContext *C, wmOperator *op) float limit = RNA_float_get(op->ptr, "limit"); bool keep_single = RNA_boolean_get(op->ptr, "keep_single"); - WT_VertexGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); + eVGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); int subset_count, vgroup_tot; - bool *vgroup_validmap = vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); + bool *vgroup_validmap = ED_vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); vgroup_clean_subset(ob, vgroup_validmap, vgroup_tot, subset_count, limit, keep_single); MEM_freeN(vgroup_validmap); @@ -3341,11 +3328,11 @@ static int vertex_group_limit_total_exec(bContext *C, wmOperator *op) Object *ob = ED_object_context(C); const int limit = RNA_int_get(op->ptr, "limit"); - WT_VertexGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); + eVGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); int subset_count, vgroup_tot; - bool *vgroup_validmap = vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); + bool *vgroup_validmap = ED_vgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); int remove_tot = vgroup_limit_total_subset(ob, vgroup_validmap, vgroup_tot, subset_count, limit); MEM_freeN(vgroup_validmap); |