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-09-30 15:20:47 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-09-30 15:20:47 +0300
commit6565aa5db14c5c961dd0e4e25cfafcbc90f23d50 (patch)
tree68ac73e7f1d5a34880ef2620daaf554ef77c41cb
parent4feb92043cbd412f1ba69ea3fe2768169db48d91 (diff)
Fix T101134 for 3.3: Export UV Layout is blurryv3.3.1blender-v3.3-release
Use 'ALPHA' instead 'ALPHA_PREMULT'. And take advantage of using 2D coordinates instead of 3D.
-rw-r--r--io_mesh_uv_layout/export_uv_png.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/io_mesh_uv_layout/export_uv_png.py b/io_mesh_uv_layout/export_uv_png.py
index 78f9f6a2..26f4c785 100644
--- a/io_mesh_uv_layout/export_uv_png.py
+++ b/io_mesh_uv_layout/export_uv_png.py
@@ -23,7 +23,7 @@ def export(filepath, face_data, colors, width, height, opacity):
offscreen.free()
def draw_image(face_data, opacity):
- gpu.state.blend_set('ALPHA_PREMULT')
+ gpu.state.blend_set('ALPHA')
with gpu.matrix.push_pop():
gpu.matrix.load_matrix(get_normalize_uvs_matrix())
@@ -70,16 +70,20 @@ 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], 0.0))
- coords.append((end[0], end[1], 0.0))
+ coords.append((start[0], start[1]))
+ coords.append((end[0], end[1]))
+
+ # Use '2D_UNIFORM_COLOR' in the `batch_for_shader` so we don't need to
+ # convert the coordinates to 3D as in the case of
+ # '3D_POLYLINE_UNIFORM_COLOR'.
+ batch = batch_for_shader(gpu.shader.from_builtin('2D_UNIFORM_COLOR'), 'LINES', {"pos" : coords})
- # 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))
+ shader.uniform_float("lineWidth", 1.0)
+ shader.uniform_float("color", (0.0, 0.0, 0.0, 1.0))
+
batch.draw(shader)
def save_pixels(filepath, pixel_data, width, height):