plugin limit removed by Joel Faber

This commit is contained in:
zueuk 2008-02-28 15:46:59 +00:00
parent 04189f461b
commit 922d06e278
14 changed files with 87 additions and 59 deletions

View File

@ -19,8 +19,8 @@ type
class function GetName: string; virtual; abstract;
class function GetInstance: TBaseVariation; virtual; abstract;
class function GetNrVariables: integer; virtual;
class function GetVariableNameAt(const Index: integer): string; virtual;
function GetNrVariables: integer; virtual;
function GetVariableNameAt(const Index: integer): string; virtual;
function GetVariable(const Name: string; var Value: double): boolean; virtual;
function SetVariable(const Name: string; var Value: double): boolean; virtual;
@ -65,7 +65,7 @@ uses SysUtils;
{ TBaseVariation }
///////////////////////////////////////////////////////////////////////////////
class function TBaseVariation.GetNrVariables: integer;
function TBaseVariation.GetNrVariables: integer;
begin
Result := 0;
end;
@ -118,7 +118,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TBaseVariation.GetVariableNameAt(const Index: integer): string;
function TBaseVariation.GetVariableNameAt(const Index: integer): string;
begin
Result := ''
end;
@ -153,13 +153,21 @@ begin
end;
function TVariationClassLoader.GetNrVariables: integer;
var
hack : TBaseVariation;
begin
Result := VariationClass.GetNrVariables();
hack := GetInstance();
Result := hack.GetNrVariables();
hack.Free();
end;
function TVariationClassLoader.GetVariableNameAt(const Index: integer): string;
var
hack : TBaseVariation;
begin
Result := VariationClass.GetVariableNameAt(Index);
hack := GetInstance();
Result := hack.GetVariableNameAt(Index);
hack.Free();
end;
end.

View File

@ -48,7 +48,7 @@ type
private
FNrFunctions: Integer;
FFunctionList: array of TCalcFunction;
FCalcFunctionList: array[0..64] of TCalcFunction;
FCalcFunctionList: array{[0..64]} of TCalcFunction;
FTx, FTy: double;
FPx, FPy: double;
@ -227,6 +227,8 @@ begin
FRegVariations[i].GetCalcFunction(FFunctionList[NRLOCVAR + i]);
end;
SetLength(FCalcFunctionList, NrVar + 2);
CalculateAngle := (vars[5] <> 0.0) or (vars[6] <> 0.0) or (vars[7] <> 0.0) or
(vars[8] <> 0.0) or (vars[12] <> 0.0) or (vars[13] <> 0.0) or
(vars[21] <> 0.0) or (vars[22] <> 0.0) or (vars[27] <> 0.0);
@ -2020,10 +2022,10 @@ begin
postXswap := Xform.postXswap;
for i := 0 to High(FRegVariations) do begin
for j:= 0 to FRegVariations[i].GetNrVariables -1 do begin
for j := 0 to FRegVariations[i].GetNrVariables - 1 do begin
Name := FRegVariations[i].GetVariableNameAt(j);
XForm.FRegVariations[i].GetVariable(Name,Value);
FRegVariations[i].SetVariable(Name,Value);
XForm.FRegVariations[i].GetVariable(Name, Value);
FRegVariations[i].SetVariable(Name, Value);
end;
end;
end;
@ -2048,7 +2050,7 @@ begin
for i := 0 to High(FRegVariations) do begin
if vars[i+NRLOCVAR] <> 0 then
for j:= 0 to FRegVariations[i].GetNrVariables -1 do begin
for j := 0 to FRegVariations[i].GetNrVariables - 1 do begin
Name := FRegVariations[i].GetVariableNameAt(j);
// FRegVariations[i].GetVariable(Name,Value);
// Result := Result + Format('%s="%g" ', [name, value]);
@ -2079,7 +2081,7 @@ begin
for i := 0 to High(FRegVariations) do begin
if vars[i+NRLOCVAR] <> 0 then
for j:= 0 to FRegVariations[i].GetNrVariables -1 do begin
for j := 0 to FRegVariations[i].GetNrVariables - 1 do begin
Name := FRegVariations[i].GetVariableNameAt(j);
// FRegVariations[i].GetVariable(Name,Value);
// Result := Result + Format('%s="%g" ', [name, value]);

View File

@ -34,8 +34,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -295,7 +295,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationCurl.GetVariableNameAt(const Index: integer): string;
function TVariationCurl.GetVariableNameAt(const Index: integer): string;
begin
case Index of
0: Result := var_c1_name;
@ -333,7 +333,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationCurl.GetNrVariables: integer;
function TVariationCurl.GetNrVariables: integer;
begin
Result := num_vars;
end;

View File

@ -16,8 +16,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -106,7 +106,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationFan2.GetVariableNameAt(const Index: integer): string;
function TVariationFan2.GetVariableNameAt(const Index: integer): string;
begin
case Index Of
0: Result := 'fan2_x';
@ -130,7 +130,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationFan2.GetNrVariables: integer;
function TVariationFan2.GetNrVariables: integer;
begin
Result := 2
end;

View File

