[Bf-blender-cvs] [d0e245647c6] master: Cleanup: use unsigned types in 3D view editor

Campbell Barton noreply at git.blender.org
Fri Mar 1 14:00:21 CET 2019


Commit: d0e245647c6df67ba6d53a67cae87083757b805e
Author: Campbell Barton
Date:   Fri Mar 1 23:43:34 2019 +1100
Branches: master
https://developer.blender.org/rBd0e245647c6df67ba6d53a67cae87083757b805e

Cleanup: use unsigned types in 3D view editor

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

M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_buttons.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_draw_legacy.c
M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/editors/space_view3d/view3d_fly.c
M	source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M	source/blender/editors/space_view3d/view3d_intern.h
M	source/blender/editors/space_view3d/view3d_select.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/editors/space_view3d/view3d_walk.c

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

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 7d540630f20..e6e0438164c 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -157,7 +157,7 @@ static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3
 	mul_v3_v3fl(vx, tmat[0], rad);
 	mul_v3_v3fl(vy, tmat[1], rad);
 
-	for (unsigned int a = 0; a < CIRCLE_RESOL; a++, viter += 3) {
+	for (uint a = 0; a < CIRCLE_RESOL; a++, viter += 3) {
 		viter[0] = cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0];
 		viter[1] = cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1];
 		viter[2] = cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2];
@@ -178,7 +178,7 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], un
 }
 
 #ifdef VIEW3D_CAMERA_BORDER_HACK
-unsigned char view3d_camera_border_hack_col[3];
+uchar view3d_camera_border_hack_col[3];
 bool view3d_camera_border_hack_test = false;
 #endif
 
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 02e5820041f..175e0eb6c4f 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -868,7 +868,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
 		uiLayout *row;
 		uiBut *but;
 		bDeformGroup *dg;
-		unsigned int i;
+		uint i;
 		int subset_count, vgroup_tot;
 		const bool *vgroup_validmap;
 		eVGroupSelect subset_type = ts->vgroupsubset;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 9a0a804ce3f..aca2cf53aa6 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -819,7 +819,7 @@ static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
 	const float starty = rect->ymax - (k + UI_UNIT_Y);
 
 	float axis_pos[3][2];
-	unsigned char axis_col[3][4];
+	uchar axis_col[3][4];
 
 	int axis_order[3] = {0, 1, 2};
 	axis_sort_v3(rv3d->viewinv[2], axis_order);
@@ -1465,7 +1465,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
         Depsgraph *depsgraph, Scene *scene,
         int drawtype,
         View3D *v3d, ARegion *ar, int sizex, int sizey,
-        unsigned int flag, unsigned int draw_flags,
+        uint flag, uint draw_flags,
         int alpha_mode, int samples, const char *viewname,
         /* output vars */
         GPUOffScreen *ofs, char err_out[256])
@@ -1591,7 +1591,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
 			        &fx_settings, ofs, viewport);
 			GPU_offscreen_read_pixels(ofs, GL_FLOAT, rect_temp);
 
-			unsigned int i = sizex * sizey * 4;
+			uint i = sizex * sizey * 4;
 			while (i--) {
 				accum_buffer[i] += rect_temp[i];
 			}
@@ -1609,16 +1609,16 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
 
 		if (ibuf->rect_float) {
 			float *rect_float = ibuf->rect_float;
-			unsigned int i = sizex * sizey * 4;
+			uint i = sizex * sizey * 4;
 			while (i--) {
 				rect_float[i] = accum_buffer[i] / samples;
 			}
 		}
 		else {
-			unsigned char *rect_ub = (unsigned char *)ibuf->rect;
-			unsigned int i = sizex * sizey * 4;
+			uchar *rect_ub = (uchar *)ibuf->rect;
+			uint i = sizex * sizey * 4;
 			while (i--) {
-				rect_ub[i] = (unsigned char)(255.0f * accum_buffer[i] / samples);
+				rect_ub[i] = (uchar)(255.0f * accum_buffer[i] / samples);
 			}
 		}
 
@@ -1656,7 +1656,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
         Depsgraph *depsgraph, Scene *scene,
         int drawtype,
         Object *camera, int width, int height,
