-
Notifications
You must be signed in to change notification settings - Fork 366
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
Expose ui point radii to logging & blueprint, remove old default radius settings in favor of blueprint default components #6678
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
71baa1c
update radius doc & add python utility for ui points
Wumpf 6f12c95
allow negative radius on radius processing
Wumpf 58570d6
add python points3d snippet for ui radius
Wumpf 6419126
wip: snippet placeholder for points2d ui radius
Wumpf 82ba394
ui/scene unit aware radius ui
Wumpf 68ff62e
improve radius docs, call it consistently ui points & scene units
Wumpf aa1f414
remove line/point default radius settings from 2d/3d views
Wumpf e0deb7d
remove auto size from re_renderer
Wumpf 8fb3afa
Express some hardcoded default radii as Radius::default
Wumpf 0e8936a
minor fix to compare_snippet_output
Wumpf ce83e0f
add rust version of point3d_ui_radius
Wumpf 21aa36f
Add C++ point3d_ui_radius demo & C++ radius extensions
Wumpf 0df4118
add example for ui radius & points2d
Wumpf 5b8035a
Add snippet for strip3d with ui radius
Wumpf cd6f858
Add snippet for 2d line point radius
Wumpf 5d21722
fix ignoring Result on new snippets
Wumpf 776a153
fix C++ warning
Wumpf 5f06955
add UI & GUI capitilization lint
Wumpf 3f0a956
fix scaling typos
Wumpf 8f65587
comment fix
Wumpf da6fe69
don't clamp radius_ui drag value so user can't put in negative numbers
Wumpf 9a1860e
rename ONE_UI_POINTS to ONE_UI_POINT
Wumpf 2b1ad43
remove Size::ONE
Wumpf 948979e
rename box_radius to box_line_radius
Wumpf 975439d
Remove Radius::ONE
Wumpf 6ce81c2
treat -0.0 (and even negative NaN) as ui point, simplified assertions
Wumpf 13c2e2b
remove unused next_offset
Wumpf 79991c7
fix UI capitalization that got missed due to codegen
Wumpf 9f729cf
add tests & comments for point/scene distinction
Wumpf 9f5d8c5
fix point2d_ui_radius comparison test, rename entities to be more sen…
Wumpf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,66 @@ | ||
use egui::NumExt as _; | ||
use re_types::components::Radius; | ||
use re_viewer_context::ViewerContext; | ||
|
||
use crate::response_utils::response_with_changes_of_inner; | ||
|
||
pub fn edit_radius_ui( | ||
_ctx: &ViewerContext<'_>, | ||
ui: &mut egui::Ui, | ||
value: &mut Radius, | ||
) -> egui::Response { | ||
let mut abs_value = value.0.abs(); | ||
let speed = (abs_value * 0.01).at_least(0.001); | ||
|
||
let drag_response = ui.add( | ||
egui::DragValue::new(&mut abs_value) | ||
.range(0.0..=f32::INFINITY) | ||
.speed(speed), | ||
); | ||
|
||
let mut is_scene_units = value.scene_units().is_some(); | ||
let selected_label = label_for_unit(is_scene_units); | ||
|
||
if ui.is_enabled() { | ||
let combobox_response = egui::ComboBox::from_id_source("units") | ||
.selected_text(selected_label) | ||
.show_ui(ui, |ui| { | ||
ui.selectable_value(&mut is_scene_units, true, label_for_unit(true)) | ||
| ui.selectable_value(&mut is_scene_units, false, label_for_unit(false)) | ||
}); | ||
|
||
if combobox_response | ||
.inner | ||
.as_ref() | ||
.map_or(false, |r| r.changed()) | ||
{ | ||
// When we change the type of units,the value is likely going to be _very wrong_. | ||
// Unfortunately, we don't have knowledge of a fallback here, so we use hardcoded "reasonable" values. | ||
if is_scene_units { | ||
abs_value = 0.5; | ||
} else { | ||
abs_value = 2.5; | ||
}; | ||
} | ||
|
||
if is_scene_units { | ||
*value = Radius::new_scene_units(abs_value); | ||
} else { | ||
*value = Radius::new_ui_points(abs_value); | ||
} | ||
|
||
drag_response | response_with_changes_of_inner(combobox_response) | ||
} else { | ||
// Don't show the combo box drop down if this is disabled ui. | ||
// TODO(#6661): This shouldn't happen on disabled ui, but rather when this is simply not editable. | ||
ui.selectable_label(false, selected_label) | ||
} | ||
} | ||
|
||
fn label_for_unit(is_scene_units: bool) -> &'static str { | ||
if is_scene_units { | ||
"scene units" | ||
} else { | ||
"ui points" | ||
Wumpf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
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
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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to be able to use the
auto_size_world_heuristic
somehow, but I guess that's a hard askThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah 100% and it would indeed be a very complicated/annoying wire to put in. That's what I meant above with not being able to access a fallback (fallbacks have this kind of context sensitive information)