Skip to content

Commit

Permalink
Merge pull request NatronGitHub#452 from splidje/NatronGitHub#449
Browse files Browse the repository at this point in the history
Unedited PyPlug Node Settings panel sets everything disabled, except top right 5 buttons and tabs.
fixes NatronGitHub#449
  • Loading branch information
devernay authored Jan 15, 2020
2 parents 7bc0aef + ab30ee9 commit 5562bab
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
27 changes: 26 additions & 1 deletion Gui/DockablePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,13 +816,38 @@ DockablePanel::onKnobsInitialized()
NodeGroup* isGroup = dynamic_cast<NodeGroup*>( collec.get() );
if (isGroup) {
if ( !isGroup->getNode()->hasPyPlugBeenEdited() ) {
setEnabled(false);
isNodePanel->setPyPlugUIEnabled(false);
}
}
}
}
} // DockablePanel::initializeKnobsInternal

void
DockablePanel::setPyPlugUIEnabled(bool enabled)
{
std::vector<QWidget*> btns = {
_imp->_centerNodeButton,
_imp->_undoButton,
_imp->_redoButton,
_imp->_colorButton,
_imp->_overlayButton,
_imp->_restoreDefaultsButton,
_imp->_nameLineEdit,
};
for (QWidget* btn : btns)
if (btn)
btn->setEnabled(enabled);
if (_imp->_tabWidget)
{
int nTabs = _imp->_tabWidget->count();
for (int i = 0; i < nTabs; ++i)
{
_imp->_tabWidget->widget(i)->setEnabled(enabled);
}
}
} // DockablePanel::setPyPlugUIEnabled

TrackerPanel*
DockablePanel::getTrackerPanel() const
{
Expand Down
2 changes: 2 additions & 0 deletions Gui/DockablePanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
virtual bool useScrollAreaForTabs() const OVERRIDE FINAL;
virtual void onKnobsInitialized() OVERRIDE FINAL;

virtual void setPyPlugUIEnabled(bool enabled);

private:

virtual void refreshUndoRedoButtonsEnabledNess(bool canUndo, bool canRedo) OVERRIDE FINAL;
Expand Down
7 changes: 7 additions & 0 deletions Gui/NodeSettingsPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ NodeSettingsPanel::setSelected(bool s)
}
}

void
NodeSettingsPanel::setPyPlugUIEnabled(bool enabled)
{
DockablePanel::setPyPlugUIEnabled(enabled);
_settingsButton->setEnabled(enabled);
}

void
NodeSettingsPanel::centerOnItem()
{
Expand Down
2 changes: 2 additions & 0 deletions Gui/NodeSettingsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON

virtual QColor getCurrentColor() const OVERRIDE FINAL;

virtual void setPyPlugUIEnabled(bool enabled);

private:


Expand Down

0 comments on commit 5562bab

Please sign in to comment.