Clean up debug prints + smooth bezier

This commit is contained in:
Vojta committed 2025-02-24 17:14:12 +01:00
1 parent 3834d282ca
commit 3187c3d359
5 files changed
+3 -47

No files matched your search

+2 -9
View File
@@ -4,7 +4,6 @@ extends EditorNode3DGizmoPlugin
func _init():
print("[gizmo] _init")
create_material("main", Color(1,0,1), false, true, false)
create_material("secondary", Color(1,0,0))
func _get_gizmo_name() -> String:
@@ -13,25 +12,20 @@ func _get_gizmo_name() -> String:
func _has_gizmo(for_node_3d: Node3D) -> bool:
var result: bool = for_node_3d is Portal
if result: print("[gizmo] _has_gizmo: " + for_node_3d.name)
return result
func _redraw(gizmo):
var portal = gizmo.get_node_3d() as Portal
print("[gizmo] _redraw: " + portal.name)
gizmo.clear() # Always clear the gizmo
if portal not in EditorInterface.get_selection().get_selected_nodes():
return # If not selected, don't draw anything
var lines = PackedVector3Array()
if portal.exit_portal != null:
print("[gizmo] Drawing the bezier")
# Draw a bezier curve connecting the two portals
var exit = portal.exit_portal
var D = portal.global_position.distance_to(exit.global_position)
@@ -59,10 +53,9 @@ func _redraw(gizmo):
+ pow(t, 3) * p3
lines.push_back(spline_pos)
lines.push_back(spline_pos)
lines.push_back(p3)
gizmo.add_lines(PackedVector3Array([p0, p3, p1, p2]), get_material("secondary", gizmo))
#var handles = PackedVector3Array()
#handles.push_back(Vector3(0, 1, 0))