-
Notifications
You must be signed in to change notification settings - Fork 376
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
Codegen/IDL 4: definitions for a Points2D
archetype
#2370
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9ee0c9d
more build tools
teh-cmc b4a81ce
self-review
teh-cmc 70b3e79
addressing PR comments
teh-cmc 276abfd
introduce re_types_builder
teh-cmc bb935f0
generate reflection code
teh-cmc a48fbc7
unindent 0.1 everywhere
teh-cmc 82aa0a6
self-review
teh-cmc db70758
adhering to py38+ style guide
teh-cmc 9897be8
vscode flatbuffer things. Fix comment typo
Wumpf 917c36d
turn the inner from_similar into _from_similar to appease linters
teh-cmc 0295e70
generate __all__ everywhere to make python tools behave
teh-cmc 0165e39
make sure __all__ manifests are lexically sorted
teh-cmc fe5c3e6
adressing PR comments
teh-cmc 3f5b2c5
introduce re_types
teh-cmc 553810c
self-review
teh-cmc e076521
python shall output to rerun_py/rerun_sdk/rerun2
teh-cmc b8920e4
addressing PR comments
teh-cmc 0d447c8
Rerun attributes' definitions
teh-cmc 5ad957a
Rerun datatypes' definitions
teh-cmc 108c55d
Rerun components' definitions
teh-cmc cf98cd1
Rerun archetypes' definitions
teh-cmc a55ea2e
fixing typo in re_types_builder doc
teh-cmc fd1495b
self-review
teh-cmc f6d048f
fix DrawOrder missing PartialEq & PartialOrd
teh-cmc 68a5b06
addressing PR comments
teh-cmc 7683212
git completely losing it
teh-cmc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
include "fbs/attributes.fbs"; | ||
|
||
include "rerun/datatypes.fbs"; | ||
include "rerun/components.fbs"; | ||
|
||
namespace rerun.archetypes; | ||
|
||
// --- | ||
|
||
// TODO(#2371): archetype IDL definitions must always be tables | ||
// TODO(#2372): archetype IDL definitions must refer to objects of kind component | ||
// TODO(#2373): `attr.rerun.component_required` implies `required` | ||
|
||
/// A 2D point cloud with positions and optional colors, radii, labels, etc. | ||
table Points2D ( | ||
"attr.rust.derive": "Debug, Clone, PartialEq", | ||
order: 100 | ||
) { | ||
// --- Required --- | ||
|
||
/// All the actual 2D points that make up the point cloud. | ||
points: [rerun.components.Point2D] ("attr.rerun.component_required", required, order: 1000); | ||
|
||
// --- Recommended --- | ||
|
||
/// Optional radii for the points, effectively turning them into circles. | ||
radii: [rerun.components.Radius] ("attr.rerun.component_recommended", order: 2000); | ||
|
||
/// Optional colors for the points. | ||
/// | ||
/// \python The colors are interpreted as RGB or RGBA in sRGB gamma-space, | ||
/// \python As either 0-1 floats or 0-255 integers, with separate alpha. | ||
colors: [rerun.components.Color] ("attr.rerun.component_recommended", order: 2100); | ||
|
||
// --- Optional --- | ||
|
||
/// Optional text labels for the points. | ||
labels: [rerun.components.Label] ("attr.rerun.component_optional", order: 3000); | ||
|
||
/// An optional floating point value that specifies the 2D drawing order. | ||
/// Objects with higher values are drawn on top of those with lower values. | ||
/// | ||
/// The default for 2D points is 30.0. | ||
draw_order: rerun.components.DrawOrder ("attr.rerun.component_optional", order: 3100); | ||
|
||
/// Optional class Ids for the points. | ||
/// | ||
/// The class ID provides colors and labels if not specified explicitly. | ||
class_ids: [rerun.components.ClassId] ("attr.rerun.component_optional", order: 3200); | ||
|
||
/// Optional keypoint IDs for the points, identifying them within a class. | ||
/// | ||
/// If keypoint IDs are passed in but no class IDs were specified, the class ID will | ||
/// default to 0. | ||
/// This is useful to identify points within a single classification (which is identified | ||
/// with `class_id`). | ||
/// E.g. the classification might be 'Person' and the keypoints refer to joints on a | ||
/// detected skeleton. | ||
keypoint_ids: [rerun.components.KeypointId] ("attr.rerun.component_optional", order: 3300); | ||
|
||
/// Unique identifiers for each individual point in the batch. | ||
instance_keys: [rerun.components.InstanceKey] ("attr.rerun.component_optional", order: 3400); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace rerun.attributes; | ||
|
||
/// Marks a component as required, which is likely to impact the generated code in | ||
/// backend-specific ways. | ||
/// | ||
/// Only applies to the fields of an archetype. | ||
attribute "attr.rerun.component_required"; | ||
|
||
/// Marks a component as recommended, which is likely to impact the generated code in | ||
/// backend-specific ways. | ||
/// | ||
/// Only applies to the fields of an archetype. | ||
attribute "attr.rerun.component_recommended"; | ||
|
||
/// Marks a component as optional, which is likely to impact the generated code in | ||
/// backend-specific ways. | ||
/// | ||
/// Only applies to the fields of an archetype. | ||
attribute "attr.rerun.component_optional"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
include "./components/class_id.fbs"; | ||
include "./components/color.fbs"; | ||
include "./components/draw_order.fbs"; | ||
include "./components/instance_key.fbs"; | ||
include "./components/keypoint_id.fbs"; | ||
include "./components/label.fbs"; | ||
include "./components/point2d.fbs"; | ||
include "./components/radius.fbs"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
include "arrow/attributes.fbs"; | ||
include "python/attributes.fbs"; | ||
include "rust/attributes.fbs"; | ||
|
||
include "rerun/attributes.fbs"; | ||
|
||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// A 16-bit ID representing a type of semantic class. | ||
/// | ||
/// \rs Used to look up a `crate::components::ClassDescription` within the `crate::components::AnnotationContext`. | ||
struct ClassId ( | ||
"attr.arrow.transparent", | ||
"attr.python.aliases": "float", | ||
"attr.python.array_aliases": "npt.NDArray[np.uint8], npt.NDArray[np.uint16], npt.NDArray[np.uint32]", | ||
"attr.rust.derive": "Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash", | ||
"attr.rust.tuple_struct", | ||
order: 100 | ||
) { | ||
id: ushort; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
include "arrow/attributes.fbs"; | ||
include "python/attributes.fbs"; | ||
include "rust/attributes.fbs"; | ||
|
||
include "rerun/attributes.fbs"; | ||
include "rerun/datatypes.fbs"; | ||
|
||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// An RGBA color tuple with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. | ||
struct Color ( | ||
"attr.arrow.transparent", | ||
"attr.python.aliases": "Sequence[int], Sequence[float], npt.NDArray[np.uint8], npt.NDArray[np.float32], npt.NDArray[np.float64]", | ||
"attr.python.array_aliases": "Sequence[int], Sequence[float], npt.NDArray[np.uint8], npt.NDArray[np.float32], npt.NDArray[np.float64]", | ||
"attr.rust.derive": "Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, bytemuck::Pod, bytemuck::Zeroable", | ||
"attr.rust.repr": "transparent", | ||
"attr.rust.tuple_struct", | ||
order: 100 | ||
) { | ||
rgba: uint; | ||
} |
29 changes: 29 additions & 0 deletions
29
crates/re_types/definitions/rerun/components/draw_order.fbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
include "arrow/attributes.fbs"; | ||
include "python/attributes.fbs"; | ||
include "rust/attributes.fbs"; | ||
|
||
include "rerun/datatypes.fbs"; | ||
include "rerun/attributes.fbs"; | ||
|
||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// Draw order used for the display order of 2D elements. | ||
/// | ||
/// Higher values are drawn on top of lower values. | ||
/// An entity can have only a single draw order component. | ||
/// Within an entity draw order is governed by the order of the components. | ||
/// | ||
/// Draw order for entities with the same draw order is generally undefined. | ||
struct DrawOrder ( | ||
"attr.arrow.transparent", | ||
"attr.python.aliases": "float", | ||
"attr.python.array_aliases": "npt.NDArray[np.float32]", | ||
"attr.rust.derive": "Debug, Clone, Copy, PartialEq, PartialOrd", | ||
"attr.rust.repr": "transparent", | ||
"attr.rust.tuple_struct", | ||
order: 100 | ||
) { | ||
value: float; | ||
} |
22 changes: 22 additions & 0 deletions
22
crates/re_types/definitions/rerun/components/instance_key.fbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
include "arrow/attributes.fbs"; | ||
include "python/attributes.fbs"; | ||
include "rust/attributes.fbs"; | ||
|
||
include "rerun/datatypes.fbs"; | ||
include "rerun/attributes.fbs"; | ||
|
||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// A unique numeric identifier for each individual instance within a batch. | ||
struct InstanceKey ( | ||
"attr.arrow.transparent", | ||
"attr.python.aliases": "int", | ||
"attr.python.array_aliases": "npt.NDArray[np.uint64]", | ||
"attr.rust.tuple_struct", | ||
"attr.rust.derive": "Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord", | ||
order: 100 | ||
) { | ||
value: uint64; | ||
} |
30 changes: 30 additions & 0 deletions
30
crates/re_types/definitions/rerun/components/keypoint_id.fbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
include "arrow/attributes.fbs"; | ||
include "python/attributes.fbs"; | ||
include "rust/attributes.fbs"; | ||
|
||
include "rerun/attributes.fbs"; | ||
|
||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// A 16-bit ID representing a type of semantic keypoint within a class. | ||
/// | ||
/// \py `KeypointId`s are only meaningful within the context of a [`rerun.components.ClassDescription`][]. | ||
/// \py | ||
/// \py Used to look up an [`rerun.components.AnnotationInfo`][] for a Keypoint within the | ||
/// \py [`rerun.components.AnnotationContext`]. | ||
/// | ||
/// \rs `KeypointId`s are only meaningful within the context of a `crate::components::ClassDescription`. | ||
/// \rs | ||
/// \rs Used to look up an `crate::components::AnnotationInfo` for a Keypoint within the `crate::components::AnnotationContext`. | ||
struct KeypointId ( | ||
"attr.arrow.transparent", | ||
"attr.python.aliases": "float", | ||
"attr.python.array_aliases": "npt.NDArray[np.uint8], npt.NDArray[np.uint16], npt.NDArray[np.uint32]", | ||
"attr.rust.derive": "Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash", | ||
"attr.rust.tuple_struct", | ||
order: 200 | ||
) { | ||
id: ushort; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
include "arrow/attributes.fbs"; | ||
include "python/attributes.fbs"; | ||
include "rust/attributes.fbs"; | ||
|
||
include "rerun/datatypes.fbs"; | ||
include "rerun/attributes.fbs"; | ||
|
||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// A String label component. | ||
table Label ( | ||
"attr.arrow.transparent", | ||
"attr.python.aliases": "str", | ||
"attr.rust.derive": "Debug, Clone, PartialEq, Eq, PartialOrd, Ord", | ||
"attr.rust.repr": "transparent", | ||
"attr.rust.tuple_struct", | ||
order: 100 | ||
) { | ||
value: string (required, order: 100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
include "arrow/attributes.fbs"; | ||
include "python/attributes.fbs"; | ||
include "rust/attributes.fbs"; | ||
|
||
include "rerun/datatypes.fbs"; | ||
include "rerun/attributes.fbs"; | ||
|
||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// A point in 2D space. | ||
struct Point2D ( | ||
"attr.arrow.transparent", | ||
"attr.python.aliases": "npt.NDArray[np.float32], Sequence[float], Tuple[float, float]", | ||
"attr.python.array_aliases": "npt.NDArray[np.float32], Sequence[float]", | ||
"attr.rust.tuple_struct", | ||
"attr.rust.derive": "Debug, Default, Clone, Copy, PartialEq, PartialOrd", | ||
order: 100 | ||
) { | ||
position: rerun.datatypes.Vec2D ( | ||
"attr.python.transparent", | ||
order: 100 | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
include "arrow/attributes.fbs"; | ||
include "python/attributes.fbs"; | ||
include "rust/attributes.fbs"; | ||
|
||
include "rerun/datatypes.fbs"; | ||
include "rerun/attributes.fbs"; | ||
|
||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// A Radius component. | ||
struct Radius ( | ||
"attr.arrow.transparent", | ||
"attr.python.aliases": "float", | ||
"attr.python.array_aliases": "npt.NDArray[np.float32]", | ||
"attr.rust.tuple_struct", | ||
"attr.rust.derive": "Debug, Clone, Copy, PartialEq, PartialOrd", | ||
order: 100 | ||
) { | ||
value: float; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include "./datatypes/vec2d.fbs"; | ||
|
||
namespace rerun.datatypes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
include "arrow/attributes.fbs"; | ||
include "fbs/attributes.fbs"; | ||
include "rust/attributes.fbs"; | ||
|
||
namespace rerun.datatypes; | ||
|
||
// --- | ||
|
||
/// A vector in 2D space. | ||
struct Vec2D ( | ||
"attr.arrow.transparent", | ||
"attr.rust.derive": "Debug, Default, Clone, Copy, PartialEq, PartialOrd", | ||
"attr.rust.tuple_struct", | ||
order: 100 | ||
) { | ||
xy: [float: 2]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# This is a sha256 hash for all direct and indirect dependencies of this crate's build script. | ||
# It can be safely removed at anytime to force the build script to run again. | ||
# Check out build.rs to see how it's computed. | ||
dae77f291d1698807cd865265cbb77731bd1aedf07c0968a6b0ac67c18f94590 | ||
95c13226f31d47e4639e155fc80ee6830579c50e38ee1d997b4bda4d23ba03b6 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future work: move over all the constants for default draw order :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahead of you on this one 😎: