--User changes

-Duplicate xform will now only add the new xforms with xaos preserved if xaos is already being used in the flame. Otherwise, they'll just be added normally.
 -This is a hybrid of the original behavior and the new behavior added a year or so ago.
This commit is contained in:
Person 2020-01-17 18:58:51 -08:00
parent f550a3e9b8
commit 8e6ba922af
3 changed files with 30 additions and 14 deletions

View File

@ -378,12 +378,14 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{ {
auto combo = ui.CurrentXformCombo; auto combo = ui.CurrentXformCombo;
bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier); bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
int times = 3;
int ftimes = 2;
if (ke->key() >= Qt::Key_F1 && ke->key() <= Qt::Key_F32) if (ke->key() >= Qt::Key_F1 && ke->key() <= Qt::Key_F32)
{ {
fcount++; fcount++;
if (fcount >= 3) if (fcount >= ftimes)
{ {
int val = ke->key() - (int)Qt::Key_F1; int val = ke->key() - (int)Qt::Key_F1;
@ -459,7 +461,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{ {
xfupcount++; xfupcount++;
if (xfupcount >= 3) if (xfupcount >= times)
{ {
xfupcount = 0; xfupcount = 0;
combo->setCurrentIndex((index + 1) % combo->count()); combo->setCurrentIndex((index + 1) % combo->count());
@ -472,7 +474,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{ {
xfdncount++; xfdncount++;
if (xfdncount >= 3) if (xfdncount >= times)
{ {
xfdncount = 0; xfdncount = 0;
@ -489,7 +491,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{ {
wcount++; wcount++;
if (wcount >= 3) if (wcount >= times)
{ {
wcount = 0; wcount = 0;
m_Controller->MoveXforms(0, vdist, pre); m_Controller->MoveXforms(0, vdist, pre);
@ -501,7 +503,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{ {
scount++; scount++;
if (scount >= 3) if (scount >= times)
{ {
scount = 0; scount = 0;
m_Controller->MoveXforms(0, -vdist, pre); m_Controller->MoveXforms(0, -vdist, pre);
@ -513,7 +515,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{ {
acount++; acount++;
if (acount >= 3) if (acount >= times)
{ {
acount = 0; acount = 0;
m_Controller->MoveXforms(-hdist, 0, pre); m_Controller->MoveXforms(-hdist, 0, pre);
@ -525,7 +527,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{ {
dcount++; dcount++;
if (dcount >= 3) if (dcount >= times)
{ {
dcount = 0; dcount = 0;
m_Controller->MoveXforms(hdist, 0, pre); m_Controller->MoveXforms(hdist, 0, pre);
@ -537,41 +539,49 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{ {
qcount++; qcount++;
if (qcount >= 3) if (qcount >= times)
{ {
qcount = 0; qcount = 0;
m_Controller->RotateXformsByAngle(-rot, pre); m_Controller->RotateXformsByAngle(-rot, pre);
} }
return true;
} }
else if (ke->key() == Qt::Key_E) else if (ke->key() == Qt::Key_E)
{ {
ecount++; ecount++;
if (ecount >= 3) if (ecount >= times)
{ {
ecount = 0; ecount = 0;
m_Controller->RotateXformsByAngle(rot, pre); m_Controller->RotateXformsByAngle(rot, pre);
} }
return true;
} }
else if (ke->key() == Qt::Key_G) else if (ke->key() == Qt::Key_G)
{ {
gcount++; gcount++;
if (gcount >= 3) if (gcount >= times)
{ {
gcount = 0; gcount = 0;
m_Controller->ScaleXforms(1 - grow, pre); m_Controller->ScaleXforms(1 - grow, pre);
} }
return true;
} }
else if (ke->key() == Qt::Key_H) else if (ke->key() == Qt::Key_H)
{ {
hcount++; hcount++;
if (hcount >= 3) if (hcount >= times)
{ {
hcount = 0; hcount = 0;
m_Controller->ScaleXforms(1 + grow, pre); m_Controller->ScaleXforms(1 + grow, pre);
} }
return true;
} }
} }
} }

View File

@ -3194,7 +3194,7 @@
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Duplicate selected xforms</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Duplicate selected xforms.&lt;/p&gt;&lt;p&gt;If xaos is present in the flame, the new xforms will be added with existing xaos preserved, else they'll just be added normally.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>

View File

@ -208,6 +208,7 @@ void Fractorium::OnAddLinkedXformButtonClicked(bool checked) { m_Controller->Add
/// <summary> /// <summary>
/// Duplicate the specified xforms in the current ember, and set the last one as the current xform. /// 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 new xforms will be added with xaos preserved, else they'll just be added normally.
/// Called when the duplicate xform button is clicked. /// Called when the duplicate xform button is clicked.
/// Resets the rendering process. /// Resets the rendering process.
/// </summary> /// </summary>
@ -218,13 +219,18 @@ void FractoriumEmberController<T>::DuplicateXform()
bool forceFinal = m_Fractorium->HaveFinal(); bool forceFinal = m_Fractorium->HaveFinal();
vector<Xform<T>> vec; vector<Xform<T>> vec;
vec.reserve(m_Ember.XformCount()); vec.reserve(m_Ember.XformCount());
UpdateXform([&] (Xform<T>* xform, size_t xfindex, size_t selIndex) UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
{ {
vec.push_back(*xform); vec.push_back(*xform);
}, eXformUpdate::UPDATE_SELECTED_EXCEPT_FINAL, false); }, eXformUpdate::UPDATE_SELECTED_EXCEPT_FINAL, false);
Update([&]() Update([&]()
{ {
if (m_Ember.XaosPresent())
AddXformsWithXaos(m_Ember, vec, true); AddXformsWithXaos(m_Ember, vec, true);
else
for (auto& it : vec)
m_Ember.AddXform(it);
int index = int(m_Ember.TotalXformCount(forceFinal) - (forceFinal ? 2 : 1));//Set index to the last item before final. int index = int(m_Ember.TotalXformCount(forceFinal) - (forceFinal ? 2 : 1));//Set index to the last item before final.
FillXforms(index);//Handles xaos. FillXforms(index);//Handles xaos.
}); });