[Bf-blender-cvs] [a1cd012549f] hair_guides_grooming: Move the selection flag from bundle to region.

Lukas Tönne noreply at git.blender.org
Mon Jun 4 14:06:20 CEST 2018


Commit: a1cd012549f619af443522787ebd8cf744719abb
Author: Lukas Tönne
Date:   Mon Jun 4 13:05:56 2018 +0100
Branches: hair_guides_grooming
https://developer.blender.org/rBa1cd012549f619af443522787ebd8cf744719abb

Move the selection flag from bundle to region.

===================================================================

M	source/blender/draw/intern/draw_cache_impl_groom.c
M	source/blender/editors/groom/editgroom_select.c
M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/space_view3d/view3d_iterators.c
M	source/blender/editors/space_view3d/view3d_select.c
M	source/blender/makesdna/DNA_groom_types.h

===================================================================

diff --git a/source/blender/draw/intern/draw_cache_impl_groom.c b/source/blender/draw/intern/draw_cache_impl_groom.c
index 7de45cc3486..020a6908e42 100644
--- a/source/blender/draw/intern/draw_cache_impl_groom.c
+++ b/source/blender/draw/intern/draw_cache_impl_groom.c
@@ -336,7 +336,7 @@ static void groom_get_verts(
 			}
 			else
 			{
-				const bool active = bundle->flag & GM_BUNDLE_SELECT;
+				const bool active = region->flag & GM_REGION_SELECT;
 				GroomSection *section = bundle->sections;
 				for (int i = 0; i < bundle->totsections; ++i, ++section)
 				{
@@ -387,7 +387,7 @@ static void groom_get_verts(
 				GroomSectionVertex *vertex = bundle->verts;
 				for (int i = 0; i < bundle->totsections; ++i, ++section)
 				{
-					const bool active = (bundle->flag & GM_BUNDLE_SELECT) && (section->flag & GM_SECTION_SELECT);
+					const bool active = (region->flag & GM_REGION_SELECT) && (section->flag & GM_SECTION_SELECT);
 					
 					for (int j = 0; j < bundle->numshapeverts; ++j, ++vertex)
 					{
diff --git a/source/blender/editors/groom/editgroom_select.c b/source/blender/editors/groom/editgroom_select.c
index ca1b69ad653..a691fb97968 100644
--- a/source/blender/editors/groom/editgroom_select.c
+++ b/source/blender/editors/groom/editgroom_select.c
@@ -58,8 +58,7 @@ bool ED_groom_select_check_regions(const EditGroom *edit)
 {
 	for (GroomRegion* region = edit->regions.first; region; region = region->next)
 	{
-		GroomBundle *bundle = &region->bundle;
-		if (bundle->flag & GM_BUNDLE_SELECT)
+		if (region->flag & GM_REGION_SELECT)
 		{
 			return true;
 		}
@@ -107,15 +106,14 @@ void ED_groom_select_regions(EditGroom *edit, EditGroomSelectCb select_cb, void
 {
 	for (GroomRegion* region = edit->regions.first; region; region = region->next)
 	{
-		GroomBundle *bundle = &region->bundle;
-		const bool select = select_cb(userdata, bundle->flag & GM_BUNDLE_SELECT);
+		const bool select = select_cb(userdata, region->flag & GM_REGION_SELECT);
 		if (select)
 		{
-			bundle->flag |= GM_BUNDLE_SELECT;
+			region->flag |= GM_REGION_SELECT;
 		}
 		else
 		{
-			bundle->flag &= ~GM_BUNDLE_SELECT;
+			region->flag &= ~GM_REGION_SELECT;
 		}
 	}
 }
@@ -261,14 +259,14 @@ void GROOM_OT_select_all(wmOperatorType *ot)
 
 static void select_pick_findnearest_cb(
         void *userdata,
-        GroomBundle *bundle,
+        GroomRegion *region,
         GroomSection *section,
         GroomSectionVertex *vertex,
         const float screen_co[2])
 {
 	struct
 	{
-		GroomBundle *bundle;
+		GroomRegion *region;
 		GroomSection *section;
 		GroomSectionVertex *vertex;
 		float dist;
@@ -282,14 +280,14 @@ static void select_pick_findnearest_cb(
 	if (data->select &&
 	    ((vertex && vertex->flag & GM_VERTEX_SELECT) ||
 	     (section && section->flag & GM_SECTION_SELECT) ||
-	     (bundle && bundle->flag & GM_BUNDLE_SELECT)))
+	     (region && region->flag & GM_REGION_SELECT)))
 	{
 		dist_test += 5.0f;
 	}
 
 	if (dist_test < data->dist) {
 		data->dist = dist_test;
-		data->bundle = bundle;
+		data->region = region;
 		data->section = section;
 		data->vertex = vertex;
 	}
@@ -299,8 +297,7 @@ static void groom_set_region_select_flags(Groom *groom, int flag)
 {
 	for (GroomRegion* region = groom->editgroom->regions.first; region; region = region->next)
 	{
-		GroomBundle *bundle = &region->bundle;
-		bundle->flag = (bundle->flag & ~GM_BUNDLE_SELECT) | (flag & GM_BUNDLE_SELECT);
+		region->flag = (region->flag & ~GM_REGION_SELECT) | (flag & GM_REGION_SELECT);
 	}
 }
 
@@ -338,7 +335,7 @@ bool ED_groom_select_pick(bContext *C, const int mval[2], bool extend, bool dese
 
 	struct
 	{
-		GroomBundle *bundle;
+		GroomRegion *region;
 		GroomSection *section;
 		GroomSectionVertex *vertex;
 		float dist;
@@ -382,7 +379,7 @@ bool ED_groom_select_pick(bContext *C, const int mval[2], bool extend, bool dese
 			groom_set_region_select_flags(groom, 0);
 			groom_set_curve_select_flags(groom, 0);
 			data.section->flag |= GM_SECTION_SELECT;
-			data.bundle->flag |= GM_BUNDLE_SELECT;
+			data.region->flag |= GM_REGION_SELECT;
 		}
 		
 		found = true;
@@ -412,30 +409,30 @@ bool ED_groom_select_pick(bContext *C, const int mval[2], bool extend, bool dese
 		{
 			/* set active region */
 			groom_set_region_select_flags(groom, 0);
-			data.bundle->flag |= GM_BUNDLE_SELECT;
+			data.region->flag |= GM_REGION_SELECT;
 		}
 		
 		found = true;
 	}
-	else if (data.bundle)
+	else if (data.region)
 	{
 		if (extend)
 		{
-			data.bundle->flag |= GM_BUNDLE_SELECT;
+			data.region->flag |= GM_REGION_SELECT;
 		}
 		else if (deselect)
 		{
-			data.bundle->flag &= ~GM_BUNDLE_SELECT;
+			data.region->flag &= ~GM_REGION_SELECT;
 		}
 		else if (toggle)
 		{
-			data.bundle->flag ^= GM_BUNDLE_SELECT;
+			data.region->flag ^= GM_REGION_SELECT;
 		}
 		else
 		{
 			/* deselect all other regions */
 			groom_set_region_select_flags(groom, 0);
-			data.bundle->flag |= GM_BUNDLE_SELECT;
+			data.region->flag |= GM_REGION_SELECT;
 		}
 		
 		found = true;
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 1d3801bf8c4..75a18e85c89 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -43,7 +43,7 @@ struct BoundBox;
 struct Camera;
 struct Depsgraph;
 struct EditBone;
-struct GroomBundle;
+struct GroomRegion;
 struct GroomSection;
 struct GroomSectionVertex;
 struct ImBuf;
@@ -208,7 +208,7 @@ void groom_foreachScreenVert(
         struct ViewContext *vc,
         void (*func)(
             void *userData,
-            struct GroomBundle *bundle,
+            struct GroomRegion *region,
             struct GroomSection *section,
             struct GroomSectionVertex *vert,
             const float screen_co[2]),
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c
index 7547cca300f..755ac1017fe 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -408,7 +408,7 @@ void groom_foreachScreenVert(
         ViewContext *vc,
         void (*func)(
             void *userData,
-            GroomBundle *bundle,
+            GroomRegion *region,
             GroomSection *section,
             GroomSectionVertex *vert,
             const float screen_co[2]),
@@ -441,7 +441,7 @@ void groom_foreachScreenVert(
 					float screen_co[2];
 					if (ED_view3d_project_float_object(vc->ar, section->center, screen_co, clip_flag) == V3D_PROJ_RET_OK)
 					{
-						func(userData, bundle, section, NULL, screen_co);
+						func(userData, region, section, NULL, screen_co);
 					}
 				}
 			}
@@ -464,7 +464,7 @@ void groom_foreachScreenVert(
 						float screen_co[2];
 						if (ED_view3d_project_float_object(vc->ar, co, screen_co, clip_flag) == V3D_PROJ_RET_OK)
 						{
-							func(userData, bundle, section, vertex, screen_co);
+							func(userData, region, section, vertex, screen_co);
 						}
 					}
 				}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 35086b290d6..4b2f0c69310 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -624,7 +624,7 @@ static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], shor
 
 static void do_lasso_select_groom__doSelect(
         void *userData,
-        GroomBundle *bundle,
+        GroomRegion *region,
         GroomSection *section,
         GroomSectionVertex *vertex,
         const float screen_co[2])
@@ -642,9 +642,9 @@ static void do_lasso_select_groom__doSelect(
 		{
 			section->flag = data->select ? (section->flag | GM_SECTION_SELECT) : (section->flag & ~GM_SECTION_SELECT);
 		}
-		else if (bundle)
+		else if (region)
 		{
-			bundle->flag = data->select ? (bundle->flag | GM_BUNDLE_SELECT) : (bundle->flag & ~GM_BUNDLE_SELECT);
+			region->flag = data->select ? (region->flag | GM_REGION_SELECT) : (region->flag & ~GM_REGION_SELECT);
 		}
 	}
 }
@@ -1857,7 +1857,7 @@ static int do_lattice_box_select(ViewContext *vc, rcti *rect, bool select, bool
 
 static void do_groom_box_select__doSelect(
         void *userData,
-        GroomBundle *bundle,
+        GroomRegion *region,
         GroomSection *section,
         GroomSectionVertex *vertex,
         const float screen_co[2])
@@ -1874,9 +1874,9 @@ static void do_groom_box_select__doSelect(
 		{
 			section->flag = data->select ? (section->flag | GM_SECTION_SELECT) : (section->flag & ~GM_SECTION_SELECT);
 		}
-		else if (bundle)
+		else if (region)
 		{
-			bundle->flag = data->select ? (bundle->flag | GM_BUNDLE_SELECT) : (bundle->flag & ~GM_BUNDLE_SELECT);
+			region->flag = data->select ? (region->flag | GM_REGION_SELECT) : (region->flag & ~GM_REGION_SELECT);
 		}
 	}
 }
@@ -2774,7 +2774,7 @@ static void lattice_circle_select(ViewContext *vc, const bool select, const int
 
 static void groom_circle_select__doSelect(
         void *userData,
-        GroomBundle *bundle,
+        GroomRegion *region,
         GroomSection *section,
         GroomSectionVertex *vertex,
         const float screen_co[2])
@@ -2791,9 +2791,9 @@ static void groom_circle_select__doSelect(
 		{
 			section->flag = data->select ? (section->flag | GM_SECTION_SELECT) : (section->flag & ~GM_SECTION_SELECT);
 		}
-		else if (bundle)
+		else if (region)
 		{
-			bundle->flag = data->select ? (bundle->flag | GM_BUNDLE_SELECT) : (bundle->flag & ~GM_BUNDLE_SELECT);
+			region->flag = data->select ? (region->flag | GM_REGION_SELECT) : (region->flag & ~GM_REGION_SELECT);
 		}
 	}
 }
diff --git a/source/blender/makesdna/DNA_groom_types.h b/source/blender/makesdna/DNA_groom_types.h
index 2a11af97b49..1066ef98eb9 100644
--- a/source/blender/makesdna/DNA_groom_types.h
+++ b/source/blender/makesdna/DNA_groom_types.h
@@ -82,7 +82,6 @@ typedef struct GroomHairGuide
 
 /* Bundle of hair strands following the same curve path */
 typedef struct GroomBundle {
-	int flag;
 	int guides_count;                       /* Number of guides to generate (totguides can be smaller) */
 	
 	int numshapeverts;                      /* Vertices per section loop

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list