Skip to content

refactor: extract demo wiring into demo_helpers.gd + add get_active_controller facade#82

Merged
blugart-dev merged 1 commit into
mainfrom
refactor/demo-helpers
Jun 19, 2026
Merged

refactor: extract demo wiring into demo_helpers.gd + add get_active_controller facade#82
blugart-dev merged 1 commit into
mainfrom
refactor/demo-helpers

Conversation

@blugart-dev

Copy link
Copy Markdown
Owner

Summary

Leanness pass over the 8 demo scripts (demos only — not part of the shipped plugin), plus a small facade addition. Final 0.3.x gate PR.

New demo/demo_helpers.gd

Collects the wiring every demo hand-duplicated into shared static helpers:

  • build_active_rig() — assemble the full active-ragdoll node graph (PhysicsRigBuilder + PhysicsRigSync + SpringResolver + ActiveRagdollController + KickbackCharacter)
  • find_skeleton_owner() / find_descendant_of_type() — locate the Skeleton3D / AnimationPlayer
  • orbit_camera() — the spherical-coords orbit math (pivot parameterized for world vs character-relative)
  • add_debug_hud() — instantiate + add the F3 StrengthDebugHUD (parent parameterized)

All 8 demos now call these instead of repeating ~30 / 15 / 10 / 5-line blocks each — ~490 fewer lines across demo/ (554 deleted, 63 added).

The helper intentionally mirrors the demos' wiring (sets NodePaths, relies on controller defaults — no .configure(), no rig_sync_path), which is distinct from test/helpers/rig_harness.gd (that one configures every node explicitly for the headless tests). The two are kept separate per the analysis.

Facade

KickbackCharacter.get_active_controller() returns the sibling ActiveRagdollController (or null), making the README's active_controller.* advanced-query pattern (balance / fatigue / pain / hit-streak / injuries) first-class. signal_showcase and euphoria_showcase adopt it to drop their own sibling-scan loops.

Validation

  • Headless import: clean
  • GUT: 112/112 (facade is additive)
  • Scene-smoke (--quit-after 150): clean (exit 0, 0 errors) on all 8 demos

This PR is tagged scene-smoke (no feel changes — pure wiring dedup), so it doesn't need an in-editor visual pass; the 8 clean scene-smokes cover load + runtime.

Merge note

Touches CHANGELOG.md like the other gate PRs — expect a trivial conflict with PR #79/#80/#81 (keep all bullets).

🤖 Generated with Claude Code

…ontroller facade

Leanness pass over the 8 demo scripts (demos only — not part of the plugin).

New demo/demo_helpers.gd collects the wiring every demo hand-duplicated into
shared static helpers:
- build_active_rig()        — assemble the full active-ragdoll node graph
- find_skeleton_owner() / find_descendant_of_type() — locate Skeleton3D / AnimationPlayer
- orbit_camera()           — the spherical-coords orbit math (pivot parameterized)
- add_debug_hud()          — instantiate + add the F3 StrengthDebugHUD (parent parameterized)

All 8 demos now call these instead of repeating ~30/15/10/5-line blocks each:
~490 fewer lines across demo/. The helper intentionally mirrors the DEMOS' wiring
(sets NodePaths, relies on controller defaults — no .configure(), no rig_sync_path),
which is distinct from test/helpers/rig_harness.gd; the two are kept separate.

Facade: KickbackCharacter.get_active_controller() returns the sibling
ActiveRagdollController (or null), making the README's active_controller.* pattern
first-class. signal_showcase and euphoria_showcase adopt it to drop their own
sibling-scan loops.

Validated: headless import clean; GUT 112/112; scene-smoke clean (exit 0,
0 errors) on all 8 demos.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@blugart-dev blugart-dev merged commit 6ede3da into main Jun 19, 2026
1 check passed
@blugart-dev blugart-dev deleted the refactor/demo-helpers branch June 19, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant