2018-07-08 13:25:08 -04:00
# include " FractoriumPch.h "
2014-07-08 03:11:14 -04:00
# include "Fractorium.h"
/// <summary>
/// Initialize the xforms UI.
/// </summary>
void Fractorium : : InitXformsUI ( )
{
int spinHeight = 20 , row = 0 ;
connect ( ui . AddXformButton , SIGNAL ( clicked ( bool ) ) , this , SLOT ( OnAddXformButtonClicked ( bool ) ) , Qt : : QueuedConnection ) ;
2015-06-24 23:49:09 -04:00
connect ( ui . AddLinkedXformButton , SIGNAL ( clicked ( bool ) ) , this , SLOT ( OnAddLinkedXformButtonClicked ( bool ) ) , Qt : : QueuedConnection ) ;
2014-07-08 03:11:14 -04:00
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 . DeleteXformButton , SIGNAL ( clicked ( bool ) ) , this , SLOT ( OnDeleteXformButtonClicked ( bool ) ) , Qt : : QueuedConnection ) ;
connect ( ui . AddFinalXformButton , SIGNAL ( clicked ( bool ) ) , this , SLOT ( OnAddFinalXformButtonClicked ( bool ) ) , Qt : : QueuedConnection ) ;
connect ( ui . CurrentXformCombo , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( OnCurrentXformComboChanged ( int ) ) , Qt : : QueuedConnection ) ;
2016-02-02 20:51:58 -05:00
connect ( ui . AnimateXformCheckBox , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( OnXformAnimateCheckBoxStateChanged ( int ) ) , Qt : : QueuedConnection ) ;
2018-07-31 00:39:41 -04:00
SetFixedTableHeader ( ui . XformWeightNameTable - > horizontalHeader ( ) , QHeaderView : : ResizeToContents ) ;
2014-07-08 03:11:14 -04:00
//Use SetupSpinner() just to create the spinner, but use col of -1 to prevent it from being added to the table.
SetupSpinner < DoubleSpinBox , double > ( ui . XformWeightNameTable , this , row , - 1 , m_XformWeightSpin , spinHeight , 0 , 1000 , 0.05 , SIGNAL ( valueChanged ( double ) ) , SLOT ( OnXformWeightChanged ( double ) ) , false , 0 , 1 , 0 ) ;
m_XformWeightSpin - > setDecimals ( 3 ) ;
m_XformWeightSpin - > SmallStep ( 0.001 ) ;
2018-07-31 00:39:41 -04:00
m_XformWeightSpin - > setMinimumWidth ( 40 ) ;
2018-07-08 13:25:08 -04:00
m_XformWeightSpinnerButtonWidget = new SpinnerLabelButtonWidget ( m_XformWeightSpin , " = " , 20 , 19 , ui . XformWeightNameTable ) ;
2018-07-31 00:39:41 -04:00
m_XformWeightSpinnerButtonWidget - > m_SpinBox - > setSizePolicy ( QSizePolicy : : Expanding , QSizePolicy : : Fixed ) ;
m_XformWeightSpinnerButtonWidget - > m_Label - > setStyleSheet ( " border: 0px; " ) ;
m_XformWeightSpinnerButtonWidget - > m_Label - > setAlignment ( Qt : : AlignRight | Qt : : AlignVCenter ) ;
m_XformWeightSpinnerButtonWidget - > m_Label - > setSizePolicy ( QSizePolicy : : Preferred , QSizePolicy : : Fixed ) ;
m_XformWeightSpinnerButtonWidget - > m_Button - > setToolTip ( " Equalize weights " ) ;
2014-07-08 03:11:14 -04:00
m_XformWeightSpinnerButtonWidget - > m_Button - > setStyleSheet ( " text-align: center center " ) ;
2018-07-31 00:39:41 -04:00
m_XformWeightSpinnerButtonWidget - > setMaximumWidth ( 130 ) ;
2014-07-08 03:11:14 -04:00
connect ( m_XformWeightSpinnerButtonWidget - > m_Button , SIGNAL ( clicked ( bool ) ) , this , SLOT ( OnEqualWeightButtonClicked ( bool ) ) , Qt : : QueuedConnection ) ;
ui . XformWeightNameTable - > setCellWidget ( 0 , 0 , m_XformWeightSpinnerButtonWidget ) ;
ui . XformWeightNameTable - > setItem ( 0 , 1 , new QTableWidgetItem ( ) ) ;
connect ( ui . XformWeightNameTable , SIGNAL ( cellChanged ( int , int ) ) , this , SLOT ( OnXformNameChanged ( int , int ) ) , Qt : : QueuedConnection ) ;
2018-07-31 00:39:41 -04:00
ui . CurrentXformCombo - > view ( ) - > setMinimumWidth ( 100 ) ;
ui . CurrentXformCombo - > view ( ) - > setMaximumWidth ( 500 ) ;
//ui.CurrentXformCombo->view()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
ui . CurrentXformCombo - > view ( ) - > setSizeAdjustPolicy ( QAbstractScrollArea : : SizeAdjustPolicy : : AdjustToContentsOnFirstShow ) ;
2016-03-01 20:26:45 -05:00
# ifndef _WIN32
2015-01-01 10:17:05 -05:00
//For some reason linux makes these 24x24, even though the designer explicitly says 16x16.
ui . AddXformButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
ui . DuplicateXformButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
ui . ClearXformButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
ui . DeleteXformButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
ui . AddFinalXformButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
ui . CurrentXformCombo - > setIconSize ( QSize ( 16 , 16 ) ) ;
2014-12-12 05:37:29 -05:00
# endif
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Get the current xform.
/// </summary>
2015-01-02 18:11:36 -05:00
/// <returns>The current xform as specified by the current xform combo box index. nullptr if out of range (should never happen).</returns>
2014-07-08 03:11:14 -04:00
template < typename T >
Xform < T > * FractoriumEmberController < T > : : CurrentXform ( )
{
2017-07-27 00:25:44 -04:00
bool hasFinal = m_Fractorium - > HaveFinal ( ) ;
return m_Ember . GetTotalXform ( m_Fractorium - > ui . CurrentXformCombo - > currentIndex ( ) , hasFinal ) ; //Need to force final for the special case they created a final, then cleared it, but did not delete it.
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Set the current xform to the index passed in.
/// </summary>
/// <param name="i">The index to set the current xform to</param>
2014-12-06 00:05:09 -05:00
void Fractorium : : CurrentXform ( uint i )
2014-07-08 03:11:14 -04:00
{
2014-12-11 00:50:15 -05:00
if ( i < uint ( ui . CurrentXformCombo - > count ( ) ) )
2018-07-31 00:39:41 -04:00
ui . CurrentXformCombo - > setCurrentIndex ( i ) ;
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Set the current xform and populate all GUI widgets.
/// Called when the current xform combo box index changes.
/// </summary>
/// <param name="index">The selected combo box index</param>
template < typename T >
void FractoriumEmberController < T > : : CurrentXformComboChanged ( int index )
{
2017-07-27 00:25:44 -04:00
bool forceFinal = m_Fractorium - > HaveFinal ( ) ;
if ( auto xform = m_Ember . GetTotalXform ( index , forceFinal ) )
2014-07-08 03:11:14 -04:00
{
FillWithXform ( xform ) ;
m_GLController - > SetSelectedXform ( xform ) ;
2018-07-31 00:39:41 -04:00
int solo = m_Ember . m_Solo ;
2014-07-08 03:11:14 -04:00
m_Fractorium - > ui . SoloXformCheckBox - > blockSignals ( true ) ;
m_Fractorium - > ui . SoloXformCheckBox - > setChecked ( solo = = index ) ;
m_Fractorium - > ui . SoloXformCheckBox - > blockSignals ( false ) ;
bool enable = ! IsFinal ( CurrentXform ( ) ) ;
m_Fractorium - > ui . DuplicateXformButton - > setEnabled ( enable ) ;
m_Fractorium - > m_XformWeightSpin - > setEnabled ( enable ) ;
m_Fractorium - > ui . SoloXformCheckBox - > setEnabled ( enable ) ;
2015-06-24 23:49:09 -04:00
m_Fractorium - > ui . AddLinkedXformButton - > setEnabled ( enable ) ;
2015-07-31 22:46:53 -04:00
m_Fractorium - > ui . AddFinalXformButton - > setEnabled ( ! m_Ember . UseFinalXform ( ) ) ;
2014-07-08 03:11:14 -04:00
}
}
void Fractorium : : OnCurrentXformComboChanged ( int index ) { m_Controller - > CurrentXformComboChanged ( index ) ; }
/// <summary>
/// Add an empty xform in the current ember and set it as the current xform.
/// Called when the add xform button is clicked.
/// Resets the rendering process.
/// </summary>
/// <param name="checked">Ignored</param>
template < typename T >
void FractoriumEmberController < T > : : AddXform ( )
{
2017-07-27 00:25:44 -04:00
bool forceFinal = m_Fractorium - > HaveFinal ( ) ;
2015-04-27 01:11:56 -04:00
Update ( [ & ] ( )
2014-07-08 03:11:14 -04:00
{
Xform < T > newXform ;
newXform . m_Weight = 0.25 ;
newXform . m_ColorX = m_Rand . Frand01 < T > ( ) ;
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
newXform . AddVariation ( m_VariationList - > GetVariationCopy ( eVariationId : : VAR_LINEAR ) ) ;
2014-07-08 03:11:14 -04:00
m_Ember . AddXform ( newXform ) ;
2017-07-27 00:25:44 -04:00
int index = int ( m_Ember . TotalXformCount ( forceFinal ) - ( forceFinal ? 2 : 1 ) ) ; //Set index to the last item before final.
2015-05-03 20:13:14 -04:00
FillXforms ( index ) ;
2014-07-08 03:11:14 -04:00
} ) ;
}
void Fractorium : : OnAddXformButtonClicked ( bool checked ) { m_Controller - > AddXform ( ) ; }
2015-06-24 23:49:09 -04:00
/// <summary>
/// Add a new linked xform in the current ember and set it as the current xform.
/// Linked means:
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
/// Add an xform whose xaos values are:
/// From: All xaos values from the current xform are zero when going to any xform but the new one added, which is 1.
/// To: The xaos value coming from the current xform is 1 and the xaos values from all other xforms are 0, when going to the newly added xform.
/// Take different action when a single xform is selected vs. multiple.
2017-12-21 23:09:08 -05:00
/// Single: Copy the current xform's xaos values to the new one.
/// Multiple: Set the new xform's xaos values to 1, and except the last entry which is 0.
2015-06-24 23:49:09 -04:00
/// 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 ( )
{
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
bool hasAdded = false ;
2017-07-27 00:25:44 -04:00
bool forceFinal = m_Fractorium - > HaveFinal ( ) ;
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
auto selCount = m_Fractorium - > SelectedXformCount ( false ) ;
if ( ! selCount ) //If none explicitly selected, use current.
selCount = 1 ;
Ember < T > ember = m_Ember ;
m_Ember . Reserve ( m_Ember . XformCount ( ) + 1 ) ; //Doing this ahead of time ensures pointers remain valid.
auto iterCount = 0 ;
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
UpdateXform ( [ & ] ( Xform < T > * xform , size_t xfindex , size_t selIndex )
2015-06-24 23:49:09 -04:00
{
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
//Covers very strange case where final is selected, but initially not considered because final is excluded,
//but after adding the new xform, it thinks its selected index is non-final.
if ( iterCount < selCount )
2015-06-24 23:49:09 -04:00
{
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
size_t i , count = m_Ember . XformCount ( ) ;
2015-06-24 23:49:09 -04:00
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
if ( ! hasAdded )
{
Xform < T > newXform ;
newXform . m_Weight = 0.5 ;
newXform . m_Opacity = xform - > m_Opacity ;
newXform . m_ColorSpeed = 0 ;
newXform . m_ColorX = 0 ;
//newXform.m_ColorY = xform->m_ColorY;
newXform . AddVariation ( m_VariationList - > GetVariationCopy ( eVariationId : : VAR_LINEAR ) ) ;
2015-06-24 23:49:09 -04:00
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
//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 + + )
{
if ( selCount = = 1 )
newXform . SetXaos ( i , xform - > Xaos ( i ) ) ;
else
newXform . SetXaos ( i , 1 ) ;
}
2015-06-24 23:49:09 -04:00
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
//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.
//Will set the last element of all linking and non-linking xforms, including the one we just added.
//Linking xforms will have their last xaos element set to 1 below.
for ( i = 0 ; i < count ; i + + )
if ( auto xf = m_Ember . GetXform ( i ) )
xf - > SetXaos ( count - 1 , 0 ) ;
hasAdded = true ;
}
//Linking xform, so set all xaos elements to 0, except the last.
for ( i = 0 ; i < count - 1 ; i + + )
xform - > SetXaos ( i , 0 ) ;
xform - > SetXaos ( count - 1 , 1 ) ; //Set the xaos value for the linking xform pointing to the new one to one.
xform - > m_Opacity = 0 ; //Clear the opacity of the all linking xform.
iterCount + + ;
}
} , eXformUpdate : : UPDATE_SELECTED_EXCEPT_FINAL ) ;
//Now update the GUI.
int index = int ( m_Ember . TotalXformCount ( forceFinal ) - ( forceFinal ? 2 : 1 ) ) ; //Set index to the last item before final.
FillXforms ( index ) ;
FillXaos ( ) ;
2015-06-24 23:49:09 -04:00
}
void Fractorium : : OnAddLinkedXformButtonClicked ( bool checked ) { m_Controller - > AddLinkedXform ( ) ; }
2014-07-08 03:11:14 -04:00
/// <summary>
2015-04-27 01:11:56 -04:00
/// Duplicate the specified xforms in the current ember, and set the last one as the current xform.
2014-07-08 03:11:14 -04:00
/// Called when the duplicate xform button is clicked.
/// Resets the rendering process.
/// </summary>
/// <param name="checked">Ignored</param>
template < typename T >
void FractoriumEmberController < T > : : DuplicateXform ( )
{
2017-07-27 00:25:44 -04:00
bool forceFinal = m_Fractorium - > HaveFinal ( ) ;
2015-04-27 01:11:56 -04:00
vector < Xform < T > > vec ;
vec . reserve ( m_Ember . XformCount ( ) ) ;
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
UpdateXform ( [ & ] ( Xform < T > * xform , size_t xfindex , size_t selIndex )
2015-04-27 01:11:56 -04:00
{
vec . push_back ( * xform ) ;
} , eXformUpdate : : UPDATE_SELECTED_EXCEPT_FINAL , false ) ;
Update ( [ & ] ( )
2014-07-08 03:11:14 -04:00
{
2018-08-10 21:06:04 -04:00
AddXformsWithXaos ( m_Ember , vec , true ) ;
2017-07-27 00:25:44 -04:00
int index = int ( m_Ember . TotalXformCount ( forceFinal ) - ( forceFinal ? 2 : 1 ) ) ; //Set index to the last item before final.
2015-05-03 20:13:14 -04:00
FillXforms ( index ) ; //Handles xaos.
2014-07-08 03:11:14 -04:00
} ) ;
}
void Fractorium : : OnDuplicateXformButtonClicked ( bool checked ) { m_Controller - > DuplicateXform ( ) ; }
/// <summary>
2015-04-27 01:11:56 -04:00
/// Clear all variations from the selected xforms. Affine, palette and xaos are left untouched.
2014-07-08 03:11:14 -04:00
/// Called when the clear xform button is clicked.
/// Resets the rendering process.
/// </summary>
/// <param name="checked">Ignored</param>
template < typename T >
2015-04-27 01:11:56 -04:00
void FractoriumEmberController < T > : : ClearXform ( )
2014-07-08 03:11:14 -04:00
{
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
UpdateXform ( [ & ] ( Xform < T > * xform , size_t xfindex , size_t selIndex )
2014-07-08 03:11:14 -04:00
{
2015-04-27 01:11:56 -04:00
xform - > ClearAndDeleteVariations ( ) ; //Note xaos is left alone.
} , eXformUpdate : : UPDATE_SELECTED ) ;
2018-07-31 00:39:41 -04:00
FillVariationTreeWithCurrentXform ( ) ;
2014-07-08 03:11:14 -04:00
}
2015-04-27 01:11:56 -04:00
void Fractorium : : OnClearXformButtonClicked ( bool checked ) { m_Controller - > ClearXform ( ) ; }
2014-07-08 03:11:14 -04:00
/// <summary>
2015-04-27 01:11:56 -04:00
/// Delete the selected xforms.
2018-08-10 21:06:04 -04:00
/// Cache a copy of the final xform if it's been selected for removal.
2014-07-08 03:11:14 -04:00
/// Will not delete the last remaining non-final xform.
/// Called when the delete xform button is clicked.
/// Resets the rendering process.
/// </summary>
/// <param name="checked">Ignored</param>
template < typename T >
2015-04-27 01:11:56 -04:00
void FractoriumEmberController < T > : : DeleteXforms ( )
2014-07-08 03:11:14 -04:00
{
2017-07-27 00:25:44 -04:00
bool removed = false ;
2018-08-10 21:06:04 -04:00
bool anyChecked = false ;
2017-07-27 00:25:44 -04:00
bool haveFinal = m_Fractorium - > HaveFinal ( ) ;
2016-02-02 20:51:58 -05:00
auto combo = m_Fractorium - > ui . CurrentXformCombo ;
2017-07-27 00:25:44 -04:00
Xform < T > * finalXform = nullptr ;
2018-08-10 21:06:04 -04:00
vector < Xform < T > > xformsToKeep ;
xformsToKeep . reserve ( m_Ember . TotalXformCount ( ) ) ;
2015-04-27 01:11:56 -04:00
//Iterating over the checkboxes must be done instead of using UpdateXform() to iterate over xforms
//because xforms are being deleted inside the loop.
//Also manually calling UpdateRender() rather than using the usual Update() call because
//it should only be called if an xform has actually been deleted.
2017-07-27 00:25:44 -04:00
//Rather than go through and delete, it's easier to just make a list of what we want to keep.
m_Fractorium - > ForEachXformCheckbox ( [ & ] ( int i , QCheckBox * w , bool isFinal )
2014-07-08 03:11:14 -04:00
{
2017-07-27 00:25:44 -04:00
if ( ! w - > isChecked ( ) ) //Keep if not checked.
2015-04-27 01:11:56 -04:00
{
2017-07-27 00:25:44 -04:00
if ( isFinal )
finalXform = m_Ember . NonConstFinalXform ( ) ;
else if ( auto xform = m_Ember . GetXform ( i ) )
2018-08-10 21:06:04 -04:00
xformsToKeep . push_back ( * xform ) ;
2015-04-27 01:11:56 -04:00
}
2018-08-10 21:06:04 -04:00
else
anyChecked = true ; //At least one was selected for removal.
2014-07-08 03:11:14 -04:00
} ) ;
2017-07-27 00:25:44 -04:00
//They might not have selected any checkboxes, in which case just delete the current.
auto current = combo - > currentIndex ( ) ;
2018-08-10 21:06:04 -04:00
auto totalCount = m_Ember . TotalXformCount ( ) ;
bool keepFinal = finalXform & & haveFinal ;
2015-04-27 01:11:56 -04:00
//Nothing was selected, so just delete current.
2018-08-10 21:06:04 -04:00
if ( ! anyChecked )
2017-07-27 00:25:44 -04:00
{
//Disallow deleting the only remaining non-final xform.
2018-08-10 21:06:04 -04:00
if ( ! ( haveFinal & & totalCount < = 2 & & current = = 0 ) & & //One non-final, one final, disallow deleting non-final.
! ( ! haveFinal & & totalCount = = 1 ) ) //One non-final, no final, disallow deleting.
2017-07-27 00:25:44 -04:00
{
2018-08-10 21:06:04 -04:00
if ( haveFinal & & m_Ember . IsFinalXform ( CurrentXform ( ) ) ) //Is final the current?
m_Ember . m_CachedFinal = * m_Ember . FinalXform ( ) ; //Keep a copy in case the user wants to re-add the final.
m_Ember . DeleteTotalXform ( current , haveFinal ) ; //Will cover the case of current either being final or non-final.
2017-07-27 00:25:44 -04:00
removed = true ;
}
}
else
2015-04-27 01:11:56 -04:00
{
2018-08-10 21:06:04 -04:00
if ( ! xformsToKeep . empty ( ) ) //Remove if they requested to do so, but ensure it's not removing all.
{
removed = true ;
m_Ember . ReplaceXforms ( xformsToKeep ) ; //Replace with only those they chose to keep (the inverse of what was checked).
}
else //They selected all to delete, which is not allowed, so just keep the first xform.
2017-07-27 00:25:44 -04:00
{
removed = true ;
2018-08-10 21:06:04 -04:00
while ( m_Ember . XformCount ( ) > 1 )
m_Ember . DeleteXform ( m_Ember . XformCount ( ) - 1 ) ;
2017-07-27 00:25:44 -04:00
}
2018-08-10 21:06:04 -04:00
if ( ! keepFinal ) //They selected final to delete.
2017-07-27 00:25:44 -04:00
{
removed = true ;
2018-08-10 21:06:04 -04:00
m_Ember . m_CachedFinal = * m_Ember . FinalXform ( ) ; //Keep a copy in case the user wants to re-add the final.
2017-07-27 00:25:44 -04:00
m_Ember . NonConstFinalXform ( ) - > Clear ( ) ;
}
2015-04-27 01:11:56 -04:00
}
2017-07-27 00:25:44 -04:00
if ( removed )
2015-04-27 01:11:56 -04:00
{
2016-02-13 20:24:51 -05:00
int index = int ( m_Ember . TotalXformCount ( ) - ( m_Ember . UseFinalXform ( ) ? 2 : 1 ) ) ; //Set index to the last item before final. Note final is requeried one last time.
2015-05-03 20:13:14 -04:00
FillXforms ( index ) ;
2015-04-27 01:11:56 -04:00
UpdateRender ( ) ;
2018-08-10 21:06:04 -04:00
m_Fractorium - > ui . GLDisplay - > repaint ( ) ; //Force update because for some reason it doesn't always happen.
2015-04-27 01:11:56 -04:00
}
2014-07-08 03:11:14 -04:00
}
2015-04-27 01:11:56 -04:00
void Fractorium : : OnDeleteXformButtonClicked ( bool checked ) { m_Controller - > DeleteXforms ( ) ; }
2014-07-08 03:11:14 -04:00
/// <summary>
/// Add a final xform to the ember and set it as the current xform.
/// Will only take action if a final xform is not already present.
2018-08-10 21:06:04 -04:00
/// Will re-add a copy of the last used final xform for the current ember if one had already been added then removed.
2014-07-08 03:11:14 -04:00
/// Called when the add final xform button is clicked.
/// Resets the rendering process.
/// </summary>
/// <param name="checked">Ignored</param>
template < typename T >
void FractoriumEmberController < T > : : AddFinalXform ( )
{
//Check to see if a final xform is already present.
if ( ! m_Fractorium - > HaveFinal ( ) )
{
2015-04-27 01:11:56 -04:00
Update ( [ & ] ( )
{
2018-08-10 21:06:04 -04:00
auto & final = m_Ember . m_CachedFinal ;
2018-04-29 01:28:05 -04:00
final . m_Animate = 0 ;
2018-08-10 21:06:04 -04:00
if ( final . Empty ( ) )
final . AddVariation ( m_VariationList - > GetVariationCopy ( eVariationId : : VAR_LINEAR ) ) ; //Just a placeholder so other parts of the code don't see it as being empty.
2015-04-27 01:11:56 -04:00
m_Ember . SetFinalXform ( final ) ;
2016-02-13 20:24:51 -05:00
int index = int ( m_Ember . TotalXformCount ( ) - 1 ) ; //Set index to the last item.
2015-05-03 20:13:14 -04:00
FillXforms ( index ) ;
2015-04-27 01:11:56 -04:00
} ) ;
2014-07-08 03:11:14 -04:00
}
}
void Fractorium : : OnAddFinalXformButtonClicked ( bool checked ) { m_Controller - > AddFinalXform ( ) ; }
/// <summary>
2015-04-27 01:11:56 -04:00
/// Set the weight of the selected xforms.
2014-07-08 03:11:14 -04:00
/// Called when weight spinner changes.
/// Resets the rendering process.
/// </summary>
/// <param name="d">The weight</param>
template < typename T >
void FractoriumEmberController < T > : : XformWeightChanged ( double d )
{
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
UpdateXform ( [ & ] ( Xform < T > * xform , size_t xfindex , size_t selIndex )
2014-07-08 03:11:14 -04:00
{
xform - > m_Weight = d ;
2015-04-27 01:11:56 -04:00
} , eXformUpdate : : UPDATE_SELECTED_EXCEPT_FINAL ) ;
SetNormalizedWeightText ( CurrentXform ( ) ) ;
2014-07-08 03:11:14 -04:00
}
void Fractorium : : OnXformWeightChanged ( double d ) { m_Controller - > XformWeightChanged ( d ) ; }
/// <summary>
/// Equalize the weights of all xforms in the ember.
/// </summary>
template < typename T >
void FractoriumEmberController < T > : : EqualizeWeights ( )
{
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
UpdateXform ( [ & ] ( Xform < T > * xform , size_t xfindex , size_t selIndex )
2014-07-08 03:11:14 -04:00
{
m_Ember . EqualizeWeights ( ) ;
m_Fractorium - > m_XformWeightSpin - > setValue ( xform - > m_Weight ) ; //Will trigger an update, so pass false to updateRender below.
2015-04-27 01:11:56 -04:00
} , eXformUpdate : : UPDATE_CURRENT , false ) ;
2014-07-08 03:11:14 -04:00
}
void Fractorium : : OnEqualWeightButtonClicked ( bool checked ) { m_Controller - > EqualizeWeights ( ) ; }
/// <summary>
/// Set the name of the current xform.
2015-04-27 01:11:56 -04:00
/// Update the corresponding xform checkbox text with the name.
2014-07-08 03:11:14 -04:00
/// Called when the user types in the name cell of the table.
/// </summary>
/// <param name="row">The row of the cell</param>
/// <param name="col">The col of the cell</param>
template < typename T >
void FractoriumEmberController < T > : : XformNameChanged ( int row , int col )
{
2017-07-27 00:25:44 -04:00
bool forceFinal = m_Fractorium - > HaveFinal ( ) ;
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
UpdateXform ( [ & ] ( Xform < T > * xform , size_t xfindex , size_t selIndex )
2014-07-08 03:11:14 -04:00
{
xform - > m_Name = m_Fractorium - > ui . XformWeightNameTable - > item ( row , col ) - > text ( ) . toStdString ( ) ;
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
XformCheckboxAt ( int ( xfindex ) , [ & ] ( QCheckBox * checkbox ) { checkbox - > setText ( MakeXformCaption ( xfindex ) ) ; } ) ;
2015-04-27 01:11:56 -04:00
} , eXformUpdate : : UPDATE_CURRENT , false ) ;
2016-03-28 21:49:10 -04:00
FillSummary ( ) ; //Manually update because this does not trigger a render, which is where this would normally be called.
2014-07-08 03:11:14 -04:00
}
2018-07-31 00:39:41 -04:00
2018-07-09 02:55:57 -04:00
void Fractorium : : OnXformNameChanged ( int row , int col )
{
2018-07-31 00:39:41 -04:00
m_Controller - > XformNameChanged ( row , col ) ;
m_Controller - > UpdateXformName ( ui . CurrentXformCombo - > currentIndex ( ) ) ;
2018-07-09 02:55:57 -04:00
}
2018-07-31 00:39:41 -04:00
2016-02-02 20:51:58 -05:00
/// <summary>
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
/// Set the animate field of the selected xforms, this allows excluding current if it's not checked, but applies only to it if none are checked.
2016-02-02 20:51:58 -05:00
/// This has no effect on interactive rendering, it only sets a value
/// that will later be saved to Xml when the user saves.
/// This value is observed when creating sequences for animation.
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
/// Applies to all embers if "Apply All" is checked.
2016-02-02 20:51:58 -05:00
/// Called when the user toggles the animate xform checkbox.
/// </summary>
/// <param name="state">1 for checked, else false</param>
template < typename T >
void FractoriumEmberController < T > : : XformAnimateChanged ( int state )
{
2018-04-13 20:45:31 -04:00
T animate = state > 0 ? 1 : 0 ;
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
UpdateXform ( [ & ] ( Xform < T > * xform , size_t xfindex , size_t selIndex )
2016-02-02 20:51:58 -05:00
{
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
bool final = IsFinal ( xform ) ;
UpdateAll ( [ & ] ( Ember < T > & ember , bool isMain )
2016-12-05 22:04:33 -05:00
{
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
if ( final ) //If the current xform was final, only apply to other embers which also have a final xform.
2016-12-05 22:04:33 -05:00
{
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
if ( ember . UseFinalXform ( ) )
{
auto xform = ember . NonConstFinalXform ( ) ;
xform - > m_Animate = animate ;
}
2018-04-13 20:45:31 -04:00
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
if ( ! m_Fractorium - > ApplyAll ( ) )
if ( m_EmberFilePointer & & m_EmberFilePointer - > UseFinalXform ( ) )
m_EmberFilePointer - > NonConstFinalXform ( ) - > m_Animate = animate ;
}
else //Current was not final, so apply to other embers which have a non-final xform at this index.
{
if ( auto xform = ember . GetXform ( xfindex ) )
2018-04-13 20:45:31 -04:00
xform - > m_Animate = animate ;
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
if ( ! m_Fractorium - > ApplyAll ( ) & & m_EmberFilePointer )
if ( auto xform = m_EmberFilePointer - > GetXform ( xfindex ) )
xform - > m_Animate = animate ;
}
} , false , eProcessAction : : NOTHING , m_Fractorium - > ApplyAll ( ) ) ;
} , eXformUpdate : : UPDATE_SELECTED , false ) ;
2016-02-02 20:51:58 -05:00
}
void Fractorium : : OnXformAnimateCheckBoxStateChanged ( int state ) { m_Controller - > XformAnimateChanged ( state ) ; }
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
2014-07-08 03:11:14 -04:00
/// <summary>
/// Fill all GUI widgets with values from the passed in xform.
/// </summary>
/// <param name="xform">The xform whose values will be used to populate the widgets</param>
template < typename T >
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
void FractoriumEmberController < T > : : FillWithXform ( Xform < T > * xform )
2014-07-08 03:11:14 -04:00
{
m_Fractorium - > m_XformWeightSpin - > SetValueStealth ( xform - > m_Weight ) ;
SetNormalizedWeightText ( xform ) ;
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
m_Fractorium - > ui . AnimateXformCheckBox - > blockSignals ( true ) ;
m_Fractorium - > ui . AnimateXformCheckBox - > setChecked ( xform - > m_Animate > 0 ? true : false ) ;
m_Fractorium - > ui . AnimateXformCheckBox - > blockSignals ( false ) ;
2014-07-08 03:11:14 -04:00
2016-02-02 20:51:58 -05:00
if ( auto item = m_Fractorium - > ui . XformWeightNameTable - > item ( 0 , 1 ) )
2014-07-08 03:11:14 -04:00
{
m_Fractorium - > ui . XformWeightNameTable - > blockSignals ( true ) ;
item - > setText ( QString : : fromStdString ( xform - > m_Name ) ) ;
m_Fractorium - > ui . XformWeightNameTable - > blockSignals ( false ) ;
}
FillVariationTreeWithXform ( xform ) ;
FillColorWithXform ( xform ) ;
FillAffineWithXform ( xform , true ) ;
FillAffineWithXform ( xform , false ) ;
}
/// <summary>
/// Set the normalized weight of the current xform as the suffix text of the weight spinner.
/// </summary>
/// <param name="xform">The current xform whose normalized weight will be shown</param>
template < typename T >
void FractoriumEmberController < T > : : SetNormalizedWeightText ( Xform < T > * xform )
{
if ( xform )
{
int index = m_Ember . GetXformIndex ( xform ) ;
m_Ember . CalcNormalizedWeights ( m_NormalizedWeights ) ;
if ( index ! = - 1 & & index < m_NormalizedWeights . size ( ) )
2018-07-31 00:39:41 -04:00
m_Fractorium - > m_XformWeightSpinnerButtonWidget - > m_Label - > setText ( QString ( " ( " ) + QLocale : : system ( ) . toString ( double ( m_NormalizedWeights [ index ] ) , ' g ' , 3 ) + " ) " ) ;
}
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Determine whether the specified xform is the final xform in the ember.
/// </summary>
/// <param name="xform">The xform to examine</param>
/// <returns>True if final, else false.</returns>
template < typename T >
bool FractoriumEmberController < T > : : IsFinal ( Xform < T > * xform )
{
return ( m_Fractorium - > HaveFinal ( ) & & ( xform = = m_Ember . FinalXform ( ) ) ) ;
}
/// <summary>
/// Fill the xforms combo box with the xforms in the current ember.
2015-05-03 20:13:14 -04:00
/// Select the index passed in and fill all widgets with its values.
2015-04-27 01:11:56 -04:00
/// Also dynamically generate a checkbox for each xform which will allow the user
/// to select which xforms to apply operations to.
2014-07-08 03:11:14 -04:00
/// </summary>
2015-05-03 20:13:14 -04:00
/// <param name="index">The index to select after populating, default 0.</param>
2015-04-27 01:11:56 -04:00
template < typename T >
2015-05-03 20:13:14 -04:00
void FractoriumEmberController < T > : : FillXforms ( int index )
2014-07-08 03:11:14 -04:00
{
2015-04-27 01:11:56 -04:00
int i = 0 , count = int ( XformCount ( ) ) ;
auto combo = m_Fractorium - > ui . CurrentXformCombo ;
2014-07-08 03:11:14 -04:00
combo - > blockSignals ( true ) ;
combo - > clear ( ) ;
2015-04-27 01:11:56 -04:00
//First clear all dynamically created checkboxes.
m_Fractorium - > ClearXformsSelections ( ) ;
m_Fractorium - > m_XformsSelectionLayout - > blockSignals ( true ) ;
2016-02-02 20:51:58 -05:00
2015-04-27 01:11:56 -04:00
//Fill combo box and create new checkboxes.
for ( i = 0 ; i < count ; i + + )
2014-07-26 15:03:51 -04:00
{
2014-10-14 11:53:15 -04:00
combo - > addItem ( ToString ( i + 1 ) ) ;
2015-04-27 01:11:56 -04:00
combo - > setItemIcon ( i , m_Fractorium - > m_XformComboIcons [ i % XFORM_COLOR_COUNT ] ) ;
2018-07-31 00:39:41 -04:00
UpdateXformName ( i ) ;
2014-07-26 15:03:51 -04:00
}
2016-02-02 20:51:58 -05:00
2015-04-27 01:11:56 -04:00
i = 0 ;
2016-02-02 20:51:58 -05:00
2015-04-27 01:11:56 -04:00
while ( i < count )
2014-07-26 15:03:51 -04:00
{
2015-04-27 01:11:56 -04:00
if ( i < count - 1 )
{
auto cb1 = new QCheckBox ( MakeXformCaption ( i ) , m_Fractorium ) ;
auto cb2 = new QCheckBox ( MakeXformCaption ( i + 1 ) , m_Fractorium ) ;
2016-04-11 21:15:14 -04:00
QObject : : connect ( cb1 , & QCheckBox : : stateChanged , [ & ] ( int state ) { m_Fractorium - > ui . GLDisplay - > update ( ) ; } ) ; //Ensure circles are drawn immediately after toggle.
QObject : : connect ( cb2 , & QCheckBox : : stateChanged , [ & ] ( int state ) { m_Fractorium - > ui . GLDisplay - > update ( ) ; } ) ;
2015-04-27 01:11:56 -04:00
m_Fractorium - > m_XformSelections . push_back ( cb1 ) ;
m_Fractorium - > m_XformSelections . push_back ( cb2 ) ;
m_Fractorium - > m_XformsSelectionLayout - > addRow ( cb1 , cb2 ) ;
i + = 2 ;
}
else if ( i < count )
{
auto cb = new QCheckBox ( MakeXformCaption ( i ) , m_Fractorium ) ;
2016-04-11 21:15:14 -04:00
QObject : : connect ( cb , & QCheckBox : : stateChanged , [ & ] ( int state ) { m_Fractorium - > ui . GLDisplay - > update ( ) ; } ) ;
2015-04-27 01:11:56 -04:00
m_Fractorium - > m_XformSelections . push_back ( cb ) ;
m_Fractorium - > m_XformsSelectionLayout - > addRow ( cb , new QWidget ( m_Fractorium ) ) ;
i + + ;
}
}
2016-02-02 20:51:58 -05:00
2015-04-27 01:11:56 -04:00
//Special case for final xform.
if ( UseFinalXform ( ) )
{
auto cb = new QCheckBox ( MakeXformCaption ( i ) , m_Fractorium ) ;
m_Fractorium - > m_XformSelections . push_back ( cb ) ;
m_Fractorium - > m_XformsSelectionLayout - > addRow ( cb , new QWidget ( m_Fractorium ) ) ;
2014-07-08 03:11:14 -04:00
combo - > addItem ( " Final " ) ;
2015-04-27 01:11:56 -04:00
combo - > setItemIcon ( i , m_Fractorium - > m_FinalXformComboIcon ) ;
2018-07-31 00:39:41 -04:00
UpdateXformName ( i ) ;
2014-07-26 15:03:51 -04:00
}
2016-02-02 20:51:58 -05:00
2015-04-27 01:11:56 -04:00
m_Fractorium - > m_XformsSelectionLayout - > blockSignals ( false ) ;
2014-07-08 03:11:14 -04:00
combo - > blockSignals ( false ) ;
2015-05-03 20:13:14 -04:00
if ( index < combo - > count ( ) )
combo - > setCurrentIndex ( index ) ;
2016-02-02 20:51:58 -05:00
2018-07-31 00:39:41 -04:00
m_Fractorium - > ui . SoloXformCheckBox - > blockSignals ( true ) ;
if ( m_Ember . m_Solo = = combo - > currentIndex ( ) )
m_Fractorium - > ui . SoloXformCheckBox - > setChecked ( true ) ;
else
m_Fractorium - > ui . SoloXformCheckBox - > setChecked ( false ) ;
SoloXformCheckBoxStateChanged ( m_Ember . m_Solo > - 1 ? Qt : : Checked : Qt : : Unchecked , m_Ember . m_Solo ) ;
m_Fractorium - > ui . SoloXformCheckBox - > blockSignals ( false ) ;
2015-04-27 01:11:56 -04:00
m_Fractorium - > FillXaosTable ( ) ;
2018-07-31 00:39:41 -04:00
m_Fractorium - > OnCurrentXformComboChanged ( index ) ; //Make sure the event gets called, because it won't if the zero index is already selected.
2018-07-09 02:55:57 -04:00
}
2018-07-31 00:39:41 -04:00
2018-07-09 02:55:57 -04:00
/// <summary>
/// Update the text in xforms combo box to show the name of Xform.
/// </summary>
/// <param name="index">The index of the Xform to update.</param>
2018-07-31 00:39:41 -04:00
///
2018-07-09 02:55:57 -04:00
template < typename T >
void FractoriumEmberController < T > : : UpdateXformName ( int index )
{
2018-07-31 00:39:41 -04:00
bool forceFinal = m_Fractorium - > HaveFinal ( ) ;
bool isFinal = m_Ember . FinalXform ( ) = = m_Ember . GetTotalXform ( index , forceFinal ) ;
QString name = isFinal ? " Final " : QString : : number ( index + 1 ) ;
if ( auto xform = m_Ember . GetTotalXform ( index , forceFinal ) )
{
if ( ! xform - > m_Name . empty ( ) )
name + = " " + QString : : fromStdString ( xform - > m_Name ) ;
m_Fractorium - > ui . CurrentXformCombo - > setItemText ( index , name ) ;
auto view = m_Fractorium - > ui . CurrentXformCombo - > view ( ) ;
auto fontMetrics1 = view - > fontMetrics ( ) ;
auto textWidth = m_Fractorium - > ui . CurrentXformCombo - > width ( ) ;
auto ww = fontMetrics1 . width ( " WW " ) ;
for ( int i = 0 ; i < m_Fractorium - > ui . CurrentXformCombo - > count ( ) ; + + i )
textWidth = std : : max ( fontMetrics1 . width ( m_Fractorium - > ui . CurrentXformCombo - > itemText ( i ) ) + ww , textWidth ) ;
view - > setMinimumWidth ( textWidth ) ;
view - > setMaximumWidth ( textWidth ) ;
}
2014-07-08 03:11:14 -04:00
}
2018-07-31 00:39:41 -04:00
2014-12-11 00:50:15 -05:00
template class FractoriumEmberController < float > ;
# ifdef DO_DOUBLE
2017-07-27 00:25:44 -04:00
template class FractoriumEmberController < double > ;
# endif