-
Notifications
You must be signed in to change notification settings - Fork 373
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
Implement AsComponents
for tuples.
#4627
Conversation
This allows preparing a set of multiple existing bundles/archetypes (e.g. `Transform3D` plus something else) before logging them all at the same entity path, rather than having to write multiple `RecordingStream::log()` calls or creating a custom bundle.
Nice idea! Note that what you are after is very similar to |
That's good to know. I think it's still worth doing this, since Do you have any advice on where to put, and how to structure, tests for this code? |
My 2 cents: exposing a generic N-tuple implementation for this is very footgun-ny: it's very common for different archetypes to share a subset of underlying components, and with this implementation they would either silently overwrite each other or dynamically fail at runtime depending on the data. You could log each tuple entry in its own row, and then you might get away with it because of how the query model works deep down, but 1) that's really playing with fire and 2) that's obfuscating the fact that you logged N events rather than 1. Since the case of |
Yes, and that's an existing problem this isn't making worse, or so I thought …
… but I wasn't aware that Transform3D was that exceptional. In that case, I agree that this is not a good design. I wish the API documentation more explicitly called out that it is not expected for logging multiple archetypes to work other than that specific case. I'll think about what, if any, more narrow change would be suitable here. |
Further observation: |
This has been lingering for a while now! I'm interpreting @teh-cmc 's concern on n-tuple impls as a veto and leave it at that.
correct! The more accurate statement is that any combination of archetype of non-overlapping components makes sense. Archetypes in Rerun are really just a vehicle of grouping components, in the end it's all about what components are logged and what matches the viewer can derive from that. Additionally, archetypes also log a marker component that the viewer uses to decide what visualizers to active; right now this is fairly opaque and can't be configured much, but we're getting closer to making this transparent and configurable. |
What
This allows preparing a set of multiple archetypes (e.g.
Transform3D
plus something else) before logging them all at the same entity path, rather than having to write multipleRecordingStream::log()
calls.However, this PR contains no tests yet, because I wasn't sure where to put them or in what form to write them. Ideally, I'd like to write a test that validates that
stream.log(path, (a, b))
produces the same data asstream.log(path, a); stream.log(path, b)
, but I'm unclear on where to place a test of that type. There don't seem to be existing tests that are at a sufficiently high layer (containsRecordingStream
) but which aren't example-application-shaped.Checklist
I've included a screenshot or gif(not applicable)I have tested the web demo(not applicable)