--User changes

-Add a new option --statevars to EmberGenome to list the variations which change state.
 -Allow for filtering in the Variations Dialog based on the same types listed in the EmberGenome options.

--Code changes
 -More correctly populate VariationList::m_ParametricVariations and VariationList::m_NonParametricVariations to account for variations which have params only used for precalc.
 -Consolidate some of the code in VariationList which searches by name.
This commit is contained in:
mfeemster 2016-05-18 16:48:40 -07:00
parent 33cc2a4326
commit cffeceec99
9 changed files with 462 additions and 30 deletions

View File

@ -379,7 +379,25 @@ VariationList<T>::VariationList()
m_PostVariations.push_back(var);
if (auto parVar = dynamic_cast<const ParametricVariation<T>*>(var))
m_ParametricVariations.push_back(parVar);
{
bool b = false;
auto& params = parVar->ParamsVec();
//Some non-parametric variations are actually stored as ParametricVariation<T> just to hold some precalcs.
//So to populate parametric, check to see at least one parameter was not a precalc, if so, treat this as parametric.
for (auto& param : params)
{
if (!param.IsPrecalc())
{
m_ParametricVariations.push_back(parVar);
b = true;
break;
}
}
if (!b)
m_NonParametricVariations.push_back(var);//Only get here if all parameters were non-precalc, so treat this as non-parametric.
}
else
m_NonParametricVariations.push_back(var);
}
@ -432,7 +450,7 @@ const Variation<T>* VariationList<T>::GetVariation(size_t index, eVariationType
}
/// <summary>
/// Gets a pointer to a copy of the variation at the specified index.
/// Get a pointer to a copy of the variation at the specified index.
/// Optionally specify a weight to assign the new copy.
/// </summary>
/// <param name="index">The index in the list to make a copy of</param>
@ -459,7 +477,7 @@ const Variation<T>* VariationList<T>::GetVariation(eVariationId id) const
}
/// <summary>
/// Gets a pointer to a copy of the variation with the specified ID.
/// Get a pointer to a copy of the variation with the specified ID.
/// Optionally specify a weight to assign the new copy.
/// </summary>
/// <param name="id">The id of the variation in the list to make a copy of</param>
@ -474,17 +492,10 @@ Variation<T>* VariationList<T>::GetVariationCopy(eVariationId id, T weight) cons
/// <param name="name">The name to search for</param>
/// <returns>A pointer to the variation if found, else nullptr.</returns>
template <typename T>
const Variation<T>* VariationList<T>::GetVariation(const string& name) const
{
for (auto var : m_Variations)
if (var && !_stricmp(name.c_str(), var->Name().c_str()))
return var;
return nullptr;
}
const Variation<T>* VariationList<T>::GetVariation(const string& name) const { return SearchVarName(m_Variations, name); }
/// <summary>
/// Gets a pointer to a copy of the variation with the specified name.
/// Get a pointer to a copy of the variation with the specified name.
/// Optionally specify a weight to assign the new copy.
/// </summary>
/// <param name="name">The name of the variation in the list to make a copy of</param>
@ -510,19 +521,38 @@ const ParametricVariation<T>* VariationList<T>::GetParametricVariation(size_t in
template <typename T>
const ParametricVariation<T>* VariationList<T>::GetParametricVariation(const string& name) const
{
for (auto var : m_ParametricVariations)
if (var && !_stricmp(name.c_str(), var->Name().c_str()))
return var;
return nullptr;
return SearchVarName(m_ParametricVariations, name);
}
/// <summary>
/// Get a pointer to a copy of the parametric variation at the specified index.
/// Optionally specify a weight to assign the new copy.
/// </summary>
/// <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 parametric variation at the index if in range, else nullptr.</returns>
template <typename T>
ParametricVariation<T>* VariationList<T>::GetParametricVariationCopy(eVariationId id, T weight) const
{
return dynamic_cast<ParametricVariation<T>*>(MakeCopyWithWeight(GetVariation(id), weight));
}
/// <summary>
/// Get a pointer to the pre variation with the specified name.
/// </summary>
/// <param name="name">The name to search for</param>
/// <returns>A pointer to the pre variation if found, else nullptr.</returns>
template <typename T>
const Variation<T>* VariationList<T>::GetPreVariation(const string& name) const { return SearchVarName(m_PreVariations, name); }
/// <summary>
/// Get a pointer to the post variation with the specified name.
/// </summary>
/// <param name="name">The name to search for</param>
/// <returns>A pointer to the post variation if found, else nullptr.</returns>
template <typename T>
const Variation<T>* VariationList<T>::GetPostVariation(const string& name) const { return SearchVarName(m_PostVariations, name); }
/// <summary>
/// Get the index of the variation with the specified name.
/// </summary>
@ -574,6 +604,25 @@ Variation<T>* VariationList<T>::MakeCopyWithWeight(const Variation<T>* var, T we
return nullptr;
}
/// <summary>
/// Search the passed in container of variations for a name which matches the passed in name.
/// Note that since the elements of vars is a nested template, they can be Variation<T>*
/// or anything which derives from that.
/// </summary>
/// <param name="vars">The vector of variations to search</param>
/// <param name="name">The name to search for</param>
/// <returns>True if found, else false.</returns>
template <typename T>
template <template <typename> class U>
const U<T>* VariationList<T>::SearchVarName(const vector<const U<T>*>& vars, const string& name) const
{
for (auto var : vars)
if (var && !_stricmp(name.c_str(), var->Name().c_str()))
return var;
return nullptr;
}
//This class was implemented in a cpp file to avoid exposing so many variation classes.
//So the explicit instantiation must be declared here rather than in Ember.cpp where
//all of the other classes are done.

View File

@ -32,6 +32,8 @@ public:
const ParametricVariation<T>* GetParametricVariation(size_t index) const;
const ParametricVariation<T>* GetParametricVariation(const string& name) const;
ParametricVariation<T>* GetParametricVariationCopy(eVariationId id, T weight = 1) const;
const Variation<T>* GetPreVariation(const string& name) const;
const Variation<T>* GetPostVariation(const string& name) const;
int GetVariationIndex(const string& name) const;
size_t Size() const;
size_t RegSize() const;
@ -52,6 +54,8 @@ public:
private:
VariationList();
Variation<T>* MakeCopyWithWeight(const Variation<T>* var, T weight) const;
template <template <typename> class U>
const U<T>* SearchVarName(const vector<const U<T>*>& vars, const string& name) const;
vector<const Variation<T>*> m_Variations;//A list of pointers to dynamically allocated variation objects.
vector<const Variation<T>*> m_RegVariations;

View File

@ -44,6 +44,7 @@ enum class eOptionIDs : et
OPT_PPSUM_VARS,
OPT_PPASSIGN_VARS,
OPT_DC_VARS,
OPT_STATE_VARS,
OPT_PAR_VARS,
OPT_NON_PAR_VARS,
@ -318,6 +319,7 @@ public:
INITBOOLOPTION(PpSumVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_PPSUM_VARS, _T("--ppsumvars"), false, SO_NONE, "\t--ppsumvars Display the names of all pre/post variations which have the non-standard behavior of summing their output, and exit.\n"));
INITBOOLOPTION(PpAssignVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_PPASSIGN_VARS, _T("--ppassignvars"), false, SO_NONE, "\t--ppassignvars Display the names of all pre/post variations which have the default behavior of assigning their output, and exit.\n"));
INITBOOLOPTION(DcVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_DC_VARS, _T("--dcvars"), false, SO_NONE, "\t--dcvars Display the names of all variations which alter the color index and exit.\n"));
INITBOOLOPTION(StateVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_STATE_VARS, _T("--statevars"), false, SO_NONE, "\t--statevars Display the names of all variations which alter their state on each iteration and exit.\n"));
INITBOOLOPTION(ParVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_PAR_VARS, _T("--parvars"), false, SO_NONE, "\t--parvars Display the names of all variations which have parameters and exit.\n"));
INITBOOLOPTION(NonParVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_NON_PAR_VARS, _T("--nonparvars"), false, SO_NONE, "\t--nonparvars Display the names of all variations which do not have parameters (weight only) and exit.\n"));
//Diagnostic bools.
@ -468,6 +470,7 @@ public:
PARSEBOOLOPTION(eOptionIDs::OPT_PPSUM_VARS, PpSumVars);
PARSEBOOLOPTION(eOptionIDs::OPT_PPASSIGN_VARS, PpAssignVars);
PARSEBOOLOPTION(eOptionIDs::OPT_DC_VARS, DcVars);
PARSEBOOLOPTION(eOptionIDs::OPT_STATE_VARS, StateVars);
PARSEBOOLOPTION(eOptionIDs::OPT_PAR_VARS, ParVars);
PARSEBOOLOPTION(eOptionIDs::OPT_NON_PAR_VARS, NonParVars);
PARSEBOOLOPTION(eOptionIDs::OPT_OPENCL, EmberCL);
@ -747,6 +750,7 @@ public:
Eob PpSumVars;
Eob PpAssignVars;
Eob DcVars;
Eob StateVars;
Eob ParVars;
Eob NonParVars;

