git clone https://git.lucas.co/hou-control.git
hc: change current node off-screen indicator to triangle
python3.11libs/hc/hcnetworkeditor.py | 44 ++++++++++++++++++------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/python3.11libs/hc/hcnetworkeditor.py b/python3.11libs/hc/hcnetworkeditor.py
index f0b2df4..0180b74 100644
--- a/python3.11libs/hc/hcnetworkeditor.py
+++ b/python3.11libs/hc/hcnetworkeditor.py
@@ -160,31 +160,31 @@ class HCNetworkEditor(HCPathTab):
tip_x, tip_y = cx + t * dx, cy + t * dy
angle = math.atan2(dy, dx)
- shaft_len = 40.0
- head_len = 14.0
- head_angle = math.pi / 6.0
- tail_x = tip_x - shaft_len * math.cos(angle)
- tail_y = tip_y - shaft_len * math.sin(angle)
- hl_x = tip_x - head_len * math.cos(angle - head_angle)
- hl_y = tip_y - head_len * math.sin(angle - head_angle)
- hr_x = tip_x - head_len * math.cos(angle + head_angle)
- hr_y = tip_y - head_len * math.sin(angle + head_angle)
+ # Dimensions for the triangle
+ length = 18.0
+ width_ratio = 0.6 # Half-width relative to length
+
+ # Calculate triangle vertices
+ # tip is at (tip_x, tip_y)
+ # back corners are at a distance 'length' away along the angle
+ p1 = hou.Vector2(tip_x, tip_y)
+ p2 = hou.Vector2(
+ tip_x - length * math.cos(angle - math.atan(width_ratio)),
+ tip_y - length * math.sin(angle - math.atan(width_ratio))
+ )
+ p3 = hou.Vector2(
+ tip_x - length * math.cos(angle + math.atan(width_ratio)),
+ tip_y - length * math.sin(angle + math.atan(width_ratio))
+ )
color = hou.Color((0.38, 0.56, 0.56))
- width = 3.0
shapes = [
- hou.NetworkShapeLine(hou.Vector2(tail_x, tail_y),
- hou.Vector2(tip_x, tip_y),
- color=color, alpha=1.0, width=width,
- screen_space=True, smooth=True),
- hou.NetworkShapeLine(hou.Vector2(tip_x, tip_y),
- hou.Vector2(hl_x, hl_y),
- color=color, alpha=1.0, width=width,
- screen_space=True, smooth=True),
- hou.NetworkShapeLine(hou.Vector2(tip_x, tip_y),
- hou.Vector2(hr_x, hr_y),
- color=color, alpha=1.0, width=width,
- screen_space=True, smooth=True),
+ hou.NetworkShapePolygon(
+ [p1, p2, p3],
+ color=color, alpha=0.8,
+ fill_color=color, fill_alpha=0.6,
+ screen_space=True
+ )
]
ed.setOverlayShapes(shapes)