-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Inline visualizers in custom data inspectors #1966
Conversation
This PR aims at making inline visualizers work on the data inspector so that more rgb encodings can be added as custom pattern language inspector rows. This was never setup to work because the inline visualizer rendering function was a private member function. In order to be accessible from the inspector class the rendering function was made public. Missing still is the tooltip to make it behave like other color entries.
…tor. The previous version was trying to use the drawVisualizer function in PatternDrawer from DataInspector which was inefficient. The former drawVisualizer code was put in its own class in ui from imhex plugin library. Both DataInspector and PatternDrawer get a member field that is used to draw inline and regular visualizers. Code has been tested to make sure it works for both the inspector and the pattern drawer.
@@ -384,11 +358,12 @@ namespace hex::ui { | |||
if (ImGui::Button(hex::format(" {} {}", ICON_VS_EYE_WATCH, value).c_str(), ImVec2(width, ImGui::GetTextLineHeight()))) { | |||
auto previousPattern = m_currVisualizedPattern; | |||
m_currVisualizedPattern = &pattern; | |||
|
|||
m_lastVisualizerError = m_visualizerDrawer.getLastVisualizerError(); |
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 doesn't look like m_lastVisualizerError
is really needed anymore. Keeping the error message only stored in the visualizer drawer would be better
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 deleted the variable as requested and added function to clear the error on VisualizerDrawer to make it easier. I simulated a code error in my Inspector rgba5551 visualizer and I got a nice popup error of the reason why it wasn't working. Fixing the error made the visualizer work again so it looks like at a basic level it is working.
The question now is how to get the color information popup working for this entries like it does for the other color entries. I looked for the popup code and couldn't find it cause it is probably a callback or something like that.
…made it easier by creating a function that clears it. I tested the implementation by simulating a code error and I got a nice descriptive error message about why the color visualizer wasn't working. I fixed it and went back to working as before.
Problem description
This PR aims at making inline visualizers work on the data inspector so that more rgb encodings can be added as custom pattern language inspector rows. This was never setup to work because the inline visualizer rendering function was a private member function.
Implementation description
In order to be accessible from the inspector class the rendering function was made public.
Additional things
Missing still is the tooltip to make it behave like other color entries.