bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Send `SceneInstanceReady` only once per scene

Open daxpedda opened this issue 1 year ago • 8 comments
trafficstars

Objective

Send SceneInstanceReady only once per scene.

Solution

I assume that this was not intentional. So I just changed it to only be sent once per scene.


Changelog

Fixed

  • Fixed SceneInstanceReady being emitted for every Entity in a scene.

daxpedda avatar Dec 16 '23 18:12 daxpedda

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

github-actions[bot] avatar Dec 16 '23 18:12 github-actions[bot]

Did you notice receiving several times this event?

It should already be sent only once

mockersf avatar Dec 16 '23 22:12 mockersf

Yes, I received it multiple times, exactly as many times actually as I had entities in the scene.

I'm not familiar with Bevy's codebase, but from how I understand the code it seems obvious that it calls send_event() once per entity.

EDIT: I only tested in v0.12.1 actually, should I test it on main as well?

daxpedda avatar Dec 16 '23 22:12 daxpedda

I'm on main and seeing this event only once, but this code shouldn't have changed since the 0.12.1

Could you share the scene you're using? I tried with a few gltf files.

Your change should be OK, just trying to understand why you're having this issue here

mockersf avatar Dec 16 '23 23:12 mockersf

Could you share the scene you're using? I tried with a few gltf files.

I added a unit test. Without the change in this PR the unit test will fail.

daxpedda avatar Dec 17 '23 10:12 daxpedda

Rebased on main after #11003.

daxpedda avatar Dec 18 '23 08:12 daxpedda

nice test, thanks!

unlike scenes from gltfs, yours has two root entities, which explains what you're seeing 👍

mockersf avatar Dec 18 '23 22:12 mockersf

Rebased after cfcb6885e3b475a93ec0fe7e88023ac0f354bbbf.

daxpedda avatar Jan 06 '24 23:01 daxpedda