feat(ui): basic draw operator

This commit is contained in:
Swann Martinez
2019-03-07 13:45:44 +01:00
parent 1504c0a5f2
commit a36d3705aa
2 changed files with 74 additions and 17 deletions

View File

@ -310,18 +310,6 @@ class session_settings(bpy.types.PropertyGroup):
name="update_frequency", default=0.008)
camera_coords = [(-1, 1, 0), (1, 1, 0), (1, 1, 0),
(1, -1, 0), (1, -1, 0), (-1, -1, 0),
(-1, -1, 0), (-1, 1, 0)]
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": camera_coords})
def draw_client():
shader.bind()
shader.uniform_float("color", (1, 1, 0, 1))
batch.draw(shader)
# TODO: Rename to match official blender convention
classes = (
@ -342,8 +330,6 @@ def register():
bpy.types.Scene.session_settings = bpy.props.PointerProperty(
type=session_settings)
bpy.types.SpaceView3D.draw_handler_add(
draw_client, (), 'WINDOW', 'POST_VIEW')
# bpy.app.handlers.depsgraph_update_post.append(on_scene_evalutation)
@ -352,9 +338,11 @@ def unregister():
for cls in reversed(classes):
unregister_class(cls)
# bpy.types.SpaceView3D.draw_handler_remove(draw_client, (),'WINDOW')
# bpy.app.handlers.depsgraph_update_post.remove(on_scene_evalutation)
# bpy.app.handlers.depsgraph_update_post.remove(on_scene_evalutation)
del bpy.types.Scene.session_settings