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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2022-07-22 05:35:50 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-07-22 05:35:50 +0300
commit563ea27eb1a8843fdc05b2fe3944dfbdcd4d5a1f (patch)
tree79d3502e2b35222e2611bd73190835d9afd198bf
parentb56a6acb9f4fe1041ed377202f05ed5a5dd09d91 (diff)
UV Layout: bring back smooth lines
Feature removed in rBAb56a6acb9f4f.
-rw-r--r--io_mesh_uv_layout/export_uv_png.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/io_mesh_uv_layout/export_uv_png.py b/io_mesh_uv_layout/export_uv_png.py
index 74cd7b19..78f9f6a2 100644
--- a/io_mesh_uv_layout/export_uv_png.py
+++ b/io_mesh_uv_layout/export_uv_png.py
@@ -23,11 +23,7 @@ def export(filepath, face_data, colors, width, height, opacity):
offscreen.free()
def draw_image(face_data, opacity):
- gpu.state.line_width_set(1.0)
gpu.state.blend_set('ALPHA_PREMULT')
- # TODO: Use shader that draws a smooth line (Eg. '3D_POLYLINE_UNIFORM_COLOR')
- # bgl.glEnable(bgl.GL_LINE_SMOOTH)
- # bgl.glHint(bgl.GL_LINE_SMOOTH_HINT, bgl.GL_NICEST)
with gpu.matrix.push_pop():
gpu.matrix.load_matrix(get_normalize_uvs_matrix())
@@ -74,12 +70,15 @@ def draw_lines(face_data):
for i in range(len(uvs)):
start = uvs[i]
end = uvs[(i+1) % len(uvs)]
- coords.append((start[0], start[1]))
- coords.append((end[0], end[1]))
+ coords.append((start[0], start[1], 0.0))
+ coords.append((end[0], end[1], 0.0))
- shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
+ # Use '2D_UNIFORM_COLOR' if smooth lines are not required.
+ shader = gpu.shader.from_builtin('3D_POLYLINE_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos" : coords})
shader.bind()
+ shader.uniform_float("viewportSize", gpu.state.viewport_get()[2:])
+ shader.uniform_float("lineWidth", 0.5)
shader.uniform_float("color", (0, 0, 0, 1))
batch.draw(shader)