diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-26 03:26:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-26 03:26:39 +0300 |
commit | 6d2897c7ed7c36ba428bb61fc3ac16eb308c283c (patch) | |
tree | ac1700ef681c1a3e856bf8cac015f63ad54c2276 /release/scripts/modules/bpy_types.py | |
parent | a4a6ed1ba3c86ed842f4373c65d64d28d827f864 (diff) |
Update Gizmo.draw_custom_shape for API changes
Diffstat (limited to 'release/scripts/modules/bpy_types.py')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 84262e618d8..a80fe6a7c9f 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -594,10 +594,7 @@ class Gizmo(StructRNA): if matrix is None: matrix = self.matrix_world - batch, dims = shape - - # XXX, can we avoid setting the shader every time? - batch.program_set_builtin('3D_UNIFORM_COLOR' if dims == 3 else '2D_UNIFORM_COLOR') + batch, shader, dims = shape if select_id is not None: gpu.select.load_id(select_id) @@ -606,7 +603,8 @@ class Gizmo(StructRNA): color = (*self.color_highlight, self.alpha_highlight) else: color = (*self.color, self.alpha) - batch.uniform_f32("color", *color) + batch.program_set(shader) + shader.uniform_float("color", color) with gpu.matrix.push_pop(): gpu.matrix.multiply_matrix(matrix) @@ -626,6 +624,7 @@ class Gizmo(StructRNA): :return: The newly created shape. :rtype: Undefined (it may change). """ + import gpu from gpu.types import ( GPUBatch, GPUVertBuf, @@ -637,9 +636,10 @@ class Gizmo(StructRNA): fmt = GPUVertFormat() pos_id = fmt.attr_add(id="pos", comp_type='F32', len=dims, fetch_mode='FLOAT') vbo = GPUVertBuf(len=len(verts), format=fmt) - vbo.fill(id=pos_id, data=verts) + vbo.attr_fill(id=pos_id, data=verts) batch = GPUBatch(type=type, buf=vbo) - return (batch, dims) + shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR' if dims == 3 else '2D_UNIFORM_COLOR') + return (batch, shader, dims) # Only defined so operators members can be used by accessing self.order |