Skip to content

Consistent constructor naming of Asset3D across C++ and Rust #9239

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

Merged
merged 13 commits into from
Mar 31, 2025

Conversation

abhishek47kashyap
Copy link
Contributor

@abhishek47kashyap abhishek47kashyap commented Mar 9, 2025

Related

Addresses #6881.

What

Deprecates existing constructor naming of Asset3D in favor of new names.

  • C++: from_file() to from_file_path() and from_bytes() to from_file_contents()
  • Rust: from_file() to from_file_path()

Passes

  • pixi run -e cpp cpp-test

Fails:

  • cargo test --all-targets --all-features: stems from re_chunk/tests/memory_test.rs and fails on the main branch as well
failures:
    concat_single_is_noop
    filter_does_allocate
    filter_empty_or_full_is_noop
    take_does_not_allocate
    take_empty_or_full_is_noop
  • pixi run fast-lint: There are some warnings but the main error is from asset3d.hpp : out of sync which I'm not entirely sure how to fix

Copy link
Member

@abey79 abey79 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

Let's start with the more obvious/simple stuff:

  • If you haven't done so, you'll need to install pixi and set it to version 0.41.4 using pixi self-update --version 0.41.4
  • When changing things in the SDKs, you always need to run the codegen to update auto-generated files. This is done with pixi run codegen.
  • You need to auto-format C++ code using pixi run cpp-fmt (when asked, use the cpp environment).
  • Please add a note in migration-0-23.md about the deprecated methods.

@abhishek47kashyap
Copy link
Contributor Author

