feat(player): instance nesting guard & audio event signal#200
Merged
Conversation
Add a cyclic/runaway-nesting guard for Instance parts: children now carry
parent depth + 1 and `_setup_instance_children` stops descending past
MAX_INSTANCE_DEPTH (16) with a warning, instead of recursing until the
stack overflows on a cyclic (A -> B -> A) .ssab. Mirrors the Unity
player's MaxInstanceDepth.
Implement audio event delivery: fill the `// TODO: Audio integration`
path to emit a new `audio` signal (Dictionary payload: part_index,
sound_list_name_hash, sound_name_hash, sound_name, loop_num), following
the existing user_data/signal_emitted pattern. Playback is left to the
game side. Documents the signal in docs/{ja,en}/api/player.md.
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.
概要
プレーヤの細かな改善2点。SSPlayerForUnity との実装比較で見つかった Godot 側のギャップを埋めます。
変更内容
#1 インスタンスのネスト深さガード(堅牢性)
循環参照(A → B → A)や過剰なネストを持つ
.ssabを読み込むと、_setup_instance_childrenがスタックオーバーフローでクラッシュするまで再帰していました(コードにも "recurse until stack overflow" と明記されていた既知の穴)。_instance_depth)を持たせ、MAX_INSTANCE_DEPTH(16)を超えたら警告を出してスキップするように変更。MaxInstanceDepth = 16と挙動を揃えています。#3 オーディオイベントの配信(機能追加)
ss_internal_player.cppに// TODO: Audio integrationとして未実装だったオーディオイベントを実装。user_data/signal_emittedと同じパターンで、新規audioシグナルを発行。Dictionary):part_index/sound_list_name_hash/sound_name_hash/sound_name/loop_num。AudioStreamPlayer等へ橋渡しする設計(ドキュメントに明記)。docs/{ja,en}/api/player.mdにシグナルと payload を追記。検証
build-extension.ps1)。備考
比較検討の過程で挙がった set_animation の設定リセット(#2)と pause の冪等性(#4)は、Godot 側は現状の仕様が正であり対応不要と判断しました(#2/#4 は SSPlayerForUnity 側を Godot に合わせる方針)。