rename enable to enabled in debug_draw

This commit is contained in:
2024-10-05 21:33:45 +10:00
parent e903a6524f
commit 6ac97ce0fb

View File

@@ -5,7 +5,7 @@ const MARKER_RADIUS: float = 0.2
const CIRCLE_RADIUS: float = 3
const DEFAULT_COLOR: Color = Color.RED
var enable: bool = false
var enabled: bool = false
var camera: Camera3D
var control: Control = Control.new()
@@ -18,26 +18,26 @@ var circles_to_draw: Array[Dictionary] = []
func _ready() -> void:
camera = get_viewport().get_camera_3d()
layer = 999
enable = false
enabled = false
control.draw.connect(_on_control_draw)
add_child(control)
func _process(_delta: float) -> void:
if not enable:
if not enabled:
return
control.queue_redraw()
func _input(event: InputEvent) -> void:
if event.is_action_pressed("toggle_debug"):
enable = not enable
visible = enable
enabled = not enabled
visible = enabled
vectors_to_draw.clear()
func vector(from: Vector3, to: Vector3, color: Color = DEFAULT_COLOR) -> void:
if not enable:
if not enabled:
return
vectors_to_draw.append({"from": from, "to": to, "color": color})
@@ -48,14 +48,14 @@ func marker(
radius: float = MARKER_RADIUS,
color: Color = DEFAULT_COLOR
) -> void:
if not enable:
if not enabled:
return
markers_to_draw.append({"pos": pos, "radius": radius, "color": color})
func circle(pos: Vector3, color: Color = DEFAULT_COLOR) -> void:
if not enable:
if not enabled:
return
circles_to_draw.append({"pos": pos, "color": color})
@@ -105,7 +105,7 @@ func _draw_circle(pos: Vector3, color: Color) -> void:
func _on_control_draw() -> void:
if not enable:
if not enabled:
return
for v in vectors_to_draw: