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

Move "is_initialized" flag for 3D scene from server to client #3452

Merged
merged 6 commits into from
Aug 16, 2024

Conversation

afullerx
Copy link
Contributor

@afullerx afullerx commented Aug 7, 2024

This PR resolves #3339 by moving the existing is_initialized flag from scene.py into scene.js. This way, each client maintains its own copy. 

I also removed is_initialized from scene_view.py. It looks like it was copied over from scene.py, but didn't serve any purpose since there are no methods for creating objects. 

@afullerx afullerx changed the title Move "is_initialized" flag from server to client Move "is_initialized" flag for 3D scene from server to client Aug 7, 2024
@falkoschindler
Copy link
Contributor

Thanks for the pull request, @afullerx!

Moving the is_initialized flag to the client is probably a good idea.
But if I understand correctly, you changed the behavior from "not running any methods before initialization" to "not creating objects before initialization". I'm not sure if this is a valid simplification or if it can break something else. I haven't yet come up with a counterexample though. 🤔

@falkoschindler falkoschindler self-requested a review August 15, 2024 19:49
@falkoschindler falkoschindler added this to the 1.4.36 milestone Aug 15, 2024
@falkoschindler falkoschindler added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Aug 15, 2024
@afullerx
Copy link
Contributor Author

I considered this, but decided it was OK since most of the methods begin with if (!this.objects.has(object_id)) return. So, they are effectively prevented from running until the scene is initialized. The only two exceptions are move_camera() and resize(). I assumed this is because they can run at any time, since they only affect the view of the scene and aren't dependent on its contents.

Copy link
Contributor

@falkoschindler falkoschindler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense. 👍🏻

@falkoschindler falkoschindler merged commit 7081253 into zauberzeug:main Aug 16, 2024
1 check passed
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.

3D objects get stuck in scene when reloading.
2 participants