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

View File

@ -3194,7 +3194,7 @@
</size>
</property>
<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 name="text">
<string/>

View File

@ -208,6 +208,7 @@ void Fractorium::OnAddLinkedXformButtonClicked(bool checked) { m_Controller->Add
/// <summary>
/// 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.
/// Resets the rendering process.
/// </summary>
@ -218,13 +219,18 @@ void FractoriumEmberController<T>::DuplicateXform()
bool forceFinal = m_Fractorium->HaveFinal();
vector<Xform<T>> vec;
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);
}, eXformUpdate::UPDATE_SELECTED_EXCEPT_FINAL, false);
Update([&]()
{
AddXformsWithXaos(m_Ember, vec, true);
if (m_Ember.XaosPresent())
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.
FillXforms(index);//Handles xaos.
});