@@ -49,19 +49,32 @@ def is_dashed(self):
49
49
return self .construction
50
50
51
51
def update (self ):
52
+ """Update the line's visual representation with thick geometry for Vulkan compatibility.
53
+
54
+ Creates triangle-based geometry for both solid and dashed lines to ensure
55
+ consistent visibility across different graphics backends.
56
+ """
52
57
if bpy .app .background :
53
58
return
54
59
55
- p1 , p2 = self .p1 .location , self .p2 .location
60
+ try :
61
+ p1 , p2 = self .p1 .location , self .p2 .location
56
62
57
- if self .is_dashed ():
58
- coords , indices = draw_thick_dashed_line_3d (p1 , p2 , self .line_width )
59
- else :
60
- coords , indices = draw_thick_line_3d (p1 , p2 , self .line_width )
61
- kwargs = {"pos" : coords }
62
- self ._batch = batch_for_shader (self ._shader , "TRIS" , kwargs , indices = indices )
63
+ if self .is_dashed ():
64
+ coords , indices = draw_thick_dashed_line_3d (p1 , p2 , self .line_width )
65
+ else :
66
+ coords , indices = draw_thick_line_3d (p1 , p2 , self .line_width )
67
+
68
+ if not coords :
69
+ logger .warning (f"Failed to create thick line geometry for { self } " )
70
+ return
63
71
64
- self .is_dirty = False
72
+ kwargs = {"pos" : coords }
73
+ self ._batch = batch_for_shader (self ._shader , "TRIS" , kwargs , indices = indices )
74
+ self .is_dirty = False
75
+ except Exception as e :
76
+ logger .error (f"Error updating line { self } : { e } " )
77
+ self .is_dirty = False
65
78
66
79
def create_slvs_data (self , solvesys , group = Solver .group_fixed ):
67
80
handle = solvesys .addLineSegment (self .p1 .py_data , self .p2 .py_data , group = group )
0 commit comments