new editor option : rebuild xaos links (after deleting xform)

This commit is contained in:
zueuk 2008-09-29 07:33:47 +00:00
parent 99ca465098
commit fdca7e4134
6 changed files with 86 additions and 41 deletions

View File

@ -3084,6 +3084,12 @@ object EditForm: TEditForm
RadioItem = True RadioItem = True
OnClick = mnuChaosViewFromClick OnClick = mnuChaosViewFromClick
end end
object mnuChaosRebuild: TMenuItem
Caption = 'Rebuild xaos links'
Checked = True
Hint = 'Rebuild xaos links when deleting transforms'
OnClick = mnuChaosRebuildClick
end
object N9: TMenuItem object N9: TMenuItem
Caption = '-' Caption = '-'
end end

View File

@ -201,6 +201,7 @@ type
GroupBox4: TGroupBox; GroupBox4: TGroupBox;
chkXformInvisible: TCheckBox; chkXformInvisible: TCheckBox;
chkXformSolo: TCheckBox; chkXformSolo: TCheckBox;
mnuChaosRebuild: TMenuItem;
procedure ValidateVariable; procedure ValidateVariable;
procedure vleVariablesValidate(Sender: TObject; ACol, ARow: Integer; const KeyName, KeyValue: string); procedure vleVariablesValidate(Sender: TObject; ACol, ARow: Integer; const KeyName, KeyValue: string);
@ -358,6 +359,7 @@ type
procedure mnuChaosSetAllClick(Sender: TObject); procedure mnuChaosSetAllClick(Sender: TObject);
procedure mnuLinkPostxformClick(Sender: TObject); procedure mnuLinkPostxformClick(Sender: TObject);
procedure chkXformSoloClick(Sender: TObject); procedure chkXformSoloClick(Sender: TObject);
procedure mnuChaosRebuildClick(Sender: TObject);
// procedure btnInvisibleClick(Sender: TObject); // procedure btnInvisibleClick(Sender: TObject);
// procedure btnSoloClick(Sender: TObject); // procedure btnSoloClick(Sender: TObject);
@ -836,6 +838,7 @@ begin
chkXformInvisible.Enabled := true; chkXformInvisible.Enabled := true;
chkXformInvisible.Checked := noPlot; chkXformInvisible.Checked := noPlot;
chkXformSolo.Enabled := true; chkXformSolo.Enabled := true;
if cp.soloXform >= 0 then begin if cp.soloXform >= 0 then begin
chkXformSolo.Checked := true; chkXformSolo.Checked := true;
chkXformSolo.Caption := Format('Solo transform #%d', [cp.soloXform + 1]); chkXformSolo.Caption := Format('Solo transform #%d', [cp.soloXform + 1]);
@ -852,8 +855,6 @@ begin
chkXformInvisible.Enabled := false; chkXformInvisible.Enabled := false;
chkXformInvisible.Checked := false; chkXformInvisible.Checked := false;
chkXformSolo.Enabled := false; chkXformSolo.Enabled := false;
// chkRetrace.Checked := true;
// chkRetrace.Enabled := false;
end; end;
tbEnableFinalXform.Down := EnableFinalXform; tbEnableFinalXform.Down := EnableFinalXform;
@ -1056,38 +1057,42 @@ begin
if (Transforms <= 1) then exit if (Transforms <= 1) then exit
else begin else begin
MainForm.UpdateUndo; MainForm.UpdateUndo;
// check for single "to" links
for i := 0 to Transforms-1 do if RebuildXaosLinks then begin
with cp.xform[i] do begin // check for single "to" links
nmin := NXFORMS; for i := 0 to Transforms-1 do
nmax := -1; with cp.xform[i] do begin
for j := 0 to Transforms-1 do nmin := NXFORMS;
if modWeights[j] <> 0 then begin nmax := -1;
if j < nmin then nmin := j;
if j > nmax then nmax := j;
end;
if (nmin = nmax) and (nmin = t) then begin
for j := 0 to Transforms-1 do for j := 0 to Transforms-1 do
modWeights[j] := cp.xform[t].modWeights[j]; if modWeights[j] <> 0 then begin
if noPlot then noPlot := cp.xform[t].noPlot; if j < nmin then nmin := j;
end; if j > nmax then nmax := j;
end; end;
// check for single "from" links if (nmin = nmax) and (nmin = t) then begin
for i := 0 to Transforms-1 do for j := 0 to Transforms-1 do
begin modWeights[j] := cp.xform[t].modWeights[j];
if cp.xform[t].modWeights[i] = 0 then continue; if noPlot then noPlot := cp.xform[t].noPlot;
nmin := NXFORMS; end;
nmax := -1; end;
for j := 0 to Transforms-1 do // check for single "from" links
if cp.xform[j].modWeights[i] <> 0 then begin for i := 0 to Transforms-1 do
if j < nmin then nmin := j; begin
if j > nmax then nmax := j; if cp.xform[t].modWeights[i] = 0 then continue;
end; nmin := NXFORMS;
if (nmin = nmax) and (nmin = t) then begin nmax := -1;
for j := 0 to Transforms-1 do for j := 0 to Transforms-1 do
cp.xform[j].modWeights[i] := cp.xform[t].modWeights[i]; if cp.xform[j].modWeights[i] <> 0 then begin
if j < nmin then nmin := j;
if j > nmax then nmax := j;
end;
if (nmin = nmax) and (nmin = t) then begin
for j := 0 to Transforms-1 do
cp.xform[j].modWeights[i] := cp.xform[t].modWeights[i];
end;
end; end;
end; end;
// delete xform from all probability tables // delete xform from all probability tables
for i := 0 to Transforms-1 do for i := 0 to Transforms-1 do
with cp.xform[i] do begin with cp.xform[i] do begin
@ -1095,7 +1100,7 @@ begin
modWeights[j] := modWeights[j+1]; modWeights[j] := modWeights[j+1];
modWeights[Transforms-1] := 1; modWeights[Transforms-1] := 1;
end; end;
//
if t = (Transforms - 1) then if t = (Transforms - 1) then
begin begin
MainTriangles[t] := MainTriangles[Transforms]; MainTriangles[t] := MainTriangles[Transforms];
@ -1710,6 +1715,7 @@ begin
end; end;
vleChaos.InsertRow('to 1', '1', true); vleChaos.InsertRow('to 1', '1', true);
mnuChaosRebuild.Checked := RebuildXaosLinks;
GraphZoom := 1; GraphZoom := 1;
@ -5081,5 +5087,11 @@ begin
end; end;
} }
procedure TEditForm.mnuChaosRebuildClick(Sender: TObject);
begin
RebuildXaosLinks := not RebuildXaosLinks;
mnuChaosRebuild.Checked := RebuildXaosLinks;
end;
end. end.

