From 5d2aca4e31fbf57c19fbff58ae0e884f670fe334 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Wed, 30 Jul 2025 12:10:40 +0200 Subject: [PATCH] Avoid crash when UV coordinates not loaded/generated CURA-12664 --- plugins/PaintTool/PaintTool.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/PaintTool/PaintTool.py b/plugins/PaintTool/PaintTool.py index 524011af9d..fa6436f10d 100644 --- a/plugins/PaintTool/PaintTool.py +++ b/plugins/PaintTool/PaintTool.py @@ -186,7 +186,11 @@ class PaintTool(Tool): pt = self._picking_pass.getPickedPosition(x, y).getData() va, vb, vc = self._mesh_transformed_cache.getFaceNodes(face_id) - ta, tb, tc = node.getMeshData().getFaceUvCoords(face_id) + + face_uv_coordinates = node.getMeshData().getFaceUvCoords(face_id) + if face_uv_coordinates is None: + return face_id, None + ta, tb, tc = face_uv_coordinates # 'Weight' of each vertex that would produce point pt, so we can generate the texture coordinates from the uv ones of the vertices. # See (also) https://mathworld.wolfram.com/BarycentricCoordinates.html