Skip to content

Keep layered portrait preview bounds finite - #2826

Open
upalvstavai wants to merge 1 commit into
dialogic-godot:mainfrom
upalvstavai:codex/fix-layered-portrait-preview
Open

upalvstavai wants to merge 1 commit into
dialogic-godot:mainfrom
upalvstavai:codex/fix-layered-portrait-preview

Conversation

@upalvstavai

Copy link
Copy Markdown

Fixes #2822.

Layered portrait coverage was calculated from global_position values. During an editor preview rebuild those global transforms can temporarily be invalid, especially after switching through an empty portrait, so subtracting them propagated inf/NaN into the preview rectangle.

This computes each sprite's transform relative to the portrait root from local transforms instead. It does not depend on the root's global transform being ready, and it also measures all four transformed corners so nested, scaled, rotated, and mirrored layers remain covered correctly.

Added focused GdUnit coverage for:

  • a portrait root with an invalid (inf, inf) preview position and a nested sprite;
  • a scaled and rotated sprite, verifying the resulting bounds.

Validation:

Godot --headless --path . -s res://addons/gdUnit4/bin/GdUnitCmdTool.gd -a res://Tests/Unit/layered_portrait_coverage_test.gd --ignoreHeadlessMode

Result: 2 test cases, 0 errors, 0 failures, 0 orphans.

The macOS sandbox emitted the repository-documented system certificate warning and could not create user://logs; neither affected the test result. Native Windows editor verification is still appropriate for the original Windows-only interaction sequence.

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.

[Bug] Empty Portrait Position Inheritance (Godot 4.7.2, Dialogic 2.0 Alpha 20)

1 participant