diff --git a/Engine/RotoContext.cpp b/Engine/RotoContext.cpp index 091dda5418..17fe0f066d 100644 --- a/Engine/RotoContext.cpp +++ b/Engine/RotoContext.cpp @@ -2002,6 +2002,12 @@ RotoContext::onItemLockedChanged(const RotoItemPtr& item, Q_EMIT itemLockedChanged( (int)reason ); } +void +RotoContext::onItemGloballyActivatedChanged(const RotoItemPtr& item) +{ + Q_EMIT itemGloballyActivatedChanged(item); +} + void RotoContext::onItemScriptNameChanged(const RotoItemPtr& item) { diff --git a/Engine/RotoContext.h b/Engine/RotoContext.h index fe5f48b30d..1e0c7ba410 100644 --- a/Engine/RotoContext.h +++ b/Engine/RotoContext.h @@ -355,6 +355,7 @@ class RotoContext **/ std::string getRotoNodeName() const; + void onItemGloballyActivatedChanged(const RotoItemPtr& item); void onItemScriptNameChanged(const RotoItemPtr& item); void onItemLabelChanged(const RotoItemPtr& item); @@ -437,6 +438,7 @@ class RotoContext void itemLockedChanged(int reason); + void itemGloballyActivatedChanged(const RotoItemPtr&); void itemScriptNameChanged(const RotoItemPtr&); void itemLabelChanged(const RotoItemPtr&); diff --git a/Engine/RotoItem.cpp b/Engine/RotoItem.cpp index 777560a39c..228aff5d25 100644 --- a/Engine/RotoItem.cpp +++ b/Engine/RotoItem.cpp @@ -195,6 +195,7 @@ RotoItem::setGloballyActivated(bool a, isDrawable->incrementNodesAge(); } c->evaluateChange(); + c->onItemGloballyActivatedChanged(shared_from_this()); } } diff --git a/Gui/RotoPanel.cpp b/Gui/RotoPanel.cpp index c0006fcb4c..b87a60dc93 100644 --- a/Gui/RotoPanel.cpp +++ b/Gui/RotoPanel.cpp @@ -476,8 +476,6 @@ struct RotoPanelPrivate void insertSelectionRecursively(const RotoLayerPtr & layer); - void setChildrenActivatedRecursively(bool activated, QTreeWidgetItem* item); - void setChildrenLockedRecursively(bool locked, QTreeWidgetItem* item); bool itemHasKey(const RotoItemPtr& item, double time) const; @@ -507,6 +505,7 @@ RotoPanel::RotoPanel(const NodeGuiPtr& n, QObject::connect( _imp->context.get(), SIGNAL(itemScriptNameChanged(RotoItemPtr)), this, SLOT(onItemScriptNameChanged(RotoItemPtr)) ); QObject::connect( _imp->context.get(), SIGNAL(itemLabelChanged(RotoItemPtr)), this, SLOT(onItemLabelChanged(RotoItemPtr)) ); QObject::connect( _imp->context.get(), SIGNAL(itemLockedChanged(int)), this, SLOT(onItemLockChanged(int)) ); + QObject::connect( _imp->context.get(), SIGNAL(itemGloballyActivatedChanged(RotoItemPtr)), this, SLOT(onItemGloballyActivatedChanged(RotoItemPtr)) ); const QSize medButtonSize( TO_DPIX(NATRON_MEDIUM_BUTTON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_SIZE) ); const QSize medButtonIconSize( TO_DPIX(NATRON_MEDIUM_BUTTON_ICON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_ICON_SIZE) ); @@ -1482,9 +1481,7 @@ RotoPanel::onItemClicked(QTreeWidgetItem* item, TreeItems::iterator found = _imp->findItem(selected[i]); assert( found != _imp->items.end() ); found->rotoItem->setGloballyActivated(activated, true); - _imp->setChildrenActivatedRecursively(activated, found->treeItem); } - _imp->context->emitRefreshViewerOverlays(); break; } @@ -1575,16 +1572,6 @@ RotoPanel::onItemColorDialogEdited(const QColor & color) } } -void -RotoPanelPrivate::setChildrenActivatedRecursively(bool activated, - QTreeWidgetItem* item) -{ - item->setIcon(COL_ACTIVATED, activated ? iconVisible : iconUnvisible); - for (int i = 0; i < item->childCount(); ++i) { - setChildrenActivatedRecursively( activated, item->child(i) ); - } -} - void RotoPanel::onItemLockChanged(int reason) { @@ -1599,6 +1586,16 @@ RotoPanel::onItemLockChanged(int reason) } } +void +RotoPanel::onItemGloballyActivatedChanged(const RotoItemPtr& item) +{ + TreeItems::iterator found = _imp->findItem(item); + if ( found != _imp->items.end() ) { + found->treeItem->setIcon(COL_ACTIVATED, item->isGloballyActivated() ? _imp->iconVisible : _imp->iconUnvisible); + } + _imp->context->emitRefreshViewerOverlays(); +} + void RotoPanelPrivate::setChildrenLockedRecursively(bool locked, QTreeWidgetItem* item) diff --git a/Gui/RotoPanel.h b/Gui/RotoPanel.h index d8f37daf0c..3454aa2ad9 100644 --- a/Gui/RotoPanel.h +++ b/Gui/RotoPanel.h @@ -172,6 +172,7 @@ public Q_SLOTS: void onItemColorDialogEdited(const QColor & color); + void onItemGloballyActivatedChanged(const RotoItemPtr& item); void onItemLabelChanged(const RotoItemPtr& item); void onItemScriptNameChanged(const RotoItemPtr& item);