mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-02-01 10:30:08 -05:00
Merge branch 'master' into travis
This commit is contained in:
commit
41a886fdac
@ -879,8 +879,8 @@ public:
|
||||
|
||||
if (tempParVar != nullptr && (parVar->ParamCount() == tempParVar->ParamCount()))//This check will should always be true, but just check to be absolutely sure to avoid clobbering memory.
|
||||
{
|
||||
ParamWithName<T>* params = parVar->Params();
|
||||
ParamWithName<T>* tempParams = tempParVar->Params();
|
||||
auto params = parVar->Params();
|
||||
auto tempParams = tempParVar->Params();
|
||||
|
||||
for (l = 0; l < parVar->ParamCount(); l++)
|
||||
{
|
||||
|
@ -529,7 +529,7 @@ private:
|
||||
|
||||
if (parVar)
|
||||
{
|
||||
ParamWithName<T>* params = parVar->Params();
|
||||
auto params = parVar->Params();
|
||||
|
||||
for (j = 0; j < parVar->ParamCount(); j++)
|
||||
{
|
||||
|
@ -547,18 +547,18 @@ public:
|
||||
if (second != nullptr && first.size() == c.size())
|
||||
{
|
||||
second->Clear();
|
||||
ParamWithName<T>* secondParams = second->Params();
|
||||
auto secondParams = second->Params();
|
||||
|
||||
//Iterate through each of the source variations.
|
||||
for (size_t i = 0; i < first.size(); i++)
|
||||
{
|
||||
ParametricVariation<T>* firstVar = first[i];
|
||||
auto firstVar = first[i];
|
||||
|
||||
//Make sure the source variation at this index is the same type as the variation being written to.
|
||||
if (firstVar->VariationId() == second->VariationId())
|
||||
{
|
||||
size_t size = firstVar->ParamCount();
|
||||
ParamWithName<T>* firstParams = firstVar->Params();
|
||||
auto firstParams = firstVar->Params();
|
||||
|
||||
//Multiply each parameter of the variation at this index by the coefficient at this index, and add
|
||||
//the result to the corresponding parameter in second.
|
||||
|
@ -607,7 +607,9 @@ FilterAndAccum:
|
||||
AccumOnly:
|
||||
if (m_ProcessState == FILTER_DONE || forceOutput)
|
||||
{
|
||||
if (m_Callback && !m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, 0, 2, 0))//Original only allowed stages 0 and 1. Add 2 to mean final accum.
|
||||
//Original only allowed stages 0 and 1. Add 2 to mean final accum.
|
||||
//Do not update state/progress on forced output because it will be immediately overwritten.
|
||||
if (m_Callback && !forceOutput && !m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, 0, 2, 0))
|
||||
{
|
||||
Abort();
|
||||
success = RENDER_ABORT;
|
||||
|
@ -1232,7 +1232,7 @@ public:
|
||||
/// Abstract copy function. Derived classes must implement.
|
||||
/// </summary>
|
||||
/// <returns>A copy of this object</returns>
|
||||
virtual Variation<T>* Copy() = 0;
|
||||
virtual Variation<T>* Copy() const = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new Variation<float>, store it in the pointer reference passed in and
|
||||
@ -1695,7 +1695,7 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="name">The name to search for</param>
|
||||
/// <returns>A pointer to the parameter value if the name matched, else false.</returns>
|
||||
T* GetParam(const char* name)
|
||||
T* GetParam(const char* name) const
|
||||
{
|
||||
for (auto& param : m_Params)
|
||||
if (!_stricmp(param.Name().c_str(), name))
|
||||
@ -1825,8 +1825,8 @@ public:
|
||||
/// <summary>
|
||||
/// Accessors.
|
||||
/// </summary>
|
||||
ParamWithName<T>* Params() { return &m_Params[0]; }
|
||||
size_t ParamCount() { return m_Params.size(); }
|
||||
const ParamWithName<T>* Params() const { return &m_Params[0]; }
|
||||
size_t ParamCount() const { return m_Params.size(); }
|
||||
const vector<ParamWithName<T>>& ParamsVec() const { return m_Params; }
|
||||
|
||||
protected:
|
||||
@ -1898,7 +1898,7 @@ protected:
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() override \
|
||||
virtual Variation<T>* Copy() const override \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
@ -1925,7 +1925,7 @@ protected:
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() override \
|
||||
virtual Variation<T>* Copy() const override \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
@ -2011,7 +2011,7 @@ protected:
|
||||
CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() override \
|
||||
virtual Variation<T>* Copy() const override \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
@ -2042,7 +2042,7 @@ protected:
|
||||
CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() override \
|
||||
virtual Variation<T>* Copy() const override \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
|
@ -375,7 +375,7 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="index">The index in the list to retrieve</param>
|
||||
/// <returns>A pointer to the variation at the index if in range, else nullptr.</returns>
|
||||
Variation<T>* GetVariation(size_t index) { return index < m_Variations.size() ? m_Variations[index] : nullptr; }
|
||||
const Variation<T>* GetVariation(size_t index) const { return index < m_Variations.size() ? m_Variations[index] : nullptr; }
|
||||
|
||||
/// <summary>
|
||||
/// Get a pointer to the variation of a specified type at the specified index.
|
||||
@ -383,7 +383,7 @@ public:
|
||||
/// <param name="index">The index in the list to retrieve</param>
|
||||
/// <param name="varType">The type of variation to retrieve</param>
|
||||
/// <returns>A pointer to the variation of the specified type at the index if in range, else nullptr.</returns>
|
||||
Variation<T>* GetVariation(size_t index, eVariationType varType)
|
||||
const Variation<T>* GetVariation(size_t index, eVariationType varType) const
|
||||
{
|
||||
if (varType == VARTYPE_REG)
|
||||
return index < m_RegVariations.size() ? m_RegVariations[index] : nullptr;
|
||||
@ -402,15 +402,15 @@ public:
|
||||
/// <param name="index">The index in the list to make a copy of</param>
|
||||
/// <param name="weight">The weight to assign the new copy. Default: 1</param>
|
||||
/// <returns>A pointer to the variation at the index if in range, else nullptr.</returns>
|
||||
Variation<T>* GetVariationCopy(size_t index, T weight = 1) { return MakeCopyWithWeight(GetVariation(index), weight); }
|
||||
Variation<T>* GetVariationCopy(size_t index, eVariationType varType, T weight = 1) { return MakeCopyWithWeight(GetVariation(index, varType), weight); }
|
||||
Variation<T>* GetVariationCopy(size_t index, T weight = 1) const { return MakeCopyWithWeight(GetVariation(index), weight); }
|
||||
Variation<T>* GetVariationCopy(size_t index, eVariationType varType, T weight = 1) const { return MakeCopyWithWeight(GetVariation(index, varType), weight); }
|
||||
|
||||
/// <summary>
|
||||
/// Get a pointer to the variation with the specified ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID to search for</param>
|
||||
/// <returns>A pointer to the variation if found, else nullptr.</returns>
|
||||
Variation<T>* GetVariation(eVariationId id)
|
||||
const Variation<T>* GetVariation(eVariationId id) const
|
||||
{
|
||||
for (uint i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
||||
if (id == m_Variations[i]->VariationId())
|
||||
@ -426,14 +426,14 @@ public:
|
||||
/// <param name="id">The id of the variation in the list to make a copy of</param>
|
||||
/// <param name="weight">The weight to assign the new copy. Default: 1</param>
|
||||
/// <returns>A pointer to the variation with a matching ID, else nullptr.</returns>
|
||||
Variation<T>* GetVariationCopy(eVariationId id, T weight = 1) { return MakeCopyWithWeight(GetVariation(id), weight); }
|
||||
Variation<T>* GetVariationCopy(eVariationId id, T weight = 1) const { return MakeCopyWithWeight(GetVariation(id), weight); }
|
||||
|
||||
/// <summary>
|
||||
/// Get a pointer to the variation with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name to search for</param>
|
||||
/// <returns>A pointer to the variation if found, else nullptr.</returns>
|
||||
Variation<T>* GetVariation(const string& name)
|
||||
const Variation<T>* GetVariation(const string& name) const
|
||||
{
|
||||
for (uint i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
||||
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
|
||||
@ -449,7 +449,7 @@ public:
|
||||
/// <param name="name">The name of the variation in the list to make a copy of</param>
|
||||
/// <param name="weight">The weight to assign the new copy. Default: 1</param>
|
||||
/// <returns>A pointer to the variation with a matching name, else nullptr.</returns>
|
||||
Variation<T>* GetVariationCopy(const string& name, T weight = 1) { return MakeCopyWithWeight(GetVariation(name), weight); }
|
||||
Variation<T>* GetVariationCopy(const string& name, T weight = 1) const { return MakeCopyWithWeight(GetVariation(name), weight); }
|
||||
|
||||
/// <summary>
|
||||
/// Get a parametric variation at the specified index.
|
||||
@ -457,14 +457,14 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="index">The index in the parametric variations list to retrieve</param>
|
||||
/// <returns>The parametric variation at the index specified if in range, else nullptr.</returns>
|
||||
ParametricVariation<T>* GetParametricVariation(size_t index) { return index < m_ParametricVariations.size() ? m_ParametricVariations[index] : nullptr; }
|
||||
const ParametricVariation<T>* GetParametricVariation(size_t index) const { return index < m_ParametricVariations.size() ? m_ParametricVariations[index] : nullptr; }
|
||||
|
||||
/// <summary>
|
||||
/// Get a parametric variation with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the variation in the parametric variations list to retrieve</param>
|
||||
/// <returns>The parametric variation with a matching name, else nullptr.</returns>
|
||||
ParametricVariation<T>* GetParametricVariation(const string& name)
|
||||
const ParametricVariation<T>* GetParametricVariation(const string& name) const
|
||||
{
|
||||
for (uint i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != nullptr; i++)
|
||||
if (!_stricmp(name.c_str(), m_ParametricVariations[i]->Name().c_str()))
|
||||
@ -490,11 +490,11 @@ public:
|
||||
/// <summary>
|
||||
/// Accessors.
|
||||
/// </summary>
|
||||
size_t Size() { return m_Variations.size(); }
|
||||
size_t RegSize() { return m_RegVariations.size(); }
|
||||
size_t PreSize() { return m_PreVariations.size(); }
|
||||
size_t PostSize() { return m_PostVariations.size(); }
|
||||
size_t ParametricSize() { return m_ParametricVariations.size(); }
|
||||
size_t Size() const { return m_Variations.size(); }
|
||||
size_t RegSize() const { return m_RegVariations.size(); }
|
||||
size_t PreSize() const { return m_PreVariations.size(); }
|
||||
size_t PostSize() const { return m_PostVariations.size(); }
|
||||
size_t ParametricSize() const { return m_ParametricVariations.size(); }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
@ -504,7 +504,7 @@ private:
|
||||
/// <param name="var">The variation to copy</param>
|
||||
/// <param name="weight">The weight to assign it</param>
|
||||
/// <returns>A pointer to the new variation copy if success, else nullptr.</returns>
|
||||
Variation<T>* MakeCopyWithWeight(Variation<T>* var, T weight)
|
||||
Variation<T>* MakeCopyWithWeight(const Variation<T>* var, T weight) const
|
||||
{
|
||||
if (var)
|
||||
{
|
||||
|
@ -766,9 +766,9 @@ public:
|
||||
//Now apply the motion func to the params if needed.
|
||||
if (motParVar != nullptr)
|
||||
{
|
||||
ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(var);
|
||||
ParamWithName<T>* params = parVar->Params();
|
||||
ParamWithName<T>* motParams = motParVar->Params();
|
||||
auto parVar = dynamic_cast<ParametricVariation<T>*>(var);
|
||||
auto params = parVar->Params();
|
||||
auto motParams = motParVar->Params();
|
||||
|
||||
for (size_t k = 0; k < motParVar->ParamCount(); k++)
|
||||
{
|
||||
|
@ -1154,9 +1154,9 @@ private:
|
||||
//Only correct names if it came from an outside source. Names originating from this library are always considered correct.
|
||||
string s = fromEmber ? string(CCX(curAtt->name)) : GetCorrectedVariationName(m_BadVariationNames, curAtt);
|
||||
|
||||
if (Variation<T>* var = m_VariationList.GetVariation(s))
|
||||
if (auto var = m_VariationList.GetVariation(s))
|
||||
{
|
||||
Variation<T>* varCopy = var->Copy();
|
||||
auto varCopy = var->Copy();
|
||||
|
||||
Atof(attStr, varCopy->m_Weight);
|
||||
xform.AddVariation(varCopy);
|
||||
|
@ -945,7 +945,7 @@ eRenderStatus RendererCL<T>::RunLogScaleFilter()
|
||||
m_ErrorReport.push_back(loc);
|
||||
}
|
||||
|
||||
if (b && m_Callback)
|
||||
if (b && m_Callback && m_LastIterPercent >= 99.0)//Only update progress if we've really reached the end, not via forced output.
|
||||
m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, 100.0, 1, 0.0);
|
||||
|
||||
return b ? RENDER_OK : RENDER_ERROR;
|
||||
|
@ -397,7 +397,7 @@ bool TestVarCounts()
|
||||
|
||||
for (; start < (uint)LAST_VAR; start++)
|
||||
{
|
||||
Variation<float>* var = vlf.GetVariation((eVariationId)start);
|
||||
auto var = vlf.GetVariation((eVariationId)start);
|
||||
|
||||
if (!var)
|
||||
{
|
||||
@ -603,7 +603,7 @@ bool TestVarPrePostNames()
|
||||
|
||||
for (size_t i = 0; i < vlf.Size(); i++)
|
||||
{
|
||||
Variation<float>* var = vlf.GetVariation(i);
|
||||
auto var = vlf.GetVariation(i);
|
||||
string name = var->Name();
|
||||
|
||||
if (var->VarType() == VARTYPE_REG)
|
||||
@ -643,7 +643,7 @@ bool TestVarPrePostNames()
|
||||
break;
|
||||
}
|
||||
|
||||
if (ParametricVariation<float>* parVar = dynamic_cast<ParametricVariation<float>*>(var))
|
||||
if (auto parVar = dynamic_cast<ParametricVariation<float>*>(const_cast<Variation<float>*>(var)))
|
||||
{
|
||||
vector<ParamWithName<float>> params = parVar->ParamsVec();
|
||||
|
||||
@ -699,7 +699,7 @@ bool TestParVars()
|
||||
|
||||
for (size_t i = 0; i < vlf.ParametricSize(); i++)
|
||||
{
|
||||
if (ParametricVariation<float>* parVar = vlf.GetParametricVariation(i))
|
||||
if (auto parVar = vlf.GetParametricVariation(i))
|
||||
{
|
||||
if (parVar->ParamCount() < 1)
|
||||
{
|
||||
@ -709,7 +709,7 @@ bool TestParVars()
|
||||
|
||||
vector<string> names;
|
||||
vector<float*> addresses;
|
||||
ParamWithName<float>* params = parVar->Params();
|
||||
auto params = parVar->Params();
|
||||
|
||||
names.reserve(parVar->ParamCount());
|
||||
addresses.reserve(parVar->ParamCount());
|
||||
@ -754,7 +754,7 @@ bool TestVarRegPrePost()
|
||||
|
||||
for (size_t i = 0; i < vlf.RegSize(); i++)
|
||||
{
|
||||
Variation<float>* regVar = vlf.GetVariation(i, VARTYPE_REG);
|
||||
auto regVar = vlf.GetVariation(i, VARTYPE_REG);
|
||||
|
||||
if (regVar)
|
||||
{
|
||||
@ -762,8 +762,8 @@ bool TestVarRegPrePost()
|
||||
{
|
||||
string name = regVar->Name();
|
||||
|
||||
Variation<float>* preVar = vlf.GetVariation("pre_" + name);
|
||||
Variation<float>* postVar = vlf.GetVariation("post_" + name);
|
||||
auto preVar = vlf.GetVariation("pre_" + name);
|
||||
auto postVar = vlf.GetVariation("post_" + name);
|
||||
|
||||
if (!preVar)
|
||||
{
|
||||
|
@ -58,13 +58,12 @@ private:
|
||||
/// VariationTreeWidgetItem and VariationTreeDoubleSpinBox need each other, but each can't include the other.
|
||||
/// So VariationTreeWidgetItem includes this file, and use a forward declaration here.
|
||||
/// </summary>
|
||||
template <typename T> class VariationTreeWidgetItem;
|
||||
class VariationTreeWidgetItem;
|
||||
|
||||
/// <summary>
|
||||
/// Derivation for the double spin boxes that are in the
|
||||
/// variations tree.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class VariationTreeDoubleSpinBox : public DoubleSpinBox
|
||||
{
|
||||
public:
|
||||
@ -73,27 +72,27 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="p">The parent widget</param>
|
||||
/// <param name="widgetItem">The widget item this spinner is contained in</param>
|
||||
/// <param name="var">The variation this spinner is for</param>
|
||||
/// <param name="id">The variation this spinner is for</param>
|
||||
/// <param name="param">The name of the parameter this is for</param>
|
||||
/// <param name="h">The height of the spin box. Default: 16.</param>
|
||||
/// <param name="step">The step used to increment/decrement the spin box when using the mouse wheel. Default: 0.05.</param>
|
||||
explicit VariationTreeDoubleSpinBox(QWidget* p, VariationTreeWidgetItem<T>* widgetItem, Variation<T>* var, string param, int h = 16, double step = 0.05)
|
||||
explicit VariationTreeDoubleSpinBox(QWidget* p, VariationTreeWidgetItem* widgetItem, eVariationId id, string param, int h = 16, double step = 0.05)
|
||||
: DoubleSpinBox(p, h, step)
|
||||
{
|
||||
m_WidgetItem = widgetItem;
|
||||
m_Param = param;
|
||||
m_Variation = var;
|
||||
m_Id = id;
|
||||
setDecimals(3);
|
||||
}
|
||||
|
||||
virtual ~VariationTreeDoubleSpinBox() { }
|
||||
bool IsParam() { return !m_Param.empty(); }
|
||||
string ParamName() { return m_Param; }
|
||||
Variation<T>* GetVariation() { return m_Variation; }
|
||||
VariationTreeWidgetItem<T>* WidgetItem() { return m_WidgetItem; }
|
||||
eVariationId GetVariationId() { return m_Id; }
|
||||
VariationTreeWidgetItem* WidgetItem() { return m_WidgetItem; }
|
||||
|
||||
private:
|
||||
string m_Param;
|
||||
Variation<T>* m_Variation;
|
||||
VariationTreeWidgetItem<T>* m_WidgetItem;
|
||||
eVariationId m_Id;
|
||||
VariationTreeWidgetItem* m_WidgetItem;
|
||||
};
|
||||
|
@ -114,6 +114,8 @@ Fractorium::Fractorium(QWidget* p)
|
||||
#endif
|
||||
m_Controller = unique_ptr<FractoriumEmberControllerBase>(new FractoriumEmberController<float>(this));
|
||||
|
||||
m_Controller->SetupVariationTree();
|
||||
|
||||
if (m_Wrapper.CheckOpenCL() && m_Settings->OpenCL() && m_QualitySpin->value() < 30)
|
||||
m_QualitySpin->setValue(30);
|
||||
|
||||
|
@ -75,7 +75,6 @@ FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
|
||||
m_SheepTools = unique_ptr<SheepTools<T, T>>(new SheepTools<T, T>("flam3-palettes.xml", new EmberNs::Renderer<T, T>()));
|
||||
m_GLController = unique_ptr<GLEmberController<T>>(new GLEmberController<T>(fractorium, fractorium->ui.GLDisplay, this));
|
||||
m_PreviewRenderer = unique_ptr<EmberNs::Renderer<T, T>>(new EmberNs::Renderer<T, T>());
|
||||
SetupVariationTree();
|
||||
|
||||
//Initial combo change event to fill the palette table will be called automatically later.
|
||||
if (!InitPaletteList("./"))
|
||||
|
@ -369,7 +369,7 @@ bool FractoriumEmberController<T>::Render()
|
||||
if (ProcessState() != ACCUM_DONE)
|
||||
{
|
||||
//if (m_Renderer->Run(m_FinalImage, 0) == RENDER_OK)//Full, non-incremental render for debugging.
|
||||
if (m_Renderer->Run(m_FinalImage[m_FinalImageIndex], 0, m_SubBatchCount, iterBegin) == RENDER_OK)//Force output on iterBegin.
|
||||
if (m_Renderer->Run(m_FinalImage[m_FinalImageIndex], 0, m_SubBatchCount, (iterBegin || m_Fractorium->m_Settings->ContinuousUpdate())) == RENDER_OK)//Force output on iterBegin or if the settings specify to always do it.
|
||||
{
|
||||
//The amount to increment sub batch while rendering proceeds is purely empirical.
|
||||
//Change later if better values can be derived/observed.
|
||||
|
@ -119,6 +119,9 @@ void FractoriumSettings::Double(bool b) { setValue(DOUBLEPRECISION, b);
|
||||
bool FractoriumSettings::ShowAllXforms() { return value(SHOWALLXFORMS).toBool(); }
|
||||
void FractoriumSettings::ShowAllXforms(bool b) { setValue(SHOWALLXFORMS, b); }
|
||||
|
||||
bool FractoriumSettings::ContinuousUpdate() { return value(CONTUPDATE).toBool(); }
|
||||
void FractoriumSettings::ContinuousUpdate(bool b) { setValue(CONTUPDATE, b); }
|
||||
|
||||
uint FractoriumSettings::PlatformIndex() { return value(PLATFORMINDEX).toUInt(); }
|
||||
void FractoriumSettings::PlatformIndex(uint i) { setValue(PLATFORMINDEX, i); }
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define TRANSPARENCY "render/transparency"
|
||||
#define OPENCL "render/opencl"
|
||||
#define DOUBLEPRECISION "render/dp64"
|
||||
#define CONTUPDATE "render/continuousupdate"
|
||||
#define SHOWALLXFORMS "render/dragshowallxforms"
|
||||
#define PLATFORMINDEX "render/platformindex"
|
||||
#define DEVICEINDEX "render/deviceindex"
|
||||
@ -89,6 +90,9 @@ public:
|
||||
bool ShowAllXforms();
|
||||
void ShowAllXforms(bool b);
|
||||
|
||||
bool ContinuousUpdate();
|
||||
void ContinuousUpdate(bool b);
|
||||
|
||||
uint PlatformIndex();
|
||||
void PlatformIndex(uint b);
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/// </summary>
|
||||
void Fractorium::InitXformsVariationsUI()
|
||||
{
|
||||
QTreeWidget* tree = ui.VariationsTree;
|
||||
auto tree = ui.VariationsTree;
|
||||
|
||||
tree->clear();
|
||||
tree->header()->setSectionsClickable(true);
|
||||
@ -32,19 +32,19 @@ void FractoriumEmberController<T>::SetupVariationTree()
|
||||
T fMax = TMAX;
|
||||
QSize hint0(75, 16);
|
||||
QSize hint1(30, 16);
|
||||
QTreeWidget* tree = m_Fractorium->ui.VariationsTree;
|
||||
auto tree = m_Fractorium->ui.VariationsTree;
|
||||
|
||||
tree->clear();
|
||||
tree->blockSignals(true);
|
||||
|
||||
for (size_t i = 0; i < m_VariationList.Size(); i++)
|
||||
{
|
||||
Variation<T>* var = m_VariationList.GetVariation(i);
|
||||
ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(var);
|
||||
auto var = m_VariationList.GetVariation(i);
|
||||
auto parVar = dynamic_cast<const ParametricVariation<T>*>(var);
|
||||
|
||||
//First add the variation, with a spinner for its weight.
|
||||
VariationTreeWidgetItem<T>* item = new VariationTreeWidgetItem<T>(var->VariationId(), tree);
|
||||
VariationTreeDoubleSpinBox<T>* spinBox = new VariationTreeDoubleSpinBox<T>(tree, item, parVar ? parVar : var, "");
|
||||
auto item = new VariationTreeWidgetItem(var->VariationId(), tree);
|
||||
auto spinBox = new VariationTreeDoubleSpinBox(tree, item, var->VariationId(), "");
|
||||
|
||||
item->setText(0, QString::fromStdString(var->Name()));
|
||||
item->setSizeHint(0, hint0);
|
||||
@ -61,14 +61,14 @@ void FractoriumEmberController<T>::SetupVariationTree()
|
||||
//Check to see if the variation was parametric, and add a tree entry with a spinner for each parameter.
|
||||
if (parVar)
|
||||
{
|
||||
ParamWithName<T>* params = parVar->Params();
|
||||
auto params = parVar->Params();
|
||||
|
||||
for (size_t j = 0; j < parVar->ParamCount(); j++)
|
||||
{
|
||||
if (!params[j].IsPrecalc())
|
||||
{
|
||||
VariationTreeWidgetItem<T>* paramWidget = new VariationTreeWidgetItem<T>(var->VariationId(), item);
|
||||
VariationTreeDoubleSpinBox<T>* varSpinBox = new VariationTreeDoubleSpinBox<T>(tree, paramWidget, parVar, params[j].Name());
|
||||
auto paramWidget = new VariationTreeWidgetItem(var->VariationId(), item);
|
||||
auto varSpinBox = new VariationTreeDoubleSpinBox(tree, paramWidget, parVar->VariationId(), params[j].Name());
|
||||
|
||||
paramWidget->setText(0, params[j].Name().c_str());
|
||||
paramWidget->setSizeHint(0, hint0);
|
||||
@ -108,13 +108,13 @@ void FractoriumEmberController<T>::ClearVariationsTree()
|
||||
for (uint i = 0; i < tree->topLevelItemCount(); i++)
|
||||
{
|
||||
QTreeWidgetItem* item = tree->topLevelItem(i);
|
||||
VariationTreeDoubleSpinBox<T>* spinBox = dynamic_cast<VariationTreeDoubleSpinBox<T>*>(tree->itemWidget(item, 1));
|
||||
auto* spinBox = dynamic_cast<VariationTreeDoubleSpinBox*>(tree->itemWidget(item, 1));
|
||||
|
||||
spinBox->SetValueStealth(0);
|
||||
|
||||
for (uint j = 0; j < item->childCount(); j++)//Iterate through all of the children, which will be the params.
|
||||
{
|
||||
if ((spinBox = dynamic_cast<VariationTreeDoubleSpinBox<T>*>(tree->itemWidget(item->child(j), 1))))//Cast the child widget to the VariationTreeDoubleSpinBox type.
|
||||
if ((spinBox = dynamic_cast<VariationTreeDoubleSpinBox*>(tree->itemWidget(item->child(j), 1))))//Cast the child widget to the VariationTreeDoubleSpinBox type.
|
||||
spinBox->SetValueStealth(0);
|
||||
}
|
||||
}
|
||||
@ -130,17 +130,17 @@ void FractoriumEmberController<T>::ClearVariationsTree()
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::VariationSpinBoxValueChanged(double d)//Would be awesome to make this work for all.//TODO
|
||||
{
|
||||
QObject* objSender = m_Fractorium->sender();
|
||||
QTreeWidget* tree = m_Fractorium->ui.VariationsTree;
|
||||
VariationTreeDoubleSpinBox<T>* sender = dynamic_cast<VariationTreeDoubleSpinBox<T>*>(objSender);
|
||||
Xform<T>* xform = m_Ember.GetTotalXform(m_Fractorium->ui.CurrentXformCombo->currentIndex());//Will retrieve normal xform or final if needed.
|
||||
auto objSender = m_Fractorium->sender();
|
||||
auto tree = m_Fractorium->ui.VariationsTree;
|
||||
auto sender = dynamic_cast<VariationTreeDoubleSpinBox*>(objSender);
|
||||
auto xform = m_Ember.GetTotalXform(m_Fractorium->ui.CurrentXformCombo->currentIndex());//Will retrieve normal xform or final if needed.
|
||||
|
||||
if (sender && xform)
|
||||
{
|
||||
Variation<T>* var = sender->GetVariation();//The variation attached to the sender, for reference only.
|
||||
ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(var);//The parametric cast of that variation.
|
||||
Variation<T>* xformVar = xform->GetVariationById(var->VariationId());//The corresponding variation in the currently selected xform.
|
||||
VariationTreeWidgetItem<T>* widgetItem = sender->WidgetItem();
|
||||
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();
|
||||
bool isParam = parVar && sender->IsParam();
|
||||
|
||||
if (isParam)
|
||||
@ -175,7 +175,7 @@ void FractoriumEmberController<T>::VariationSpinBoxValueChanged(double d)//Would
|
||||
{
|
||||
//If the item wasn't a param and the xform did not contain this variation,
|
||||
//it means they went from zero to a non-zero weight, so add a new copy of this xform.
|
||||
Variation<T>* newVar = var->Copy();//Create a new one with default values.
|
||||
auto newVar = var->Copy();//Create a new one with default values.
|
||||
|
||||
newVar->m_Weight = d;
|
||||
xform->AddVariation(newVar);
|
||||
@ -185,14 +185,14 @@ void FractoriumEmberController<T>::VariationSpinBoxValueChanged(double d)//Would
|
||||
//for the child parameters and assign them to the newly added variation.
|
||||
if (parVar)
|
||||
{
|
||||
ParametricVariation<T>* newParVar = dynamic_cast<ParametricVariation<T>*>(newVar);
|
||||
auto newParVar = dynamic_cast<ParametricVariation<T>*>(newVar);
|
||||
|
||||
for (int i = 0; i < widgetItem->childCount(); i++)//Iterate through all of the children, which will be the params.
|
||||
{
|
||||
QTreeWidgetItem* childItem = widgetItem->child(i);//Get the child.
|
||||
QWidget* itemWidget = tree->itemWidget(childItem, 1);//Get the widget for the child.
|
||||
auto childItem = widgetItem->child(i);//Get the child.
|
||||
auto itemWidget = tree->itemWidget(childItem, 1);//Get the widget for the child.
|
||||
|
||||
if (VariationTreeDoubleSpinBox<T>* spinBox = dynamic_cast<VariationTreeDoubleSpinBox<T>*>(itemWidget))//Cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
if (auto spinBox = dynamic_cast<VariationTreeDoubleSpinBox*>(itemWidget))//Cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
{
|
||||
string s = childItem->text(0).toStdString();//Use the name of the child, and the value of the spinner widget to assign the param.
|
||||
|
||||
@ -218,18 +218,18 @@ void Fractorium::OnVariationSpinBoxValueChanged(double d) { m_Controller->Variat
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::FillVariationTreeWithXform(Xform<T>* xform)
|
||||
{
|
||||
QTreeWidget* tree = m_Fractorium->ui.VariationsTree;
|
||||
auto tree = m_Fractorium->ui.VariationsTree;
|
||||
|
||||
tree->blockSignals(true);
|
||||
|
||||
for (uint i = 0; i < tree->topLevelItemCount(); i++)
|
||||
{
|
||||
VariationTreeWidgetItem<T>* item = dynamic_cast<VariationTreeWidgetItem<T>*>(tree->topLevelItem(i));
|
||||
Variation<T>* var = xform->GetVariationById(item->Id());//See if this variation in the tree was contained in the xform.
|
||||
ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(var);//Attempt cast to parametric variation for later.
|
||||
ParametricVariation<T>* origParVar = dynamic_cast<ParametricVariation<T>*>(m_VariationList.GetVariation(item->Id()));
|
||||
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()));
|
||||
|
||||
if (VariationTreeDoubleSpinBox<T>* spinBox = dynamic_cast<VariationTreeDoubleSpinBox<T>*>(tree->itemWidget(item, 1)))//Get the widget for the item, and cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
if (auto spinBox = dynamic_cast<VariationTreeDoubleSpinBox*>(tree->itemWidget(item, 1)))//Get the widget for the item, and cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
{
|
||||
spinBox->SetValueStealth(var ? var->m_Weight : 0);//If the variation was present, set the spin box to its weight, else zero.
|
||||
item->setBackgroundColor(0, var ? QColor(200, 200, 200) : QColor(255, 255, 255));//Ensure background is always white if the value goes to zero, else gray if var present.
|
||||
@ -237,10 +237,10 @@ void FractoriumEmberController<T>::FillVariationTreeWithXform(Xform<T>* xform)
|
||||
for (uint j = 0; j < item->childCount(); j++)//Iterate through all of the children, which will be the params if it was a parametric variation.
|
||||
{
|
||||
T* param = nullptr;
|
||||
QTreeWidgetItem* childItem = item->child(j);//Get the child.
|
||||
QWidget* childItemWidget = tree->itemWidget(childItem, 1);//Get the widget for the child.
|
||||
auto childItem = item->child(j);//Get the child.
|
||||
auto childItemWidget = tree->itemWidget(childItem, 1);//Get the widget for the child.
|
||||
|
||||
if (VariationTreeDoubleSpinBox<T>* childSpinBox = dynamic_cast<VariationTreeDoubleSpinBox<T>*>(childItemWidget))//Cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
if (auto childSpinBox = dynamic_cast<VariationTreeDoubleSpinBox*>(childItemWidget))//Cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
{
|
||||
string s = childItem->text(0).toStdString();//Get the name of the child.
|
||||
|
||||
|
@ -68,6 +68,7 @@ FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, Q
|
||||
ui.EarlyClipCheckBox->setChecked( m_Settings->EarlyClip());
|
||||
ui.YAxisUpCheckBox->setChecked( m_Settings->YAxisUp());
|
||||
ui.TransparencyCheckBox->setChecked( m_Settings->Transparency());
|
||||
ui.ContinuousUpdateCheckBox->setChecked(m_Settings->ContinuousUpdate());
|
||||
ui.DoublePrecisionCheckBox->setChecked( m_Settings->Double());
|
||||
ui.ShowAllXformsCheckBox->setChecked( m_Settings->ShowAllXforms());
|
||||
ui.ThreadCountSpin->setValue( m_Settings->ThreadCount());
|
||||
@ -100,6 +101,7 @@ FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, Q
|
||||
bool FractoriumOptionsDialog::EarlyClip() { return ui.EarlyClipCheckBox->isChecked(); }
|
||||
bool FractoriumOptionsDialog::YAxisUp() { return ui.YAxisUpCheckBox->isChecked(); }
|
||||
bool FractoriumOptionsDialog::Transparency() { return ui.TransparencyCheckBox->isChecked(); }
|
||||
bool FractoriumOptionsDialog::ContinuousUpdate() { return ui.ContinuousUpdateCheckBox->isChecked(); }
|
||||
bool FractoriumOptionsDialog::OpenCL() { return ui.OpenCLCheckBox->isChecked(); }
|
||||
bool FractoriumOptionsDialog::Double() { return ui.DoublePrecisionCheckBox->isChecked(); }
|
||||
bool FractoriumOptionsDialog::ShowAllXforms() { return ui.ShowAllXformsCheckBox->isChecked(); }
|
||||
@ -152,6 +154,7 @@ void FractoriumOptionsDialog::accept()
|
||||
m_Settings->EarlyClip(EarlyClip());
|
||||
m_Settings->YAxisUp(YAxisUp());
|
||||
m_Settings->Transparency(Transparency());
|
||||
m_Settings->ContinuousUpdate(ContinuousUpdate());
|
||||
m_Settings->OpenCL(OpenCL());
|
||||
m_Settings->Double(Double());
|
||||
m_Settings->ShowAllXforms(ShowAllXforms());
|
||||
@ -187,6 +190,7 @@ void FractoriumOptionsDialog::reject()
|
||||
ui.EarlyClipCheckBox->setChecked(m_Settings->EarlyClip());
|
||||
ui.YAxisUpCheckBox->setChecked(m_Settings->YAxisUp());
|
||||
ui.TransparencyCheckBox->setChecked(m_Settings->Transparency());
|
||||
ui.ContinuousUpdateCheckBox->setChecked(m_Settings->ContinuousUpdate());
|
||||
ui.OpenCLCheckBox->setChecked(m_Settings->OpenCL());
|
||||
ui.DoublePrecisionCheckBox->setChecked(m_Settings->Double());
|
||||
ui.ShowAllXformsCheckBox->setChecked(m_Settings->ShowAllXforms());
|
||||
|
@ -37,6 +37,7 @@ private:
|
||||
bool YAxisUp();
|
||||
bool AlphaChannel();
|
||||
bool Transparency();
|
||||
bool ContinuousUpdate();
|
||||
bool OpenCL();
|
||||
bool Double();
|
||||
bool ShowAllXforms();
|
||||
|
@ -113,13 +113,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QComboBox" name="PlatformCombo"/>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QComboBox" name="DeviceCombo"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QSpinBox" name="ThreadCountSpin">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The number of threads to use with CPU rendering.</p><p>Decrease for more responsive editing, increase for better performance.</p></body></html></string>
|
||||
@ -135,7 +135,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QGroupBox" name="InteraciveCpuFilteringGroupBox">
|
||||
<property name="title">
|
||||
<string>CPU Filtering</string>
|
||||
@ -182,7 +182,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="12" column="0">
|
||||
<widget class="QGroupBox" name="InteraciveGpuFilteringGroupBox">
|
||||
<property name="title">
|
||||
<string>OpenCL Filtering</string>
|
||||
@ -226,7 +226,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QSpinBox" name="CpuSubBatchSpin">
|
||||
<property name="toolTip">
|
||||
<string>The number of 10,000 iteration chunks ran per thread on the CPU
|
||||
@ -243,7 +243,7 @@ in interactive mode for each mouse movement</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QSpinBox" name="OpenCLSubBatchSpin">
|
||||
<property name="toolTip">
|
||||
<string>The number of ~8M iteration chunks ran using OpenCL
|
||||
@ -300,6 +300,16 @@ in interactive mode for each mouse movement</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="ContinuousUpdateCheckBox">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Continually update output image during interactive rendering.</p><p>This will slow down performance, but will give continuous updates on how the final render will look. Note that only log scale filtering is applied on each update. Full DE is not applied until iteration is complete.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Continuous Update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="OptionsXmlSavingTab">
|
||||
@ -716,11 +726,12 @@ in interactive mode for each mouse movement</string>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>EarlyClipCheckBox</tabstop>
|
||||
<tabstop>YAxisUpCheckBox</tabstop>
|
||||
<tabstop>TransparencyCheckBox</tabstop>
|
||||
<tabstop>OpenCLCheckBox</tabstop>
|
||||
<tabstop>YAxisUpCheckBox</tabstop>
|
||||
<tabstop>DoublePrecisionCheckBox</tabstop>
|
||||
<tabstop>TransparencyCheckBox</tabstop>
|
||||
<tabstop>ShowAllXformsCheckBox</tabstop>
|
||||
<tabstop>ContinuousUpdateCheckBox</tabstop>
|
||||
<tabstop>PlatformCombo</tabstop>
|
||||
<tabstop>DeviceCombo</tabstop>
|
||||
<tabstop>ThreadCountSpin</tabstop>
|
||||
@ -730,9 +741,7 @@ in interactive mode for each mouse movement</string>
|
||||
<tabstop>CpuFilteringDERadioButton</tabstop>
|
||||
<tabstop>OpenCLFilteringLogRadioButton</tabstop>
|
||||
<tabstop>OpenCLFilteringDERadioButton</tabstop>
|
||||
<tabstop>OptionsXmlSavingTable</tabstop>
|
||||
<tabstop>OptionsIdentityTable</tabstop>
|
||||
<tabstop>OptionsButtonBox</tabstop>
|
||||
<tabstop>AutoUniqueCheckBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
@ -13,7 +13,6 @@
|
||||
/// by index or by weight. It supports weights less than, equal to, or
|
||||
/// greater than zero.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class VariationTreeWidgetItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
@ -56,24 +55,24 @@ private:
|
||||
int column = treeWidget()->sortColumn();
|
||||
eVariationId index1, index2;
|
||||
double weight1 = 0, weight2 = 0;
|
||||
VariationTreeWidgetItem<T>* varItemWidget;
|
||||
VariationTreeDoubleSpinBox<T>* spinBox1, *spinBox2;
|
||||
VariationTreeWidgetItem* varItemWidget;
|
||||
VariationTreeDoubleSpinBox* spinBox1, *spinBox2;
|
||||
|
||||
QWidget* itemWidget1 = treeWidget()->itemWidget(const_cast<VariationTreeWidgetItem<T>*>(this), 1);//Get the widget for the second column.
|
||||
auto itemWidget1 = treeWidget()->itemWidget(const_cast<VariationTreeWidgetItem*>(this), 1);//Get the widget for the second column.
|
||||
|
||||
if ((spinBox1 = dynamic_cast<VariationTreeDoubleSpinBox<T>*>(itemWidget1)))//Cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
if ((spinBox1 = dynamic_cast<VariationTreeDoubleSpinBox*>(itemWidget1)))//Cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
{
|
||||
QWidget* itemWidget2 = treeWidget()->itemWidget(const_cast<QTreeWidgetItem*>(&other), 1);//Get the widget for the second column of the widget item passed in.
|
||||
auto itemWidget2 = treeWidget()->itemWidget(const_cast<QTreeWidgetItem*>(&other), 1);//Get the widget for the second column of the widget item passed in.
|
||||
|
||||
if ((spinBox2 = dynamic_cast<VariationTreeDoubleSpinBox<T>*>(itemWidget2)))//Cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
if ((spinBox2 = dynamic_cast<VariationTreeDoubleSpinBox*>(itemWidget2)))//Cast the widget to the VariationTreeDoubleSpinBox type.
|
||||
{
|
||||
if (spinBox1->IsParam() || spinBox2->IsParam())//Do not sort params, their order will always remain the same.
|
||||
return false;
|
||||
|
||||
weight1 = spinBox1->value();
|
||||
weight2 = spinBox2->value();
|
||||
index1 = spinBox1->GetVariation()->VariationId();
|
||||
index2 = spinBox2->GetVariation()->VariationId();
|
||||
index1 = spinBox1->GetVariationId();
|
||||
index2 = spinBox2->GetVariationId();
|
||||
|
||||
if (column == 0)//First column clicked, sort by variation index.
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user