[Bf-blender-cvs] [60e8e20] master: Cleanup: use macro for common view3d zbuf check

Campbell Barton noreply at git.blender.org
Mon Apr 20 17:51:46 CEST 2015


Commit: 60e8e2013246e2c6b9675a9d7e634fe1c1ba9e75
Author: Campbell Barton
Date:   Mon Apr 20 23:39:54 2015 +1000
Branches: master
https://developer.blender.org/rB60e8e2013246e2c6b9675a9d7e634fe1c1ba9e75

Cleanup: use macro for common view3d zbuf check

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

M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/mesh/editmesh_select.c
M	source/blender/editors/physics/particle_edit.c
M	source/blender/editors/space_view3d/view3d_draw.c

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

diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 50199ad..94399c2 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -344,8 +344,6 @@ bool ED_view3d_lock(struct RegionView3D *rv3d);
 uint64_t ED_view3d_datamask(const struct Scene *scene, const struct View3D *v3d);
 uint64_t ED_view3d_screen_datamask(const struct bScreen *screen);
 
-bool ED_view3d_view_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d);
-
 bool ED_view3d_offset_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d);
 
 /* camera lock functions */
@@ -392,4 +390,7 @@ void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op, int *winx,
 void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar);
 void ED_view3d_shade_update(struct Main *bmain, struct Scene *scene, struct View3D *v3d, struct ScrArea *sa);
 
+#define V3D_IS_ZBUF(v3d) \
+	(((v3d)->flag & V3D_ZBUF_SELECT) && ((v3d)->drawtype > OB_WIRE))
+
 #endif /* __ED_VIEW3D_H__ */
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index d5e60cf..403a80e 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -196,7 +196,7 @@ bool EDBM_backbuf_border_init(ViewContext *vc, short xmin, short ymin, short xma
 	unsigned int *dr;
 	int a;
 	
-	if (vc->obedit == NULL || vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
+	if (vc->obedit == NULL || !V3D_IS_ZBUF(vc->v3d)) {
 		return false;
 	}
 	
@@ -271,7 +271,7 @@ bool EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short
 			return false;
 		}
 	}
-	else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
+	else if (!V3D_IS_ZBUF(vc->v3d)) {
 		return false;
 	}
 
@@ -320,7 +320,7 @@ bool EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads)
 			return false;
 		}
 	}
-	else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
+	else if (!V3D_IS_ZBUF(vc->v3d)) {
 		return false;
 	}
 
@@ -402,7 +402,7 @@ BMVert *EDBM_vert_find_nearest(
         ViewContext *vc, float *r_dist,
         const bool use_select_bias, const bool is_strict)
 {
-	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
+	if (V3D_IS_ZBUF(vc->v3d)) {
 		float distance;
 		unsigned int index;
 		BMVert *eve;
@@ -502,7 +502,7 @@ static void findnearestedge__doClosest(void *userData, BMEdge *eed, const float
 BMEdge *EDBM_edge_find_nearest(ViewContext *vc, float *r_dist)
 {
 
-	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
+	if (V3D_IS_ZBUF(vc->v3d)) {
 		float distance;
 		unsigned int index;
 		BMEdge *eed;
@@ -576,7 +576,7 @@ static void findnearestface__doClosest(void *userData, BMFace *efa, const float
 BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
 {
 
-	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
+	if (V3D_IS_ZBUF(vc->v3d)) {
 		unsigned int index;
 		BMFace *efa;
 
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index a0420df..04764aa 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -400,7 +400,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
 	/* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather than (obmat * viewmat) */
 	view3d_get_transformation(data->vc.ar, data->vc.rv3d, NULL, &data->mats);
 
-	if ((data->vc.v3d->drawtype>OB_WIRE) && (data->vc.v3d->flag & V3D_ZBUF_SELECT)) {
+	if (V3D_IS_ZBUF(data->vc.v3d)) {
 		if (data->vc.v3d->flag & V3D_INVALID_BACKBUF) {
 			/* needed or else the draw matrix can be incorrect */
 			view3d_operator_needs_opengl(C);
@@ -443,8 +443,8 @@ static bool key_test_depth(PEData *data, const float co[3], const int screen_co[
 	float depth;
 
 	/* nothing to do */
-	if ((v3d->drawtype<=OB_WIRE) || (v3d->flag & V3D_ZBUF_SELECT)==0)
-		return 1;
+	if (!V3D_IS_ZBUF(v3d))
+		return true;
 
 	/* used to calculate here but all callers have  the screen_co already, so pass as arg */
 #if 0
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index bfb4f60..39e21e2 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1327,12 +1327,12 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
 		/* do nothing */
 	}
 	else if ((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) &&
-	         v3d->drawtype > OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT))
+	         V3D_IS_ZBUF(v3d))
 	{
 		/* do nothing */
 	}
-	else if (scene->obedit && v3d->drawtype > OB_WIRE &&
-	         (v3d->flag & V3D_ZBUF_SELECT))
+	else if (scene->obedit &&
+	         V3D_IS_ZBUF(v3d))
 	{
 		/* do nothing */
 	}




More information about the Bf-blender-cvs mailing list