[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57407] trunk/blender/source/blender/ editors: prepared local vgroup selection function for more general usage

Gaia Clary gaia.clary at machinimatrix.org
Wed Jun 12 11:52:38 CEST 2013


Revision: 57407
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57407
Author:   gaiaclary
Date:     2013-06-12 09:52:37 +0000 (Wed, 12 Jun 2013)
Log Message:
-----------
prepared local vgroup selection function for more general usage

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_object.h
    trunk/blender/source/blender/editors/object/object_vgroup.c

Modified: trunk/blender/source/blender/editors/include/ED_object.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_object.h	2013-06-12 09:35:02 UTC (rev 57406)
+++ trunk/blender/source/blender/editors/include/ED_object.h	2013-06-12 09:52:37 UTC (rev 57407)
@@ -200,6 +200,22 @@
 /* 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

Modified: trunk/blender/source/blender/editors/object/object_vgroup.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_vgroup.c	2013-06-12 09:35:02 UTC (rev 57406)
+++ trunk/blender/source/blender/editors/object/object_vgroup.c	2013-06-12 09:52:37 UTC (rev 57407)
@@ -430,19 +430,6 @@
 	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 @@
 /**
  * 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 @@
 	
 	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 @@
 	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 @@
 
 	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 @@
 	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);




More information about the Bf-blender-cvs mailing list