Skip to content

Commit

Permalink
Hide viewer buttons when roto/tracker properties panel is minimized (#…
Browse files Browse the repository at this point in the history
…748)

- addresses issue commented in [#745 (review)](#745 (review))
- when panel is maximized, buttons are displayed even if viewer is not in render path (see #744 for an explanation of that feature). This is not 100% satisfactory, but better than before IMHO
- do not show the viewer buttons if a node is selected in the nodegraph but has its properties panel minimized
- maximize properties panel when double-clicking a node in the nodegraph
- minimized() and maximized() were originally two separate signals (in NodeSettingsPanel), so I kept it that way, but we could have simpler definitions of NodeGui::onSettingsPanelMinimized() and NodeGui::onSettingsPanelMaximized() that simply call NodeGui::onSettingsPanelClosed(true) or NodeGui::onSettingsPanelClosed(false).
  • Loading branch information
devernay authored Jan 11, 2022
1 parent cfbad48 commit b530320
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 6 deletions.
40 changes: 34 additions & 6 deletions Gui/NodeGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ NodeGui::ensurePanelCreated(bool minimized, bool hideUnmodified)
if (_settingsPanel) {
QObject::connect( _settingsPanel, SIGNAL(nameChanged(QString)), this, SLOT(setName(QString)) );
QObject::connect( _settingsPanel, SIGNAL(closeChanged(bool)), this, SLOT(onSettingsPanelClosed(bool)) );
QObject::connect( _settingsPanel, SIGNAL(minimized()), this, SLOT(onSettingsPanelMinimized()) );
QObject::connect( _settingsPanel, SIGNAL(maximized()), this, SLOT(onSettingsPanelMaximized()) );
QObject::connect( _settingsPanel, SIGNAL(colorChanged(QColor)), this, SLOT(onSettingsPanelColorChanged(QColor)) );

_graph->getGui()->setNodeViewerInterface(thisShared);
Expand Down Expand Up @@ -497,6 +499,32 @@ NodeGui::onSettingsPanelClosed(bool closed)
Q_EMIT settingsPanelClosed(closed);
}

void
NodeGui::onSettingsPanelMinimized()
{
NodePtr internalNode = getNode();
if (internalNode && internalNode->hasAnyPersistentMessage()) {
const std::list<ViewerTab*>& viewers = getDagGui()->getGui()->getViewersList();
for (std::list<ViewerTab*>::const_iterator it = viewers.begin(); it != viewers.end(); ++it) {
(*it)->getViewer()->updatePersistentMessage();
}
}
Q_EMIT settingsPanelMinimized();
}

void
NodeGui::onSettingsPanelMaximized()
{
NodePtr internalNode = getNode();
if (internalNode && internalNode->hasAnyPersistentMessage()) {
const std::list<ViewerTab*>& viewers = getDagGui()->getGui()->getViewersList();
for (std::list<ViewerTab*>::const_iterator it = viewers.begin(); it != viewers.end(); ++it) {
(*it)->getViewer()->updatePersistentMessage();
}
}
Q_EMIT settingsPanelMaximized();
}

NodeSettingsPanel*
NodeGui::createPanel(QVBoxLayout* container,
const NodeGuiPtr& thisAsShared)
Expand Down Expand Up @@ -2102,23 +2130,23 @@ NodeGui::setVisibleSettingsPanel(bool b, bool m, bool h)
}
if (_settingsPanel) {
_settingsPanel->setClosed(!b);
if (b) {
// also maximize (but don't minimize when closing)
_settingsPanel->minimizeOrMaximize(false);
}
}
}

bool
NodeGui::isSettingsPanelVisible() const
{
if (_settingsPanel) {
return !_settingsPanel->isClosed();
} else {
return false;
}
return _settingsPanel && !_settingsPanel->isClosed() && !_settingsPanel->isMinimized();
}

bool
NodeGui::isSettingsPanelMinimized() const
{
return _settingsPanel ? _settingsPanel->isMinimized() : false;
return _settingsPanel && _settingsPanel->isMinimized();
}

void
Expand Down
8 changes: 8 additions & 0 deletions Gui/NodeGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ public Q_SLOTS:

void onSettingsPanelClosed(bool closed);

void onSettingsPanelMinimized();

void onSettingsPanelMaximized();

void onSettingsPanelColorChanged(const QColor & color);

void togglePreview();
Expand Down Expand Up @@ -543,6 +547,10 @@ public Q_SLOTS:

void settingsPanelClosed(bool b);

void settingsPanelMinimized();

void settingsPanelMaximized();

void previewImageComputed();

protected:
Expand Down
14 changes: 14 additions & 0 deletions Gui/NodeViewerContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ NodeViewerContext::createGui()
QObject::connect( _imp->viewer, SIGNAL(selectionCleared()), this, SLOT(onViewerSelectionCleared()), Qt::UniqueConnection );
NodeGuiPtr node = _imp->getNode();
QObject::connect( node.get(), SIGNAL(settingsPanelClosed(bool)), this, SLOT(onNodeSettingsPanelClosed(bool)), Qt::UniqueConnection );
QObject::connect( node.get(), SIGNAL(settingsPanelMinimized()), this, SLOT(onNodeSettingsPanelMinimized()), Qt::UniqueConnection );
QObject::connect( node.get(), SIGNAL(settingsPanelMaximized()), this, SLOT(onNodeSettingsPanelMaximized()), Qt::UniqueConnection );
KnobsVec knobsOrdered = node->getNode()->getEffectInstance()->getViewerUIKnobs();


Expand Down Expand Up @@ -268,6 +270,18 @@ NodeViewerContext::onNodeSettingsPanelClosed(bool closed)
}
}

void
NodeViewerContext::onNodeSettingsPanelMinimized()
{
return onNodeSettingsPanelClosed(true);
}

void
NodeViewerContext::onNodeSettingsPanelMaximized()
{
return onNodeSettingsPanelClosed(false);
}

int
NodeViewerContext::getItemsSpacingOnSameLine() const
{
Expand Down
4 changes: 4 additions & 0 deletions Gui/NodeViewerContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ public Q_SLOTS:

void onNodeSettingsPanelClosed(bool closed);

void onNodeSettingsPanelMinimized();

void onNodeSettingsPanelMaximized();

private:

boost::scoped_ptr<NodeViewerContextPrivate> _imp;
Expand Down

0 comments on commit b530320

Please sign in to comment.