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

Inline visualizers in custom data inspectors #1966

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

paxcut
Copy link
Contributor

@paxcut paxcut commented Nov 23, 2024

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.

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.
auto displayFunction = [value = pattern->getFormattedValue()] {
ImGui::TextUnformatted(value.c_str());
auto displayFunction = [pattern,value = pattern->getFormattedValue()] {
auto drawer = std::make_unique<hex::ui::PatternDrawer>();
Copy link
Owner

Choose a reason for hiding this comment

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

This causes a lot of unnecessary allocations every single frame. Instead, I believe the PatternDrawer shouldn't be involved at all in rendering this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only function that draws the inline visualizer is defined as a member function of pattern drawer. Do we need to create an identical function here as well?

paxcut and others added 3 commits November 24, 2024 08:56
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants