From 2a98e8c05bf7bf3a6338ff6064e11aa67667a53b Mon Sep 17 00:00:00 2001 From: mfeemster Date: Sun, 19 Oct 2014 12:29:12 -0700 Subject: [PATCH] FinalRenderEmberController: Fix unique names and estimated iter count with strips. --- Source/Fractorium/FinalRenderEmberController.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/Fractorium/FinalRenderEmberController.cpp b/Source/Fractorium/FinalRenderEmberController.cpp index cb74d4b..ba0753e 100644 --- a/Source/Fractorium/FinalRenderEmberController.cpp +++ b/Source/Fractorium/FinalRenderEmberController.cpp @@ -155,7 +155,7 @@ FinalRenderEmberController::FinalRenderEmberController(FractoriumFinalRenderD m_GuiState = m_FinalRenderDialog->State();//Cache render settings from the GUI before running. bool doAll = m_GuiState.m_DoAll && m_EmberFile.Size() > 1; unsigned int currentStripForProgress = 0;//Sort of a hack to get the strip value to the progress function. - QString path = doAll ? ComposePath(QString::fromStdString(m_EmberFile.m_Embers[0].m_Name)) : ComposePath(Name()); + QString path = EmberFile::UniqueFilename(doAll ? ComposePath(QString::fromStdString(m_EmberFile.m_Embers[0].m_Name)) : ComposePath(Name())); QString backup = path + "_backup.flame"; //Save backup Xml. @@ -219,7 +219,7 @@ FinalRenderEmberController::FinalRenderEmberController(FractoriumFinalRenderD //Render each image, cancelling if m_Run ever gets set to false. for (i = 0; i < m_EmberFile.Size() && m_Run; i++) { - Output("Image " + ToString(m_FinishedImageCount) + ":\n" + ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name))); + Output("Image " + ToString(m_FinishedImageCount) + ":\n" + EmberFile::UniqueFilename(ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name)))); m_Renderer->Reset();//Have to manually set this since the ember is not set each time through. m_RenderTimer.Tic();//Toc() is called in RenderComplete(). @@ -244,7 +244,7 @@ FinalRenderEmberController::FinalRenderEmberController(FractoriumFinalRenderD //Render each image, cancelling if m_Run ever gets set to false. for (i = 0; i < m_EmberFile.Size() && m_Run; i++) { - Output("Image " + ToString(m_FinishedImageCount) + ":\n" + ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name))); + Output("Image " + ToString(m_FinishedImageCount) + ":\n" + EmberFile::UniqueFilename(ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name)))); m_Renderer->SetEmber(m_EmberFile.m_Embers[i]); m_Renderer->PrepFinalAccumVector(m_FinalImage);//Must manually call this first because it could be erroneously made smaller due to strips if called inside Renderer::Run(). m_Stats.Clear(); @@ -272,7 +272,7 @@ FinalRenderEmberController::FinalRenderEmberController(FractoriumFinalRenderD m_Renderer->PrepFinalAccumVector(m_FinalImage);//Must manually call this first because it could be erroneously made smaller due to strips if called inside Renderer::Run(). m_Stats.Clear(); Memset(m_FinalImage); - Output(ComposePath(QString::fromStdString(m_Ember->m_Name))); + Output(EmberFile::UniqueFilename(ComposePath(QString::fromStdString(m_Ember->m_Name)))); m_RenderTimer.Tic();//Toc() is called in RenderComplete(). StripsRender(m_Renderer.get(), *m_Ember, m_FinalImage, 0, m_GuiState.m_Strips, m_GuiState.m_YAxisUp, @@ -496,7 +496,7 @@ void FinalRenderEmberController::SyncCurrentToGui() m_FinalRenderDialog->Scale(m_Ember->ScaleType()); m_FinalRenderDialog->m_QualitySpin->SetValueStealth(m_Ember->m_Quality); m_FinalRenderDialog->m_SupersampleSpin->SetValueStealth(m_Ember->m_Supersample); - m_FinalRenderDialog->Path(ComposePath(EmberFile::UniqueFilename(Name()))); + m_FinalRenderDialog->Path(EmberFile::UniqueFilename(ComposePath(Name()))); } /// @@ -574,6 +574,8 @@ pair FinalRenderEmberController::SyncAndComputeMemory() { bool b = false; unsigned int channels = m_FinalRenderDialog->Ext() == "png" ? 4 : 3;//4 channels for Png, else 3. + size_t strips = VerifyStrips(m_Ember->m_FinalRasH, m_FinalRenderDialog->Strips(), + [&](const string& s) { }, [&](const string& s) { }, [&](const string& s) { }); SyncGuiToEmbers(); m_Renderer->SetEmber(*m_Ember); @@ -585,7 +587,7 @@ pair FinalRenderEmberController::SyncAndComputeMemory() CancelPreviewRender(); m_FinalPreviewRenderFunc(); p.first = m_Renderer->MemoryRequired(m_FinalRenderDialog->Strips(), true); - p.second = m_Renderer->TotalIterCount(m_FinalRenderDialog->Strips()); + p.second = m_Renderer->TotalIterCount(strips); } return p; @@ -633,7 +635,7 @@ template void FinalRenderEmberController::RenderComplete(Ember& ember) { string renderTimeString = m_RenderTimer.Format(m_RenderTimer.Toc()), totalTimeString; - QString status, filename = ComposePath(EmberFile::UniqueFilename(QString::fromStdString(ember.m_Name))); + QString status, filename = EmberFile::UniqueFilename(ComposePath(QString::fromStdString(ember.m_Name))); QString itersString = ToString(m_Stats.m_Iters); QString itersPerSecString = ToString(size_t(m_Stats.m_Iters / (m_Stats.m_IterMs / 1000.0)));