mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-02-08 05:50:07 -05:00
--User changes
Add linked xform support, with new button and icon on the xforms tab.
This commit is contained in:
parent
c43dfb6786
commit
3cd970a347
@ -190,6 +190,7 @@ public slots:
|
|||||||
//Xforms.
|
//Xforms.
|
||||||
void OnCurrentXformComboChanged(int index);
|
void OnCurrentXformComboChanged(int index);
|
||||||
void OnAddXformButtonClicked(bool checked);
|
void OnAddXformButtonClicked(bool checked);
|
||||||
|
void OnAddLinkedXformButtonClicked(bool checked);
|
||||||
void OnDuplicateXformButtonClicked(bool checked);
|
void OnDuplicateXformButtonClicked(bool checked);
|
||||||
void OnClearXformButtonClicked(bool checked);
|
void OnClearXformButtonClicked(bool checked);
|
||||||
void OnDeleteXformButtonClicked(bool checked);
|
void OnDeleteXformButtonClicked(bool checked);
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
<file>Icons/infomation.png</file>
|
<file>Icons/infomation.png</file>
|
||||||
<file>Icons/del.png</file>
|
<file>Icons/del.png</file>
|
||||||
<file>Icons/add.png</file>
|
<file>Icons/add.png</file>
|
||||||
|
<file>Icons/link-add.png</file>
|
||||||
<file>Icons/eraser.png</file>
|
<file>Icons/eraser.png</file>
|
||||||
<file>Icons/editraise.png</file>
|
<file>Icons/editraise.png</file>
|
||||||
<file>Icons/square.png</file>
|
<file>Icons/square.png</file>
|
||||||
|
@ -2146,15 +2146,15 @@
|
|||||||
<widget class="QDockWidget" name="XformsDockWidget">
|
<widget class="QDockWidget" name="XformsDockWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>300</x>
|
<x>280</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>240</width>
|
<width>267</width>
|
||||||
<height>881</height>
|
<height>881</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>240</width>
|
<width>267</width>
|
||||||
<height>613</height>
|
<height>613</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -2261,6 +2261,38 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="AddLinkedXformButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>25</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Add linked xform</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="Fractorium.qrc">
|
||||||
|
<normaloff>:/Fractorium/Icons/link-add.png</normaloff>:/Fractorium/Icons/link-add.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="DuplicateXformButton">
|
<widget class="QPushButton" name="DuplicateXformButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -3252,7 +3284,7 @@ SpinBox
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>216</width>
|
<width>237</width>
|
||||||
<height>745</height>
|
<height>745</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -4909,7 +4941,7 @@ SpinBox
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>216</width>
|
<width>237</width>
|
||||||
<height>680</height>
|
<height>680</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -62,6 +62,7 @@ public:
|
|||||||
virtual void SetEmber(size_t index) { }
|
virtual void SetEmber(size_t index) { }
|
||||||
//virtual void Clear() { }
|
//virtual void Clear() { }
|
||||||
virtual void AddXform() { }
|
virtual void AddXform() { }
|
||||||
|
virtual void AddLinkedXform() { }
|
||||||
virtual void DuplicateXform() { }
|
virtual void DuplicateXform() { }
|
||||||
virtual void ClearXform() { }
|
virtual void ClearXform() { }
|
||||||
virtual void DeleteXforms() { }
|
virtual void DeleteXforms() { }
|
||||||
@ -290,6 +291,7 @@ public:
|
|||||||
virtual void SetEmber(size_t index) override;
|
virtual void SetEmber(size_t index) override;
|
||||||
//virtual void Clear() override { }
|
//virtual void Clear() override { }
|
||||||
virtual void AddXform() override;
|
virtual void AddXform() override;
|
||||||
|
virtual void AddLinkedXform() override;
|
||||||
virtual void DuplicateXform() override;
|
virtual void DuplicateXform() override;
|
||||||
virtual void ClearXform() override;
|
virtual void ClearXform() override;
|
||||||
virtual void DeleteXforms() override;
|
virtual void DeleteXforms() override;
|
||||||
|
@ -9,6 +9,7 @@ void Fractorium::InitXformsUI()
|
|||||||
int spinHeight = 20, row = 0;
|
int spinHeight = 20, row = 0;
|
||||||
|
|
||||||
connect(ui.AddXformButton, SIGNAL(clicked(bool)), this, SLOT(OnAddXformButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.AddXformButton, SIGNAL(clicked(bool)), this, SLOT(OnAddXformButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
|
connect(ui.AddLinkedXformButton, SIGNAL(clicked(bool)), this, SLOT(OnAddLinkedXformButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.DuplicateXformButton, SIGNAL(clicked(bool)), this, SLOT(OnDuplicateXformButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.DuplicateXformButton, SIGNAL(clicked(bool)), this, SLOT(OnDuplicateXformButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.ClearXformButton, SIGNAL(clicked(bool)), this, SLOT(OnClearXformButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.ClearXformButton, SIGNAL(clicked(bool)), this, SLOT(OnClearXformButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.DeleteXformButton, SIGNAL(clicked(bool)), this, SLOT(OnDeleteXformButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.DeleteXformButton, SIGNAL(clicked(bool)), this, SLOT(OnDeleteXformButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
@ -86,6 +87,7 @@ void FractoriumEmberController<T>::CurrentXformComboChanged(int index)
|
|||||||
m_Fractorium->ui.DuplicateXformButton->setEnabled(enable);
|
m_Fractorium->ui.DuplicateXformButton->setEnabled(enable);
|
||||||
m_Fractorium->m_XformWeightSpin->setEnabled(enable);
|
m_Fractorium->m_XformWeightSpin->setEnabled(enable);
|
||||||
m_Fractorium->ui.SoloXformCheckBox->setEnabled(enable);
|
m_Fractorium->ui.SoloXformCheckBox->setEnabled(enable);
|
||||||
|
m_Fractorium->ui.AddLinkedXformButton->setEnabled(enable);
|
||||||
m_Fractorium->ui.AddFinalXformButton->setEnabled(enable);
|
m_Fractorium->ui.AddFinalXformButton->setEnabled(enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +106,6 @@ void FractoriumEmberController<T>::AddXform()
|
|||||||
Update([&]()
|
Update([&]()
|
||||||
{
|
{
|
||||||
Xform<T> newXform;
|
Xform<T> newXform;
|
||||||
QComboBox* combo = m_Fractorium->ui.CurrentXformCombo;
|
|
||||||
|
|
||||||
newXform.m_Weight = 0.25;
|
newXform.m_Weight = 0.25;
|
||||||
newXform.m_ColorX = m_Rand.Frand01<T>();
|
newXform.m_ColorX = m_Rand.Frand01<T>();
|
||||||
@ -116,6 +117,55 @@ void FractoriumEmberController<T>::AddXform()
|
|||||||
|
|
||||||
void Fractorium::OnAddXformButtonClicked(bool checked) { m_Controller->AddXform(); }
|
void Fractorium::OnAddXformButtonClicked(bool checked) { m_Controller->AddXform(); }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a new linked xform in the current ember and set it as the current xform.
|
||||||
|
/// Linked means:
|
||||||
|
///
|
||||||
|
/// Called when the add xform button is clicked.
|
||||||
|
/// Resets the rendering process.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="checked">Ignored</param>
|
||||||
|
template <typename T>
|
||||||
|
void FractoriumEmberController<T>::AddLinkedXform()
|
||||||
|
{
|
||||||
|
UpdateXform([&](Xform<T>* xform)
|
||||||
|
{
|
||||||
|
size_t i, count = m_Ember.XformCount();
|
||||||
|
Xform<T> newXform;
|
||||||
|
|
||||||
|
newXform.m_Weight = 0.5;
|
||||||
|
newXform.m_Opacity = 1;
|
||||||
|
newXform.m_ColorSpeed = 1;
|
||||||
|
newXform.m_ColorX = xform->m_ColorX;
|
||||||
|
//newXform.m_ColorY = xform->m_ColorY;
|
||||||
|
|
||||||
|
//Set all of the new xform's xaos values to the selected xform's xaos values,
|
||||||
|
//then set the selected xform's xaos values to 0.
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
newXform.SetXaos(i, xform->Xaos(i));
|
||||||
|
xform->SetXaos(i, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add the new xform and update the total count.
|
||||||
|
m_Ember.AddXform(newXform);
|
||||||
|
count = m_Ember.XformCount();
|
||||||
|
|
||||||
|
//Set the xaos for all xforms pointing to the new one to zero.
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
if (auto* xf = m_Ember.GetXform(i))
|
||||||
|
xf->SetXaos(count - 1, 0);
|
||||||
|
|
||||||
|
xform->SetXaos(count - 1, 1);//Set the xaos value for the previous xform pointing to the new one to one.
|
||||||
|
xform->m_Opacity = 0;//Clear the opacity of the previous xform.
|
||||||
|
int index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
|
||||||
|
FillXforms(index);
|
||||||
|
FillXaos();
|
||||||
|
}, eXformUpdate::UPDATE_CURRENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fractorium::OnAddLinkedXformButtonClicked(bool checked) { m_Controller->AddLinkedXform(); }
|
||||||
|
|
||||||
/// <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.
|
||||||
/// Called when the duplicate xform button is clicked.
|
/// Called when the duplicate xform button is clicked.
|
||||||
|
BIN
Source/Fractorium/Icons/link-add.png
Normal file
BIN
Source/Fractorium/Icons/link-add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Loading…
Reference in New Issue
Block a user