Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/python_api/examples/gpu.5.py')
-rw-r--r--doc/python_api/examples/gpu.5.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/doc/python_api/examples/gpu.5.py b/doc/python_api/examples/gpu.5.py
index 7af3a518457..855f9a28e44 100644
--- a/doc/python_api/examples/gpu.5.py
+++ b/doc/python_api/examples/gpu.5.py
@@ -14,20 +14,23 @@ mesh.calc_loop_triangles()
vertices = np.empty((len(mesh.vertices), 3), 'f')
indices = np.empty((len(mesh.loop_triangles), 3), 'i')
-mesh.vertices.foreach_get("co",
- np.reshape(vertices, len(mesh.vertices) * 3))
-mesh.loop_triangles.foreach_get("vertices",
- np.reshape(indices, len(mesh.loop_triangles) * 3))
+mesh.vertices.foreach_get(
+ "co", np.reshape(vertices, len(mesh.vertices) * 3))
+mesh.loop_triangles.foreach_get(
+ "vertices", np.reshape(indices, len(mesh.loop_triangles) * 3))
vertex_colors = [(random(), random(), random(), 1) for _ in range(len(mesh.vertices))]
shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR')
-batch = batch_for_shader(shader, 'TRIS',
- {"pos" : vertices,
- "color" : vertex_colors},
- indices=indices)
+batch = batch_for_shader(
+ shader, 'TRIS',
+ {"pos": vertices, "color": vertex_colors},
+ indices=indices,
+)
+
def draw():
batch.draw(shader)
-bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW') \ No newline at end of file
+
+bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')