Skip to content

Commit

Permalink
rerun codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jul 3, 2023
1 parent 64e1ca0 commit 0fc2a9f
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 2 deletions.
13 changes: 13 additions & 0 deletions crates/re_types/definitions/rerun/archetypes/points2d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ namespace rerun.archetypes;
// TODO(#2521): always derive debug & clone for rust backend

/// A 2D point cloud with positions and optional colors, radii, labels, etc.
///
/// \py Example
/// \py -------
/// \py
/// \py ```python
/// \py include:../../../../../docs/code-examples/point2d_simple_v2.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs ```ignore
/// \rs include:../../../../../docs/code-examples/point2d_simple_v2.rs
/// \rs ```
table Points2D (
"attr.rust.derive": "Debug, Clone, PartialEq",
order: 100
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt
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.
2482cd3e136880416056a88c296bd419d5b01626d2db3914e5e375c614123bcc
3635c632f3859d33d5b8ad124e652bc8d647d7bf94b05b35e42488558f603b3e
30 changes: 30 additions & 0 deletions crates/re_types/src/archetypes/points2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,36 @@
#![allow(clippy::unnecessary_cast)]

#[doc = "A 2D point cloud with positions and optional colors, radii, labels, etc."]
#[doc = ""]
#[doc = "## Example"]
#[doc = ""]
#[doc = "```ignore"]
#[doc = "//! Log some very simple points."]
#[doc = ""]
#[doc = "use rerun::{"]
#[doc = " components::{Rect2D, Vec4D},"]
#[doc = " experimental::archetypes::Points2D,"]
#[doc = " MsgSender, RecordingStreamBuilder,"]
#[doc = "};"]
#[doc = ""]
#[doc = "fn main() -> Result<(), Box<dyn std::error::Error>> {"]
#[doc = " let (rec_stream, storage) = RecordingStreamBuilder::new(\"points\").memory()?;"]
#[doc = ""]
#[doc = " MsgSender::from_archetype(\"points\", &Points2D::new([(0.0, 0.0), (1.0, 1.0)]))?"]
#[doc = " .send(&rec_stream)?;"]
#[doc = ""]
#[doc = " // Log an extra rect to set the view bounds"]
#[doc = " MsgSender::new(\"bounds\")"]
#[doc = " .with_component(&[Rect2D::XCYCWH(Vec4D([0.0, 0.0, 4.0, 3.0]))])?"]
#[doc = " .send(&rec_stream)?;"]
#[doc = ""]
#[doc = " rec_stream.flush_blocking();"]
#[doc = ""]
#[doc = " rerun::native_viewer::show(storage.take())?;"]
#[doc = ""]
#[doc = " Ok(())"]
#[doc = "}"]
#[doc = "```"]
#[derive(Debug, Clone, PartialEq)]
pub struct Points2D {
#[doc = "All the actual 2D points that make up the point cloud."]
Expand Down
17 changes: 16 additions & 1 deletion rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,22 @@

@dataclass
class Points2D(Archetype):
"""A 2D point cloud with positions and optional colors, radii, labels, etc."""
"""
A 2D point cloud with positions and optional colors, radii, labels, etc.
Example
-------
```python
import rerun as rr
rr.init("points", spawn=True)
rr.log_any("simple", rr.Points2D([[0, 0], [1, 1]]))
# Log an extra rect to set the view bounds
rr.log_rect("bounds", [0, 0, 4, 3], rect_format=rr.RectFormat.XCYCWH)
```
"""

points: components.Point2DArray = field(metadata={"component": "primary"})
"""
Expand Down

0 comments on commit 0fc2a9f

Please sign in to comment.