diff --git a/src/app/GUI/RenderWidgets/rendersettingsdialog.cpp b/src/app/GUI/RenderWidgets/rendersettingsdialog.cpp index b3e41cd12..969b95aee 100644 --- a/src/app/GUI/RenderWidgets/rendersettingsdialog.cpp +++ b/src/app/GUI/RenderWidgets/rendersettingsdialog.cpp @@ -4,13 +4,14 @@ #include "Private/document.h" #include "canvas.h" -RenderSettingsDialog::RenderSettingsDialog( - const RenderInstanceSettings &settings, - QWidget *parent) : - QDialog(parent), - mInitialScene(settings.getTargetCanvas()), - mCurrentScene(mInitialScene), - mInitialSettings(settings.getRenderSettings()) { +RenderSettingsDialog::RenderSettingsDialog(const RenderInstanceSettings &settings, + QWidget *parent) + : QDialog(parent) + , mInitialScene(settings.getTargetCanvas()) + , mCurrentScene(mInitialScene) + , mInitialSettings(settings.getRenderSettings()) + , mFrameRangeButton(nullptr) +{ setWindowTitle(tr("Render Settings")); const auto mainLayout = new QVBoxLayout(this); @@ -19,14 +20,14 @@ RenderSettingsDialog::RenderSettingsDialog( const auto sceneLay = new QHBoxLayout; mSceneLabel = new QLabel(tr("Scene")); mSceneCombo = new QComboBox(); - for(const auto& canvas : Document::sInstance->fScenes) { + for (const auto& canvas : Document::sInstance->fScenes) { mSceneCombo->addItem(canvas->prp_getName()); } - if(mCurrentScene) mSceneCombo->setCurrentText(mCurrentScene->prp_getName()); + if (mCurrentScene) { mSceneCombo->setCurrentText(mCurrentScene->prp_getName()); } connect(mSceneCombo, qOverload(&QComboBox::currentIndexChanged), this, [this](const int id) { const auto newScene = Document::sInstance->fScenes.at(id).get(); - if(newScene) { + if (newScene) { const auto frameRange = newScene->getFrameRange(); mMinFrameSpin->setValue(frameRange.fMin); mMaxFrameSpin->setValue(frameRange.fMax); @@ -85,10 +86,37 @@ RenderSettingsDialog::RenderSettingsDialog( mMinFrameSpin->setValue(mInitialSettings.fMinFrame); mMaxFrameSpin->setValue(mInitialSettings.fMaxFrame); + const auto frameRangeMenu = new QMenu(this); + mFrameRangeButton = new QPushButton(QIcon::fromTheme("preferences"), + QString(), + this); + mFrameRangeButton->setObjectName("FlatButton"); + mFrameRangeButton->setToolTip(tr("Frame Range Options")); + + frameRangeMenu->addAction(QIcon::fromTheme("sequence"), + tr("Scene Range"), + this, [this]() { + if (!mCurrentScene) { return; } + mMinFrameSpin->setValue(mCurrentScene->getMinFrame()); + mMaxFrameSpin->setValue(mCurrentScene->getMaxFrame()); + }); + frameRangeMenu->addAction(QIcon::fromTheme("sequence"), + tr("In/Out Range"), + this, [this]() { + if (!mCurrentScene) { return; } + const auto fIn = mCurrentScene->getFrameIn(); + const auto fOut = mCurrentScene->getFrameOut(); + if (fIn.enabled) { mMinFrameSpin->setValue(fIn.frame); } + if (fOut.enabled) { mMaxFrameSpin->setValue(fOut.frame); } + }); + + mFrameRangeButton->setMenu(frameRangeMenu); + rangeLay->addWidget(mFrameRangeLabel); rangeLay->addWidget(mMinFrameSpin); rangeLay->addWidget(new QLabel(" - ")); rangeLay->addWidget(mMaxFrameSpin); + rangeLay->addWidget(mFrameRangeButton); mainLayout->addLayout(rangeLay); diff --git a/src/app/GUI/RenderWidgets/rendersettingsdialog.h b/src/app/GUI/RenderWidgets/rendersettingsdialog.h index b97eafcc4..2dea5495f 100644 --- a/src/app/GUI/RenderWidgets/rendersettingsdialog.h +++ b/src/app/GUI/RenderWidgets/rendersettingsdialog.h @@ -8,6 +8,7 @@ #include #include #include +#include class RenderSettingsDialog : public QDialog { Q_OBJECT @@ -49,6 +50,7 @@ class RenderSettingsDialog : public QDialog { QLabel *mFrameRangeLabel = nullptr; QSpinBox *mMinFrameSpin = nullptr; QSpinBox *mMaxFrameSpin = nullptr; + QPushButton *mFrameRangeButton; // QLabel *mFpsLabel = nullptr; // QDoubleSpinBox *mFpsSpin = nullptr; diff --git a/src/core/canvas.cpp b/src/core/canvas.cpp index e52845c5c..b214c483a 100644 --- a/src/core/canvas.cpp +++ b/src/core/canvas.cpp @@ -446,12 +446,12 @@ void Canvas::setFrameOut(const bool enabled, emit requestUpdate(); } -const FrameMarker Canvas::getFrameIn() +const FrameMarker Canvas::getFrameIn() const { return mIn; } -const FrameMarker Canvas::getFrameOut() +const FrameMarker Canvas::getFrameOut() const { return mOut; } diff --git a/src/core/canvas.h b/src/core/canvas.h index b72965db7..66569fcb6 100644 --- a/src/core/canvas.h +++ b/src/core/canvas.h @@ -357,8 +357,8 @@ class CORE_EXPORT Canvas : public CanvasBase const int frameIn); void setFrameOut(const bool enabled, const int frameOut); - const FrameMarker getFrameIn(); - const FrameMarker getFrameOut(); + const FrameMarker getFrameIn() const; + const FrameMarker getFrameOut() const; void setMarker(const QString &title, const int frame);