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

provide empty() method on Rust archetype implementations to log empty #3279

Closed
Wumpf opened this issue Sep 11, 2023 · 5 comments
Closed

provide empty() method on Rust archetype implementations to log empty #3279

Wumpf opened this issue Sep 11, 2023 · 5 comments

Comments

@Wumpf
Copy link
Member

Wumpf commented Sep 11, 2023

It's cumbersome right now to log an empty set of things:

rec.log("rects_test/rects", &Boxes2D::new([HalfExtents2D; 0]))?;

this should be instead

rec.log("rects_test/rects", &Boxes2D::empty())?;
@nikolausWest
Copy link
Member

C++ and Python too?

@teh-cmc
Copy link
Member

teh-cmc commented Sep 12, 2023

@jleibs had an intesresting question:

Is this different from Clear?

The answer is yes for three reasons:

  1. clear() has optional recursiveness
  2. clear() has the out-of-order / pendingness thing (which I'm not sure I understand what that's expected to do anymore)
  3. and finally clear() doesnt stop at a specific archetype: if the entity has 10 archetypes logged, it clears all of them

@Wumpf
Copy link
Member Author

Wumpf commented Sep 12, 2023

In C++ and Python we have harder to avoid default construction which I think is more suited there for creating empty archetypes 🤔

@emilk
Copy link
Member

emilk commented Sep 19, 2023

We should make empty() set all the components to empty lists so that they overwrite everything. We should probably make the default constructor do the same.

@emilk
Copy link
Member

emilk commented Sep 20, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants