Skip to content

fix: drive Instance parts nested inside Instance parts (SDK bump) - #304

Merged
Naruto merged 4 commits into
developfrom
feature/fix_instance
Sep 9, 2026
Merged

fix: drive Instance parts nested inside Instance parts (SDK bump)#304
Naruto merged 4 commits into
developfrom
feature/fix_instance

Conversation

@Naruto

@Naruto Naruto commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

What

An Instance inside an Instance never advanced. _update_instance_children — the
sim phase — was reached only from _seek_and_redraw, and a parent-driven child
never enters it: update() returns early on _parent_driven, and the child's
draw arrives straight from _redraw_child_if_frame_changed. So everything below
the first level held the frame _fetchAnimation's one-off setup left it at,
however far the animation ran.

Also bumps SpriteStudio-SDK to the landed
cri-middleware/SpriteStudio-SDK#399, which fixes an Instance key with a
startOffset losing the tail of its sub-animation.

Player-facing effect

  • Nested sub-animations play. A project whose Instance parts reference packs
    that themselves hold Instance parts (an Adobe Animate conversion typically
    nests three or four deep) previously showed those inner parts frozen on their
    setup frame. They now step with their parent.
  • A phase-offset Instance runs its whole cycle. With the SDK change, a key
    carrying startOffset keeps its section instead of collapsing to two frames —
    a walk cycle whose second leg is half a cycle out of phase walks instead of
    vibrating in place.
  • Clipping carried out of a nested Instance reaches the right parts, because
    the carry-over flag (visible_this_frame) is now settled before the child
    draws.

Changes

  • ss_player/ss_internal_player.cpp
    • _drive_instance_slot recurses into child->_update_instance_children
      ahead of the child's draw.
    • Hiding an Instance child moves out of the sim phase and into
      _drawAnimation, beside the Effect emitter canvas items. The draw is what
      re-shows them, and a player holding a frame does not redraw — hiding in the
      sim phase stranded the children of every held frame with nothing to switch
      them back on. That surfaced as a sub-animation blanking out whenever a seek
      landed on a fractional frame with sub-frames off, which the Godot editor's
      seek bar produces.
  • ss_player/SpriteStudio-SDK — submodule bump to the merged #399.

Verification

  • scripts/run-tests.sh — 35 cases, 101 assertions, 0 failed, 0 skipped, on the
    GDExtension build.
  • Both builds compile: scripts/build.sh (custom module) and
    scripts/build-extension.sh.
  • Rendered before/after on an instance-heavy Adobe Animate conversion: identical
    frames differ where the nested instances now advance, and with sub-frames off
    a fractional seek renders byte-identical to its integer frame
    (24.0 / 24.25 / 24.5 / 24.75 one hash; 269.5 = 269.0, 270.5 = 270.0,
    271.5 = 271.0, 430.5 = 430.0). With sub-frames on, fractional frames
    interpolate as before.
  • Stage boundaries still swap cleanly — one Instance visible at a time, no
    ghosting.

Known limit, not addressed here

_needs_continuous_update() looks one level down, so an independent Instance
nested two or more levels deep loses the ticks where the root holds its frame
and runs slow. Nothing in the corpus to hand carries one — every Instance key
across the projects checked is synced — so it is left until an asset shows it.

`_update_instance_children` is the sim phase, and it ran only from
`_seek_and_redraw`, which a parent-driven child never enters. Instance
parts below the first level therefore held the frame the setup pass left
them at. `_drive_instance_slot` now recurses into the child ahead of its
draw, so the whole reference graph steps and the clipping carry-over
(`visible_this_frame`) is settled before the child builds.

Hiding an Instance child moves with it, out of the sim phase and into
`_drawAnimation`, alongside the Effect emitter canvas items: the draw is
what re-shows them, and a player holding a frame does not redraw, so
hiding in the sim phase left the children of every held frame with
nothing to switch them back on. That surfaced as a sub-animation blanking
out whenever a seek landed on a fractional frame with sub-frames off.
@Naruto
Naruto merged commit c110e43 into develop Sep 9, 2026
0 of 2 checks passed
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