diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-10 12:50:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-10 12:50:14 +0300 |
commit | f59303bead2ae4a25132edadf217a64cdd581dc5 (patch) | |
tree | 1d64b157ee7c0ddac1f5c91c239d12a104e3c87e /release/scripts/modules/bpy_types.py | |
parent | 2b56faebe5f2a8e2b37004485206007d22cdac1d (diff) |
Fix color for manipulator drawing
Was drawing black after the first draw call.
For now set the shader before each draw call,
noted as TODO to investigate a nicer way to handle.
Diffstat (limited to 'release/scripts/modules/bpy_types.py')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 78c70225a04..6b06ff77ecd 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -644,6 +644,11 @@ class Manipulator(StructRNA, metaclass=OrderedMeta): 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') + if select_id is not None: gpu.select.load_id(select_id) else: @@ -651,11 +656,11 @@ class Manipulator(StructRNA, metaclass=OrderedMeta): color = (*self.color_highlight, self.alpha_highlight) else: color = (*self.color, self.alpha) - shape.uniform_f32("color", *color) + batch.uniform_f32("color", *color) with gpu.matrix.push_pop(): gpu.matrix.multiply_matrix(matrix) - shape.draw() + batch.draw() @staticmethod def new_custom_shape(type, verts): @@ -684,8 +689,7 @@ class Manipulator(StructRNA, metaclass=OrderedMeta): vbo = Gwn_VertBuf(len=len(verts), format=fmt) vbo.fill(id=pos_id, data=verts) batch = Gwn_Batch(type=type, buf=vbo) - batch.program_set_builtin('3D_UNIFORM_COLOR' if dims == 3 else '2D_UNIFORM_COLOR') - return batch + return (batch, dims) # Only defined so operators members can be used by accessing self.order |