--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

@ -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/>