@tool
extends ProcGeometryNode
## Curve test: CurveCircle → CurveToMesh (tube/pipe)
## Expected: a torus-like ring mesh (circle profile swept along circle path)
func _ready():
_build_graph()
call_deferred("_apply_material")
func _apply_material():
var mesh_child = get_node_or_null("MeshOutput")
if mesh_child and mesh_child is MeshInstance3D:
var mat = StandardMaterial3D.new()
mat.albedo_color = Color(0.8, 0.6, 0.2)
mat.roughness = 0.4
mat.metallic = 0.3
mesh_child.material_override = mat
func _build_graph():
var g = ProcNodeGraph.new()
# 0: Path circle (large, radius 2)
var path = CurveCircleNode.new()
g.add_node(path)
# 1: Path radius
var path_r = ValueNode.new()
path_r.value = 2.0
g.add_node(path_r)
# 2: Path resolution
var path_res = ValueNode.new()
path_res.value = 48.0
g.add_node(path_res)
# 3: Profile circle (small, radius 0.3)
var profile = CurveCircleNode.new()
g.add_node(profile)
# 4: Profile radius
var prof_r = ValueNode.new()
prof_r.value = 0.3
g.add_node(prof_r)
# 5: Profile resolution
var prof_res = ValueNode.new()
prof_res.value = 12.0
g.add_node(prof_res)
# 6: CurveToMesh
var to_mesh = CurveToMeshNode.new()
g.add_node(to_mesh)
# 7: Sweep resolution
var sweep_res = ValueNode.new()
sweep_res.value = 48.0
g.add_node(sweep_res)
# --- Connections ---
g.connect_sockets(1, 0, 0, 0) # path_r → path.Radius
g.connect_sockets(2, 0, 0, 1) # path_res → path.Resolution
g.connect_sockets(4, 0, 3, 0) # prof_r → profile.Radius
g.connect_sockets(5, 0, 3, 1) # prof_res → profile.Resolution
# 8: Closed = true (circle path is a closed loop)
var closed_val = ValueNode.new()
closed_val.value = 1.0 # true
g.add_node(closed_val)
g.connect_sockets(0, 0, 6, 0) # path → CurveToMesh.Path
g.connect_sockets(3, 0, 6, 1) # profile → CurveToMesh.Profile
g.connect_sockets(7, 0, 6, 2) # sweep_res → CurveToMesh.Resolution
g.connect_sockets(8, 0, 6, 3) # closed → CurveToMesh.Closed
self.graph = g
print("Curve test: torus (circle profile swept along circle path)")