mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-01 05:46:06 -04:00
--User changes
-Edits will not save back to the file in memory on render completion when preview renderer is running. --Bug fixes -dc_perlin was crashing on Nvidia when using SP. -Duplicate images were randomly getting added to the file in memory. -Crash when opening an Xml with less than 2 flames in it. --Code changes -Use raw array of floats in OpenCL for perlin noise, rather than float3/double3. -Add some default cases to dc_perlin. -Redo singleton pattern yet again. Deriving from a templated Singleton<T> class was creating a separate instance per module. Now only one instance of each type will ever be created and it will be wrapped in a shared_ptr which guarantees its deletion as main() exits.
This commit is contained in:
@ -400,7 +400,7 @@ void FractoriumFinalRenderDialog::OnDoSequenceCheckBoxStateChanged(int state)
|
||||
/// <param name="d">Ignored</param>
|
||||
void FractoriumFinalRenderDialog::OnCurrentSpinChanged(int d)
|
||||
{
|
||||
m_Controller->SetEmber(d - 1);
|
||||
m_Controller->SetEmber(d - 1, false);
|
||||
m_Controller->SyncCurrentToGui();
|
||||
SetMemory();
|
||||
}
|
||||
@ -743,7 +743,7 @@ bool FractoriumFinalRenderDialog::CreateControllerFromGUI(bool createRenderer)
|
||||
if (m_Controller.get())
|
||||
{
|
||||
m_Controller->SetEmberFile(efd);//Convert float to double or set double verbatim;
|
||||
m_Controller->SetEmber(index);
|
||||
m_Controller->SetEmber(index, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ template <typename T> void FinalRenderEmberController<T>::CopyEmberFile(EmberFil
|
||||
/// </summary>
|
||||
/// <param name="index">The index in the file from which to retrieve the ember</param>
|
||||
template <typename T>
|
||||
void FinalRenderEmberController<T>::SetEmber(size_t index)
|
||||
void FinalRenderEmberController<T>::SetEmber(size_t index, bool verbatim)
|
||||
{
|
||||
if (index < m_EmberFile.Size())
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
virtual void SetEmberFile(const EmberFile<double>& emberFile) override;
|
||||
virtual void CopyEmberFile(EmberFile<double>& emberFile, std::function<void(Ember<double>& ember)> perEmberOperation/* = [&](Ember<double>& ember) { }*/) override;
|
||||
#endif
|
||||
virtual void SetEmber(size_t index) override;
|
||||
virtual void SetEmber(size_t index, bool verbatim) override;
|
||||
virtual bool Render() override;
|
||||
virtual bool CreateRenderer(eRendererType renderType, const vector<pair<size_t, size_t>>& devices, bool shared = true) override;
|
||||
virtual int ProgressFunc(Ember<T>& ember, void* foo, double fraction, int stage, double etaMs) override;
|
||||
|
@ -134,7 +134,7 @@ FractoriumEmberController<T>::~FractoriumEmberController() { }
|
||||
/// These are used to preserve the current ember/file when switching between renderers.
|
||||
/// Note that some precision will be lost when going from double to float.
|
||||
/// </summary>
|
||||
template <typename T> void FractoriumEmberController<T>::SetEmber(const Ember<float>& ember, bool verbatim) { SetEmberPrivate<float>(ember, verbatim); }
|
||||
template <typename T> void FractoriumEmberController<T>::SetEmber(const Ember<float>& ember, bool verbatim, bool updatePointer) { SetEmberPrivate<float>(ember, verbatim, updatePointer); }
|
||||
template <typename T> void FractoriumEmberController<T>::CopyEmber(Ember<float>& ember, std::function<void(Ember<float>& ember)> perEmberOperation) { ember = m_Ember; perEmberOperation(ember); }
|
||||
template <typename T> void FractoriumEmberController<T>::SetEmberFile(const EmberFile<float>& emberFile) { m_EmberFile = emberFile; }
|
||||
template <typename T> void FractoriumEmberController<T>::CopyEmberFile(EmberFile<float>& emberFile, std::function<void(Ember<float>& ember)> perEmberOperation)
|
||||
@ -146,7 +146,7 @@ template <typename T> void FractoriumEmberController<T>::CopyEmberFile(EmberFile
|
||||
template <typename T> void FractoriumEmberController<T>::SetTempPalette(const Palette<float>& palette) { m_TempPalette = palette; }
|
||||
template <typename T> void FractoriumEmberController<T>::CopyTempPalette(Palette<float>& palette) { palette = m_TempPalette; }
|
||||
#ifdef DO_DOUBLE
|
||||
template <typename T> void FractoriumEmberController<T>::SetEmber(const Ember<double>& ember, bool verbatim) { SetEmberPrivate<double>(ember, verbatim); }
|
||||
template <typename T> void FractoriumEmberController<T>::SetEmber(const Ember<double>& ember, bool verbatim, bool updatePointer) { SetEmberPrivate<double>(ember, verbatim, updatePointer); }
|
||||
template <typename T> void FractoriumEmberController<T>::CopyEmber(Ember<double>& ember, std::function<void(Ember<double>& ember)> perEmberOperation) { ember = m_Ember; perEmberOperation(ember); }
|
||||
template <typename T> void FractoriumEmberController<T>::SetEmberFile(const EmberFile<double>& emberFile) { m_EmberFile = emberFile; }
|
||||
template <typename T> void FractoriumEmberController<T>::CopyEmberFile(EmberFile<double>& emberFile, std::function<void(Ember<double>& ember)> perEmberOperation)
|
||||
@ -173,8 +173,9 @@ void FractoriumEmberController<T>::ConstrainDimensions(Ember<T>& ember)
|
||||
/// Resets the rendering process.
|
||||
/// </summary>
|
||||
/// <param name="index">The index in the file from which to retrieve the ember</param>
|
||||
/// <param name="verbatim">If true, do not overwrite temporal samples, quality or supersample value, else overwrite.</param>
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::SetEmber(size_t index)
|
||||
void FractoriumEmberController<T>::SetEmber(size_t index, bool verbatim)
|
||||
{
|
||||
if (index < m_EmberFile.Size())
|
||||
{
|
||||
@ -188,7 +189,7 @@ void FractoriumEmberController<T>::SetEmber(size_t index)
|
||||
}
|
||||
|
||||
ClearUndo();
|
||||
SetEmber(*m_EmberFile.Get(index));
|
||||
SetEmber(*m_EmberFile.Get(index), verbatim, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,9 +319,10 @@ void FractoriumEmberController<T>::UpdateXform(std::function<void(Xform<T>*)> fu
|
||||
/// </summary>
|
||||
/// <param name="ember">The ember to set as the current</param>
|
||||
/// <param name="verbatim">If true, do not overwrite temporal samples, quality or supersample value, else overwrite.</param>
|
||||
/// <param name="updatePointer">If true, update the current ember pointer to the address of the one passed in.</param>
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
void FractoriumEmberController<T>::SetEmberPrivate(const Ember<U>& ember, bool verbatim)
|
||||
void FractoriumEmberController<T>::SetEmberPrivate(const Ember<U>& ember, bool verbatim, bool updatePointer)
|
||||
{
|
||||
if (ember.m_Name != m_Ember.m_Name)
|
||||
m_LastSaveCurrent = "";
|
||||
@ -328,7 +330,9 @@ void FractoriumEmberController<T>::SetEmberPrivate(const Ember<U>& ember, bool v
|
||||
size_t w = m_Ember.m_FinalRasW;//Cache values for use below.
|
||||
size_t h = m_Ember.m_FinalRasH;
|
||||
m_Ember = ember;
|
||||
m_EmberFilePointer = &ember;
|
||||
|
||||
if (updatePointer)
|
||||
m_EmberFilePointer = &ember;
|
||||
|
||||
if (!verbatim)
|
||||
{
|
||||
|
@ -52,21 +52,21 @@ public:
|
||||
virtual ~FractoriumEmberControllerBase();
|
||||
|
||||
//Embers.
|
||||
virtual void SetEmber(const Ember<float>& ember, bool verbatim = false) { }
|
||||
virtual void SetEmber(const Ember<float>& ember, bool verbatim, bool updatePointer) { }
|
||||
virtual void CopyEmber(Ember<float>& ember, std::function<void(Ember<float>& ember)> perEmberOperation/* = [&](Ember<float>& ember) { }*/) { }//Uncomment default lambdas once LLVM fixes a crash in their compiler with default lambda parameters.//TODO
|
||||
virtual void SetEmberFile(const EmberFile<float>& emberFile) { }
|
||||
virtual void CopyEmberFile(EmberFile<float>& emberFile, std::function<void(Ember<float>& ember)> perEmberOperation/* = [&](Ember<float>& ember) { }*/) { }
|
||||
virtual void SetTempPalette(const Palette<float>& palette) { }
|
||||
virtual void CopyTempPalette(Palette<float>& palette) { }
|
||||
#ifdef DO_DOUBLE
|
||||
virtual void SetEmber(const Ember<double>& ember, bool verbatim = false) { }
|
||||
virtual void SetEmber(const Ember<double>& ember, bool verbatim, bool updatePointer) { }
|
||||
virtual void CopyEmber(Ember<double>& ember, std::function<void(Ember<double>& ember)> perEmberOperation/* = [&](Ember<double>& ember) { }*/) { }
|
||||
virtual void SetEmberFile(const EmberFile<double>& emberFile) { }
|
||||
virtual void CopyEmberFile(EmberFile<double>& emberFile, std::function<void(Ember<double>& ember)> perEmberOperation/* = [&](Ember<double>& ember) { }*/) { }
|
||||
virtual void SetTempPalette(const Palette<double>& palette) { }
|
||||
virtual void CopyTempPalette(Palette<double>& palette) { }
|
||||
#endif
|
||||
virtual void SetEmber(size_t index) { }
|
||||
virtual void SetEmber(size_t index, bool verbatim) { }
|
||||
//virtual void Clear() { }
|
||||
virtual void AddXform() { }
|
||||
virtual void AddLinkedXform() { }
|
||||
@ -95,7 +95,7 @@ public:
|
||||
virtual void OpenAndPrepFiles(const QStringList& filenames, bool append) { }
|
||||
virtual void SaveCurrentAsXml() { }
|
||||
virtual void SaveEntireFileAsXml() { }
|
||||
virtual void SaveCurrentToOpenedFile() { }
|
||||
virtual uint SaveCurrentToOpenedFile() { return 0; }
|
||||
virtual void Undo() { }//Edit.
|
||||
virtual void Redo() { }
|
||||
virtual void CopyXml() { }
|
||||
@ -290,21 +290,21 @@ public:
|
||||
virtual ~FractoriumEmberController();
|
||||
|
||||
//Embers.
|
||||
virtual void SetEmber(const Ember<float>& ember, bool verbatim = false) override;
|
||||
virtual void SetEmber(const Ember<float>& ember, bool verbatim, bool updatePointer) override;
|
||||
virtual void CopyEmber(Ember<float>& ember, std::function<void(Ember<float>& ember)> perEmberOperation/* = [&](Ember<float>& ember) { }*/) override;
|
||||
virtual void SetEmberFile(const EmberFile<float>& emberFile) override;
|
||||
virtual void CopyEmberFile(EmberFile<float>& emberFile, std::function<void(Ember<float>& ember)> perEmberOperation/* = [&](Ember<float>& ember) { }*/) override;
|
||||
virtual void SetTempPalette(const Palette<float>& palette) override;
|
||||
virtual void CopyTempPalette(Palette<float>& palette) override;
|
||||
#ifdef DO_DOUBLE
|
||||
virtual void SetEmber(const Ember<double>& ember, bool verbatim = false) override;
|
||||
virtual void SetEmber(const Ember<double>& ember, bool verbatim, bool updatePointer) override;
|
||||
virtual void CopyEmber(Ember<double>& ember, std::function<void(Ember<double>& ember)> perEmberOperation/* = [&](Ember<double>& ember) { }*/) override;
|
||||
virtual void SetEmberFile(const EmberFile<double>& emberFile) override;
|
||||
virtual void CopyEmberFile(EmberFile<double>& emberFile, std::function<void(Ember<double>& ember)> perEmberOperation/* = [&](Ember<double>& ember) { }*/) override;
|
||||
virtual void SetTempPalette(const Palette<double>& palette) override;
|
||||
virtual void CopyTempPalette(Palette<double>& palette) override;
|
||||
#endif
|
||||
virtual void SetEmber(size_t index) override;
|
||||
virtual void SetEmber(size_t index, bool verbatim) override;
|
||||
//virtual void Clear() override { }
|
||||
virtual void AddXform() override;
|
||||
virtual void AddLinkedXform() override;
|
||||
@ -336,7 +336,7 @@ public:
|
||||
virtual void OpenAndPrepFiles(const QStringList& filenames, bool append) override;
|
||||
virtual void SaveCurrentAsXml() override;
|
||||
virtual void SaveEntireFileAsXml() override;
|
||||
virtual void SaveCurrentToOpenedFile() override;
|
||||
virtual uint SaveCurrentToOpenedFile() override;
|
||||
virtual void Undo() override;
|
||||
virtual void Redo() override;
|
||||
virtual void CopyXml() override;
|
||||
@ -472,7 +472,7 @@ public:
|
||||
private:
|
||||
//Embers.
|
||||
void ApplyXmlSavingTemplate(Ember<T>& ember);
|
||||
template <typename U> void SetEmberPrivate(const Ember<U>& ember, bool verbatim);
|
||||
template <typename U> void SetEmberPrivate(const Ember<U>& ember, bool verbatim, bool updatePointer);
|
||||
|
||||
//Params.
|
||||
void ParamsToEmber(Ember<T>& ember);
|
||||
@ -509,7 +509,7 @@ private:
|
||||
Xform<T> m_CopiedFinalXform;
|
||||
Palette<T> m_TempPalette;
|
||||
PaletteList<T> m_PaletteList;
|
||||
VariationList<T>& m_VariationList;
|
||||
shared_ptr<VariationList<T>> m_VariationList;
|
||||
unique_ptr<SheepTools<T, float>> m_SheepTools;
|
||||
unique_ptr<GLEmberController<T>> m_GLController;
|
||||
unique_ptr<EmberNs::Renderer<T, float>> m_PreviewRenderer = make_unique<EmberNs::Renderer<T, float>>();
|
||||
|
@ -243,7 +243,7 @@ void FractoriumEmberController<T>::EmberTreeItemDoubleClicked(QTreeWidgetItem* i
|
||||
{
|
||||
//qDebug() << "Setting current ember to: " << QString::fromStdString(emberItem->GetEmber()->m_Name);
|
||||
ClearUndo();
|
||||
SetEmber(*emberItem->GetEmber());
|
||||
SetEmber(*emberItem->GetEmber(), false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ void FractoriumEmberController<T>::NewFlock(size_t count)
|
||||
void Fractorium::OnActionNewFlock(bool checked)
|
||||
{
|
||||
m_Controller->NewFlock(m_Settings->RandomCount());
|
||||
m_Controller->SetEmber(0);
|
||||
m_Controller->SetEmber(0, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -102,7 +102,7 @@ void FractoriumEmberController<T>::NewEmptyFlameInCurrentFile()
|
||||
m_EmberFile.m_Embers.push_back(ember);//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync.
|
||||
m_EmberFile.MakeNamesUnique();
|
||||
UpdateLibraryTree();
|
||||
SetEmber(m_EmberFile.Size() - 1);
|
||||
SetEmber(m_EmberFile.Size() - 1, false);
|
||||
}
|
||||
|
||||
void Fractorium::OnActionNewEmptyFlameInCurrentFile(bool checked) { m_Controller->NewEmptyFlameInCurrentFile(); }
|
||||
@ -124,7 +124,7 @@ void FractoriumEmberController<T>::NewRandomFlameInCurrentFile()
|
||||
m_EmberFile.m_Embers.push_back(ember);//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync.
|
||||
m_EmberFile.MakeNamesUnique();
|
||||
UpdateLibraryTree();
|
||||
SetEmber(m_EmberFile.Size() - 1);
|
||||
SetEmber(m_EmberFile.Size() - 1, false);
|
||||
}
|
||||
|
||||
void Fractorium::OnActionNewRandomFlameInCurrentFile(bool checked) { m_Controller->NewRandomFlameInCurrentFile(); }
|
||||
@ -144,7 +144,7 @@ void FractoriumEmberController<T>::CopyFlameInCurrentFile()
|
||||
m_EmberFile.m_Embers.push_back(ember);//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync.
|
||||
m_EmberFile.MakeNamesUnique();
|
||||
UpdateLibraryTree();
|
||||
SetEmber(m_EmberFile.Size() - 1);
|
||||
SetEmber(m_EmberFile.Size() - 1, false);
|
||||
}
|
||||
|
||||
void Fractorium::OnActionCopyFlameInCurrentFile(bool checked) { m_Controller->CopyFlameInCurrentFile(); }
|
||||
@ -231,7 +231,7 @@ void FractoriumEmberController<T>::OpenAndPrepFiles(const QStringList& filenames
|
||||
FillLibraryTree(append ? previousSize - 1 : 0);
|
||||
|
||||
ClearUndo();
|
||||
SetEmber(previousSize);
|
||||
SetEmber(previousSize, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,37 +365,45 @@ void Fractorium::OnActionSaveCurrentScreen(bool checked)
|
||||
|
||||
/// <summary>
|
||||
/// Save the current ember back to its position in the opened file.
|
||||
/// This will not take any action if the previews are still rendering because
|
||||
/// this writes to memory the preview renderer might be reading, and also stops the
|
||||
/// preview renderer.
|
||||
/// This does not save to disk.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::SaveCurrentToOpenedFile()
|
||||
uint FractoriumEmberController<T>::SaveCurrentToOpenedFile()
|
||||
{
|
||||
uint i = 0;
|
||||
bool fileFound = false;
|
||||
|
||||
for (auto& it : m_EmberFile.m_Embers)
|
||||
if (!m_PreviewRunning)
|
||||
{
|
||||
if (&it == m_EmberFilePointer)//Just compare memory addresses.
|
||||
for (auto& it : m_EmberFile.m_Embers)
|
||||
{
|
||||
it = m_Ember;//Save it to the opened file in memory.
|
||||
fileFound = true;
|
||||
break;
|
||||
if (&it == m_EmberFilePointer)//Just compare memory addresses.
|
||||
{
|
||||
it = m_Ember;//Save it to the opened file in memory.
|
||||
fileFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
i++;
|
||||
if (!fileFound)
|
||||
{
|
||||
StopPreviewRender();
|
||||
m_EmberFile.m_Embers.push_back(m_Ember);
|
||||
m_EmberFile.MakeNamesUnique();
|
||||
UpdateLibraryTree();
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderPreviews(i, i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileFound)
|
||||
{
|
||||
StopPreviewRender();
|
||||
m_EmberFile.m_Embers.push_back(m_Ember);
|
||||
m_EmberFile.MakeNamesUnique();
|
||||
UpdateLibraryTree();
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderPreviews(i, i + 1);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -419,9 +427,7 @@ void FractoriumEmberController<T>::Undo()
|
||||
int index = m_Ember.GetTotalXformIndex(CurrentXform());
|
||||
m_LastEditWasUndoRedo = true;
|
||||
m_UndoIndex = std::max<size_t>(0u, m_UndoIndex - 1u);
|
||||
auto temp = m_EmberFilePointer;//m_EmberFilePointer will be set to point to whatever is passed in, which we don't want since it's coming from the undo list...
|
||||
SetEmber(m_UndoList[m_UndoIndex], true);
|
||||
m_EmberFilePointer = temp;//...keep it pointing to the original one in the file.
|
||||
SetEmber(m_UndoList[m_UndoIndex], true, false);//Don't update pointer because it's coming from the undo list...
|
||||
m_EditState = eEditUndoState::UNDO_REDO;
|
||||
|
||||
if (index >= 0)
|
||||
@ -445,9 +451,7 @@ void FractoriumEmberController<T>::Redo()
|
||||
int index = m_Ember.GetTotalXformIndex(CurrentXform());
|
||||
m_LastEditWasUndoRedo = true;
|
||||
m_UndoIndex = std::min<size_t>(m_UndoIndex + 1, m_UndoList.size() - 1);
|
||||
auto temp = m_EmberFilePointer;
|
||||
SetEmber(m_UndoList[m_UndoIndex], true);
|
||||
m_EmberFilePointer = temp;//...keep it pointing to the original one in the file.
|
||||
SetEmber(m_UndoList[m_UndoIndex], true, false);
|
||||
m_EditState = eEditUndoState::UNDO_REDO;
|
||||
|
||||
if (index >= 0)
|
||||
@ -552,7 +556,7 @@ void FractoriumEmberController<T>::PasteXmlAppend()
|
||||
|
||||
m_EmberFile.MakeNamesUnique();
|
||||
UpdateLibraryTree();
|
||||
SetEmber(previousSize);
|
||||
SetEmber(previousSize, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,7 +615,7 @@ void FractoriumEmberController<T>::PasteXmlOver()
|
||||
|
||||
m_EmberFile.MakeNamesUnique();
|
||||
FillLibraryTree();
|
||||
SetEmber(0);
|
||||
SetEmber(0, false);
|
||||
}
|
||||
|
||||
void Fractorium::OnActionPasteXmlOver(bool checked) { m_Controller->PasteXmlOver(); }
|
||||
|
@ -455,7 +455,7 @@ bool FractoriumEmberController<T>::Render()
|
||||
gl->update();
|
||||
|
||||
if (ProcessState() == eProcessState::ACCUM_DONE)
|
||||
SaveCurrentToOpenedFile();
|
||||
SaveCurrentToOpenedFile();//Will not save if the previews are still rendering.
|
||||
|
||||
//Uncomment for debugging kernel build and execution errors.
|
||||
//m_Fractorium->ui.InfoRenderingTextEdit->setText(QString::fromStdString(m_Fractorium->m_Wrapper.DumpInfo()));
|
||||
@ -671,6 +671,7 @@ bool Fractorium::CreateControllerFromOptions()
|
||||
auto blur = m_PaletteBlurSpin->value();
|
||||
auto freq = m_PaletteFrequencySpin->value();
|
||||
double scale;
|
||||
uint current = 0;
|
||||
#ifdef DO_DOUBLE
|
||||
Ember<double> ed;
|
||||
EmberFile<double> efd;
|
||||
@ -686,6 +687,7 @@ bool Fractorium::CreateControllerFromOptions()
|
||||
if (m_Controller.get())
|
||||
{
|
||||
scale = m_Controller->LockedScale();
|
||||
current = m_Controller->SaveCurrentToOpenedFile();
|
||||
m_Controller->StopPreviewRender();//Must stop any previews first, else changing controllers will crash the program.
|
||||
m_Controller->CopyTempPalette(tempPalette);//Convert float to double or save double verbatim;
|
||||
//Replace below with this once LLVM fixes a crash in their compiler with default lambda parameters.//TODO
|
||||
@ -713,8 +715,8 @@ bool Fractorium::CreateControllerFromOptions()
|
||||
if (m_Controller.get())
|
||||
{
|
||||
ed.m_Palette = tempPalette;//Restore base temp palette. Adjustments will be then be applied and stored back in in m_Ember.m_Palette below.
|
||||
m_Controller->SetEmber(ed);//Convert float to double or set double verbatim. This will assign m_Ember.m_Palette (which was just tempPalette) to m_TempPalette.
|
||||
m_Controller->SetEmberFile(efd);
|
||||
m_Controller->SetEmber(current, true);
|
||||
m_Controller->LockedScale(scale);
|
||||
//Setting these and updating the GUI overwrites the work of clearing them done in SetEmber() above.
|
||||
//It's a corner case, but doesn't seem to matter.
|
||||
|
@ -279,7 +279,7 @@ void FractoriumEmberController<T>::AddFinalXform()
|
||||
Update([&]()
|
||||
{
|
||||
Xform<T> final;
|
||||
final.AddVariation(m_VariationList.GetVariationCopy(eVariationId::VAR_LINEAR));//Just a placeholder so other parts of the code don't see it as being empty.
|
||||
final.AddVariation(m_VariationList->GetVariationCopy(eVariationId::VAR_LINEAR));//Just a placeholder so other parts of the code don't see it as being empty.
|
||||
m_Ember.SetFinalXform(final);
|
||||
int index = int(m_Ember.TotalXformCount() - 1);//Set index to the last item.
|
||||
FillXforms(index);
|
||||
|
@ -84,8 +84,8 @@ void FractoriumEmberController<T>::FilteredVariations()
|
||||
m_FilteredVariations.clear();
|
||||
m_FilteredVariations.reserve(map.size());
|
||||
|
||||
for (auto i = 0; i < m_VariationList.Size(); i++)
|
||||
if (auto var = m_VariationList.GetVariation(i))
|
||||
for (auto i = 0; i < m_VariationList->Size(); i++)
|
||||
if (auto var = m_VariationList->GetVariation(i))
|
||||
if (map.contains(var->Name().c_str()) && map[var->Name().c_str()].toBool())
|
||||
m_FilteredVariations.push_back(var->VariationId());
|
||||
}
|
||||
@ -107,9 +107,9 @@ void FractoriumEmberController<T>::SetupVariationsTree()
|
||||
tree->clear();
|
||||
tree->blockSignals(true);
|
||||
|
||||
for (size_t i = 0; i < m_VariationList.Size(); i++)
|
||||
for (size_t i = 0; i < m_VariationList->Size(); i++)
|
||||
{
|
||||
auto var = m_VariationList.GetVariation(i);
|
||||
auto var = m_VariationList->GetVariation(i);
|
||||
auto parVar = dynamic_cast<const ParametricVariation<T>*>(var);
|
||||
//First add the variation, with a spinner for its weight.
|
||||
auto item = new VariationTreeWidgetItem(var->VariationId(), tree);
|
||||
@ -206,7 +206,7 @@ void FractoriumEmberController<T>::VariationSpinBoxValueChanged(double d)//Would
|
||||
{
|
||||
UpdateXform([&](Xform<T>* xform)
|
||||
{
|
||||
auto var = m_VariationList.GetVariation(sender->GetVariationId());//The variation attached to the sender, for reference only.
|
||||
auto var = m_VariationList->GetVariation(sender->GetVariationId());//The variation attached to the sender, for reference only.
|
||||
auto parVar = dynamic_cast<const ParametricVariation<T>*>(var);//The parametric cast of that variation.
|
||||
auto xformVar = xform->GetVariationById(var->VariationId());//The corresponding variation in the currently selected xform.
|
||||
auto widgetItem = sender->WidgetItem();
|
||||
@ -294,7 +294,7 @@ void FractoriumEmberController<T>::FillVariationTreeWithXform(Xform<T>* xform)
|
||||
auto item = dynamic_cast<VariationTreeWidgetItem*>(tree->topLevelItem(i));
|
||||
auto var = xform->GetVariationById(item->Id());//See if this variation in the tree was contained in the xform.
|
||||
auto parVar = dynamic_cast<ParametricVariation<T>*>(var);//Attempt cast to parametric variation for later.
|
||||
auto origParVar = dynamic_cast<const ParametricVariation<T>*>(m_VariationList.GetVariation(item->Id()));
|
||||
auto origParVar = dynamic_cast<const ParametricVariation<T>*>(m_VariationList->GetVariation(item->Id()));
|
||||
|
||||
if (auto spinBox = dynamic_cast<VariationTreeDoubleSpinBox*>(tree->itemWidget(item, 1)))//Get the widget for the item, and cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
{
|
||||
|
@ -27,6 +27,8 @@ int main(int argc, char* argv[])
|
||||
putenv(const_cast<char*>("GPU_MAX_ALLOC_PERCENT=100"));
|
||||
#endif
|
||||
int rv = -1;
|
||||
auto vlf = VariationList<float>::Instance();//Create two instances that will stay alive until this function exits.
|
||||
auto vld = VariationList<double>::Instance();//No further creations should occur after this.
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -128,26 +128,26 @@ void FractoriumVariationsDialog::OnSelectNoneButtonClicked(bool checked)
|
||||
void FractoriumVariationsDialog::Populate()
|
||||
{
|
||||
auto table = ui.VariationsTable;
|
||||
int size = int(std::max<size_t>(std::max<size_t>(m_VariationList.RegSize(), m_VariationList.PreSize()), m_VariationList.PostSize()));
|
||||
int size = int(std::max<size_t>(std::max<size_t>(m_VariationList->RegSize(), m_VariationList->PreSize()), m_VariationList->PostSize()));
|
||||
table->setRowCount(size);
|
||||
|
||||
for (auto i = 0; i < size; i++)
|
||||
{
|
||||
if (auto pre = m_VariationList.GetVariation(i, eVariationType::VARTYPE_PRE))
|
||||
if (auto pre = m_VariationList->GetVariation(i, eVariationType::VARTYPE_PRE))
|
||||
{
|
||||
auto cb = new QTableWidgetItem(pre->Name().c_str());
|
||||
table->setItem(i, 0, cb);
|
||||
SetCheckFromMap(cb, pre);
|
||||
}
|
||||
|
||||
if (auto reg = m_VariationList.GetVariation(i, eVariationType::VARTYPE_REG))
|
||||
if (auto reg = m_VariationList->GetVariation(i, eVariationType::VARTYPE_REG))
|
||||
{
|
||||
auto cb = new QTableWidgetItem(reg->Name().c_str());
|
||||
table->setItem(i, 1, cb);
|
||||
SetCheckFromMap(cb, reg);
|
||||
}
|
||||
|
||||
if (auto post = m_VariationList.GetVariation(i, eVariationType::VARTYPE_POST))
|
||||
if (auto post = m_VariationList->GetVariation(i, eVariationType::VARTYPE_POST))
|
||||
{
|
||||
auto cb = new QTableWidgetItem(post->Name().c_str());
|
||||
table->setItem(i, 2, cb);
|
||||
@ -209,7 +209,7 @@ void FractoriumVariationsDialog::DataToGui()
|
||||
{
|
||||
ForEachCell([&](QTableWidgetItem * cb)
|
||||
{
|
||||
if (auto var = m_VariationList.GetVariation(cb->text().toStdString()))
|
||||
if (auto var = m_VariationList->GetVariation(cb->text().toStdString()))
|
||||
SetCheckFromMap(cb, var);
|
||||
});
|
||||
}
|
||||
@ -221,7 +221,7 @@ void FractoriumVariationsDialog::GuiToData()
|
||||
{
|
||||
ForEachCell([&](QTableWidgetItem * cb)
|
||||
{
|
||||
if (auto var = m_VariationList.GetVariation(cb->text().toStdString()))
|
||||
if (auto var = m_VariationList->GetVariation(cb->text().toStdString()))
|
||||
m_Vars[cb->text()] = (cb->checkState() == Qt::Checked);
|
||||
});
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
void GuiToData();
|
||||
void Populate();
|
||||
void SetCheckFromMap(QTableWidgetItem* cb, const Variation<float>* var);
|
||||
VariationList<float>& m_VariationList;
|
||||
shared_ptr<VariationList<float>> m_VariationList;
|
||||
QMap<QString, QVariant> m_Vars;
|
||||
FractoriumSettings* m_Settings;
|
||||
Ui::VariationsDialog ui;
|
||||
|
Reference in New Issue
Block a user