View File

@ -67,9 +67,12 @@ bool EmberGenome(EmberOptions& opt)
auto varList = VariationList<T>::Instance();
if (opt.AllVars() || opt.SumVars() || opt.AssignVars() || opt.PpSumVars() || opt.PpAssignVars() ||
opt.DcVars() || opt.ParVars() || opt.NonParVars() ||
opt.DcVars() || opt.StateVars() || opt.ParVars() || opt.NonParVars() ||
opt.RegVars() || opt.PreVars() || opt.PostVars())
{
vector<string> assign{ "outPoint->m_X =", "outPoint->m_Y =", "outPoint->m_Z =",
"outPoint->m_X=", "outPoint->m_Y=", "outPoint->m_Z=" };
if (opt.AllVars())
{
auto& vars = varList->AllVars();
@ -80,18 +83,14 @@ bool EmberGenome(EmberOptions& opt)
else if (opt.SumVars())
{
auto& reg = varList->RegVars();
auto matches = FindVarsWithout<T>(varList->RegVars(), vector<string> { "outPoint->m_X =", "outPoint->m_Y =", "outPoint->m_Z =",
"outPoint->m_X=", "outPoint->m_Y=", "outPoint->m_Z="
});
auto matches = FindVarsWithout<T>(varList->RegVars(), assign);
for (auto& v : matches)
cout << v->Name() << "\n";
}
else if (opt.AssignVars())
{
auto matches = FindVarsWith<T>(varList->RegVars(), vector<string> { "outPoint->m_X =", "outPoint->m_Y =", "outPoint->m_Z =",
"outPoint->m_X=", "outPoint->m_Y=", "outPoint->m_Z="
});
auto matches = FindVarsWith<T>(varList->RegVars(), assign);
for (auto& v : matches)
cout << v->Name() << "\n";
@ -130,18 +129,26 @@ bool EmberGenome(EmberOptions& opt)
for (auto& v : matches)
cout << v->Name() << "\n";
}
else if (opt.StateVars())
{
auto& all = varList->AllVars();
for (auto& v : all)
if (!v->StateOpenCLString().empty())
cout << v->Name() << "\n";
}
else if (opt.ParVars())
{
auto& par = varList->ParametricVariations();
auto& parVars = varList->ParametricVariations();
for (auto& v : par)
for (auto& v : parVars)
cout << v->Name() << "\n";
}
else if (opt.NonParVars())
{
auto& par = varList->NonParametricVariations();
auto& vars = varList->NonParametricVariations();
for (auto& v : par)
for (auto& v : vars)
cout << v->Name() << "\n";
}
else

View File

@ -80,8 +80,7 @@ bool FinalRenderEmberControllerBase::CreateRendererFromGUI()
bool useOpenCL = m_Info->Ok() && m_FinalRenderDialog->OpenCL();
auto v = Devices(m_FinalRenderDialog->Devices());
return CreateRenderer((useOpenCL && !v.empty()) ? eRendererType::OPENCL_RENDERER : eRendererType::CPU_RENDERER,
v,
false);//Not shared.
v, false); //Not shared.
}
/// <summary>

