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

Introduce API for setting view defaults from python #6545

Merged
merged 4 commits into from
Jun 12, 2024

Conversation

jleibs
Copy link
Member

@jleibs jleibs commented Jun 12, 2024

What

Just a bit of plumbing to write all the provided defaults to the correct location in the blueprint.

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!

To run all checks from main, comment on the PR with @rerun-bot full-check.

@jleibs jleibs added 🟦 blueprint The data that defines our UI 🐍 Python API Python logging API exclude from changelog PRs with this won't show up in CHANGELOG.md do-not-merge Do not merge this PR labels Jun 12, 2024
@jleibs jleibs marked this pull request as ready for review June 12, 2024 00:08
@Wumpf Wumpf self-requested a review June 12, 2024 08:08
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love how little code this last bit now is to wire things up!

Comment on lines +115 to +117
"List of default components or component batches to add to the space view. When an archetype
in the view is missing a component included in this set, the value of default will be used
instead of the normal fallback for the visualizer.".to_owned(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we handling batches for default correctly already? The way things are set up I expect it to just work but did you get around to testing that?
E.g. setting several colors for color default

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested -- works perfectly.

import rerun as rr
import rerun.blueprint as rrb
from numpy.random import default_rng

rr.init("rerun_example_points3d_random", spawn=True)
rng = default_rng(12345)

positions = rng.uniform(-5, 5, size=[10, 3])
colors = rng.uniform(0, 255, size=[10, 3])
radii = rng.uniform(0, 1, size=[10])

rr.send_blueprint(
    rrb.Vertical(
        rrb.Spatial3DView(defaults=[rr.components.Color([255, 255, 0])]),
        rrb.Spatial3DView(defaults=[rr.components.ColorBatch(colors)]),
    )
)

rr.log("random", rr.Points3D(positions, radii=radii))

Base automatically changed from jleibs/python_component_mixin to main June 12, 2024 17:17
@jleibs jleibs removed the do-not-merge Do not merge this PR label Jun 12, 2024
@jleibs jleibs force-pushed the jleibs/python_defaults branch from 5079e17 to 5a963a7 Compare June 12, 2024 17:19
@jleibs jleibs merged commit 3010d2f into main Jun 12, 2024
34 of 35 checks passed
@jleibs jleibs deleted the jleibs/python_defaults branch June 12, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🟦 blueprint The data that defines our UI exclude from changelog PRs with this won't show up in CHANGELOG.md 🐍 Python API Python logging API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python (blueprint) API for setting component defaults
2 participants