more parameter strings,

pivot is now an "object"
This commit is contained in:
zueuk 2006-12-12 11:33:50 +00:00
parent f2ac93f7ce
commit b045ec43f8
2 changed files with 151 additions and 218 deletions

View File

@ -20,7 +20,7 @@ object ScriptEditor: TScriptEditor
TextHeight = 13 TextHeight = 13
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 0 Left = 0
Top = 244 Top = 250
Width = 531 Width = 531
Height = 4 Height = 4
Cursor = crVSplit Cursor = crVSplit
@ -30,7 +30,7 @@ object ScriptEditor: TScriptEditor
Left = 508 Left = 508
Top = 0 Top = 0
Width = 23 Width = 23
Height = 244 Height = 250
Align = alRight Align = alRight
AutoSize = True AutoSize = True
Caption = 'ToolBar' Caption = 'ToolBar'
@ -96,7 +96,7 @@ object ScriptEditor: TScriptEditor
end end
object StatusBar: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Top = 337 Top = 343
Width = 531 Width = 531
Height = 19 Height = 19
Anchors = [akLeft, akRight] Anchors = [akLeft, akRight]
@ -106,7 +106,7 @@ object ScriptEditor: TScriptEditor
Left = 0 Left = 0
Top = 0 Top = 0
Width = 508 Width = 508
Height = 244 Height = 250
Align = alClient Align = alClient
BevelInner = bvLowered BevelInner = bvLowered
BevelOuter = bvLowered BevelOuter = bvLowered
@ -116,7 +116,7 @@ object ScriptEditor: TScriptEditor
Left = 2 Left = 2
Top = 2 Top = 2
Width = 504 Width = 504
Height = 240 Height = 246
Cursor = crIBeam Cursor = crIBeam
PopupMenu = PopupMenu PopupMenu = PopupMenu
ActiveLineSettings.ShowActiveLine = False ActiveLineSettings.ShowActiveLine = False
@ -136,8 +136,6 @@ object ScriptEditor: TScriptEditor
BlockLineColor = clGray BlockLineColor = clGray
BkColor = clWindow BkColor = clWindow
BorderStyle = bsNone BorderStyle = bsNone
CodeFolding.Enabled = False
CodeFolding.LineColor = clGray
Ctl3D = False Ctl3D = False
DelErase = True DelErase = True
EnhancedHomeKey = False EnhancedHomeKey = False
@ -147,6 +145,11 @@ object ScriptEditor: TScriptEditor
Gutter.Font.Height = -13 Gutter.Font.Height = -13
Gutter.Font.Name = 'Courier New' Gutter.Font.Name = 'Courier New'
Gutter.Font.Style = [] Gutter.Font.Style = []
Gutter.LineNumberStart = 1
Gutter.LineNumberTextColor = clBlack
Gutter.ShowLineNumbers = True
Gutter.Visible = True
Gutter.ShowLeadingZeros = False
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -13 Font.Height = -13
@ -188,14 +191,14 @@ object ScriptEditor: TScriptEditor
UrlStyle.BkColor = clWhite UrlStyle.BkColor = clWhite
UrlStyle.Style = [fsUnderline] UrlStyle.Style = [fsUnderline]
UseStyler = True UseStyler = True
Version = '2.0.0.1' Version = '1.6.0.17'
WordWrap = wwNone WordWrap = wwNone
OnChange = EditorChange OnChange = EditorChange
end end
end end
object Console: TMemo object Console: TMemo
Left = 0 Left = 0
Top = 248 Top = 254
Width = 531 Width = 531
Height = 89 Height = 89
Align = alBottom Align = alBottom
@ -359,6 +362,7 @@ object ScriptEditor: TScriptEditor
end> end>
AutoCompletion.Strings = ( AutoCompletion.Strings = (
'ShowMessage' 'ShowMessage'
'InputQuery'
'' ''
'RotateFlame' 'RotateFlame'
'RotateReference' 'RotateReference'
@ -396,12 +400,6 @@ object ScriptEditor: TScriptEditor
'ProgramVersionString' 'ProgramVersionString'
'VariationIndex' 'VariationIndex'
'VariationName' 'VariationName'
'GetPivotMode'
'SetPivotMode'
'GetPivotX'
'GetPivotY'
'SetPivot'
'ResetPivot'
'CalculateScale' 'CalculateScale'
'CalculateBounds' 'CalculateBounds'
'NormalizeVars' 'NormalizeVars'
@ -498,6 +496,12 @@ object ScriptEditor: TScriptEditor
'UPRHeight' 'UPRHeight'
'ExportRenderer' 'ExportRenderer'
'' ''
'Pivot'
''
'Mode'
'Set'
'Reset'
''
'PI' 'PI'
'NVARS' 'NVARS'
'NXFORMS' 'NXFORMS'
@ -557,70 +561,38 @@ object ScriptEditor: TScriptEditor
'InputQuery(const Caption: string; const Prompt: string; var Valu' + 'InputQuery(const Caption: string; const Prompt: string; var Valu' +
'e: string)' 'e: string)'
'Translate(X: integer, Y: integer)'
'Rotate(Angle: double)'
'SetActiveTransform(TransformNumber: integer);'
'ListFile(const filename: string)'
'DeleteFile(const filename: string)' 'DeleteFile(const filename: string)'
'LoadFlame(FlameNumber: integer)' 'RotateFlame(Angle: double)'
'SetActiveTransform(TransformNumber: integer)'
'ShowStatus(const Text: string)'
'RotateReference(Angle: double)' 'RotateReference(Angle: double)'
'Rotate(Angle: double)'
'Multiply(a00: double, a01: double, a10: double, a11: double)'
'StoreFlame(FlameNumber: integer)'
'GetFlame(FlameNumber: integer)'
'LoadFlame(FlameNumber: integer)'
'Scale(Scale: double)' 'Scale(Scale: double)'
'SaveFlame(const filename: string)') 'Translate(X: double, Y: double)'
'SetActiveTransform(TransformNumber: integer)'
'Print(something_printable)'
'AddSymmetry(symmetry_type: integer)'
'Morph(FlameNumber1: integer, FlameNumber2: integer, Time: double' +
')'
'SetFlameFile(const filename: string)'
'ListFile(const filename: string)'
'SaveFlame(const filename: string)'
'ShowStatus(const Text: string)'
'RandomFlame(randomness_type: integer)'
'SaveGradient(Title: string, FileName: string)'
'SetVariation(Number: integer)'
'VariationIndex(var_name: string): integer'
'VariationName(var_index: integer): string'
'CopyFile(Source: string, Destination: string)')
HexIdentifier = '$' HexIdentifier = '$'
Description = 'Pascal' Description = 'Pascal'
Filter = 'Pascal Files (*.pas,*.dpr,*.dpk,*.inc)|*.pas;*.dpr;*.dpk;*.inc' Filter = 'Pascal Files (*.pas,*.dpr,*.dpk,*.inc)|*.pas;*.dpr;*.dpk;*.inc'
DefaultExtension = '.pas' DefaultExtension = '.pas'
StylerName = 'Pascal' StylerName = 'Pascal'
Extensions = 'pas;dpr;dpk;inc' Extensions = 'pas;dpr;dpk;inc'
RegionDefinitions = <
item
Identifier = 'procedure'
RegionStart = 'begin'
RegionEnd = 'end'
RegionType = rtClosed
ShowComments = False
end
item
Identifier = 'interface'
RegionStart = 'interface'
RegionType = rtOpen
ShowComments = False
end
item
Identifier = 'unit'
RegionStart = 'unit'
RegionType = rtFile
ShowComments = False
end
item
Identifier = 'implementation'
RegionStart = 'implementation'
RegionType = rtOpen
ShowComments = False
end
item
Identifier = 'case'
RegionStart = 'case'
RegionEnd = 'end'
RegionType = rtIgnore
ShowComments = False
end
item
Identifier = 'function'
RegionStart = 'begin'
RegionEnd = 'end'
RegionType = rtClosed
ShowComments = False
end
item
Identifier = '{$region'
RegionStart = '{$region'
RegionEnd = '{$endregion'
RegionType = rtClosed
ShowComments = False
end>
Left = 328 Left = 328
Top = 32 Top = 32
end end

View File

@ -56,6 +56,9 @@ type
MaxMemory, Width, Height: integer; MaxMemory, Width, Height: integer;
Filename: string; Filename: string;
end; end;
TPivot = class
public
end;
TScriptEditor = class(TForm) TScriptEditor = class(TForm)
MainOpenDialog: TOpenDialog; MainOpenDialog: TOpenDialog;
MainSaveDialog: TSaveDialog; MainSaveDialog: TSaveDialog;
@ -106,6 +109,7 @@ type
cmap: TColorMap; cmap: TColorMap;
Flame: TFlame; Flame: TFlame;
Options: TOptions; Options: TOptions;
Pivot: TPivot;
Renderer: TScriptRender; Renderer: TScriptRender;
Another: TScriptRender; Another: TScriptRender;
procedure UpdateFlame; procedure UpdateFlame;
@ -204,6 +208,7 @@ type
procedure GetRenderMaxMemoryProc(AMachine: TatVirtualMachine); procedure GetRenderMaxMemoryProc(AMachine: TatVirtualMachine);
procedure SetRenderMaxMemoryProc(AMachine: TatVirtualMachine); procedure SetRenderMaxMemoryProc(AMachine: TatVirtualMachine);
procedure FillFileList; procedure FillFileList;
{ Options interface } { Options interface }
procedure GetJPEGQuality(AMachine: TatVirtualMachine); procedure GetJPEGQuality(AMachine: TatVirtualMachine);
procedure SetJPEGQuality(AMachine: TatVirtualMachine); procedure SetJPEGQuality(AMachine: TatVirtualMachine);
@ -299,6 +304,17 @@ type
procedure SetUPRHeight(AMachine: TatVirtualMachine); procedure SetUPRHeight(AMachine: TatVirtualMachine);
procedure GetExportPath(AMachine: TatVirtualMachine); procedure GetExportPath(AMachine: TatVirtualMachine);
procedure SetExportPath(AMachine: TatVirtualMachine); procedure SetExportPath(AMachine: TatVirtualMachine);
{ Pivot interface }
procedure GetPivotModeProc(AMachine: TatVirtualMachine);
procedure SetPivotModeProc(AMachine: TatVirtualMachine);
procedure GetPivotXProc(AMachine: TatVirtualMachine);
procedure SetPivotXProc(AMachine: TatVirtualMachine);
procedure GetPivotYProc(AMachine: TatVirtualMachine);
procedure SetPivotYProc(AMachine: TatVirtualMachine);
procedure SetPivotProc(AMachine: TatVirtualMachine);
procedure ResetPivotProc(AMachine: TatVirtualMachine);
end; end;
TTransform = class TTransform = class
public public
@ -371,7 +387,7 @@ type
procedure ScaleProc(AMachine: TatVirtualMachine); procedure ScaleProc(AMachine: TatVirtualMachine);
procedure MulProc(AMachine: TatVirtualMachine); procedure MulProc(AMachine: TatVirtualMachine);
procedure TranslateProc(AMachine: TatVirtualMachine); procedure TranslateProc(AMachine: TatVirtualMachine);
procedure ActiveTransformProc(AMachine: TatVirtualMachine); procedure GetActiveTransformProc(AMachine: TatVirtualMachine);
procedure SetActiveTransformProc(AMachine: TatVirtualMachine); procedure SetActiveTransformProc(AMachine: TatVirtualMachine);
procedure TransformsProc(AMachine: TatVirtualMachine); procedure TransformsProc(AMachine: TatVirtualMachine);
procedure FileCountProc(AMachine: TatVirtualMachine); procedure FileCountProc(AMachine: TatVirtualMachine);
@ -398,20 +414,9 @@ type
procedure SaveGradientProc(AMachine: TatVirtualMachine); procedure SaveGradientProc(AMachine: TatVirtualMachine);
procedure GetVariation(AMachine: TatVirtualMachine); procedure GetVariation(AMachine: TatVirtualMachine);
procedure SetVariation(AMachine: TatVirtualMachine); procedure SetVariation(AMachine: TatVirtualMachine);
{
procedure GetVariable(AMachine: TatVirtualMachine);
procedure SetVariable(AMachine: TatVirtualMachine);
procedure GetVariableStr(AMachine: TatVirtualMachine);
procedure SetVariableStr(AMachine: TatVirtualMachine);
}
procedure VariationIndexProc(AMachine: TatVirtualMachine); procedure VariationIndexProc(AMachine: TatVirtualMachine);
procedure VariationNameProc(AMachine: TatVirtualMachine); procedure VariationNameProc(AMachine: TatVirtualMachine);
procedure GetPivotModeProc(AMachine: TatVirtualMachine);
procedure SetPivotModeProc(AMachine: TatVirtualMachine);
procedure GetPivotXProc(AMachine: TatVirtualMachine);
procedure GetPivotYProc(AMachine: TatVirtualMachine);
procedure SetPivotProc(AMachine: TatVirtualMachine);
procedure ResetPivotProc(AMachine: TatVirtualMachine);
procedure CalculateScale(AMachine: TatVirtualMachine); procedure CalculateScale(AMachine: TatVirtualMachine);
procedure NormalizeVars(AMachine: TatVirtualMachine); procedure NormalizeVars(AMachine: TatVirtualMachine);
@ -1194,7 +1199,8 @@ begin
Scripter.DefineMethod('LoadFlame', 1, tkNone, nil, LoadFlameProc); Scripter.DefineMethod('LoadFlame', 1, tkNone, nil, LoadFlameProc);
Scripter.DefineMethod('Scale', 1, tkNone, nil, ScaleProc); Scripter.DefineMethod('Scale', 1, tkNone, nil, ScaleProc);
Scripter.DefineMethod('Translate', 2, tkNone, nil, TranslateProc); Scripter.DefineMethod('Translate', 2, tkNone, nil, TranslateProc);
Scripter.DefineMethod('ActiveTransform', 0, tkInteger, nil, ActiveTransformProc); // Scripter.DefineMethod('ActiveTransform', 0, tkInteger, nil, GetActiveTransformProc);
Scripter.DefineProp('ActiveTransform', tkInteger, GetActiveTransformProc, SetActiveTransformProc);
Scripter.DefineMethod('SetActiveTransform', 1, tkInteger, nil, SetActiveTransformProc); Scripter.DefineMethod('SetActiveTransform', 1, tkInteger, nil, SetActiveTransformProc);
Scripter.DefineMethod('Transforms', 0, tkInteger, nil, TransformsProc); Scripter.DefineMethod('Transforms', 0, tkInteger, nil, TransformsProc);
Scripter.DefineMethod('FileCount', 0, tkInteger, nil, FileCountProc); Scripter.DefineMethod('FileCount', 0, tkInteger, nil, FileCountProc);
@ -1218,23 +1224,11 @@ begin
Scripter.DefineMethod('SaveGradient', 2, tkNone, nil, SaveGradientProc); Scripter.DefineMethod('SaveGradient', 2, tkNone, nil, SaveGradientProc);
Scripter.DefineMethod('Variation', 0, tkInteger, nil, GetVariation); Scripter.DefineMethod('Variation', 0, tkInteger, nil, GetVariation);
Scripter.DefineMethod('SetVariation', 1, tkInteger, nil, SetVariation); Scripter.DefineMethod('SetVariation', 1, tkInteger, nil, SetVariation);
{
Scripter.DefineMethod('GetVariable', 1, tkFloat, nil, GetVariable);
Scripter.DefineMethod('SetVariable', 2, tkNone, nil, SetVariable);
Scripter.DefineMethod('GetVariableStr', 1, tkFloat, nil, GetVariableStr);
Scripter.DefineMethod('SetVariableStr', 2, tkNone, nil, SetVariableStr);
}
Scripter.AddConstant('ProgramVersionString', AppVersionString); Scripter.AddConstant('ProgramVersionString', AppVersionString);
Scripter.DefineMethod('VariationIndex', 1, tkInteger, nil, VariationIndexProc); Scripter.DefineMethod('VariationIndex', 1, tkInteger, nil, VariationIndexProc);
Scripter.DefineMethod('VariationName', 1, tkString, nil, VariationNameProc); Scripter.DefineMethod('VariationName', 1, tkString, nil, VariationNameProc);
Scripter.DefineMethod('GetPivotMode', 0, tkInteger, nil, GetPivotModeProc);
Scripter.DefineMethod('SetPivotMode', 1, tkNone, nil, SetPivotModeProc);
Scripter.DefineMethod('GetPivotX', 0, tkFloat, nil, GetPivotXProc);
Scripter.DefineMethod('GetPivotY', 0, tkFloat, nil, GetPivotYProc);
Scripter.DefineMethod('SetPivot', 2, tkNone, nil, SetPivotProc);
Scripter.DefineMethod('ResetPivot', 0, tkNone, nil, ResetPivotProc);
Scripter.DefineMethod('CalculateScale', 0, tkNone, nil, CalculateScale); Scripter.DefineMethod('CalculateScale', 0, tkNone, nil, CalculateScale);
Scripter.DefineMethod('CalculateBounds', 0, tkNone, nil, CalculateBounds); Scripter.DefineMethod('CalculateBounds', 0, tkNone, nil, CalculateBounds);
Scripter.DefineMethod('NormalizeVars', 0, tkNone, nil, NormalizeVars); Scripter.DefineMethod('NormalizeVars', 0, tkNone, nil, NormalizeVars);
@ -1742,7 +1736,7 @@ begin
end; end;
end; end;
procedure TOperationLibrary.ActiveTransformProc(AMachine: TatVirtualMachine); procedure TOperationLibrary.GetActiveTransformProc(AMachine: TatVirtualMachine);
begin begin
with AMachine do with AMachine do
ReturnOutputArg(ActiveTransform); ReturnOutputArg(ActiveTransform);
@ -1784,66 +1778,6 @@ begin
end end
end; end;
(*
procedure TOperationLibrary.SetVariable(AMachine: TatVirtualMachine);
var
vb: double;
v: Variant;
begin
with AMachine do
begin
v := GetInputArg(0);
vb := GetInputArgAsFloat(1);
if varType(v) and varTypeMask = varByte then begin
ScriptEditor.cp.xform[ActiveTransform].SetVariable(GetVariableNameAt(Integer(v)), vb);
end
else if varType(v) and varTypeMask = varString then begin
ScriptEditor.cp.xform[ActiveTransform].SetVariable(String(v), vb);
end;
// else error...?
end
end;
procedure TOperationLibrary.GetVariable(AMachine: TatVirtualMachine);
var
i: integer;
vb: double;
begin
with AMachine do
begin
i := GetInputArgAsInteger(0);
ScriptEditor.cp.xform[ActiveTransform].GetVariable(GetVariableNameAt(i), vb);
ReturnOutputArg(vb);
end
end;
procedure TOperationLibrary.GetVariableStr(AMachine: TatVirtualMachine);
var
variable: string;
vb: double;
begin
with AMachine do
begin
variable := GetInputArgAsString(0);
ScriptEditor.cp.xform[ActiveTransform].GetVariable(variable, vb);
ReturnOutputArg(vb);
end
end;
procedure TOperationLibrary.SetVariableStr(AMachine: TatVirtualMachine);
var
variable: string;
vb: double;
begin
with AMachine do
begin
variable := GetInputArgAsString(0);
vb := GetInputArgAsFloat(1);
ScriptEditor.cp.xform[ActiveTransform].SetVariable(variable, vb);
end
end;
*)
procedure TOperationLibrary.VariationIndexProc(AMachine: TatVirtualMachine); procedure TOperationLibrary.VariationIndexProc(AMachine: TatVirtualMachine);
var var
i: integer; i: integer;
@ -2092,65 +2026,6 @@ begin
NormalizeVariations(ScriptEditor.cp); NormalizeVariations(ScriptEditor.cp);
end; end;
procedure TOperationLibrary.GetPivotModeProc(AMachine: TatVirtualMachine);
begin
AMachine.ReturnOutputArg(Integer(EditForm.PivotMode));
end;
procedure TOperationLibrary.SetPivotModeProc(AMachine: TatVirtualMachine);
var
n: integer;
begin
n := AMachine.GetInputArgAsInteger(0);
if n = 0 then
EditForm.PivotMode := pivotLocal
else
EditForm.PivotMode := pivotWorld;
end;
procedure TOperationLibrary.GetPivotXProc(AMachine: TatVirtualMachine);
var
px, py: double;
begin
// EditForm.ScriptGetPivot(px, py);
// AMachine.ReturnOutputArg(px);
if EditForm.PivotMode = pivotLocal then
AMachine.ReturnOutputArg(EditForm.LocalPivot.x)
else
AMachine.ReturnOutputArg(EditForm.WorldPivot.x);
end;
procedure TOperationLibrary.GetPivotYProc(AMachine: TatVirtualMachine);
var
px, py: double;
begin
// EditForm.ScriptGetPivot(px, py);
// AMachine.ReturnOutputArg(py);
if EditForm.PivotMode = pivotLocal then
AMachine.ReturnOutputArg(EditForm.LocalPivot.y)
else
AMachine.ReturnOutputArg(EditForm.WorldPivot.y);
end;
procedure TOperationLibrary.SetPivotProc(AMachine: TatVirtualMachine);
begin
with AMachine do begin
if EditForm.PivotMode = pivotLocal then begin
EditForm.LocalPivot.x := GetInputArgAsFloat(0);
EditForm.LocalPivot.y := GetInputArgAsFloat(1);
end
else begin
EditForm.WorldPivot.x := GetInputArgAsFloat(0);
EditForm.WorldPivot.y := GetInputArgAsFloat(1);
end;
end;
end;
procedure TOperationLibrary.ResetPivotProc(AMachine: TatVirtualMachine);
begin
EditForm.btnResetPivotClick(nil);
end;
{ ******************************** Math Library ****************************** } { ******************************** Math Library ****************************** }
procedure TMathLibrary.Init; procedure TMathLibrary.Init;
@ -2225,6 +2100,7 @@ begin
FileList := TStringList.Create; FileList := TStringList.Create;
Flame := TFlame.Create; Flame := TFlame.Create;
Options := TOptions.Create; Options := TOptions.Create;
Pivot := TPivot.Create;
Renderer := TScriptRender.create; Renderer := TScriptRender.create;
Another := TScriptRender.create; Another := TScriptRender.create;
cp := TControlPoint.create; cp := TControlPoint.create;
@ -2246,6 +2122,7 @@ begin
Flame.Free; Flame.Free;
Transform.Free; Transform.Free;
Options.Free; Options.Free;
Pivot.Free;
end; end;
procedure TScriptEditor.FormShow(Sender: TObject); procedure TScriptEditor.FormShow(Sender: TObject);
@ -3096,6 +2973,79 @@ begin
end; end;
end; end;
{ **************************************************************************** }
procedure TScriptEditor.GetPivotModeProc(AMachine: TatVirtualMachine);
begin
AMachine.ReturnOutputArg(Integer(EditForm.PivotMode));
end;
procedure TScriptEditor.SetPivotModeProc(AMachine: TatVirtualMachine);
var
n: integer;
begin
n := AMachine.GetInputArgAsInteger(0);
if n = 0 then
EditForm.PivotMode := pivotLocal
else
EditForm.PivotMode := pivotWorld;
end;
procedure TScriptEditor.GetPivotXProc(AMachine: TatVirtualMachine);
begin
// EditForm.ScriptGetPivot(px, py);
// AMachine.ReturnOutputArg(px);
if EditForm.PivotMode = pivotLocal then
AMachine.ReturnOutputArg(EditForm.LocalPivot.x)
else
AMachine.ReturnOutputArg(EditForm.WorldPivot.x);
end;
procedure TScriptEditor.SetPivotXProc(AMachine: TatVirtualMachine);
begin
if EditForm.PivotMode = pivotLocal then
EditForm.LocalPivot.x := AMachine.GetInputArgAsFloat(0)
else
EditForm.WorldPivot.x := AMachine.GetInputArgAsFloat(0);
end;
procedure TScriptEditor.GetPivotYProc(AMachine: TatVirtualMachine);
begin
// EditForm.ScriptGetPivot(px, py);
// AMachine.ReturnOutputArg(py);
if EditForm.PivotMode = pivotLocal then
AMachine.ReturnOutputArg(EditForm.LocalPivot.y)
else
AMachine.ReturnOutputArg(EditForm.WorldPivot.y);
end;
procedure TScriptEditor.SetPivotYProc(AMachine: TatVirtualMachine);
begin
if EditForm.PivotMode = pivotLocal then
EditForm.LocalPivot.y := AMachine.GetInputArgAsFloat(0)
else
EditForm.WorldPivot.y := AMachine.GetInputArgAsFloat(0);
end;
procedure TScriptEditor.SetPivotProc(AMachine: TatVirtualMachine);
begin
with AMachine do begin
if EditForm.PivotMode = pivotLocal then begin
EditForm.LocalPivot.x := GetInputArgAsFloat(0);
EditForm.LocalPivot.y := GetInputArgAsFloat(1);
end
else begin
EditForm.WorldPivot.x := GetInputArgAsFloat(0);
EditForm.WorldPivot.y := GetInputArgAsFloat(1);
end;
end;
end;
procedure TScriptEditor.ResetPivotProc(AMachine: TatVirtualMachine);
begin
EditForm.btnResetPivotClick(nil);
end;
{ ********************************* Scripter ********************************* } { ********************************* Scripter ********************************* }
procedure TScriptEditor.PrepareScripter; procedure TScriptEditor.PrepareScripter;
@ -3225,8 +3175,19 @@ begin
DefineProp('UPRHeight', tkInteger, GetUPRHeight, SetUPRHeight); DefineProp('UPRHeight', tkInteger, GetUPRHeight, SetUPRHeight);
DefineProp('ExportRenderer', tkInteger, GetExportPath, SetExportPath); DefineProp('ExportRenderer', tkInteger, GetExportPath, SetExportPath);
end; end;
Scripter.AddComponent(OpenDialog);
Scripter.AddObject('Options', Options); Scripter.AddObject('Options', Options);
with Scripter.defineClass(TPivot) do
begin
DefineProp('Mode', tkInteger, GetPivotModeProc, SetPivotModeProc);
DefineProp('X', tkFloat, GetPivotXProc, SetPivotXProc);
DefineProp('Y', tkFloat, GetPivotYProc, SetPivotYProc);
DefineMethod('Set', 2, tkNone, nil, SetPivotProc);
DefineMethod('Reset', 0, tkNone, nil, ResetPivotProc);
end;
Scripter.AddObject('Pivot', Pivot);
Scripter.AddComponent(OpenDialog);
Scripter.AddLibrary(TOperationLibrary); Scripter.AddLibrary(TOperationLibrary);
Scripter.AddLibrary(TatClassesLibrary); Scripter.AddLibrary(TatClassesLibrary);