[Bf-blender-cvs] [4dadb6d4453] blender2.8: Naming constancy for 'imm' utility functions

Campbell Barton noreply at git.blender.org
Wed Apr 5 09:47:47 CEST 2017


Commit: 4dadb6d4453d84d537e25e753f7904ce5c8539fb
Author: Campbell Barton
Date:   Wed Apr 5 17:43:28 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB4dadb6d4453d84d537e25e753f7904ce5c8539fb

Naming constancy for 'imm' utility functions

- use 'imm_draw_' prefix for functions that draw.
- use '_3d' suffix for 3d functions, no suffix for 2d functions.
- use terms fill/wire (shorter than filled / lined).

Also add `imm_draw_circle_fill_3d` (only had wire version)

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

M	source/blender/editors/armature/editarmature_sketch.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/include/BIF_glutil.h
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/screen/screendump.c
M	source/blender/editors/space_view3d/drawarmature.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/windowmanager/intern/wm_gesture.c
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index f42ce147431..c5243b29255 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -478,7 +478,7 @@ static void sk_drawEdge(SK_Point *pt0, SK_Point *pt1, float size, float color[4]
 
 	angle = angle_normalized_v3v3(vec2, vec1);
 	gpuRotate3fv(angle * (float)(180.0 / M_PI) + 180.0f, axis);
-	imm_cylinder(pos, sk_clampPointSize(pt1, size), sk_clampPointSize(pt0, size), length, 8, 8);
+	imm_draw_cylinder_fill_3d(pos, sk_clampPointSize(pt1, size), sk_clampPointSize(pt0, size), length, 8, 8);
 
 	immUnbindProgram();
 }
@@ -506,7 +506,7 @@ static void sk_drawNormal(SK_Point *pt, float size, float height)
 	angle = angle_normalized_v3v3(vec2, pt->no);
 	gpuRotate3fv(angle * (float)(180.0 / M_PI), axis);
 
-	imm_cylinder(pos, sk_clampPointSize(pt, size), 0, sk_clampPointSize(pt, height), 10, 2);
+	imm_draw_cylinder_fill_3d(pos, sk_clampPointSize(pt, size), 0, sk_clampPointSize(pt, height), 10, 2);
 
 	immUnbindProgram();
 
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 73f393537ba..ed1ffc13602 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1852,7 +1852,7 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr)
 		glEnable(GL_BLEND);
 
 		immUniformColor4ub(255, 100, 100, 20);
-		imm_draw_filled_circle(pos, x, y, p->radius, 40);
+		imm_draw_circle_fill(pos, x, y, p->radius, 40);
 
 		setlinestyle(6); /* TODO: handle line stipple in shader */
 
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index ebc6cd86479..7db32eb39a0 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -60,7 +60,8 @@ struct ColorManagedDisplaySettings;
 void imm_draw_lined_circle(unsigned pos, float x, float y, float radius, int nsegments);
 
 /* use this version when VertexFormat has a vec3 position */
-void imm_draw_lined_circle_3D(unsigned pos, float x, float y, float radius, int nsegments);
+void imm_draw_circle_wire_3d(unsigned pos, float x, float y, float radius, int nsegments);
+void imm_draw_circle_fill_3d(unsigned pos, float x, float y, float radius, int nsegments);
 
 /**
  * Draw a filled circle with the given \a radius.
@@ -72,7 +73,7 @@ void imm_draw_lined_circle_3D(unsigned pos, float x, float y, float radius, int
  * \param radius The circle's radius.
  * \param nsegments The number of segments to use in drawing (more = smoother).
  */
-void imm_draw_filled_circle(unsigned pos, float x, float y, float radius, int nsegments);
+void imm_draw_circle_fill(unsigned pos, float x, float y, float radius, int nsegments);
 
 /**
  * Draw a filled arc with the given inner and outer radius.
@@ -89,7 +90,7 @@ void imm_draw_filled_circle(unsigned pos, float x, float y, float radius, int ns
  * \param start: Specifies the starting angle, in degrees, of the disk portion.
  * \param sweep: Specifies the sweep angle, in degrees, of the disk portion.
  */
