bouncy bull

This commit is contained in:
2026-05-15 22:10:58 +03:00
parent fe5d143047
commit 6549240337
9 changed files with 697 additions and 382 deletions
+61 -3
View File
@@ -110,7 +110,11 @@ func _build_params(content: VBoxContainer) -> void:
content.add_child(header)
for key: String in sections[section]:
_add_float_row(content, key, DP.get_all()[key])
var meta: Dictionary = DP.get_all()[key]
if meta["type"] == TYPE_FLOAT:
_add_float_row(content, key, meta)
elif meta["type"] == TYPE_BOOL:
_add_bool_row(content, key, meta)
func _add_float_row(parent: VBoxContainer, key: String, meta: Dictionary) -> void:
@@ -161,6 +165,47 @@ func _add_float_row(parent: VBoxContainer, key: String, meta: Dictionary) -> voi
)
func _add_bool_row(parent: VBoxContainer, key: String, meta: Dictionary) -> void:
var row := HBoxContainer.new()
row.size_flags_horizontal = Control.SIZE_FILL
parent.add_child(row)
var lbl := Label.new()
lbl.text = key.replace("_", " ")
lbl.custom_minimum_size.x = 140
lbl.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
row.add_child(lbl)
var btn := Button.new()
btn.toggle_mode = true
btn.button_pressed = meta["value"]
btn.text = "HIDDEN" if not meta["value"] else "SHOWN"
_update_btn_style(btn, meta["value"])
row.add_child(btn)
btn.toggled.connect(func(v: bool) -> void:
btn.text = "HIDDEN" if not v else "SHOWN"
_update_btn_style(btn, v)
DP.set_value(key, v)
)
DP.any_changed.connect(func(changed_key: String, _val: Variant) -> void:
if changed_key != key and changed_key != "__all__":
return
var v_b: bool = DP.b(key)
btn.set_pressed_no_signal(v_b)
btn.text = "HIDDEN" if not v_b else "SHOWN"
_update_btn_style(btn, v_b)
)
func _update_btn_style(btn: Button, active: bool) -> void:
if active:
btn.add_theme_color_override("font_color", Color(0.4, 1.0, 0.5))
else:
btn.add_theme_color_override("font_color", Color(1.0, 0.4, 0.4))
func _on_save() -> void:
DP.save()
_status_label.text = "Saved!"
@@ -169,8 +214,21 @@ func _on_save() -> void:
)
func _on_dp_changed(_key: String, _value: Variant) -> void:
pass # individual rows handle their own updates via signal
func _on_dp_changed(key: String, _value: Variant) -> void:
if key == "show_collisions" or key == "__all__":
var active: bool = DP.b("show_collisions")
get_tree().debug_collisions_hint = active
# Force refresh of all collision shapes
_refresh_collisions(get_tree().root, active)
func _refresh_collisions(node: Node, active: bool) -> void:
if node is CollisionShape3D or node is CollisionPolygon3D:
node.visible = !node.visible # Trigger a notification
node.visible = !node.visible
for child in node.get_children():
_refresh_collisions(child, active)
func _input(event: InputEvent) -> void: