-
Notifications
You must be signed in to change notification settings - Fork 326
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
Fix visualisation FRP bugs. #6831
Fix visualisation FRP bugs. #6831
Conversation
411b592
to
2846934
Compare
2846934
to
ea162d3
Compare
/// Indicates the visibility state of the visualisation. | ||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub enum ViewState { | ||
/// Visualisation is permanently enabled and visible in thw graph editor. It is attached to a |
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.
/// Visualisation is permanently enabled and visible in thw graph editor. It is attached to a | |
/// Visualisation is permanently enabled and visible in the graph editor. It is attached to a |
impl Default for ViewState { | ||
fn default() -> Self { | ||
ViewState::Disabled | ||
} | ||
} |
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.
Derivable.
pub fn visible(&self) -> bool { | ||
!matches!(self, ViewState::Disabled) | ||
} | ||
|
||
/// Indicates whether the visualisation is fullscreen mode. | ||
pub fn is_fullscreen(&self) -> bool { | ||
matches!(self, ViewState::Fullscreen) | ||
} |
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.
Inconsistent is_
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.
The code looks good, with some comments below. But I'm worried we have regressions in displaying errors (the visualization should be hidden on error). Should be checked during QA.
//! a visualisation int he graph editor and includes a visual box that contains the visualisaiton, | ||
//! a action bar that allows setting the visualisation type. |
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.
//! a visualisation int he graph editor and includes a visual box that contains the visualisaiton, | |
//! a action bar that allows setting the visualisation type. | |
//! a visualisation in the graph editor and includes a visual box that contains the visualisaiton, | |
//! and the action bar that allows setting the visualisation type. |
//! is correctly positioned, sized and layouted in its different `ViewState`s (which include the | ||
//! `Enabled`, `Fullscreen` and `Preview` states). Importantly, this also includes layer management |
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.
You can put ViewState
in [] ([ViewState]
) making them link to the structure; then I think it's not necessary to list enum variants.
//! `Enabled`, `Fullscreen` and `Preview` states). Importantly, this also includes layer management | ||
//! and ensuring that the visualisation is correctly layered with respect to other scene objects. |
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.
I don't quite understand the "layer management". Does visualization create new layers? What "correct layering" means? Is visualization split into layers?
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.
This is about EnsoGL layers and management of occlusion. I clarified this now.
Enabled, | ||
/// Visualisation is disabled and hidden in the graph editor. | ||
Disabled, | ||
/// Visualisation is temporarily enabled and visible in the graph editor. It should be placed |
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.
Is any difference between "enabled" and "visible"? Before, "enabled" meant that the visualization "eye" was toggled on. Visualization could be visible and not enabled (in case of Preview) and enabled but not visible (if there's error on the node - I think we miss that variant here).
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.
This logic is now decoupled; thus, the visualization is either visible or not. While the button's state is managed independently. I will double-check the button has the correct state during preview.
Some(visualization::Registry::default_visualisation()) | ||
}); | ||
vis_input_type <- frp.set_vis_input_type.on_change(); | ||
vis_input_type <- input.set_vis_input_type.on_change(); | ||
vis_input_type <- vis_input_type.gate(&visualisation_uninitialised).unwrap(); |
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.
I know it's an older code, but the name is bad, as it says nothing about the type being updated only when visualization is uninitialized.
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.
I've updated the naming. But it does get a bit verbose.
visualisation_uninitialised <- input.set_visualization.map(|t| t.is_none()); | ||
input_type_uninitialised <- input.set_vis_input_type.is_some().not(); |
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.
The name "visualization_uninitialized" is a bit unfortunate. I think "non-chosen" says better what it is.
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.
I've updated the naming.
app/gui/view/graph-editor/src/component/visualization/container.rs
Outdated
Show resolved
Hide resolved
app/gui/view/graph-editor/src/component/visualization/container.rs
Outdated
Show resolved
Hide resolved
app/gui/view/graph-editor/src/component/visualization/container.rs
Outdated
Show resolved
Hide resolved
has_selection <- visualization_chooser.chosen_entry.is_some(); | ||
frp.source.visualisation_selection | ||
<+ visualization_chooser.chosen_entry.gate(&has_selection); |
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.
.filter_map(|entry| *entry)
does it in one line. And I use it a lot - maybe we could make filter_some
node?
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.
I think .unwrap()
already does exactly that.
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.
Amazing that it's here! Skipping my code review seeing code reviews of Kaz and Adam :)
…r.rs Co-authored-by: Adam Obuchowicz <[email protected]>
…r.rs Co-authored-by: Adam Obuchowicz <[email protected]>
…r.rs Co-authored-by: Adam Obuchowicz <[email protected]>
…actoring_And_Bugfixes # Conflicts: # app/gui/view/graph-editor/src/component/visualization/container.rs
QA Report 🔴Most importantly, error visualization is indeed affected, as @farmaazon noticed in his review. Hovering the output with the mouse displays both the error message and a visualization. Switching visualization with the icon doesn't work, but using 2023-05-31.12-36-42.mp4Also, I noticed that on complex projects a lot of visualizations disappear after loading. For example, for COVID project on my machine: 2023-05-31.12-31-51.mp4 |
This should now be fixed.
I can reproduce this also on develop and this seems to be #6724. |
@MichaelMauderer |
I think that does not make sense, even if it works like that on develop. So, it is fixed now to stop the empty vis from opening. |
QA: passed 🟢 |
Pull Request Description
Fixes
Peek.2023-05-22.15-17.mp4
Peek.2023-05-25.12-52.mp4
Peek.2023-05-25.12-55.mp4
Generally improves the logic around the visualization API by avoiding decentralized logic in different places and removing old code that is no longer needed.
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.