-        unsigned int flag, unsigned int draw_flags,
+        uint flag, uint draw_flags,
         int alpha_mode, int samples, const char *viewname,
         GPUOffScreen *ofs, char err_out[256])
 {
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 09a3c9a5ed0..d7d0e4660f7 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -112,7 +112,7 @@ void ED_view3d_clipping_set(RegionView3D *rv3d)
 {
 #ifdef USE_CLIP_PLANES
 	double plane[4];
-	const unsigned int tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
+	const uint tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
 
 	for (unsigned a = 0; a < tot; a++) {
 		copy_v4db_v4fl(plane, rv3d->clip[a]);
@@ -308,7 +308,7 @@ int ED_view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist)
 }
 
 /* samples a single pixel (copied from vpaint) */
-unsigned int ED_view3d_backbuf_sample(
+uint ED_view3d_backbuf_sample(
         ViewContext *vc, int x, int y)
 {
 	if (x >= vc->ar->winx || y >= vc->ar->winy) {
@@ -317,7 +317,7 @@ unsigned int ED_view3d_backbuf_sample(
 
 	ED_view3d_backbuf_validate(vc);
 
-	unsigned int col;
+	uint col;
 	view3d_opengl_read_pixels(vc->ar, x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
 	glReadBuffer(GL_BACK);
 
@@ -386,9 +386,9 @@ ImBuf *ED_view3d_backbuf_read(
 }
 
 /* smart function to sample a rect spiralling outside, nice for backbuf selection */
-unsigned int ED_view3d_backbuf_sample_rect(
+uint ED_view3d_backbuf_sample_rect(
         ViewContext *vc, const int mval[2], int size,
-        unsigned int min, unsigned int max, float *r_dist)
+        uint min, uint max, float *r_dist)
 {
 	int dirvec[4][2];
 
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 82d7e4eac4c..fe0dfc6bc31 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -287,7 +287,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
 	else if (ob_act == NULL || ob_act->mode == OB_MODE_OBJECT) {
 		/* object mode use boundbox centers */
 		Base *base_eval;
-		unsigned int tot = 0;
+		uint tot = 0;
 		float select_center[3];
 
 		zero_v3(select_center);
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index d8996e99bb5..47961371530 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -708,7 +708,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
 
 #ifdef NDOF_FLY_DEBUG
 	{
-		static unsigned int iteration = 1;
+		static uint iteration = 1;
 		printf("fly timer %d\n", iteration++);
 	}
 #endif
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index 6dd144612b4..6e26f9a2c13 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -509,8 +509,8 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
 	const int arc_steps = ARC_STEPS;
 	const float color_act[4] = {1.0f, 1.0f, 1.0f, 1.0f};
 	const float color_base[4] = {0.0f, 0.0f, 0.0f, 1.0f};
-	unsigned char color_text[3];
-	unsigned char color_wire[3];
+	uchar color_text[3];
+	uchar color_wire[3];
 	float color_back[4] = {1.0f, 1.0f, 1.0f, 0.5f};
 
 	/* anti-aliased lines for more consistent appearance */
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index d929ac89c4b..bb6b96b96d5 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -271,7 +271,7 @@ void VIEW3D_GT_navigate_rotate(struct wmGizmoType *gzt);
  * any direction it starts to fail */
 #define VIEW3D_CAMERA_BORDER_HACK
 #ifdef VIEW3D_CAMERA_BORDER_HACK
-extern unsigned char view3d_camera_border_hack_col[3];
+extern uchar view3d_camera_border_hack_col[3];
 extern bool view3d_camera_border_hack_test;
 #endif
 
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index bf30f903929..e14d0a5ff3f 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -190,7 +190,7 @@ static bool edbm_backbuf_check_and_select_verts(BMEditMesh *em, const eSelectOp
 {
 	BMVert *eve;
 	BMIter iter;
-	unsigned int index = bm_wireoffs;
+	uint index = bm_wireoffs;
 	bool changed = false;
 
 	BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
@@ -212,7 +212,7 @@ static bool edbm_backbuf_check_and_select_edges(BMEditMesh *em, const eSelectOp
 {
 	BMEdge *eed;
 	BMIter iter;
-	unsigned int index = bm_solidoffs;
+	uint index = bm_solidoffs;
 	bool changed = false;
 
 	BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
@@ -234,7 +234,7 @@ static bool edbm_backbuf_check_and_select_faces(BMEditMesh *em, const eSelectOp
 {
 	BMFace *efa;
 	BMIter iter;
-	unsigned int index = 1;
+	uint index = 1;
 	bool changed = false;
 
 	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
@@ -256,7 +256,7 @@ static bool edbm_backbuf_check_and_select_faces(BMEditMesh *em, const eSelectOp
 static bool edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const eSelectOp sel_op)
 {
 	MVert *mv = me->mvert;
-	unsigned int index;
+	uint index;
 	bool changed = false;
 
 	if (mv) {
@@ -279,7 +279,7 @@ static bool edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const eSelectOp
 static bool edbm_backbuf_check_and_select_tfaces(Mesh *me, const eSelectOp sel_op)
 {
 	MPoly *mpoly = me->mpoly;
-	unsigned int index;
+	uint index;
 	bool changed = false;
 
 	if (mpoly) {
@@ -1222,7 +1222,7 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot)
 }
 
 static Base *object_mouse_select_menu(
-        bContext *C, ViewContext *vc, unsigned int *buffer, int hits,
+        bContext *C, ViewContext *vc, uint *buffer, int hits,
         const int mval[2], bool toggle)
 {
 	short baseCount = 0;
@@ -1305,7 +1305,7 @@ static Base *object_mouse_select_menu(
 
 static bool selectbuffer_has_bones(const uint *buffer, const uint hits)
 {
-	unsigned int i;
+	uint i;
 	for (i = 0; i < hits; i++) {
 		if (buffer[(4 * i) + 3] & 0xFFFF0000) {
 			return true;
@@ -1315,22 +1315,22 @@ static bool selectbuffer_has_bones(const uint *buffer, const uint hits)
 }
 
 /* utility function for mixed_bones

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list