[Bf-blender-cvs] [fbae373db54] blender2.8: Cleanup: remove ref to dm in names in projpaint struct.

Bastien Montagne noreply at git.blender.org
Tue Jun 19 15:57:27 CEST 2018


Commit: fbae373db54517795fe041cdf3808cb95b752006
Author: Bastien Montagne
Date:   Tue Jun 19 15:53:21 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBfbae373db54517795fe041cdf3808cb95b752006

Cleanup: remove ref to dm in names in projpaint struct.

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

M	source/blender/editors/sculpt_paint/paint_image_proj.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 35c6fd57596..c9233416428 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -355,26 +355,26 @@ typedef struct ProjPaintState {
 	SpinLock *tile_lock;
 
 	Mesh *me_eval;
-	int  dm_totlooptri;
-	int  dm_totpoly;
-	int  dm_totedge;
-	int  dm_totvert;
+	int  totlooptri_eval;
+	int  totpoly_eval;
+	int  totedge_eval;
+	int  totvert_eval;
 
-	const MVert    *dm_mvert;
-	const MEdge    *dm_medge;
-	const MPoly    *dm_mpoly;
-	const MLoop    *dm_mloop;
-	const MLoopTri *dm_mlooptri;
+	const MVert    *mvert_eval;
+	const MEdge    *medge_eval;
+	const MPoly    *mpoly_eval;
+	const MLoop    *mloop_eval;
+	const MLoopTri *mlooptri_eval;
 
-	const MLoopUV  *dm_mloopuv_stencil;
+	const MLoopUV  *mloopuv_stencil_eval;
 
 	/**
-	 * \note These UV layers are aligned to \a dm_mpoly
+	 * \note These UV layers are aligned to \a mpoly_eval
 	 * but each pointer references the start of the layer,
 	 * so a loop indirection is needed as well.
 	 */
-	const MLoopUV **dm_mloopuv;
-	const MLoopUV **dm_mloopuv_clone;    /* other UV map, use for cloning between layers */
+	const MLoopUV **poly_to_loop_uv;
+	const MLoopUV **poly_to_loop_uv_clone;    /* other UV map, use for cloning between layers */
 
 	/* Actual material for each index, either from object or Mesh datablock... */
 	Material **mat_array;
@@ -443,13 +443,13 @@ typedef struct {
 
 BLI_INLINE const MPoly *ps_tri_index_to_mpoly(const ProjPaintState *ps, int tri_index)
 {
-	return &ps->dm_mpoly[ps->dm_mlooptri[tri_index].poly];
+	return &ps->mpoly_eval[ps->mlooptri_eval[tri_index].poly];
 }
 
 #define PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) \
-	ps->dm_mloop[lt->tri[0]].v, \
-	ps->dm_mloop[lt->tri[1]].v, \
-	ps->dm_mloop[lt->tri[2]].v,
+	ps->mloop_eval[lt->tri[0]].v, \
+	ps->mloop_eval[lt->tri[1]].v, \
+	ps->mloop_eval[lt->tri[2]].v,
 
 #define PS_LOOPTRI_AS_UV_3(uvlayer, lt) \
 	uvlayer[lt->poly][lt->tri[0]].uv, \
@@ -599,11 +599,11 @@ static int project_paint_PickFace(
 
 	for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
 		const int tri_index = GET_INT_FROM_POINTER(node->link);
-		const MLoopTri *lt = &ps->dm_mlooptri[tri_index];
+		const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
 		const float *vtri_ss[3] = {
-		    ps->screenCoords[ps->dm_mloop[lt->tri[0]].v],
-		    ps->screenCoords[ps->dm_mloop[lt->tri[1]].v],
-		    ps->screenCoords[ps->dm_mloop[lt->tri[2]].v],
+		    ps->screenCoords[ps->mloop_eval[lt->tri[0]].v],
+		    ps->screenCoords[ps->mloop_eval[lt->tri[1]].v],
+		    ps->screenCoords[ps->mloop_eval[lt->tri[2]].v],
 		};
 
 
@@ -658,8 +658,8 @@ static bool project_paint_PickColor(
 	if (tri_index == -1)
 		return 0;
 
-	lt = &ps->dm_mlooptri[tri_index];
-	PS_LOOPTRI_ASSIGN_UV_3(lt_tri_uv, ps->dm_mloopuv, lt);
+	lt = &ps->mlooptri_eval[tri_index];
+	PS_LOOPTRI_ASSIGN_UV_3(lt_tri_uv, ps->poly_to_loop_uv, lt);
 
 	interp_v2_v2v2v2(uv, UNPACK3(lt_tri_uv), w);
 
@@ -815,19 +815,19 @@ static bool project_bucket_point_occluded(
 		const int tri_index = GET_INT_FROM_POINTER(bucketFace->link);
 
 		if (orig_face != tri_index) {
-			const MLoopTri *lt = &ps->dm_mlooptri[tri_index];
+			const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
 			const float *vtri_ss[3] = {
-			    ps->screenCoords[ps->dm_mloop[lt->tri[0]].v],
-			    ps->screenCoords[ps->dm_mloop[lt->tri[1]].v],
-			    ps->screenCoords[ps->dm_mloop[lt->tri[2]].v],
+			    ps->screenCoords[ps->mloop_eval[lt->tri[0]].v],
+			    ps->screenCoords[ps->mloop_eval[lt->tri[1]].v],
+			    ps->screenCoords[ps->mloop_eval[lt->tri[2]].v],
 			};
 			float w[3];
 
 			if (do_clip) {
 				const float *vtri_co[3] = {
-				    ps->dm_mvert[ps->dm_mloop[lt->tri[0]].v].co,
-				    ps->dm_mvert[ps->dm_mloop[lt->tri[1]].v].co,
-				    ps->dm_mvert[ps->dm_mloop[lt->tri[2]].v].co,
+				    ps->mvert_eval[ps->mloop_eval[lt->tri[0]].v].co,
+				    ps->mvert_eval[ps->mloop_eval[lt->tri[1]].v].co,
+				    ps->mvert_eval[ps->mloop_eval[lt->tri[2]].v].co,
 				};
 				isect_ret = project_paint_occlude_ptv_clip(
 				        pixelScreenCo, UNPACK3(vtri_ss), UNPACK3(vtri_co),
@@ -1007,8 +1007,8 @@ static bool pixel_bounds_array(float (*uv)[2], rcti *bounds_px, const int ibuf_x
 static void project_face_winding_init(const ProjPaintState *ps, const int tri_index)
 {
 	/* detect the winding of faces in uv space */
-	const MLoopTri *lt = &ps->dm_mlooptri[tri_index];
-	const float *lt_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->dm_mloopuv, lt) };
+	const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
+	const float *lt_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, lt) };
 	float winding = cross_tri_v2(lt_tri_uv[0], lt_tri_uv[1], lt_tri_uv[2]);
 
 	if (winding > 0)
@@ -1024,11 +1024,11 @@ static bool check_seam(
         const int orig_face, const int orig_i1_fidx, const int orig_i2_fidx,
         int *other_face, int *orig_fidx)
 {
-	const MLoopTri *orig_lt = &ps->dm_mlooptri[orig_face];
-	const float *orig_lt_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->dm_mloopuv, orig_lt) };
+	const MLoopTri *orig_lt = &ps->mlooptri_eval[orig_face];
+	const float *orig_lt_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, orig_lt) };
 	/* vert indices from face vert order indices */
-	const unsigned int i1 = ps->dm_mloop[orig_lt->tri[orig_i1_fidx]].v;
-	const unsigned int i2 = ps->dm_mloop[orig_lt->tri[orig_i2_fidx]].v;
+	const unsigned int i1 = ps->mloop_eval[orig_lt->tri[orig_i1_fidx]].v;
+	const unsigned int i2 = ps->mloop_eval[orig_lt->tri[orig_i2_fidx]].v;
 	LinkNode *node;
 	int i1_fidx = -1, i2_fidx = -1; /* index in face */
 
@@ -1036,7 +1036,7 @@ static bool check_seam(
 		const int tri_index = GET_INT_FROM_POINTER(node->link);
 
 		if (tri_index != orig_face) {
-			const MLoopTri *lt = &ps->dm_mlooptri[tri_index];
+			const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
 			const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
 			/* could check if the 2 faces images match here,
 			 * but then there wouldn't be a way to return the opposite face's info */
@@ -1049,7 +1049,7 @@ static bool check_seam(
 
 			/* Only need to check if 'i2_fidx' is valid because we know i1_fidx is the same vert on both faces */
 			if (i2_fidx != -1) {
-				const float *lt_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->dm_mloopuv, lt) };
+				const float *lt_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, lt) };
 				Image *tpage = project_paint_face_paint_image(ps, tri_index);
 				Image *orig_tpage = project_paint_face_paint_image(ps, orig_face);
 
@@ -1353,8 +1353,8 @@ static float project_paint_uvpixel_mask(
 		Image *other_tpage = ps->stencil_ima;
 
 		if (other_tpage && (ibuf_other = BKE_image_acquire_ibuf(other_tpage, NULL, NULL))) {
-			const MLoopTri *lt_other = &ps->dm_mlooptri[tri_index];
-			const float *lt_other_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->dm_mloopuv, lt_other) };
+			const MLoopTri *lt_other = &ps->mlooptri_eval[tri_index];
+			const float *lt_other_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, lt_other) };
 
 			/* BKE_image_acquire_ibuf - TODO - this may be slow */
 			unsigned char rgba_ub[4];
@@ -1387,7 +1387,7 @@ static float project_paint_uvpixel_mask(
 	}
 
 	if (ps->do_mask_cavity) {
-		const MLoopTri *lt = &ps->dm_mlooptri[tri_index];
+		const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
 		const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
 		float ca1, ca2, ca3, ca_mask;
 		ca1 = ps->cavities[lt_vtri[0]];
@@ -1402,16 +1402,16 @@ static float project_paint_uvpixel_mask(
 
 	/* calculate mask */
 	if (ps->do_mask_normal) {
-		const MLoopTri *lt = &ps->dm_mlooptri[tri_index];
+		const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
 		const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
-		const MPoly *mp = &ps->dm_mpoly[lt->poly];
+		const MPoly *mp = &ps->mpoly_eval[lt->poly];
 		float no[3], angle_cos;
 
 		if (mp->flag & ME_SMOOTH) {
 			const short *no1, *no2, *no3;
-			no1 = ps->dm_mvert[lt_vtri[0]].no;
-			no2 = ps->dm_mvert[lt_vtri[1]].no;
-			no3 = ps->dm_mvert[lt_vtri[2]].no;
+			no1 = ps->mvert_eval[lt_vtri[0]].no;
+			no2 = ps->mvert_eval[lt_vtri[1]].no;
+			no3 = ps->mvert_eval[lt_vtri[2]].no;
 
 			no[0] = w[0] * no1[0] + w[1] * no2[0] + w[2] * no3[0];
 			no[1] = w[0] * no1[1] + w[1] * no2[1] + w[2] * no3[1];
@@ -1423,9 +1423,9 @@ static float project_paint_uvpixel_mask(
 #if 1
 			/* normalizing per pixel isn't optimal, we could cache or check ps->*/
 			normal_tri_v3(no,
-			              ps->dm_mvert[lt_vtri[0]].co,
-			              ps->dm_mvert[lt_vtri[1]].co,
-			              ps->dm_mvert[lt_vtri[2]].co);
+			              ps->mvert_eval[lt_vtri[0]].co,
+			              ps->mvert_eval[lt_vtri[1]].co,
+			              ps->mvert_eval[lt_vtri[2]].co);
 #else
 			/* don't use because some modifiers dont have normal data (subsurf for eg) */
 			copy_v3_v3(no, (float *)ps->dm->getTessFaceData(ps->dm, tri_index, CD_NORMAL));
@@ -1444,9 +1444,9 @@ static float project_paint_uvpixel_mask(
 			/* Annoying but for the perspective view we need to get the pixels location in 3D space :/ */
 			float viewDirPersp[3];
 			const float *co1, *co2, *co3;
-			co1 = ps->dm_mvert[lt_vtri[0]].co;
-			co2 = ps->dm_mvert[lt_vtri[1]].co;
-			co3 = ps->dm_mvert[lt_vtri[2]].co;
+			co1 = ps->mvert_eval[lt_vtri[0]].co;
+			co2 = ps->mvert_eval[lt_vtri[1]].co;
+			co3 = ps->mvert_eval[lt_vtri[2]].co;
 
 			/* Get the direction from the viewPoint to the pixel and normalize */
 			viewDirPersp[0] = (ps->viewPos[0] - (w[0] * co1[0] + w[1] * co2[0] + w[2] * co3[0]));
@@ -1615,13 +1615,13 @@ static ProjPixel *project_paint_uvpixel_init(
 
 	/* done with view3d_project_float inline */
 	if (ps->tool == PAINT_TOOL_CLONE) {
-		if (ps->dm_mloopuv_clone) {
+		if (ps->poly_to_loop_uv_clone) {
 			ImBuf *ibuf_other;
 			Image *other_tpage = project_paint_face_clone_image(ps, tri_index);
 
 			if (other_tpage && (ibuf_other = BKE_image_acquire_ibuf(other_tpage, NULL, NULL))) {
-				const MLoopTri *lt_other = &ps->dm_mlooptri[tri_index];
-				const float *lt_other_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->dm_mloopuv_clone, lt_other) };
+	

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list