View File

@ -21,6 +21,15 @@
#define OPENCLSUBBATCH "render/openclsubbatch"
#define RANDOMCOUNT "render/randomcount"
#define VARFILTERSUM "varfilter/sumcheckbox"
#define VARFILTERASSIGN "varfilter/assigncheckbox"
#define VARFILTERPPSUM "varfilter/ppsumcheckbox"
#define VARFILTERPPASSIGN "varfilter/ppassigncheckbox"
#define VARFILTERSDC "varfilter/dccheckbox"
#define VARFILTERSSTATE "varfilter/statecheckbox"
#define VARFILTERPARAM "varfilter/paramcheckbox"
#define VARFILTERNONPARAM "varfilter/nonparamcheckbox"
#define FINALEARLYCLIP "finalrender/earlyclip"
#define FINALYAXISUP "finalrender/finalyaxisup"
#define FINALTRANSPARENCY "finalrender/transparency"

View File

@ -18,6 +18,33 @@ FractoriumVariationsDialog::FractoriumVariationsDialog(FractoriumSettings* setti
m_Vars = m_Settings->Variations();
Populate();
OnSelectAllButtonClicked(true);
m_CheckBoxes.push_back(ui.SumCheckBox);
m_CheckBoxes.push_back(ui.AssignCheckBox);
m_CheckBoxes.push_back(ui.PpSumCheckBox);
m_CheckBoxes.push_back(ui.PpAssignCheckBox);
m_CheckBoxes.push_back(ui.DcCheckBox);
m_CheckBoxes.push_back(ui.StateCheckBox);
m_CheckBoxes.push_back(ui.ParamCheckBox);
m_CheckBoxes.push_back(ui.NonParamCheckBox);
ui.SumCheckBox->setCheckState(Qt::CheckState(m_Settings->value(VARFILTERSUM).toInt()));
ui.AssignCheckBox->setCheckState(Qt::CheckState(m_Settings->value(VARFILTERASSIGN).toInt()));
ui.PpSumCheckBox->setCheckState(Qt::CheckState(m_Settings->value(VARFILTERPPSUM).toInt()));
ui.PpAssignCheckBox->setCheckState(Qt::CheckState(m_Settings->value(VARFILTERPPASSIGN).toInt()));
ui.DcCheckBox->setCheckState(Qt::CheckState(m_Settings->value(VARFILTERSDC).toInt()));
ui.StateCheckBox->setCheckState(Qt::CheckState(m_Settings->value(VARFILTERSSTATE).toInt()));
ui.ParamCheckBox->setCheckState(Qt::CheckState(m_Settings->value(VARFILTERPARAM).toInt()));
ui.NonParamCheckBox->setCheckState(Qt::CheckState(m_Settings->value(VARFILTERNONPARAM).toInt()));
for (auto& cb : m_CheckBoxes)
{
if (cb->checkState() == Qt::CheckState::PartiallyChecked)
{
auto f = cb->font();
f.setStrikeOut(true);
cb->setFont(f);
}
}
table->verticalHeader()->setSectionsClickable(true);
table->horizontalHeader()->setSectionsClickable(true);
table->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
@ -25,6 +52,14 @@ FractoriumVariationsDialog::FractoriumVariationsDialog(FractoriumSettings* setti
connect(ui.SelectAllButton, SIGNAL(clicked(bool)), this, SLOT(OnSelectAllButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.InvertSelectionButton, SIGNAL(clicked(bool)), this, SLOT(OnInvertSelectionButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.SelectNoneButton, SIGNAL(clicked(bool)), this, SLOT(OnSelectNoneButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.SumCheckBox , SIGNAL(stateChanged(int)), this, SLOT(OnSelectionCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.AssignCheckBox , SIGNAL(stateChanged(int)), this, SLOT(OnSelectionCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.PpSumCheckBox , SIGNAL(stateChanged(int)), this, SLOT(OnSelectionCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.PpAssignCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnSelectionCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.DcCheckBox , SIGNAL(stateChanged(int)), this, SLOT(OnSelectionCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.StateCheckBox , SIGNAL(stateChanged(int)), this, SLOT(OnSelectionCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.ParamCheckBox , SIGNAL(stateChanged(int)), this, SLOT(OnSelectionCheckBoxStateChanged(int)), Qt::QueuedConnection);
connect(ui.NonParamCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnSelectionCheckBoxStateChanged(int)), Qt::QueuedConnection);
}
/// <summary>
@ -77,6 +112,14 @@ void FractoriumVariationsDialog::SyncSettings()
m[cb->text()] = cb->checkState() == Qt::CheckState::Checked;
});
m_Settings->Variations(m);
m_Settings->setValue(VARFILTERSUM , int(ui.SumCheckBox->checkState()));
m_Settings->setValue(VARFILTERASSIGN , int(ui.AssignCheckBox->checkState()));
m_Settings->setValue(VARFILTERPPSUM , int(ui.PpSumCheckBox->checkState()));
m_Settings->setValue(VARFILTERPPASSIGN, int(ui.PpAssignCheckBox->checkState()));
m_Settings->setValue(VARFILTERSDC , int(ui.DcCheckBox->checkState()));
m_Settings->setValue(VARFILTERSSTATE , int(ui.StateCheckBox->checkState()));
m_Settings->setValue(VARFILTERPARAM , int(ui.ParamCheckBox->checkState()));
m_Settings->setValue(VARFILTERNONPARAM, int(ui.NonParamCheckBox->checkState()));
}
/// <summary>
@ -89,12 +132,29 @@ const QMap<QString, QVariant>& FractoriumVariationsDialog::Map()
return m_Vars;
}
/// <summary>
/// Clears the type checkboxes without triggering any events.
/// </summary>
void FractoriumVariationsDialog::ClearTypesStealth()
{
for (auto& cb : m_CheckBoxes)
{
cb->blockSignals(true);
cb->setCheckState(Qt::CheckState::Unchecked);
auto f = cb->font();
f.setStrikeOut(cb->checkState() == Qt::CheckState::PartiallyChecked);
cb->setFont(f);
cb->blockSignals(false);
}
}
/// <summary>
/// Check all of the checkboxes.
/// </summary>
/// <param name="checked">Ignored</param>
void FractoriumVariationsDialog::OnSelectAllButtonClicked(bool checked)
{
ClearTypesStealth();
ForEachCell([&](QTableWidgetItem * cb) { cb->setCheckState(Qt::CheckState::Checked); });
}
@ -104,6 +164,7 @@ void FractoriumVariationsDialog::OnSelectAllButtonClicked(bool checked)
/// <param name="checked">Ignored</param>
void FractoriumVariationsDialog::OnInvertSelectionButtonClicked(bool checked)
{
ClearTypesStealth();
ForEachCell([&](QTableWidgetItem * cb)
{
if (cb->checkState() != Qt::CheckState::Checked)
@ -119,9 +180,186 @@ void FractoriumVariationsDialog::OnInvertSelectionButtonClicked(bool checked)
/// <param name="checked">Ignored</param>
void FractoriumVariationsDialog::OnSelectNoneButtonClicked(bool checked)
{
ClearTypesStealth();
ForEachCell([&](QTableWidgetItem * cb) { cb->setCheckState(Qt::CheckState::Unchecked); });
}
/// <summary>
/// Called when any of the selection checkboxes change state.
/// This will re-evaluate the entire grid of checkboxes.
/// </summary>
/// <param name="i">Ignored</param>
void FractoriumVariationsDialog::OnSelectionCheckBoxStateChanged(int i)
{
static vector<string> dc{ "m_ColorX" };
static vector<string> assign{ "outPoint->m_X =", "outPoint->m_Y =", "outPoint->m_Z =",
"outPoint->m_X=", "outPoint->m_Y=", "outPoint->m_Z=" };
//static vector<const Variation<T>*> excluded;
static std::set<eVariationId> excluded;
excluded.clear();
//excluded.reserve(size_t(eVariationId::LAST_VAR));
if (auto s = dynamic_cast<QCheckBox*>(sender()))
{
auto f = s->font();
f.setStrikeOut(s->checkState() == Qt::CheckState::PartiallyChecked);
s->setFont(f);
}
ForEachCell([&](QTableWidgetItem * cb) { cb->setCheckState(Qt::CheckState::Unchecked); });
ForEachCell([&](QTableWidgetItem * cb)
{
if (auto var = m_VariationList->GetVariation(cb->text().toStdString()))
{
if (ui.StateCheckBox->checkState() != Qt::CheckState::Unchecked)
{
if (!var->StateOpenCLString().empty())
{
if (ui.StateCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(var->VariationId());
}
else if (!Contains(excluded, var->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
if (ui.SumCheckBox->isChecked() != Qt::CheckState::Unchecked)
{
if (var->VarType() == eVariationType::VARTYPE_REG && !SearchVar(var, assign, false))
{
if (ui.SumCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(var->VariationId());
}
else if (!Contains(excluded, var->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
if (ui.AssignCheckBox->isChecked() != Qt::CheckState::Unchecked)
{
if (var->VarType() == eVariationType::VARTYPE_REG && SearchVar(var, assign, false))
{
if (ui.AssignCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(var->VariationId());
}
else if (!Contains(excluded, var->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
if (ui.DcCheckBox->isChecked() != Qt::CheckState::Unchecked)
{
if (SearchVar(var, dc, false))
{
if (ui.DcCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(var->VariationId());
}
else if (!Contains(excluded, var->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
if (ui.NonParamCheckBox->isChecked() != Qt::CheckState::Unchecked)
{
if (!m_VariationList->GetParametricVariation(cb->text().toStdString()))
{
if (ui.NonParamCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(var->VariationId());
}
else if (!Contains(excluded, var->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
}
if (ui.PpSumCheckBox->isChecked() != Qt::CheckState::Unchecked)
{
if (auto pre = m_VariationList->GetPreVariation(cb->text().toStdString()))
{
if (pre->AssignType() == eVariationAssignType::ASSIGNTYPE_SUM)
{
if (ui.PpSumCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(pre->VariationId());
}
else if (!Contains(excluded, pre->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
if (auto post = m_VariationList->GetPostVariation(cb->text().toStdString()))
{
if (post->AssignType() == eVariationAssignType::ASSIGNTYPE_SUM)
{
if (ui.PpSumCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(post->VariationId());
}
else if (!Contains(excluded, post->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
}
if (ui.PpAssignCheckBox->isChecked() != Qt::CheckState::Unchecked)
{
if (auto pre = m_VariationList->GetPreVariation(cb->text().toStdString()))
{
if (pre->AssignType() == eVariationAssignType::ASSIGNTYPE_SET)
{
if (ui.PpAssignCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(pre->VariationId());
}
else if (!Contains(excluded, pre->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
if (auto post = m_VariationList->GetPostVariation(cb->text().toStdString()))
{
if (post->AssignType() == eVariationAssignType::ASSIGNTYPE_SET)
{
if (ui.PpAssignCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(post->VariationId());
}
else if (!Contains(excluded, post->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
}
if (ui.ParamCheckBox->isChecked() != Qt::CheckState::Unchecked)
{
if (auto parVar = m_VariationList->GetParametricVariation(cb->text().toStdString()))
{
if (ui.ParamCheckBox->checkState() == Qt::CheckState::PartiallyChecked)
{
cb->setCheckState(Qt::CheckState::Unchecked);
excluded.insert(parVar->VariationId());
}
else if (!Contains(excluded, parVar->VariationId()))
cb->setCheckState(Qt::CheckState::Checked);
}
}
});
}
/// <summary>
/// Create all checkboxes and check them according to the map.
/// </summary>

View File

@ -29,6 +29,7 @@ public slots:
void OnSelectAllButtonClicked(bool checked);
void OnInvertSelectionButtonClicked(bool checked);
void OnSelectNoneButtonClicked(bool checked);
void OnSelectionCheckBoxStateChanged(int i);
void OnVariationsTableItemChanged(QTableWidgetItem* item);
virtual void accept() override;
virtual void reject() override;
@ -37,11 +38,13 @@ protected:
virtual void showEvent(QShowEvent* e) override;
private:
void ClearTypesStealth();
void DataToGui();
void GuiToData();
void Populate();
void SetCheckFromMap(QTableWidgetItem* cb, const Variation<float>* var);
shared_ptr<VariationList<float>> m_VariationList;
vector<QCheckBox*> m_CheckBoxes;
QMap<QString, QVariant> m_Vars;
FractoriumSettings* m_Settings;
Ui::VariationsDialog ui;

View File

@ -122,6 +122,125 @@
</item>
</layout>
</item>
<item row="1" column="0" rowspan="2">
<widget class="QGroupBox" name="TypeGroupBox">
<property name="title">
<string>Select by variation type</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="2">
<widget class="QCheckBox" name="PpSumCheckBox">
<property name="toolTip">
<string>Select all pre/post variations which have the non-standard behavior of summing their outputs</string>
</property>
<property name="text">
<string>PP Sum</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="SumCheckBox">
<property name="toolTip">
<string>Select all regular variations which have the default behavior of summing their outputs</string>
</property>
<property name="text">
<string>Sum</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="AssignCheckBox">
<property name="toolTip">
<string>Select all regular variations which have the non-standard behavior of assigning their outputs</string>
</property>
<property name="text">
<string>Assign</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="DcCheckBox">
<property name="toolTip">
<string>Select all variations which use direct coloring</string>
</property>
<property name="text">
<string>DC</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="StateCheckBox">
<property name="toolTip">
<string>Select all variations which alter their state on each iteration</string>
</property>
<property name="text">
<string>State</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="ParamCheckBox">
<property name="toolTip">
<string>Select all variations which have parameters</string>
</property>
<property name="text">
<string>Param</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QCheckBox" name="NonParamCheckBox">
<property name="toolTip">
<string>Select all variations which do not have parameters (weight only)</string>
</property>
<property name="text">
<string>Non Param</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="PpAssignCheckBox">
<property name="toolTip">
<string>Select all pre/post variations which have the default behavior of assigning their outputs</string>
</property>
<property name="text">
<string>PP Assign</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>