mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-02 06:16:17 -04:00
--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:
@ -793,6 +793,43 @@ static vector<const Variation<T>*> FindVarsWithout(const vector<const Variation<
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a vector of xforms to the passed in ember, and optionally preserve the xaos based on position.
|
||||
/// </summary>
|
||||
/// <param name="ember">The ember to add xforms to</param>
|
||||
/// <param name="xforms">The vector of xforms to add</param>
|
||||
/// <param name="preserveXaos">True to preserve xaos else false.</param>
|
||||
template <typename T>
|
||||
static void AddXformsWithXaos(Ember<T>& ember, std::vector<Xform<T>>& xforms, bool preserveXaos)
|
||||
{
|
||||
auto origXformCount = ember.XformCount();
|
||||
|
||||
for (auto& it : xforms)
|
||||
ember.AddXform(it);
|
||||
|
||||
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].Xaos(j - origXformCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user