[Bf-extensions-cvs] [93425213] master: Cleanup: pep8

Campbell Barton noreply at git.blender.org
Mon Apr 6 14:41:48 CEST 2020


Commit: 93425213fa5493563061b245f83763460a5c6009
Author: Campbell Barton
Date:   Mon Apr 6 22:36:40 2020 +1000
Branches: master
https://developer.blender.org/rBA93425213fa5493563061b245f83763460a5c6009

Cleanup: pep8

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

M	space_view3d_math_vis/__init__.py
M	space_view3d_math_vis/draw.py

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

diff --git a/space_view3d_math_vis/__init__.py b/space_view3d_math_vis/__init__.py
index c7a145e9..b99456f8 100644
--- a/space_view3d_math_vis/__init__.py
+++ b/space_view3d_math_vis/__init__.py
@@ -68,7 +68,8 @@ class PanelConsoleVars(Panel):
 
     def draw(self, context):
         layout = self.layout
-        state_props = bpy.context.window_manager.MathVisStatePropList
+        wm = context.window_manager
+        state_props = wm.MathVisStatePropList
 
         if len(state_props) == 0:
             box = layout.box()
@@ -85,10 +86,11 @@ class PanelConsoleVars(Panel):
                 rows=10
             )
         col = layout.column()
-        col.prop(bpy.context.window_manager.MathVisProp, "name_hide")
-        col.prop(bpy.context.window_manager.MathVisProp, "bbox_hide")
-        col.prop(bpy.context.window_manager.MathVisProp, "in_front")
-        col.prop(bpy.context.window_manager.MathVisProp, "bbox_scale")
+        mvp = wm.MathVisProp
+        col.prop(mvp, "name_hide")
+        col.prop(mvp, "bbox_hide")
+        col.prop(mvp, "in_front")
+        col.prop(mvp, "bbox_scale")
         col.operator("mathvis.cleanup_console")
 
 
@@ -249,6 +251,7 @@ class MathVis(PropertyGroup):
         update=call_console_hook
     )
 
+
 classes = (
     PanelConsoleVars,
     DeleteVar,
diff --git a/space_view3d_math_vis/draw.py b/space_view3d_math_vis/draw.py
index 60467faa..fa03061d 100644
--- a/space_view3d_math_vis/draw.py
+++ b/space_view3d_math_vis/draw.py
@@ -34,13 +34,14 @@ if not bpy.app.background:
     single_color_shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
     smooth_color_shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR')
 else:
-  single_color_shader = None
-  smooth_color_shader = None
+    single_color_shader = None
+    smooth_color_shader = None
 
 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
 
@@ -88,7 +89,6 @@ def draw_callback_px():
     if not data_matrix and not data_quat and not data_euler and not data_vector and not data_vector_array:
         return
 
-
     region = context.region
     region3d = context.space_data.region_3d
 
@@ -133,6 +133,7 @@ def draw_callback_px():
             draw_text(key, loc, dy=-offset_y)
             offset_y += 20
 
+
 def draw_callback_view():
     settings = bpy.context.window_manager.MathVisProp
     scale = settings.bbox_scale
@@ -170,35 +171,39 @@ 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", 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", COLOR_LINE)
     batch.draw(single_color_shader)
 
+
 def batch_from_points(points, type):
-    return batch_for_shader(single_color_shader, type, {"pos" : points})
+    return batch_for_shader(single_color_shader, type, {"pos": points})
+
 
 def draw_matrices(matrices, scale, with_bounding_box):
-    x_p = Vector(( scale,   0.0,   0.0))
-    x_n = Vector((-scale,   0.0,   0.0))
-    y_p = Vector((0.0,    scale,   0.0))
-    y_n = Vector((0.0,   -scale,   0.0))
-    z_p = Vector((0.0,      0.0,  scale))
-    z_n = Vector((0.0,      0.0, -scale))
-
-    red_dark =    (0.2, 0.0, 0.0, 1.0)
-    red_light =   (1.0, 0.2, 0.2, 1.0)
-    green_dark =  (0.0, 0.2, 0.0, 1.0)
+    x_p = Vector((scale, 0.0, 0.0))
+    x_n = Vector((-scale, 0.0, 0.0))
+    y_p = Vector((0.0, scale, 0.0))
+    y_n = Vector((0.0, -scale, 0.0))
+    z_p = Vector((0.0, 0.0, scale))
+    z_n = Vector((0.0, 0.0, -scale))
+
+    red_dark = (0.2, 0.0, 0.0, 1.0)
+    red_light = (1.0, 0.2, 0.2, 1.0)
+    green_dark = (0.0, 0.2, 0.0, 1.0)
     green_light = (0.2, 1.0, 0.2, 1.0)
-    blue_dark =   (0.0, 0.0, 0.2, 1.0)
-    blue_light =  (0.4, 0.4, 1.0, 1.0)
+    blue_dark = (0.0, 0.0, 0.2, 1.0)
+    blue_light = (0.4, 0.4, 1.0, 1.0)
 
     coords = []
     colors = []
@@ -214,14 +219,15 @@ def draw_matrices(matrices, scale, with_bounding_box):
         colors.extend((blue_dark, blue_light))
 
     batch = batch_for_shader(smooth_color_shader, "LINES", {
-        "pos" : coords,
-        "color" : colors
+        "pos": coords,
+        "color": colors
     })
     batch.draw(smooth_color_shader)
 
     if with_bounding_box:
         draw_bounding_boxes(matrices, scale, COLOR_BOUNDING_BOX)
 
+
 def draw_bounding_boxes(matrices, scale, color):
     boundbox_points = []
     for x in (-scale, scale):



More information about the Bf-extensions-cvs mailing list