[Bf-extensions-cvs] [fdebdd68] master: UV Layout: don't convert line coordinates to 3d

Germano Cavalcante noreply at git.blender.org
Thu Jul 28 21:12:21 CEST 2022


Commit: fdebdd681f0bee5fb1914eaa8b1c2c022b73a2f1
Author: Germano Cavalcante
Date:   Thu Jul 28 16:12:06 2022 -0300
Branches: master
https://developer.blender.org/rBAfdebdd681f0bee5fb1914eaa8b1c2c022b73a2f1

UV Layout: don't convert line coordinates to 3d

Although shader uses 3D attribute, it fills missing components with
vec4(0,0,0,1).

This was changed in rBA563ea27eb1a8

===================================================================

M	io_mesh_uv_layout/__init__.py
M	io_mesh_uv_layout/export_uv_png.py

===================================================================

diff --git a/io_mesh_uv_layout/__init__.py b/io_mesh_uv_layout/__init__.py
index ceb5ddbc..40d9b501 100644
--- a/io_mesh_uv_layout/__init__.py
+++ b/io_mesh_uv_layout/__init__.py
@@ -3,7 +3,7 @@
 bl_info = {
     "name": "UV Layout",
     "author": "Campbell Barton, Matt Ebb",
-    "version": (1, 1, 2),
+    "version": (1, 1, 3),
     "blender": (3, 0, 0),
     "location": "Image-Window > UVs > Export UV Layout",
     "description": "Export the UV layout as a 2D graphic",
@@ -128,10 +128,10 @@ class ExportUVLayout(bpy.types.Operator):
         polygon_data = list(self.iter_polygon_data_to_draw(context, meshes))
         different_colors = set(color for _, color in polygon_data)
         if self.modified:
-          depsgraph = context.evaluated_depsgraph_get()
-          for obj in self.iter_objects_to_export(context):
-              obj_eval = obj.evaluated_get(depsgraph)
-              obj_eval.to_mesh_clear()
+            depsgraph = context.evaluated_depsgraph_get()
+            for obj in self.iter_objects_to_export(context):
+                obj_eval = obj.evaluated_get(depsgraph)
+                obj_eval.to_mesh_clear()
 
         export = self.get_exporter()
         export(filepath, polygon_data, different_colors, self.size[0], self.size[1], self.opacity)
diff --git a/io_mesh_uv_layout/export_uv_png.py b/io_mesh_uv_layout/export_uv_png.py
index 78f9f6a2..b7110c73 100644
--- a/io_mesh_uv_layout/export_uv_png.py
+++ b/io_mesh_uv_layout/export_uv_png.py
@@ -70,12 +70,14 @@ 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' if smooth lines are not required.
+    # 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})
     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)



More information about the Bf-extensions-cvs mailing list