Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash during scene transition due to invalid camera #1676

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

rh101
Copy link
Contributor

@rh101 rh101 commented Feb 13, 2024

Scene can now be visited correctly with valid cameras being set for child nodes when rendering outside of normal render loop.

Which branch your pull-request should merge into?

  • 2.1: BugFixes and Improvements for Current LTS branch

Describe your changes

Currently Scene::visit() is only used to draw a scene when rendering to a RenderTexture. The issue with this is that there is no valid camera set for use by the child nodes, so if they access the camera during a call to Node::visit(...), a crash will occur. An example is FastTMXLayer::draw accessing the camera.

The fix in this PR allows the Scene to override visit(), and ensure that the camera is set correctly for all child nodes in that scene.

Scene::visit() is only ever called when attempting to render to a RenderTexture, so the changes in this PR should have no impact on any other functionality in Axmol.

Issue ticket number and link

Crash issue is described in #1663

Checklist before requesting a review

For each PR

  • Add Copyright if it missed:
    - "Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md)."

  • I have performed a self-review of my code.

    Optional:

    • I have checked readme and add important infos to this PR.
    • I have added/adapted some tests too.

For core/new feature PR

  • I have checked readme and add important infos to this PR.
  • I have added thorough tests.

Scene can now be visited correctly with valid cameras being set for child nodes when rendering outside of normal render loop.
@halx99 halx99 merged commit 9899a97 into axmolengine:2.1 Feb 13, 2024
8 checks passed
@halx99 halx99 added this to the 2.1.2 milestone Feb 13, 2024
@halx99 halx99 added the bug Something isn't working label Feb 13, 2024
@rh101 rh101 deleted the transition-crash-fix branch February 13, 2024 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants