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

Make rerun_demo default to the cube #1301

Merged
merged 2 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ jobs:
# If you change the line below you should almost definitely change the `key:` line above by giving it a new, unique name
run: |
pip install -r examples/python/colmap/requirements.txt
python examples/python/colmap/main.py --dataset colmap_fiat --resize 800x600 --save colmap_fiat.rrd
cp colmap_fiat.rrd rerun_py/rerun_sdk/rerun_demo/demo.rrd
python examples/python/colmap/main.py --dataset colmap_fiat --resize 800x600 --save colmap.rrd
cp colmap.rrd rerun_py/rerun_sdk/rerun_demo/colmap.rrd

- name: Build Wheel
uses: PyO3/maturin-action@v1
Expand Down
2 changes: 1 addition & 1 deletion rerun_py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ target-version = ["py38"]
# with the other `rerun` pypi package. The rerun_sdk.pth adds this to the pythonpath
# which then allows `import rerun` to work as expected.
# See https://github.com/rerun-io/rerun/pull/1085 for more details
include = ["rerun_sdk.pth", "rerun_sdk/rerun_demo/demo.rrd"]
include = ["rerun_sdk.pth", "rerun_sdk/rerun_demo/colmap.rrd"]
locked = true
python-packages = ["rerun_sdk/rerun", "rerun_sdk/rerun_demo"]
46 changes: 43 additions & 3 deletions rerun_py/rerun_sdk/rerun_demo/__main__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,62 @@
"""Demo program which loads an rrd file built into the package."""

import argparse
import pathlib
import sys

from rerun import bindings, unregister_shutdown # type: ignore[attr-defined]

def run_cube():
import rerun as rr

rr.init("Cube", spawn=True, default_enabled=True)
from rerun_demo.data import color_grid

rr.log_points("cube", positions=color_grid.positions, colors=color_grid.colors, radii=0.5)


def run_colmap():
from rerun import bindings, unregister_shutdown # type: ignore[attr-defined]

def main() -> None:
# We don't need to call shutdown in this case. Rust should be handling everything
unregister_shutdown()

rrd_file = pathlib.Path(__file__).parent.joinpath("demo.rrd").resolve()
rrd_file = pathlib.Path(__file__).parent.joinpath("colmap.rrd").resolve()
if not rrd_file.exists():
print("No demo file found at {}. Package was built without demo support".format(rrd_file), file=sys.stderr)
exit(1)
else:
exit(bindings.main([sys.argv[0], str(rrd_file)]))


def main() -> None:

parser = argparse.ArgumentParser(description="Run rerun example programs")

group = parser.add_mutually_exclusive_group()

group.add_argument(
"--cube",
action="store_true",
help="Run the color grid cube demo",
)

group.add_argument(
"--colmap",
action="store_true",
help="Run the COLMAP data demo",
)

args = parser.parse_args()

if not any([args.cube, args.colmap]):
args.cube = True

if args.cube:
run_cube()

elif args.colmap:
run_colmap()


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun_demo/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ColorGrid = namedtuple("ColorGrid", ["positions", "colors"])


def build_color_grid(x_count=6, y_count=6, z_count=6):
def build_color_grid(x_count=10, y_count=10, z_count=10):
"""
Create a cube of points with colors.

Expand Down
Binary file modified rerun_py/rerun_sdk/rerun_demo/demo.rrd
Binary file not shown.