@ -79,6 +79,9 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
function ResetVariable(const Name: string): boolean; override;
@ -183,6 +186,18 @@ begin
Result := '';
end;
///////////////////////////////////////////////////////////////////////////////
function TPluginVariation.GetNrVariables: integer;
begin
Result := PluginData.PluginVarGetNrVariables;
end;
///////////////////////////////////////////////////////////////////////////////
function TPluginVariation.GetVariableNameAt(const Index: integer): string;
begin
Result := PluginData.PluginVarGetVariableNameAt(Index);
end;
///////////////////////////////////////////////////////////////////////////////
function TPluginVariation.SetVariable(const Name: string; var value: double): boolean;
begin
@ -219,7 +234,7 @@ begin
@PluginVarGetName := GetProcAddress(PluginHandle,'PluginVarGetName');
if @PluginVarGetName = nil then begin // Must not be a valid plugin!
FreeLibrary(PluginHandle);
msg := msg + 'Invalid plugin type: "'+searchResult.Name + '" is not a plugin' + #13#10;
msg := msg + 'Invalid plugin type: "' + searchResult.Name + '" is not a plugin' + #13#10;
continue;
end;
name := PluginVarGetName;
@ -243,12 +258,15 @@ begin
RegisterVariation(TVariationPluginLoader.Create(PluginData));
end;
end else
msg := msg + 'Cannot open plugin file: '+searchResult.Name + #13#10;
msg := msg + 'Cannot open plugin file: ' + searchResult.Name + #13#10;
end;
until (FindNext(searchResult) <> 0);
SysUtils.FindClose(searchResult); //Since we use Windows unit (LoadLibrary)
if msg <> '' then Application.MessageBox(PChar('There were problems with some of the plugins:' + #13#10#13#10 + msg), 'Warning', MB_OK);
if msg <> '' then
Application.MessageBox(
PChar('There were problems with some of the plugins:' + #13#10#13#10 + msg),
'Warning', MB_ICONWARNING or MB_OK);
end;
end;

View File

@ -32,8 +32,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -324,7 +324,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationJulian.GetVariableNameAt(const Index: integer): string;
function TVariationJulian.GetVariableNameAt(const Index: integer): string;
begin
case Index of
0: Result := var_n_name;
@ -365,7 +365,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationJulian.GetNrVariables: integer;
function TVariationJulian.GetNrVariables: integer;
begin
Result := 2;
end;

View File

@ -32,8 +32,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -369,7 +369,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationJuliaScope.GetVariableNameAt(const Index: integer): string;
function TVariationJuliaScope.GetVariableNameAt(const Index: integer): string;
begin
case Index of
0: Result := var_n_name;
@ -410,7 +410,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationJuliaScope.GetNrVariables: integer;
function TVariationJuliaScope.GetNrVariables: integer;
begin
Result := 2;
end;

View File

@ -25,8 +25,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -131,7 +131,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationPerspective.GetVariableNameAt(const Index: integer): string;
function TVariationPerspective.GetVariableNameAt(const Index: integer): string;
begin
case Index of
0: Result := var_a_name;
@ -168,7 +168,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationPerspective.GetNrVariables: integer;
function TVariationPerspective.GetNrVariables: integer;
begin
Result := 2;
end;

View File

@ -29,8 +29,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function GetVariable(const Name: string; var value: double): boolean; override;
function SetVariable(const Name: string; var value: double): boolean; override;
@ -275,7 +275,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationRadialBlur.GetVariableNameAt(const Index: integer): string;
function TVariationRadialBlur.GetVariableNameAt(const Index: integer): string;
begin
case Index of
0: Result := var_a_name;
@ -314,7 +314,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationRadialBlur.GetNrVariables: integer;
function TVariationRadialBlur.GetNrVariables: integer;
begin
Result := 1;
end;

View File

@ -38,8 +38,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -105,7 +105,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationRectangles.GetVariableNameAt(const Index: integer): string;
function TVariationRectangles.GetVariableNameAt(const Index: integer): string;
begin
case Index Of
0: Result := 'rectangles_x';
@ -116,7 +116,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationRectangles.GetNrVariables: integer;
function TVariationRectangles.GetNrVariables: integer;
begin
Result := 2;
end;

View File

@ -15,8 +15,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -82,7 +82,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationRings2.GetVariableNameAt(const Index: integer): string;
function TVariationRings2.GetVariableNameAt(const Index: integer): string;
begin
case Index Of
0: Result := 'rings2_val';
@ -102,7 +102,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationRings2.GetNrVariables: integer;
function TVariationRings2.GetNrVariables: integer;
begin
Result := 1
end;

View File

@ -35,8 +35,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -117,7 +117,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationSuperShape.GetVariableNameAt(const Index: integer): string;
function TVariationSuperShape.GetVariableNameAt(const Index: integer): string;
begin
case Index Of
0: Result := 'super_shape_m';
@ -132,7 +132,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationSuperShape.GetNrVariables: integer;
function TVariationSuperShape.GetNrVariables: integer;
begin
Result := 6;
end;

View File

@ -16,8 +16,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -79,7 +79,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationBlob.GetVariableNameAt(const Index: integer): string;
function TVariationBlob.GetVariableNameAt(const Index: integer): string;
begin
case Index Of
0: Result := 'blob_low';
@ -91,7 +91,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationBlob.GetNrVariables: integer;
function TVariationBlob.GetNrVariables: integer;
begin
Result := 3;
end;

View File

@ -17,8 +17,8 @@ type
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
class function GetNrVariables: integer; override;
class function GetVariableNameAt(const Index: integer): string; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
@ -92,7 +92,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationPDJ.GetVariableNameAt(const Index: integer): string;
function TVariationPDJ.GetVariableNameAt(const Index: integer): string;
begin
case Index Of
0: Result := 'pdj_a';
@ -124,7 +124,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationPDJ.GetNrVariables: integer;
function TVariationPDJ.GetNrVariables: integer;
begin
Result := 4
end;