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

Fix renderer list right click menu for particles #3528

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions apps/vaporgui/RendererList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ RendererList::RendererList(ControlExec *ce) : VContainer(_lw = new QListWidget),
_rendererMetadata[rendererType] = {
router->Supports2DVariables(),
router->Supports3DVariables(),
router->SupportsParticleVariables(),
router->GetDescription(),
router->GetSmallIconImagePath(),
router->GetIconImagePath()
Expand Down Expand Up @@ -268,8 +269,9 @@ void RendererList::showContextMenu(const QPoint& localPos)

for (const auto &dataset : datasets) {
DataMgr *dm = _ce->GetDataStatus()->GetDataMgr(dataset);
bool has2D = !dm->GetDataVarNames(2).empty();
bool has3D = !dm->GetDataVarNames(3).empty();
bool has2D = dm->GetDataVarNames(2, DataMgr::VarType::Scalar).size();
bool has3D = dm->GetDataVarNames(3, DataMgr::VarType::Scalar).size();
bool hasParticle = dm->GetDataVarNames(3, DataMgr::VarType::Particle).size();
QMenu *datasetMenu = newRendererMenu;
if (datasets.size() > 1)
datasetMenu = newRendererMenu->addMenu(QString::fromStdString(dataset));
Expand All @@ -278,9 +280,9 @@ void RendererList::showContextMenu(const QPoint& localPos)
_ce->ActivateRender(currentViz, dataset, rendererType, _ce->MakeRendererNameUnique(rendererType), false);
});
const auto &meta = _rendererMetadata[rendererType];
if (!(meta.supports2D && has2D) && !(meta.supports3D && has3D)) {
if (!((has2D && meta.supports2D) || (has3D && meta.supports3D) || (hasParticle && meta.supportsParticle))) {
action->setEnabled(false);
action->setToolTip("This dataset has no 2D/3D variables");
action->setToolTip(QString::fromStdString("Dataset \"" + dataset + "\" does not have data supported by this renderer"));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/vaporgui/RendererList.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RendererList : public VContainer {
NewRendererDialogManager *_nrd;

struct RendererMetadata {
bool supports2D, supports3D;
bool supports2D, supports3D, supportsParticle;
string description;
string iconPath;
string imagePath;
Expand Down
3 changes: 0 additions & 3 deletions apps/vaporgui/RenderersPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@ class RenderersPanel : public VContainer {
public:
RenderersPanel(VAPoR::ControlExec *ce);
void Update();

signals:
void ShowNewRendererModal();
};