-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfunctions.py
More file actions
29 lines (22 loc) · 719 Bytes
/
functions.py
File metadata and controls
29 lines (22 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import bpy
import bgl
import gpu
from gpu_extras.batch import batch_for_shader
shader = gpu.shader.from_builtin('3D_FLAT_COLOR')
def draw_callback_3d(cameras):
bgl.glPointSize(4)
bgl.glEnable(bgl.GL_BLEND)
coords = []
colors = []
for cam in cameras:
if cam['camera_data'].camera_frustum_settings.enable:
for co in cam["co"]:
coords.append(co)
colors.append(list(cam["color"]) + [0.5])
batch = batch_for_shader(shader, 'POINTS', {"pos": coords,
"color": colors})
shader.bind()
batch.draw(shader)
# Restore opengl defaults
bgl.glPointSize(1)
bgl.glDisable(bgl.GL_BLEND)