View File

@ -95,7 +95,7 @@ var
HelpersEnabled: boolean; HelpersEnabled: boolean;
EditorBkgColor, ReferenceTriangleColor: integer; EditorBkgColor, ReferenceTriangleColor: integer;
GridColor1, GridColor2, HelpersColor: integer; GridColor1, GridColor2, HelpersColor: integer;
ExtEditEnabled, TransformAxisLock: boolean; ExtEditEnabled, TransformAxisLock, RebuildXaosLinks: boolean;
ShowAllXforms: boolean; ShowAllXforms: boolean;
{ Display } { Display }
@ -357,6 +357,15 @@ begin
Result := str; Result := str;
end; end;
procedure SinCos(const Theta: double; var Sin, Cos: double); // to avoid using 'extended' type
asm
FLD Theta
FSINCOS
FSTP qword ptr [edx] // Cos
FSTP qword ptr [eax] // Sin
FWAIT
end;
(* (*
{ Palette and gradient functions } { Palette and gradient functions }

View File

@ -405,7 +405,7 @@ object OptionsForm: TOptionsForm
end end
object rgReferenceMode: TRadioGroup object rgReferenceMode: TRadioGroup
Left = 160 Left = 160
Top = 76 Top = 108
Width = 145 Width = 145
Height = 69 Height = 69
Caption = 'Reference Triangle' Caption = 'Reference Triangle'
@ -421,7 +421,7 @@ object OptionsForm: TOptionsForm
Left = 160 Left = 160
Top = 4 Top = 4
Width = 145 Width = 145
Height = 65 Height = 85
Caption = 'Editor defaults' Caption = 'Editor defaults'
TabOrder = 2 TabOrder = 2
object chkAxisLock: TCheckBox object chkAxisLock: TCheckBox
@ -444,6 +444,16 @@ object OptionsForm: TOptionsForm
State = cbChecked State = cbChecked
TabOrder = 1 TabOrder = 1
end end
object chkXaosRebuild: TCheckBox
Left = 8
Top = 58
Width = 129
Height = 17
Caption = 'Rebuild xaos links'
Checked = True
State = cbChecked
TabOrder = 2
end
end end
end end
object DisplayPage: TTabSheet object DisplayPage: TTabSheet

View File

@ -222,6 +222,7 @@ type
cbInternalBitsPerSample: TComboBox; cbInternalBitsPerSample: TComboBox;
txtGammaThreshold: TEdit; txtGammaThreshold: TEdit;
lblGammaThreshold: TLabel; lblGammaThreshold: TLabel;
chkXaosRebuild: TCheckBox;
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure btnOKClick(Sender: TObject); procedure btnOKClick(Sender: TObject);
@ -333,6 +334,7 @@ begin
chkHelpers.Checked := HelpersEnabled; chkHelpers.Checked := HelpersEnabled;
chkExtendedEdit.Checked := ExtEditEnabled; chkExtendedEdit.Checked := ExtEditEnabled;
chkAxisLock.Checked := TransformAxisLock; chkAxisLock.Checked := TransformAxisLock;
chkXaosRebuild.Checked := RebuildXaosLinks;
chkShowAllXforms.Checked := ShowAllXforms; chkShowAllXforms.Checked := ShowAllXforms;
{ Display tab } { Display tab }
@ -472,6 +474,7 @@ begin
ExtEditEnabled := chkExtendedEdit.Checked; ExtEditEnabled := chkExtendedEdit.Checked;
TransformAxisLock := chkAxisLock.Checked; TransformAxisLock := chkAxisLock.Checked;
RebuildXaosLinks := chkXaosRebuild.Checked;
{ Display tab } { Display tab }
defSampleDensity := StrToFloat(txtSampleDensity.Text); defSampleDensity := StrToFloat(txtSampleDensity.Text);

View File

@ -567,11 +567,11 @@ begin
end else begin end else begin
ShowRenderStats := false; ShowRenderStats := false;
end; end;
if Registry.ValueExists('LowerRenderPriority') then begin // if Registry.ValueExists('LowerRenderPriority') then begin
LowerRenderPriority := Registry.ReadBool('LowerRenderPriority'); // LowerRenderPriority := Registry.ReadBool('LowerRenderPriority');
end else begin // end else begin
LowerRenderPriority := false; // LowerRenderPriority := false;
end; // end;
if Registry.ValueExists('PNGTransparency') then begin if Registry.ValueExists('PNGTransparency') then begin
PNGTransparency := Registry.ReadInteger('PNGTransparency'); PNGTransparency := Registry.ReadInteger('PNGTransparency');
@ -681,7 +681,7 @@ begin
// ResizeOnLoad := False; // ResizeOnLoad := False;
ShowProgress := true; ShowProgress := true;
SaveIncompleteRenders := false; SaveIncompleteRenders := false;
LowerRenderPriority := false; // LowerRenderPriority := false;
ShowRenderStats := false; ShowRenderStats := false;
PNGTransparency := 1; PNGTransparency := 1;
ShowTransparency := False; ShowTransparency := False;
@ -753,6 +753,9 @@ begin
if Registry.ValueExists('LockTransformAxis') then if Registry.ValueExists('LockTransformAxis') then
TransformAxisLock := Registry.ReadBool('LockTransformAxis') TransformAxisLock := Registry.ReadBool('LockTransformAxis')
else TransformAxisLock := true; else TransformAxisLock := true;
if Registry.ValueExists('RebuildXaosLinks') then
RebuildXaosLinks := Registry.ReadBool('RebuildXaosLinks')
else RebuildXaosLinks := true;
end end
else begin else begin
UseTransformColors := false; UseTransformColors := false;
@ -765,6 +768,7 @@ begin
ReferenceTriangleColor := integer(clGray); ReferenceTriangleColor := integer(clGray);
ExtEditEnabled := true; ExtEditEnabled := true;
TransformAxisLock := true; TransformAxisLock := true;
RebuildXaosLinks := true;
end; end;
Registry.CloseKey; Registry.CloseKey;
@ -1171,6 +1175,7 @@ begin
Registry.WriteInteger('ReferenceTriangleColor', ReferenceTriangleColor); Registry.WriteInteger('ReferenceTriangleColor', ReferenceTriangleColor);
Registry.WriteBool('ExtendedEdit', ExtEditEnabled); Registry.WriteBool('ExtendedEdit', ExtEditEnabled);
Registry.WriteBool('LockTransformAxis', TransformAxisLock); Registry.WriteBool('LockTransformAxis', TransformAxisLock);
Registry.WriteBool('RebuildXaosLinks', RebuildXaosLinks);
end; end;
Registry.CloseKey; Registry.CloseKey;