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

Draft for Issue1123 - Expandable Transfer Function #3698

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

sgpearse
Copy link
Collaborator

Draft to fix #1123 by creating new PTFEditors with an expand-window button, shown in the top left corner of the editor.

I have two questions that I'm uncertain on:

  1. ParamsMgr.cpp:1315 asserts that _groups.size() > 0, but then returns in the following statement under the same condition. Why is it throwing an assert here? Does the return statement suffice?

  2. I need to set the sizePolicy for TFMapWidgets that contain TFColorMaps and TFIsoValueMaps. I'm doing this in the TFMapWidget constructor with dynamic casts to catch the TFColorMap/TFIsoValueMap instances. Is there a better way to do this?

I'm currently reaching out to leigh for usability feedback.

Note that the Volume Renderer's colormapped variable transfer function is currently not expandable. I plan on coming back to it hopefully once the currently reported regressions have been fixed.

Screen Shot 2025-01-29 at 10 09 55 AM

@sgpearse sgpearse requested a review from StasJ January 29, 2025 17:10
@sgpearse sgpearse changed the title Draft for Issue1123 Draft for Issue1123 - Expandable Transfer Function Feb 7, 2025
Copy link
Collaborator

@StasJ StasJ left a comment

Choose a reason for hiding this comment

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

Crash:

  1. Create/enable a volume renderer
  2. Expand TF editor
  3. Create/enable a 2d renderer
  4. Delete the first renderer
  5. Edit the first renderers TF in the expanded view
  6. Vapor will crash

The resolution of the histogram needs to be limited/performance improved as it becomes noticeably slow at fullscreen retina.

{
_maps = new TFMapGroupWidget;
_histogram = new TFHistogramMap(tag);
_opacityMap = new TFOpacityMap(tag);
_colorMap = new TFColorMap(tag);
_isoMap = new TFIsoValueMap(tag);
_range = new TFMappingRangeSelector(tag);
_elements = elements;
_label = label;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The label parameter should be held by the VSection rather than in the subclass. Also, it is optional which is not being handled.

}

void PTFEditor::closeEvent(QCloseEvent* event) {
emit closed();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not simply call closeExpandedPTFEditor

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We need to specifically capture the expanded PTFEditor's closeEvent so the containing PTFEditor can then set the expanded to nullptr.

If we don't, then the checks for _expandedPTFEditor==nullptr will fail, particularly in PTFEditor::showExpandedPTFEditor().

@@ -55,6 +54,8 @@ class PWidget : public UWidget {
void setToolTip(const QString &) = delete;

protected:
const std::string _tag;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should remain private.

@@ -199,6 +201,11 @@ TFMapWidget::TFMapWidget(TFMap *map)
AddMap(map);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(_showContextMenu(const QPoint &)));

// Is there a better way or place to set the sizePolicy of this object?
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could do it in the subclass constructor

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The subclass isn't a QWidget though. It needs to be done in the TFMapWidget, not the TFMap :\

option.features = QStyleOptionToolButton::None;
p.drawComplexControl(QStyle::CC_ToolButton, option);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

ExpandSectionButton duplicates the code of SettingsMenuButton apart from changing the icon path.

@@ -1312,7 +1312,8 @@ void ParamsMgr::PMgrStateSave::EndGroup()

if (!GetEnabled()) return;

assert(_groups.size());
// If we are going to return in the next statement, why also assert for the same condition?
//assert(_groups.size());
Copy link
Collaborator

Choose a reason for hiding this comment

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

This assert needs to remain here. I think the intention was to have it be a VAssert so that it would only crash in debug builds and silently fail on release builds.


public:
VSection(const std::string &title);
QVBoxLayout *layout() const;
void setMenu(QMenu *menu);
void setExpandedSection();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Method is called set... but nothing is being set.

@sgpearse
Copy link
Collaborator Author

Thanks @StasJ. I'll address/reply to your comments shortly.

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.

Transfer function editor improvements
2 participants