Skip to content

Commit

Permalink
Renderer: support In/Out range #310
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Nov 11, 2024
1 parent 67c7c1b commit 11f4680
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 14 deletions.
48 changes: 38 additions & 10 deletions src/app/GUI/RenderWidgets/rendersettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<int>(&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);
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/app/GUI/RenderWidgets/rendersettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <QDoubleSpinBox>
#include <QHBoxLayout>
#include <QComboBox>
#include <QPushButton>

class RenderSettingsDialog : public QDialog {
Q_OBJECT
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/core/canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 11f4680

Please sign in to comment.