Thanks for the feedback.

  • My pixi version is 0.41.4.
  • On running pixi run codegen, it said Returning early: no changes detected (and --force wasn't set), so I decided to set the force flag to observe the difference and found that my changes to asset3d.hpp (which this PR introduces) were reversed. Does this mean I modified the generated code but not the generating/"source" code?
  • I ran pixi run cpp-fmt and the changes are in commit 5242f67. However pixi run fast-lint still fails with asset3d.hpp : out of sync.
  • Have updated migration-0-23.md (had to resolve a merge conflict because my fork had fallen behind).

@abhishek47kashyap
Copy link
Contributor Author

@abey79 thought I'd ping on how best to move this PR forward 🙂

Copy link
Member

@abey79 abey79 left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. Your latest changes look good, thanks! I've updated to latest main and run codger (make sure to pull these commits!).

Could you also update all snippets (in docs/snippets/all) and examples (in examples/cpp and examples/rust) to use the new API?

@abey79
Copy link
Member

abey79 commented Mar 24, 2025

Also, apparently there are build errors. You might want to run pixi run -e cpp cpp-build-all and fix any error.

@abhishek47kashyap
Copy link
Contributor Author

Thanks for getting back to me. Yeah sure I'll get to the snippets and examples.

I'm a little unsure why is codegen undoing the following change to C++ API (from the PR description at the very top):

C++: from_file() to from_file_path() and from_bytes() to from_file_contents()

The build errors stem from the absence of from_file_path() which is getting called inside from_file(), the latter being the constructor we want to deprecate through this PR. Since codegen removes from_file_path(), the implementation of from_file() is no longer correct and pixi run -e cpp cpp-build-all fails.

Perhaps I'm making an incorrect assumption about the purpose/effect of codegen? My understanding is that I need to modify both C++ and Rust constructors of Asset3D, but codegen undoes my changes to the C++ constructor, so I'm confused how to run codegen and keep the changes to C++.

@abey79
Copy link
Member

abey79 commented Mar 26, 2025

The way to get things in asset3d.hpp is via asset3d_ext.cpp and the CODEGEN_COPY_TO_HEADER markers. You add stuff there and then run pixi run codegen so it shows up in the actual .hpp file.

passes , , and -- Configuring loguru as sub-directory
-- Rerun SDK install version: 0.23.0
-- Configuring done (0.7s)
-- Generating done (0.1s)
-- Build files have been written to: /home/abhishek/Code/rerun/build/debug
[0/2] Re-checking globbed directories...
[1/130] Performing update step for 'arrow_cpp'
[2/130] No patch step for 'arrow_cpp'
[3/130] Performing configure step for 'arrow_cpp'
[4/130] Performing build step for 'arrow_cpp'
[5/129] Performing install step for 'arrow_cpp'
[6/129] Completed 'arrow_cpp'
[7/129] Linking CXX executable examples/cpp/spawn_viewer/example_spawn_viewer
[8/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_annotation_context
[9/129] Linking CXX executable examples/cpp/shared_recording/example_shared_recording
[10/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_boxes3d
[11/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_boxes2d
[12/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_depth_image
[13/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_arrows3d
[14/129] Linking CXX executable examples/cpp/minimal/example_minimal
[15/129] Linking CXX executable examples/cpp/external_data_loader/rerun-loader-cpp-file
[16/129] Linking CXX executable examples/cpp/clock/example_clock
[17/129] Linking CXX executable examples/cpp/stdio/example_stdio
[18/129] Linking CXX executable examples/cpp/dna/example_dna
[19/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_arrows2d
[20/129] Linking CXX executable examples/cpp/custom_collection_adapter/example_custom_collection_adapter
[21/129] Linking CXX executable examples/cpp/incremental_logging/example_incremental_logging
[22/129] Linking CXX executable tests/cpp/plot_dashboard_stress/plot_dashboard_stress
[23/129] Linking CXX executable tests/cpp/log_benchmark/log_benchmark
[24/129] Linking CXX executable examples/cpp/log_file/example_log_file
[25/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_image
[26/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_view_coordinates
[27/129] Linking CXX executable docs/snippets/annotation_context_segmentation
[28/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_points3d
[29/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_line_strips2d
[30/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_tensor
[31/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_line_strips3d
[32/129] Linking CXX executable docs/snippets/annotation_context_rects
[33/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_text_document
[34/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_pinhole
[35/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_segmentation_image
[36/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_visible_time_ranges
[37/129] Linking CXX executable docs/snippets/arrows2d_simple
[38/129] Linking CXX executable docs/snippets/annotation_context_connections
[39/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_text_log
[40/129] Linking CXX executable docs/snippets/arrows3d_column_updates
[41/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_transform3d
[42/129] Linking CXX executable tests/cpp/roundtrips/roundtrip_points2d
[43/129] Linking CXX executable docs/snippets/arrows3d_row_updates
[44/129] Linking CXX executable docs/snippets/entity_path
[45/129] Linking CXX executable docs/snippets/boxes2d_simple
[46/129] Linking CXX executable docs/snippets/boxes3d_simple
[47/129] Linking CXX executable docs/snippets/clear_recursive
[48/129] Linking CXX executable docs/snippets/ellipsoids3d_batch
[49/129] Linking CXX executable docs/snippets/geo_line_strings_simple
[50/129] Linking CXX executable docs/snippets/boxes3d_batch
[51/129] Linking CXX executable docs/snippets/depth_image_3d
[52/129] Linking CXX executable docs/snippets/encoded_image
[53/129] Linking CXX executable docs/snippets/bar_chart
[54/129] Linking CXX executable docs/snippets/arrows3d_simple
[55/129] Linking CXX executable docs/snippets/asset3d_simple
[56/129] Linking CXX executable docs/snippets/clear_simple
[57/129] Linking CXX executable docs/snippets/capsules3d_batch
[58/129] Linking CXX executable docs/snippets/geo_points_simple
[59/129] Linking CXX executable docs/snippets/depth_image_simple
[60/129] Linking CXX executable docs/snippets/ellipsoids3d_simple
[61/129] Linking CXX executable docs/snippets/graph_directed
[62/129] Linking CXX executable docs/snippets/line_strips2d_simple
[63/129] Linking CXX executable docs/snippets/line_strips2d_batch
[64/129] Linking CXX executable docs/snippets/line_strips3d_segments_simple
[65/129] Linking CXX executable docs/snippets/line_strips2d_segments_simple
[66/129] Linking CXX executable docs/snippets/mesh3d_instancing
[67/129] Linking CXX executable docs/snippets/line_strips2d_ui_radius
[68/129] Linking CXX executable docs/snippets/line_strips3d_ui_radius
[69/129] Linking CXX executable docs/snippets/image_row_updates
[70/129] Linking CXX executable docs/snippets/image_formats
[71/129] Linking CXX executable docs/snippets/line_strips3d_simple
[72/129] Linking CXX executable docs/snippets/mesh3d_partial_updates
[73/129] Linking CXX executable docs/snippets/line_strips3d_batch
[74/129] Linking CXX executable docs/snippets/graph_undirected
[75/129] Linking CXX executable docs/snippets/image_column_updates
[76/129] Linking CXX executable docs/snippets/mesh3d_indexed
[77/129] Linking CXX executable docs/snippets/instance_poses3d_combined
[78/129] Linking CXX executable docs/snippets/image_simple
[79/129] Linking CXX executable docs/snippets/mesh3d_simple
[80/129] Linking CXX executable docs/snippets/series_line_style
[81/129] Linking CXX executable docs/snippets/points2d_random
[82/129] Linking CXX executable docs/snippets/pinhole_simple
[83/129] Linking CXX executable docs/snippets/points3d_ui_radius
[84/129] Linking CXX executable docs/snippets/points2d_simple
[85/129] Linking CXX executable docs/snippets/scalar_row_updates
[86/129] Linking CXX executable docs/snippets/scalar_column_updates
[87/129] Linking CXX executable docs/snippets/points3d_column_updates
[88/129] Linking CXX executable docs/snippets/scalar_multiple_plots
[89/129] Linking CXX executable docs/snippets/points3d_simple
[90/129] Linking CXX executable docs/snippets/points3d_row_updates
[91/129] Linking CXX executable docs/snippets/points3d_random
[92/129] Linking CXX executable docs/snippets/pinhole_perspective
[93/129] Linking CXX executable docs/snippets/points3d_partial_updates
[94/129] Linking CXX executable docs/snippets/points2d_ui_radius
[95/129] Linking CXX executable docs/snippets/segmentation_image_simple
[96/129] Linking CXX executable docs/snippets/scalar_simple
[97/129] Linking CXX executable docs/snippets/series_point_style
[98/129] Linking CXX executable docs/snippets/text_log
[99/129] Linking CXX executable docs/snippets/transform3d_row_updates
[100/129] Linking CXX executable docs/snippets/view_coordinates_simple
[101/129] Linking CXX executable docs/snippets/text_log_integration
[102/129] Linking CXX executable docs/snippets/transform3d_axes
[103/129] Linking CXX executable docs/snippets/transform3d_partial_updates
[104/129] Linking CXX executable docs/snippets/text_document
[105/129] Linking CXX executable docs/snippets/transform3d_simple
[106/129] Linking CXX executable docs/snippets/video_manual_frames
[107/129] Linking CXX executable docs/snippets/native-async
[108/129] Linking CXX executable docs/snippets/tensor_simple
[109/129] Linking CXX executable docs/snippets/native-sync
[110/129] Linking CXX executable docs/snippets/different_data_per_timeline
[111/129] Linking CXX executable docs/snippets/video_auto_frames
[112/129] Linking CXX executable docs/snippets/transform3d_column_updates
[113/129] Linking CXX executable docs/snippets/transform3d_hierarchy
[114/129] Linking CXX executable docs/snippets/indices
[115/129] Linking CXX executable docs/snippets/recording_properties
[116/129] Linking CXX executable docs/snippets/descr_builtin_archetype
[117/129] Linking CXX executable docs/snippets/any_values_column_updates
[118/129] Linking CXX executable docs/snippets/descr_builtin_component
[119/129] Linking CXX executable docs/snippets/any_batch_value_column_updates
[120/129] Linking CXX executable docs/snippets/descr_custom_archetype
[121/129] Linking CXX executable docs/snippets/any_values_row_updates
[122/129] Linking CXX executable docs/snippets/descr_custom_component
[123/129] Linking CXX executable docs/snippets/quick_start_spawn
[124/129] Linking CXX executable docs/snippets/any_values
[125/129] Linking CXX executable docs/snippets/annotation_context
[126/129] Linking CXX executable docs/snippets/quick_start_connect
[127/129] Linking CXX executable docs/snippets/custom_data
[128/129] Linking CXX executable docs/snippets/extra_values
[129/129] Linking CXX executable docs/snippets/dataframe_view_query_external
@abhishek47kashyap
Copy link
Contributor Author

Thanks for the explanation, I hadn't made all the changes to asset3d_ext.cpp which was causing asset3d.hpp : out of sync. That's resolved now and there are no build errors from pixi run -e cpp cpp-build-all.

docs/snippets was already updated in ctor renaming and I think I got them all. Search returns empty for Asset3D in examples so didn't see any changes to be made there.

Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Nice; thank you!

Copy link
Member

@abey79 abey79 left a comment

Choose a reason for hiding this comment

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

thanks!

@emilk emilk added this to the 0.23.0 milestone Mar 31, 2025
@emilk
Copy link
Member

emilk commented Mar 31, 2025

CI failures are unrelated.

@emilk emilk merged commit 900800a into rerun-io:main Mar 31, 2025
30 of 32 checks passed
@abhishek47kashyap abhishek47kashyap deleted the asset3d branch March 31, 2025 18:37
@emilk emilk mentioned this pull request Apr 11, 2025
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 C++ API C/C++ API specific include in changelog 🦀 Rust API Rust logging API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants