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
OnClick = mnuChaosViewFromClick
end
object mnuChaosRebuild: TMenuItem
Caption = 'Rebuild xaos links'
Checked = True
Hint = 'Rebuild xaos links when deleting transforms'
OnClick = mnuChaosRebuildClick
end
object N9: TMenuItem
Caption = '-'
end

View File

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

View File

@ -95,7 +95,7 @@ var
HelpersEnabled: boolean;
EditorBkgColor, ReferenceTriangleColor: integer;
GridColor1, GridColor2, HelpersColor: integer;
ExtEditEnabled, TransformAxisLock: boolean;
ExtEditEnabled, TransformAxisLock, RebuildXaosLinks: boolean;
ShowAllXforms: boolean;
{ Display }
@ -357,6 +357,15 @@ begin
Result := str;
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 }

View File

@ -405,7 +405,7 @@ object OptionsForm: TOptionsForm
end
object rgReferenceMode: TRadioGroup
Left = 160
Top = 76
Top = 108
Width = 145
Height = 69
Caption = 'Reference Triangle'
@ -421,7 +421,7 @@ object OptionsForm: TOptionsForm
Left = 160
Top = 4
Width = 145
Height = 65
Height = 85
Caption = 'Editor defaults'
TabOrder = 2
object chkAxisLock: TCheckBox
@ -444,6 +444,16 @@ object OptionsForm: TOptionsForm
State = cbChecked
TabOrder = 1
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
object DisplayPage: TTabSheet

View File

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

View File

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