Skip to content

Commit

Permalink
Fix render queue with multiple scenes
Browse files Browse the repository at this point in the history
Rendering multiple scenes in queue now works, the renderer will switch to the targeted scene before rendering.
  • Loading branch information
rodlie committed Aug 1, 2024
1 parent 31f74f8 commit 970c151
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/GUI/RenderWidgets/renderwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,17 @@ void RenderWidget::render(RenderInstanceSettings &settings)
mRenderProgressBar->setValue(renderSettings.fMinFrame);
handleRenderState(RenderState::waiting);
mCurrentRenderedSettings = &settings;

// the scene we want to render MUST be current if multiple scenes are in queue
const auto scene = mCurrentRenderedSettings->getTargetCanvas();
if (scene) {
const auto handler = MainWindow::sGetInstance()->getLayoutHandler();
const int index = handler->getSceneId(scene);
if (index > -1 && !handler->isCurrentScene(index)) {
handler->setCurrentScene(index);
}
}

RenderHandler::sInstance->renderFromSettings(&settings);
connect(&settings, &RenderInstanceSettings::renderFrameChanged,
this, &RenderWidget::setRenderedFrame);
Expand Down
4 changes: 4 additions & 0 deletions src/app/GUI/layouthandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ class LayoutHandler : public QObject {
mNumberLayouts - nCLays + relCurrentId;
setCurrent(absId);
}
int getSceneId(const Canvas* const scene) { return sceneId(scene); };
bool isCurrentScene(const int index) { return index == mCurrentId; };
void setCurrentScene(const int index) { setCurrent(index); };

private:
void rename(const int id, const QString& newName) {
auto& layout = mLayouts[uint(id)];
Expand Down
5 changes: 5 additions & 0 deletions src/app/GUI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2148,6 +2148,11 @@ void MainWindow::cmdAddAction(QAction *act)
eSettings::sInstance->fCommandPalette.append(act);
}

LayoutHandler *MainWindow::getLayoutHandler()
{
return mLayoutHandler;
}

stdsptr<void> MainWindow::lock()
{
if (mLock) { return mLock->ref<Lock>(); }
Expand Down
1 change: 1 addition & 0 deletions src/app/GUI/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class MainWindow : public QMainWindow
void updateAutoSaveBackupState();
void openRendererWindow();
void cmdAddAction(QAction *act);
LayoutHandler* getLayoutHandler();

protected:
void lockFinished();
Expand Down

0 comments on commit 970c151

Please sign in to comment.