refactor: extract demo wiring into demo_helpers.gd + add get_active_controller facade#82
Merged
Merged
Conversation
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.gdCollects 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 theSkeleton3D/AnimationPlayerorbit_camera()— the spherical-coords orbit math (pivot parameterized for world vs character-relative)add_debug_hud()— instantiate + add the F3StrengthDebugHUD(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(), norig_sync_path), which is distinct fromtest/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 siblingActiveRagdollController(or null), making the README'sactive_controller.*advanced-query pattern (balance / fatigue / pain / hit-streak / injuries) first-class.signal_showcaseandeuphoria_showcaseadopt it to drop their own sibling-scan loops.Validation
--quit-after 150): clean (exit 0, 0 errors) on all 8 demosThis 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.mdlike the other gate PRs — expect a trivial conflict with PR #79/#80/#81 (keep all bullets).🤖 Generated with Claude Code