diff --git a/Source/EmberCommon/EmberCommon.h b/Source/EmberCommon/EmberCommon.h
index 3d77ae1..710764e 100644
--- a/Source/EmberCommon/EmberCommon.h
+++ b/Source/EmberCommon/EmberCommon.h
@@ -10,6 +10,8 @@
namespace EmberCommon
{
+enum class eXaosPasteStyle : int { NONE, ZERO_TO_ONE, ZERO_TO_VALS, ONE_TO_VALS, VALS_TO_ONE };
+
///
/// Derivation of the RenderCallback class to do custom printing action
/// whenever the progress function is internally called inside of Ember
@@ -869,43 +871,6 @@ static vector*> FindVarsWithout(const vector
-/// Add a vector of xforms to the passed in ember, and optionally preserve the xaos based on position.
-///
-/// The ember to add xforms to
-/// The vector of xforms to add
-/// True to preserve xaos else false.
-template
-static void AddXformsWithXaos(Ember& ember, std::vector, size_t>>& xforms, bool preserveXaos)
-{
- auto origXformCount = ember.XformCount();
-
- for (auto& it : xforms)
- ember.AddXform(it.first);
-
- for (auto i = 0; i < ember.XformCount(); i++)
- {
- auto xf = ember.GetXform(i);
-
- if (i < origXformCount)
- {
- for (auto j = 0; j < ember.XformCount(); j++)
- if (j >= origXformCount)
- xf->SetXaos(j, 0);
- }
- else
- {
- for (auto j = 0; j < ember.XformCount(); j++)
- if (j < origXformCount)
- xf->SetXaos(j, 0);
- else if (!preserveXaos)
- xf->SetXaos(j, 1);
- else if (i - origXformCount < xforms.size())//Should never be out of bounds, but just to be safe.
- xf->SetXaos(j, xforms[i - origXformCount].first.Xaos(j - origXformCount));
- }
- }
-}
}
///
diff --git a/Source/Fractorium/DoubleSpinBox.cpp b/Source/Fractorium/DoubleSpinBox.cpp
index a632562..28d1d31 100644
--- a/Source/Fractorium/DoubleSpinBox.cpp
+++ b/Source/Fractorium/DoubleSpinBox.cpp
@@ -12,10 +12,11 @@ QTimer DoubleSpinBox::s_Timer;
/// The parent widget. Default: nullptr.
/// The height of the spin box. Default: 16.
/// The step used to increment/decrement the spin box when using the mouse wheel. Default: 0.05.
-DoubleSpinBox::DoubleSpinBox(QWidget* p, int h, double step)
+DoubleSpinBox::DoubleSpinBox(QWidget* p, int h, double step, bool clearSel)
: QDoubleSpinBox(p)
{
m_DoubleClick = false;
+ m_ClearSel = clearSel;
m_DoubleClickLowVal = 0;
m_DoubleClickNonZero = 0;
m_DoubleClickZero = 1;
@@ -135,7 +136,8 @@ QLineEdit* DoubleSpinBox::lineEdit()
///
void DoubleSpinBox::OnSpinBoxValueChanged(double)
{
- lineEdit()->deselect();//Gets rid of nasty "feature" that always has text selected.
+ if (m_ClearSel)
+ lineEdit()->deselect();//Gets rid of nasty "feature" that always has text selected.
}
///
diff --git a/Source/Fractorium/DoubleSpinBox.h b/Source/Fractorium/DoubleSpinBox.h
index 80b6123..e2a85c2 100644
--- a/Source/Fractorium/DoubleSpinBox.h
+++ b/Source/Fractorium/DoubleSpinBox.h
@@ -19,7 +19,7 @@ class DoubleSpinBox : public QDoubleSpinBox
Q_OBJECT
public:
- explicit DoubleSpinBox(QWidget* parent = nullptr, int height = 16, double step = 0.05);
+ explicit DoubleSpinBox(QWidget* parent = nullptr, int height = 16, double step = 0.05, bool clearsel = true);
virtual ~DoubleSpinBox() { }
void SetValueStealth(double d);
void DoubleClick(bool b);
@@ -45,6 +45,7 @@ protected:
virtual void leaveEvent(QEvent* e) override;
bool m_DoubleClick;
+ bool m_ClearSel;
shared_ptr m_Settings;
private:
diff --git a/Source/Fractorium/Fractorium.h b/Source/Fractorium/Fractorium.h
index b08a316..aade5af 100644
--- a/Source/Fractorium/Fractorium.h
+++ b/Source/Fractorium/Fractorium.h
@@ -129,6 +129,9 @@ public:
bool DrawAllPost();
bool LocalPivot();
+ //Xaos.
+ eXaosPasteStyle GetXaosPasteStyleType();
+
//Info.
void ReorderVariations(QTreeWidgetItem* item);
@@ -144,7 +147,7 @@ public slots:
void OnActionCopyFlameInCurrentFile(bool checked);
void OnActionCreateReferenceFile(bool checked);
void OnActionOpen(bool checked);
- void OnActionOpenExamples(bool checked);
+ void OnActionOpenExamples(bool checked);
void OnActionSaveCurrentAsXml(bool checked);
void OnActionSaveEntireFileAsXml(bool checked);
void OnActionSaveCurrentScreen(bool checked);
@@ -470,7 +473,7 @@ private:
void EnableRenderControls(bool enable);
//Dialogs.
- QStringList SetupOpenXmlDialog(bool openExamples = false);
+ QStringList SetupOpenXmlDialog(bool openExamples = false);
QString SetupSaveXmlDialog(const QString& defaultFilename);
QString SetupSaveImageDialog(const QString& defaultFilename);
QString SetupSaveFolderDialog();
diff --git a/Source/Fractorium/Fractorium.ui b/Source/Fractorium/Fractorium.ui
index c58c8ed..e687db5 100644
--- a/Source/Fractorium/Fractorium.ui
+++ b/Source/Fractorium/Fractorium.ui
@@ -1867,7 +1867,7 @@
550
0
- 252
+ 310
881
@@ -1879,8 +1879,8 @@
- 252
- 409
+ 310
+ 428
@@ -1902,9 +1902,9 @@
0
-
+
- 4
+ 1
4
@@ -2002,6 +2002,86 @@
+ -
+
+
+ <html><head/><body><p><br/></p></body></html>
+
+
+ Paste Style
+
+
+
+ 0
+
+
+ 4
+
+
+ 2
+
+
+ 0
+
+
+ 2
+
+
-
+
+
+ <html><head/><body><p>All values in the new xaos rows and columns will be 1</p></body></html>
+
+
+ None
+
+
+ true
+
+
+
+ -
+
+
+ <html><head/><body><p>All values in the new xaos rows and columns before the bottom right square will be 0, and those in the square will be 1</p></body></html>
+
+
+ 0->1
+
+
+
+ -
+
+
+ <html><head/><body><p>All values in the new xaos rows and columns before the bottom right square will be 0, and those in the square will be the original xaos values starting from the top of the new xforms</p></body></html>
+
+
+ 0->Vals
+
+
+
+ -
+
+
+ <html><head/><body><p>All values in the new xaos rows and columns before the bottom right square will be 1, and those in the square will be the original xaos values starting from the top of the new xforms</p></body></html>
+
+
+ 1->Vals
+
+
+
+ -
+
+
+ <html><head/><body><p>All values in the new xaos rows and columns before the bottom right square will be the original xaos values starting from the top of the new xforms, and those in the square will be 1</p></body></html>
+
+
+ Vals->1
+
+
+
+
+
+
-
@@ -2226,7 +2306,7 @@
false
- false
+ true
false
@@ -2316,7 +2396,7 @@
- 800
+ 860
10
295
700
diff --git a/Source/Fractorium/FractoriumEmberController.h b/Source/Fractorium/FractoriumEmberController.h
index e17139a..72665a1 100644
--- a/Source/Fractorium/FractoriumEmberController.h
+++ b/Source/Fractorium/FractoriumEmberController.h
@@ -489,6 +489,7 @@ public:
void FillWithXform(Xform* xform);
Xform* CurrentXform();
void UpdateXform(std::function*, size_t, size_t)> func, eXformUpdate updateType = eXformUpdate::UPDATE_CURRENT, bool updateRender = true, eProcessAction action = eProcessAction::FULL_RENDER, size_t index = 0);
+ static void AddXformsWithXaos(Ember& ember, std::vector, size_t>>& xforms, bool preserveXaos, eXaosPasteStyle pastestyle);
//Xforms Affine.
virtual void AffineSetHelper(double d, int index, bool pre) override;
diff --git a/Source/Fractorium/FractoriumMenus.cpp b/Source/Fractorium/FractoriumMenus.cpp
index c391024..1388eee 100644
--- a/Source/Fractorium/FractoriumMenus.cpp
+++ b/Source/Fractorium/FractoriumMenus.cpp
@@ -812,7 +812,7 @@ void FractoriumEmberController::PasteSelectedXforms()
{
Update([&]()
{
- AddXformsWithXaos(m_Ember, m_CopiedXforms, true);
+ AddXformsWithXaos(m_Ember, m_CopiedXforms, true, m_Fractorium->GetXaosPasteStyleType());
if (!m_CopiedFinalXform.Empty())
m_Ember.SetFinalXform(m_CopiedFinalXform);
diff --git a/Source/Fractorium/FractoriumXaos.cpp b/Source/Fractorium/FractoriumXaos.cpp
index 10d0df8..49d48ab 100644
--- a/Source/Fractorium/FractoriumXaos.cpp
+++ b/Source/Fractorium/FractoriumXaos.cpp
@@ -11,7 +11,7 @@ void Fractorium::InitXaosUI()
int spinHeight = 20;
ui.XaosTableView->verticalHeader()->setSectionsClickable(true);
ui.XaosTableView->horizontalHeader()->setSectionsClickable(true);
- m_XaosSpinBox = new DoubleSpinBox(nullptr, spinHeight, 0.1);
+ m_XaosSpinBox = new DoubleSpinBox(nullptr, spinHeight, 0.1, false);
m_XaosSpinBox->DoubleClick(true);
m_XaosSpinBox->DoubleClickZero(1);
m_XaosSpinBox->DoubleClickNonZero(0);
@@ -265,7 +265,7 @@ void FractoriumEmberController::AddLayer(int xforms)
Update([&]
{
std::vector, size_t>> vec(xforms);
- AddXformsWithXaos(m_Ember, vec, false);
+ AddXformsWithXaos(m_Ember, vec, false, eXaosPasteStyle::ZERO_TO_ONE);
});
FillXforms();
@@ -371,6 +371,26 @@ void Fractorium::OnXaosVScrollValueChanged(int value)
ui.XaosAppliedTableView->verticalScrollBar()->setValue(value);
}
+///
+/// Get an enum value corresponding to the currently selected xaos pasting mode.
+///
+/// The xaos pasting mode enum
+eXaosPasteStyle Fractorium::GetXaosPasteStyleType()
+{
+ if (ui.XaosPasteNoneRadio->isChecked())
+ return eXaosPasteStyle::NONE;
+ else if (ui.XaosPaste0to1Radio->isChecked())
+ return eXaosPasteStyle::ZERO_TO_ONE;
+ else if (ui.XaosPaste0toValsRadio->isChecked())
+ return eXaosPasteStyle::ZERO_TO_VALS;
+ else if (ui.XaosPaste1toValsRadio->isChecked())
+ return eXaosPasteStyle::ONE_TO_VALS;
+ else if (ui.XaosPasteValsTo1Radio->isChecked())
+ return eXaosPasteStyle::VALS_TO_ONE;
+ else
+ return eXaosPasteStyle::NONE;
+}
+
template class FractoriumEmberController;
#ifdef DO_DOUBLE
diff --git a/Source/Fractorium/FractoriumXforms.cpp b/Source/Fractorium/FractoriumXforms.cpp
index 705b310..f417644 100644
--- a/Source/Fractorium/FractoriumXforms.cpp
+++ b/Source/Fractorium/FractoriumXforms.cpp
@@ -206,6 +206,94 @@ void FractoriumEmberController::AddLinkedXform()
void Fractorium::OnAddLinkedXformButtonClicked(bool checked) { m_Controller->AddLinkedXform(); }
+///
+/// Add a vector of xforms to the passed in ember, and optionally preserve the xaos based on position.
+///
+/// The ember to add xforms to
+/// The vector of xforms to add
+/// True to preserve xaos else false.
+/// The method which governs how the copying of xaos values is handles
+template
+void FractoriumEmberController::AddXformsWithXaos(Ember& ember, std::vector, size_t>>& xforms, bool preserveXaos, eXaosPasteStyle pastestyle)
+{
+ if (ember.XaosPresent())
+ {
+ auto oldxfcount = ember.XformCount();
+
+ for (auto& it : xforms)
+ {
+ ember.AddXform(it.first);
+ auto newxfcount = ember.XformCount() - 1;
+ auto* newxform = ember.GetXform(newxfcount);
+
+ for (size_t i = 0; i < oldxfcount; i++)
+ {
+ if (auto xform = ember.GetXform(i))
+ {
+ switch (pastestyle)
+ {
+ case EmberCommon::eXaosPasteStyle::NONE:
+ newxform->SetXaos(i, 1);
+ xform->SetXaos(newxfcount, 1);
+ break;
+
+ case EmberCommon::eXaosPasteStyle::ZERO_TO_ONE:
+ case EmberCommon::eXaosPasteStyle::ZERO_TO_VALS:
+ newxform->SetXaos(i, 0);
+ xform->SetXaos(newxfcount, 0);
+ break;
+
+ case EmberCommon::eXaosPasteStyle::ONE_TO_VALS:
+ newxform->SetXaos(i, 1);
+ xform->SetXaos(newxfcount, 1);
+ break;
+
+ case EmberCommon::eXaosPasteStyle::VALS_TO_ONE:
+ newxform->SetXaos(i, it.first.Xaos(i));
+ xform->SetXaos(newxfcount, xform->Xaos(it.second));
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ for (size_t i = oldxfcount; i < ember.XformCount(); i++)
+ {
+ if (auto xform = ember.GetXform(i))
+ {
+ for (size_t j = oldxfcount; j < ember.XformCount(); j++)
+ {
+ switch (pastestyle)
+ {
+ case EmberCommon::eXaosPasteStyle::NONE:
+ case EmberCommon::eXaosPasteStyle::ZERO_TO_ONE:
+ xform->SetXaos(j, 1);
+ break;
+
+ case EmberCommon::eXaosPasteStyle::ZERO_TO_VALS:
+ case EmberCommon::eXaosPasteStyle::ONE_TO_VALS:
+ xform->SetXaos(j, xforms[i - oldxfcount].first.Xaos(j - oldxfcount));
+ break;
+
+ case EmberCommon::eXaosPasteStyle::VALS_TO_ONE:
+ xform->SetXaos(j, 1);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ for (auto& it : xforms)
+ ember.AddXform(it.first);
+}
+
///
/// Duplicate the specified xforms in the current ember, and set the last one as the current xform.
/// If xaos is present in the ember, the duplicated xforms will be added with xaos preserved, else they'll just be added normally.
@@ -227,37 +315,7 @@ void FractoriumEmberController::DuplicateXform()
}, eXformUpdate::UPDATE_SELECTED_EXCEPT_FINAL, false);
Update([&]()
{
- if (m_Ember.XaosPresent())
- {
- if (!ctrl)
- {
- auto oldxfcount = m_Ember.XformCount();
-
- for (auto& it : vec)
- {
- m_Ember.AddXform(it.first);
- auto newxfcount = m_Ember.XformCount() - 1;
- auto* newxform = m_Ember.GetXform(newxfcount);
-
- for (size_t i = 0; i < oldxfcount; i++)
- {
- if (auto xform = m_Ember.GetXform(i))
- {
- newxform->SetXaos(i, it.first.Xaos(i));
- xform->SetXaos(newxfcount, xform->Xaos(it.second));
- }
- }
- }
- }
- else
- {
- AddXformsWithXaos(m_Ember, vec, true);
- }
- }
- else
- for (auto& it : vec)
- m_Ember.AddXform(it.first);
-
+ AddXformsWithXaos(m_Ember, vec, true, m_Fractorium->GetXaosPasteStyleType());
int index = int(m_Ember.TotalXformCount(forceFinal) - (forceFinal ? 2 : 1));//Set index to the last item before final.
FillXforms(index);//Handles xaos.
});
diff --git a/package-linux.sh b/package-linux.sh
index 6730985..8a5a415 100755
--- a/package-linux.sh
+++ b/package-linux.sh
@@ -123,6 +123,14 @@ tar --exclude='package-linux.sh' \
./Data/dark_linux.qss \
./Data/lightdark.qss \
./Data/uranium.qss \
+ ./Data/examples/b33rheart_examples.flame \
+ ./Data/examples/b33rheart_sierpinski.flame \
+ ./Data/examples/pillemaster_hexagonal_tilings.flame \
+ ./Data/examples/plangkye_examples.flame \
+ ./Data/examples/tatasz_examples.flame \
+ ./Data/examples/tatasz_substitution.flame \
+ ./Data/examples/triptychaos_examples \
+ ./Data/examples/tyrantwave_base_forms.flame \
.
[ $? -ne 0 ] && echo "Tar command failed." && exit 2