[Bf-extensions-cvs] [3456a058] master: refactor: MathVis: replaced color definitions by constants, changed point color to improve visibility

Gaia Clary noreply at git.blender.org
Mon Apr 1 12:00:53 CEST 2019


Commit: 3456a058ac4c3c366262b2c4a5da03c0bbb250f9
Author: Gaia Clary
Date:   Mon Apr 1 11:59:15 2019 +0200
Branches: master
https://developer.blender.org/rBA3456a058ac4c3c366262b2c4a5da03c0bbb250f9

refactor: MathVis: replaced color definitions by constants, changed point color to improve visibility

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

M	space_view3d_math_vis/draw.py

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

diff --git a/space_view3d_math_vis/draw.py b/space_view3d_math_vis/draw.py
index 0490a5ce..a9c38fbe 100644
--- a/space_view3d_math_vis/draw.py
+++ b/space_view3d_math_vis/draw.py
@@ -32,6 +32,10 @@ callback_handle = []
 single_color_shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
 smooth_color_shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR')
 
+COLOR_POINT = (1.0, 0.0, 1.0, 1)
+COLOR_LINE = (0.5, 0.5, 1, 1)
+COLOR_BOUNDING_BOX = (1.0, 1.0, 1.0, 1.0)
+
 def tag_redraw_areas():
     context = bpy.context
 
@@ -155,17 +159,16 @@ def draw_callback_view():
             derived_matrices.append(matrix)
         draw_matrices(derived_matrices, scale, with_bounding_box)
 
-
 def draw_points(points):
     batch = batch_from_points(points, "POINTS")
     single_color_shader.bind()
-    single_color_shader.uniform_float("color", (0.5, 0.5, 1, 1))
+    single_color_shader.uniform_float("color", COLOR_POINT)
     batch.draw(single_color_shader)
 
 def draw_line(points):
     batch = batch_from_points(points, "LINE_STRIP")
     single_color_shader.bind()
-    single_color_shader.uniform_float("color", (0.5, 0.5, 1, 1))
+    single_color_shader.uniform_float("color", COLOR_LINE)
     batch.draw(single_color_shader)
 
 def batch_from_points(points, type):
@@ -206,7 +209,7 @@ def draw_matrices(matrices, scale, with_bounding_box):
     batch.draw(smooth_color_shader)
 
     if with_bounding_box:
-        draw_bounding_boxes(matrices, scale, (1.0, 1.0, 1.0, 1.0))
+        draw_bounding_boxes(matrices, scale, COLOR_BOUNDING_BOX)
 
 def draw_bounding_boxes(matrices, scale, color):
     boundbox_points = []



More information about the Bf-extensions-cvs mailing list