--User changes

-Attempt to preserve xaos when adding xforms. Note this is not an exact copy, but just a preservation of some values based on position.
 -Add some acceleration to the changing of spinner values when dragging the right mouse button to adjust.
 -Make the pivot be the center of the viewable area when doing drag/rotate/scale with the right mouse button.
 --Clamp minimum scale to 10
 --Draw a line from the mouse position to the pivot.
 -Keep a cache of the last added final xform with each flame so that it can be quickly added, removed, then added back for testing its effect.
 --This is not saved with the xml file and is solely for interactive editing.

--Bug fixes
 -File filtering in open and save dialogs were broken.
 -Right clicking on integer spin boxes was causing the context menu to pop up, when it should be supressed just like double spin boxes.
 -Deleting xforms was still broken.

--Code changes
 -Refactor the code for adding and pasting xforms into a single global static function called AddXformsWithXaos().
This commit is contained in:
Person
2018-08-10 18:06:04 -07:00
parent 26c558a2f5
commit dee4304bf2
13 changed files with 173 additions and 62 deletions

View File

@ -180,28 +180,9 @@ void FractoriumEmberController<T>::AddLayer(int xforms)
{
Update([&]
{
auto origXformCount = m_Ember.XformCount();
m_Ember.AddXforms(xforms);
std::vector<Xform<T>> vec(xforms);
AddXformsWithXaos(m_Ember, vec, false);
for (auto i = 0; i < m_Ember.XformCount(); i++)
{
auto xf = m_Ember.GetXform(i);
if (i < origXformCount)
{
for (auto j = 0; j < m_Ember.XformCount(); j++)
if (j >= origXformCount)
xf->SetXaos(j, 0);
}
else
{
for (auto j = 0; j < m_Ember.XformCount(); j++)
if (j < origXformCount)
xf->SetXaos(j, 0);
else
xf->SetXaos(j, 1);
}
}
});
FillXforms();
FillSummary();
@ -210,25 +191,35 @@ void FractoriumEmberController<T>::AddLayer(int xforms)
void Fractorium::OnAddLayerButtonClicked(bool checked) { m_Controller->AddLayer(ui.AddLayerSpinBox->value()); }
/// <summary>
/// Toggle all xaos values in one row.
/// Toggle all xaos values in one row on left mouse button double click and resize all cells to fit their data.
/// Skip toggling and only refit on right mouse button double click.
/// Resets the rendering process.
/// </summary>
/// <param name="logicalIndex">The index of the row that was double clicked</param>
void Fractorium::OnXaosRowDoubleClicked(int logicalIndex)
{
ToggleTableRow(ui.XaosTableView, logicalIndex);
auto btn = QApplication::mouseButtons();
if (!btn.testFlag(Qt::RightButton))
ToggleTableRow(ui.XaosTableView, logicalIndex);
ui.XaosTableView->resizeRowsToContents();
ui.XaosTableView->resizeColumnsToContents();
}
/// <summary>
/// Toggle all xaos values in one column.
/// Toggle all xaos values in one column on left mouse button double click and resize all cells to fit their data.
/// Skip toggling and only refit on right mouse button double click.
/// Resets the rendering process.
/// </summary>
/// <param name="logicalIndex">The index of the column that was double clicked</param>
void Fractorium::OnXaosColDoubleClicked(int logicalIndex)
{
ToggleTableCol(ui.XaosTableView, logicalIndex);
auto btn = QApplication::mouseButtons();
if (!btn.testFlag(Qt::RightButton))
ToggleTableCol(ui.XaosTableView, logicalIndex);
ui.XaosTableView->resizeRowsToContents();
ui.XaosTableView->resizeColumnsToContents();
}