-void imm_draw_filled_disk_partial(
+void imm_draw_disk_partial_fill(
         unsigned pos, float x, float y,
         float radius_inner, float radius_outer, int nsegments, float start, float sweep);
 
@@ -105,7 +106,7 @@ void imm_draw_filled_disk_partial(
 void imm_draw_line_box(unsigned pos, float x1, float y1, float x2, float y2);
 
 /* use this version when VertexFormat has a vec3 position */
-void imm_draw_line_box_3D(unsigned pos, float x1, float y1, float x2, float y2);
+void imm_draw_line_box_3d(unsigned pos, float x1, float y1, float x2, float y2);
 
 /* Draw a standard checkerboard to indicate transparent backgrounds */
 void imm_draw_checker_box(float x1, float y1, float x2, float y2);
@@ -129,9 +130,10 @@ void imm_cpack(unsigned int x);
 * \param slices Specifies the number of subdivisions around the z axis.
 * \param stacks Specifies the number of subdivisions along the z axis.
 */
-void imm_cylinder_nor(unsigned int pos, unsigned int nor, float base, float top, float height, int slices, int stacks);
-void imm_cylinder_wire(unsigned int pos, float base, float top, float height, int slices, int stacks);
-void imm_cylinder(unsigned int pos, float base, float top, float height, int slices, int stacks);
+void imm_draw_cylinder_fill_normal_3d(
+        unsigned int pos, unsigned int nor, float base, float top, float height, int slices, int stacks);
+void imm_draw_cylinder_wire_3d(unsigned int pos, float base, float top, float height, int slices, int stacks);
+void imm_draw_cylinder_fill_3d(unsigned int pos, float base, float top, float height, int slices, int stacks);
 
 /**
  * Returns a float value as obtained by glGetFloatv.
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 05916bd2e6a..5924d600ac7 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2270,7 +2270,7 @@ static void ui_hsv_cursor(float x, float y)
 	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
 	immUniformColor3f(1.0f, 1.0f, 1.0f);
-	imm_draw_filled_circle(pos, x, y, 3.0f * U.pixelsize, 8);
+	imm_draw_circle_fill(pos, x, y, 3.0f * U.pixelsize, 8);
 	
 	glEnable(GL_BLEND);
 	glEnable(GL_LINE_SMOOTH);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 5a011db6090..1852df66df7 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -97,7 +97,7 @@ void imm_draw_lined_circle(unsigned pos, float x, float y, float rad, int nsegme
 	imm_draw_circle(PRIM_LINE_LOOP, pos, x, y, rad, nsegments);
 }
 
-void imm_draw_filled_circle(unsigned pos, float x, float y, float rad, int nsegments)
+void imm_draw_circle_fill(unsigned pos, float x, float y, float rad, int nsegments)
 {
 	imm_draw_circle(PRIM_TRIANGLE_FAN, pos, x, y, rad, nsegments);
 }
@@ -127,16 +127,18 @@ static void imm_draw_disk_partial(
 /**
  * Replacement for gluPartialDisk, (without 'loops' argument).
  */
-void imm_draw_filled_disk_partial(
+void imm_draw_disk_partial_fill(
         unsigned pos, float x, float y,
         float rad_inner, float rad_outer, int nsegments, float start, float sweep)
 {
 	imm_draw_disk_partial(PRIM_TRIANGLE_STRIP, pos, x, y, rad_inner, rad_outer, nsegments, start, sweep);
 }
 
-void imm_draw_lined_circle_3D(unsigned pos, float x, float y, float rad, int nsegments)
+static void imm_draw_circle_3D(
+        PrimitiveType prim_type, unsigned pos, float x, float y,
+        float rad, int nsegments)
 {
-	immBegin(PRIM_LINE_LOOP, nsegments);
+	immBegin(prim_type, nsegments);
 	for (int i = 0; i < nsegments; ++i) {
 		float angle = 2 * M_PI * ((float)i / (float)nsegments);
 		immVertex3f(pos, x + rad * cosf(angle), y + rad * sinf(angle), 0.0f);
@@ -144,6 +146,16 @@ void imm_draw_lined_circle_3D(unsigned pos, float x, float y, float rad, int nse
 	immEnd();
 }
 
+void imm_draw_circle_wire_3d(unsigned pos, float x, float y, float rad, int nsegments)
+{
+	imm_draw_circle_3D(PRIM_LINE_LOOP, pos, x, y, rad, nsegments);
+}
+
+void imm_draw_circle_fill_3d(unsigned pos, float x, float y, float rad, int nsegments)
+{
+	imm_draw_circle_3D(PRIM_TRIANGLE_FAN, pos, x, y, rad, nsegments);
+}
+
 void imm_draw_line_box(unsigned pos, float x1, float y1, float x2, float y2)
 {
 	immBegin(PRIM_LINE_LOOP, 4);
@@ -154,7 +166,7 @@ void imm_draw_line_box(unsigned pos, float x1, float y1, float x2, float y2)
 	immEnd();
 }
 
-void imm_draw_line_box_3D(unsigned pos, float x1, float y1, float x2, float y2)
+void imm_draw_line_box_3d(unsigned pos, float x1, float y1, float x2, float y2)
 {
 	/* use this version when VertexFormat has a vec3 position */
 	immBegin(PRIM_LINE_LOOP, 4);
@@ -186,7 +198,8 @@ void imm_cpack(unsigned int x)
 	                   (((x) >> 16) & 0xFF));
 }
 
-void imm_cylinder_nor(unsigned int pos, unsigned int nor, float base, float top, float height, int slices, int stacks)
+void imm_draw_cylinder_fill_normal_3d(
+        unsigned int pos, unsigned int nor, float base, float top, float height, int slices, int stacks)
 {
 	immBegin(GL_TRIANGLES, 6 * slices * stacks);
 	for (int i = 0; i < slices; ++i) {
@@ -237,7 +250,7 @@ void imm_cylinder_nor(unsigned int pos, unsigned int nor, float base, float top,
 	immEnd();
 }
 
-void imm_cylinder_wire(unsigned int pos, float base, float top, float height, int slices, int stacks)
+void imm_draw_cylinder_wire_3d(unsigned int pos, float base, float top, float height, int slices, int stacks)
 {
 	immBegin(GL_LINES, 6 * slices * stacks);
 	for (int i = 0; i < slices; ++i) {
@@ -274,7 +287,7 @@ void imm_cylinder_wire(unsigned int pos, float base, float top, float height, in
 	immEnd();
 }
 
-void imm_cylinder(unsigned int pos, float base, float top, float height, int slices, int stacks)
+void imm_draw_cylinder_fill_3d(unsigned int pos, float base, float top, float height, int slices, int stacks)
 {
 	immBegin(GL_TRIANGLES, 6 * slices * stacks);
 	for (int i = 0; i < slices; ++i) {
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 5a8ea10cb0a..e5fc89fccbc 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -462,7 +462,7 @@ static void screencast_draw_cursor(bContext *UNUSED(C), int x, int y, void *UNUS
 	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
 	immUniformColor4ub(0, 0, 0, 32);
-	imm_draw_filled_circle(pos, (float)x, (float)y, 20, 40);
+	imm_draw_circle_fill(pos, (float)x, (float)y, 20, 40);
 
 	immUniformColor4ub(255, 255, 255, 128);
 	imm_draw_lined_circle(pos, (float)x, (float)y, 20, 40);
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 9d555cf7907..2e69cfcc901 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1115,7 +1115,7 @@ static void draw_sphere_bone(const sh

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list