diff --git a/libs/ui/kis_node_manager.h b/libs/ui/kis_node_manager.h --- a/libs/ui/kis_node_manager.h +++ b/libs/ui/kis_node_manager.h @@ -158,6 +158,8 @@ */ void createFromVisible(); + void slotShowHideTimeline(bool value); + void toggleIsolateActiveNode(); void toggleIsolateMode(bool checked); void slotUpdateIsolateModeAction(); diff --git a/libs/ui/kis_node_manager.cpp b/libs/ui/kis_node_manager.cpp --- a/libs/ui/kis_node_manager.cpp +++ b/libs/ui/kis_node_manager.cpp @@ -80,6 +80,8 @@ #include "processing/kis_mirror_processing_visitor.h" #include "KisView.h" +#include + struct KisNodeManager::Private { Private(KisNodeManager *_q, KisViewManager *v) @@ -103,6 +105,8 @@ QScopedPointer nodeSelectionAdapter; QScopedPointer nodeInsertionAdapter; + KisAction *showInTimeline; + KisNodeList selectedNodes; QPointer nodeJuggler; @@ -297,6 +301,11 @@ action = actionManager->createAction("new_from_visible"); connect(action, SIGNAL(triggered()), this, SLOT(createFromVisible())); + action = actionManager->createAction("show_in_timeline"); + action->setCheckable(true); + connect(action, SIGNAL(toggled(bool)), this, SLOT(slotShowHideTimeline(bool))); + m_d->showInTimeline = action; + NEW_LAYER_ACTION("add_new_paint_layer", "KisPaintLayer"); NEW_LAYER_ACTION("add_new_group_layer", "KisGroupLayer"); @@ -522,6 +531,13 @@ KisLayerUtils::newLayerFromVisible(m_d->view->image(), m_d->view->image()->root()->lastChild()); } +void KisNodeManager::slotShowHideTimeline(bool value) +{ + Q_FOREACH (KisNodeSP node, selectedNodes()) { + node->setUseInTimeline(value); + } +} + KisLayerSP KisNodeManager::createPaintLayer() { KisNodeSP activeNode = this->activeNode(); @@ -639,6 +655,10 @@ m_d->view->updateGUI(); m_d->view->selectionManager()->selectionChanged(); + { + KisSignalsBlocker b(m_d->showInTimeline); + m_d->showInTimeline->setChecked(node->useInTimeline()); + } } KisPaintDeviceSP KisNodeManager::activePaintDevice() diff --git a/plugins/dockers/animation/timeline_docker.cpp b/plugins/dockers/animation/timeline_docker.cpp --- a/plugins/dockers/animation/timeline_docker.cpp +++ b/plugins/dockers/animation/timeline_docker.cpp @@ -140,4 +140,6 @@ for (; it != end; ++it) { actionManager->addAction(it.key(), it.value()); } + + m_d->view->setShowInTimeline(actionManager->actionByName("show_in_timeline")); } diff --git a/plugins/dockers/animation/timeline_frames_view.h b/plugins/dockers/animation/timeline_frames_view.h --- a/plugins/dockers/animation/timeline_frames_view.h +++ b/plugins/dockers/animation/timeline_frames_view.h @@ -41,6 +41,8 @@ QMap globalActions() const; + void setShowInTimeline(KisAction *action); + public Q_SLOTS: void slotSelectionChanged(); @@ -52,7 +54,6 @@ void slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); void slotRemoveLayer(); - void slotHideLayerFromTimeline(); void slotLayerContextMenuRequested(const QPoint &globalPos); @@ -82,8 +83,6 @@ private: void setFramesPerSecond(int fps); - void updateShowInTimeline(); - protected: QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, const QEvent *event) const; diff --git a/plugins/dockers/animation/timeline_frames_view.cpp b/plugins/dockers/animation/timeline_frames_view.cpp --- a/plugins/dockers/animation/timeline_frames_view.cpp +++ b/plugins/dockers/animation/timeline_frames_view.cpp @@ -182,13 +182,6 @@ m_d->existingLayersMenu = m_d->layerEditingMenu->addMenu(KisAnimationUtils::addExistingLayerActionName); m_d->layerEditingMenu->addSeparator(); - m_d->showHideLayerAction = new KisAction(KisAnimationUtils::showLayerActionName, this); - m_d->showHideLayerAction->setActivationFlags(KisAction::ACTIVE_LAYER); - connect(m_d->showHideLayerAction, SIGNAL(triggered()), SLOT(slotHideLayerFromTimeline())); - m_d->showHideLayerAction->setCheckable(true); - m_d->globalActions.insert("show_in_timeline", m_d->showHideLayerAction); - m_d->layerEditingMenu->addAction(m_d->showHideLayerAction); - m_d->layerEditingMenu->addAction(KisAnimationUtils::removeLayerActionName, this, SLOT(slotRemoveLayer())); connect(m_d->existingLayersMenu, SIGNAL(aboutToShow()), SLOT(slotUpdateLayersMenu())); @@ -291,6 +284,12 @@ return m_d->globalActions; } +void TimelineFramesView::setShowInTimeline(KisAction* action) +{ + m_d->showHideLayerAction = action; + m_d->layerEditingMenu->addAction(m_d->showHideLayerAction); +} + void resizeToMinimalSize(QAbstractButton *w, int minimalSize) { QSize buttonSize = w->sizeHint(); if (buttonSize.height() > minimalSize) { @@ -619,15 +618,12 @@ if (newFps != m_d->fps) { setFramesPerSecond(newFps); } - } else /* if (orientation == Qt::Vertical) */ { - updateShowInTimeline(); } } void TimelineFramesView::rowsInserted(const QModelIndex& parent, int start, int end) { QTableView::rowsInserted(parent, start, end); - updateShowInTimeline(); } @@ -1000,13 +996,6 @@ m_d->layerEditingMenu->exec(globalPos); } -void TimelineFramesView::updateShowInTimeline() -{ - const int row = m_d->model->activeLayerRow(); - const bool status = m_d->model->headerData(row, Qt::Vertical, TimelineFramesModel::LayerUsedInTimelineRole).toBool(); - m_d->showHideLayerAction->setChecked(status); -} - void TimelineFramesView::slotAddNewLayer() { QModelIndex index = currentIndex(); @@ -1034,13 +1023,6 @@ model()->removeRow(index.row()); } -void TimelineFramesView::slotHideLayerFromTimeline() -{ - const int row = m_d->model->activeLayerRow(); - const bool status = m_d->model->headerData(row, Qt::Vertical, TimelineFramesModel::LayerUsedInTimelineRole).toBool(); - m_d->model->setHeaderData(row, Qt::Vertical, !status, TimelineFramesModel::LayerUsedInTimelineRole); -} - void TimelineFramesView::slotNewFrame() { QModelIndex index = currentIndex(); diff --git a/plugins/dockers/defaultdockers/kis_layer_box.cpp b/plugins/dockers/defaultdockers/kis_layer_box.cpp --- a/plugins/dockers/defaultdockers/kis_layer_box.cpp +++ b/plugins/dockers/defaultdockers/kis_layer_box.cpp @@ -587,9 +587,9 @@ menu.addSeparator(); - if (singleLayer) { - addActionToMenu(&menu, "show_in_timeline"); + addActionToMenu(&menu, "show_in_timeline"); + if (singleLayer) { KisNodeSP node = m_filteringModel->nodeFromIndex(index); if (node && !node->inherits("KisTransformMask")) { addActionToMenu(&menu, "isolate_layer");