-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This semantically mimics very closely the way things are done in Rust, minus all technical differences due to the differences between both the languages and the SDKs. For that reason, everything stated in #8304 (comment) basically applies as-is. Pretty happy about it, I must say. * DNM: requires #8316 * Part of #7948
- Loading branch information
Showing
148 changed files
with
647 additions
and
242 deletions.
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,12 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from __future__ import annotations | ||
|
||
import rerun as rr # pip install rerun-sdk | ||
|
||
rr.init("rerun_example_descriptors_builtin_archetype") | ||
rr.spawn() | ||
|
||
rr.log("data", rr.Points3D([[1, 2, 3]], radii=[0.3, 0.2, 0.1]), static=True) | ||
|
||
# The tags are indirectly checked by the Rust version (have a look over there for more info). |
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,12 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from __future__ import annotations | ||
|
||
import rerun as rr # pip install rerun-sdk | ||
|
||
rr.init("rerun_example_descriptors_builtin_component") | ||
rr.spawn() | ||
|
||
rr.log("data", [rr.components.Position3DBatch([1, 2, 3])], static=True) | ||
|
||
# The tags are indirectly checked by the Rust version (have a look over there for more info). |
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,59 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Iterable | ||
|
||
import numpy.typing as npt | ||
import pyarrow as pa | ||
import rerun as rr # pip install rerun-sdk | ||
|
||
|
||
class CustomPosition3DBatch(rr.ComponentBatchLike): | ||
def __init__(self: Any, positions: npt.ArrayLike) -> None: | ||
self.position = rr.components.Position3DBatch(positions) | ||
|
||
def component_descriptor(self) -> rr.ComponentDescriptor: | ||
return rr.ComponentDescriptor( | ||
"user.CustomPosition3D", | ||
archetype_name="user.CustomPoints3D", | ||
archetype_field_name="custom_positions", | ||
) | ||
|
||
def as_arrow_array(self) -> pa.Array: | ||
return self.position.as_arrow_array() | ||
|
||
|
||
class CustomPoints3D(rr.AsComponents): | ||
def __init__(self: Any, positions: npt.ArrayLike, colors: npt.ArrayLike) -> None: | ||
self.positions = CustomPosition3DBatch(positions) | ||
self.colors = rr.components.ColorBatch(colors) | ||
|
||
def as_component_batches(self) -> Iterable[rr.ComponentBatchLike]: | ||
return ( | ||
[rr.IndicatorComponentBatch("user.CustomPoints3D")] | ||
+ [ | ||
rr.DescribedComponentBatch( | ||
self.positions, | ||
self.positions.component_descriptor().or_with_overrides( | ||
archetype_name="user.CustomPoints3D", archetype_field_name="custom_positions" | ||
), | ||
) | ||
] | ||
+ [ | ||
rr.DescribedComponentBatch( | ||
self.colors, | ||
self.colors.component_descriptor().or_with_overrides( | ||
archetype_name="user.CustomPoints3D", archetype_field_name="colors" | ||
), | ||
) | ||
] | ||
) | ||
|
||
|
||
rr.init("rerun_example_descriptors_custom_archetype") | ||
rr.spawn() | ||
|
||
rr.log("data", CustomPoints3D([[1, 2, 3]], [0xFF00FFFF]), static=True) | ||
|
||
# The tags are indirectly checked by the Rust version (have a look over there for more info). |
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,32 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
import numpy.typing as npt | ||
import pyarrow as pa | ||
import rerun as rr # pip install rerun-sdk | ||
|
||
|
||
class CustomPosition3DBatch(rr.ComponentBatchLike): | ||
def __init__(self: Any, positions: npt.ArrayLike) -> None: | ||
self.position = rr.components.Position3DBatch(positions) | ||
|
||
def component_descriptor(self) -> rr.ComponentDescriptor: | ||
return rr.ComponentDescriptor( | ||
"user.CustomPosition3D", | ||
archetype_name="user.CustomArchetype", | ||
archetype_field_name="custom_positions", | ||
) | ||
|
||
def as_arrow_array(self) -> pa.Array: | ||
return self.position.as_arrow_array() | ||
|
||
|
||
rr.init("rerun_example_descriptors_custom_component") | ||
rr.spawn() | ||
|
||
rr.log("data", [CustomPosition3DBatch([[1, 2, 3]])], static=True) | ||
|
||
# The tags are indirectly checked by the Rust version (have a look over there for more info). |
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
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
Oops, something went wrong.