Skip to content
Permalink
Browse files

Add layer not visible warnings to new/delete/duplicate frame

  • Loading branch information...
scribblemaniac committed Apr 13, 2019
1 parent 1dc46e6 commit 8cc1f8bddee29db47b1cfa85c771f66bb3e529a4
Showing with 21 additions and 1 deletion.
  1. +6 −0 app/src/actioncommands.cpp
  2. +14 −0 core_lib/src/interface/editor.cpp
  3. +1 −1 core_lib/src/interface/scribblearea.cpp
@@ -49,6 +49,7 @@ GNU General Public License for more details.
#include "aboutdialog.h"
#include "doubleprogressdialog.h"
#include "checkupdatesdialog.h"
#include "scribblearea.h"


ActionCommands::ActionCommands(QWidget* parent) : QObject(parent)
@@ -542,6 +543,11 @@ void ActionCommands::duplicateKey()
{
Layer* layer = mEditor->layers()->currentLayer();
if (layer == nullptr) return;
if (!layer->visible())
{
mEditor->getScribbleArea()->showLayerNotVisibleWarning();
return;
}

KeyFrame* key = layer->getKeyFrameAt(mEditor->currentFrame());
if (key == nullptr) return;
@@ -923,6 +923,12 @@ KeyFrame* Editor::addKeyFrame(int layerNumber, int frameIndex)
return nullptr;
}

if (!layer->visible())
{
mScribbleArea->showLayerNotVisibleWarning();
return nullptr;
}

while (layer->keyExists(frameIndex))
{
frameIndex += 1;
@@ -939,6 +945,14 @@ KeyFrame* Editor::addKeyFrame(int layerNumber, int frameIndex)
void Editor::removeKey()
{
Layer* layer = layers()->currentLayer();
Q_ASSERT(layer != nullptr);

if (!layer->visible())
{
mScribbleArea->showLayerNotVisibleWarning();
return;
}

if (!layer->keyExistsWhichCovers(currentFrame()))
{
return;
@@ -714,7 +714,7 @@ QPointF ScribbleArea::getCurrentOffset()
void ScribbleArea::showLayerNotVisibleWarning()
{
QMessageBox::warning(this, tr("Warning"),
tr("You are drawing on a hidden layer! Please select another layer (or make the current layer visible)."),
tr("You are trying to modify a hidden layer! Please select another layer (or make the current layer visible)."),
QMessageBox::Ok,
QMessageBox::Ok);
}

0 comments on commit 8cc1f8b

Please sign in to comment.
You can’t perform that action at this time.