added duplicate variation detection + some other new things
This commit is contained in:
parent
e647e5481b
commit
dec5c50e8f
@ -36,17 +36,17 @@ uses
|
|||||||
Dialogs; //ShowMessage
|
Dialogs; //ShowMessage
|
||||||
|
|
||||||
type
|
type
|
||||||
TPluginVarGetName = function : PChar; cdecl;
|
// TPluginVarGetName = function : PChar; cdecl;
|
||||||
TPluginVarGetNrVariables = function : Integer; cdecl;
|
// TPluginVarGetNrVariables = function : Integer; cdecl;
|
||||||
TPluginVarGetVariableNameAt = function(const Index: integer): PChar; cdecl;
|
// TPluginVarGetVariableNameAt = function(const Index: integer): PChar; cdecl;
|
||||||
|
|
||||||
TPluginVarCreate = function : Pointer; cdecl;
|
// TPluginVarCreate = function : Pointer; cdecl;
|
||||||
TPluginVarDestroy = function(var MyVariation : Pointer) : LongBool; cdecl;
|
// TPluginVarDestroy = function(var MyVariation : Pointer) : LongBool; cdecl;
|
||||||
TPluginVarInit = function(MyVariation, FPx, FPy, FTx, FTy: Pointer; vvar: double) : LongBool; cdecl;
|
// TPluginVarInit = function(MyVariation, FPx, FPy, FTx, FTy: Pointer; vvar: double) : LongBool; cdecl;
|
||||||
TPluginVarPrepare = function(MyVariation : Pointer) : LongBool; cdecl;
|
// TPluginVarPrepare = function(MyVariation : Pointer) : LongBool; cdecl;
|
||||||
TPluginVarCalc = function(MyVariation : Pointer) : LongBool; cdecl;
|
// TPluginVarCalc = function(MyVariation : Pointer) : LongBool; cdecl;
|
||||||
TPluginVarGetVariable = function(MyVariation:Pointer; const Name: PChar; var value: double) : LongBool; cdecl;
|
// TPluginVarGetVariable = function(MyVariation:Pointer; const Name: PChar; var value: double) : LongBool; cdecl;
|
||||||
TPluginVarSetVariable = function(MyVariation:Pointer; const Name: PChar; var value: double) : LongBool; cdecl;
|
// TPluginVarSetVariable = function(MyVariation:Pointer; const Name: PChar; var value: double) : LongBool; cdecl;
|
||||||
|
|
||||||
TPluginVariationClass = class of TPluginVariation;
|
TPluginVariationClass = class of TPluginVariation;
|
||||||
|
|
||||||
@ -55,17 +55,18 @@ type
|
|||||||
PluginHandle: THandle;
|
PluginHandle: THandle;
|
||||||
PluginClass: TPluginVariationClass;
|
PluginClass: TPluginVariationClass;
|
||||||
|
|
||||||
PluginVarGetName : TPluginVarGetName;
|
PluginVarGetName: function: PChar; cdecl;
|
||||||
PluginVarGetNrVariables : TPluginVarGetNrVariables;
|
PluginVarGetNrVariables: function: Integer; cdecl;
|
||||||
PluginVarGetVariableNameAt: TPluginVarGetVariableNameAt;
|
PluginVarGetVariableNameAt: function(const Index: integer): PChar; cdecl;
|
||||||
|
|
||||||
PluginVarCreate : TPluginVarCreate;
|
PluginVarCreate: function: Pointer; cdecl;
|
||||||
PluginVarDestroy : TPluginVarDestroy;
|
PluginVarDestroy: function(var MyVariation: Pointer): LongBool; cdecl;
|
||||||
PluginVarInit : TPluginVarInit;
|
PluginVarInit: function(MyVariation, FPx, FPy, FTx, FTy: Pointer; vvar: double): LongBool; cdecl;
|
||||||
PluginVarPrepare : TPluginVarPrepare;
|
PluginVarInit3D: function(MyVariation, FPx, FPy, FPz, FTx, FTy, FTz: Pointer; vvar: double): LongBool; cdecl;
|
||||||
PluginVarCalc : TPluginVarCalc;
|
PluginVarPrepare: function(MyVariation: Pointer): LongBool; cdecl;
|
||||||
PluginVarGetVariable : TPluginVarGetVariable;
|
PluginVarCalc: function(MyVariation: Pointer): LongBool; cdecl;
|
||||||
PluginVarSetVariable : TPluginVarSetVariable;
|
PluginVarGetVariable: function(MyVariation: Pointer; const Name: PChar; var value: double): LongBool; cdecl;
|
||||||
|
PluginVarSetVariable: function(MyVariation: Pointer; const Name: PChar; var value: double): LongBool; cdecl;
|
||||||
end;
|
end;
|
||||||
PPluginData = ^TPluginData;
|
PPluginData = ^TPluginData;
|
||||||
|
|
||||||
@ -402,8 +403,13 @@ end;
|
|||||||
|
|
||||||
procedure TPluginVariation.Prepare;
|
procedure TPluginVariation.Prepare;
|
||||||
begin
|
begin
|
||||||
GetPluginData.PluginVarInit(MyVariation, Pointer(FPX), Pointer(FPy), Pointer(FTx), Pointer(FTy), vvar);
|
with GetPluginData^ do begin
|
||||||
GetPluginData.PluginVarPrepare(MyVariation);
|
// if @PluginVarInit3D <> nil then
|
||||||
|
// PluginVarInit3D(MyVariation, Pointer(FPX), Pointer(FPy), Pointer(FPz), Pointer(FTx), Pointer(FTy), Pointer(FTz), vvar)
|
||||||
|
// else
|
||||||
|
PluginVarInit(MyVariation, Pointer(FPX), Pointer(FPy), Pointer(FTx), Pointer(FTy), vvar);
|
||||||
|
PluginVarPrepare(MyVariation);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -465,6 +471,7 @@ end;
|
|||||||
procedure InitializePlugins;
|
procedure InitializePlugins;
|
||||||
var
|
var
|
||||||
searchResult: TSearchRec;
|
searchResult: TSearchRec;
|
||||||
|
name: string;
|
||||||
begin
|
begin
|
||||||
NumPlugins := 0;
|
NumPlugins := 0;
|
||||||
// Try to find regular files matching *.dll in the plugins dir
|
// Try to find regular files matching *.dll in the plugins dir
|
||||||
@ -479,16 +486,25 @@ begin
|
|||||||
if @PluginVarGetName = nil then begin // Must not be a valid plugin!
|
if @PluginVarGetName = nil then begin // Must not be a valid plugin!
|
||||||
FreeLibrary(PluginHandle);
|
FreeLibrary(PluginHandle);
|
||||||
ShowMessage('Invalid Plugin: Could not find PluginVarGetName in '+searchResult.Name);
|
ShowMessage('Invalid Plugin: Could not find PluginVarGetName in '+searchResult.Name);
|
||||||
end else begin
|
continue;
|
||||||
|
end;
|
||||||
|
name := PluginVarGetName;
|
||||||
|
if GetVariationIndex(name) >= 0 then begin
|
||||||
|
FreeLibrary(PluginHandle);
|
||||||
|
ShowMessage('Plugin "' + searchResult.Name + '" not loaded: Variation ' + name + ' already exists!');
|
||||||
|
end
|
||||||
|
else begin
|
||||||
@PluginVarGetNrVariables := GetProcAddress(PluginHandle,'PluginVarGetNrVariables');
|
@PluginVarGetNrVariables := GetProcAddress(PluginHandle,'PluginVarGetNrVariables');
|
||||||
@PluginVarGetVariableNameAt := GetProcAddress(PluginHandle,'PluginVarGetVariableNameAt');
|
@PluginVarGetVariableNameAt := GetProcAddress(PluginHandle,'PluginVarGetVariableNameAt');
|
||||||
@PluginVarCreate := GetProcAddress(PluginHandle,'PluginVarCreate');
|
@PluginVarCreate := GetProcAddress(PluginHandle,'PluginVarCreate');
|
||||||
@PluginVarDestroy := GetProcAddress(PluginHandle,'PluginVarDestroy');
|
@PluginVarDestroy := GetProcAddress(PluginHandle,'PluginVarDestroy');
|
||||||
@PluginVarInit := GetProcAddress(PluginHandle,'PluginVarInit');
|
@PluginVarInit := GetProcAddress(PluginHandle,'PluginVarInit');
|
||||||
|
@PluginVarInit3D := GetProcAddress(PluginHandle,'PluginVarInit3D');
|
||||||
@PluginVarPrepare := GetProcAddress(PluginHandle,'PluginVarPrepare');
|
@PluginVarPrepare := GetProcAddress(PluginHandle,'PluginVarPrepare');
|
||||||
@PluginVarCalc := GetProcAddress(PluginHandle,'PluginVarCalc');
|
@PluginVarCalc := GetProcAddress(PluginHandle,'PluginVarCalc');
|
||||||
@PluginVarGetVariable := GetProcAddress(PluginHandle,'PluginVarGetVariable');
|
@PluginVarGetVariable := GetProcAddress(PluginHandle,'PluginVarGetVariable');
|
||||||
@PluginVarSetVariable := GetProcAddress(PluginHandle,'PluginVarSetVariable');
|
@PluginVarSetVariable := GetProcAddress(PluginHandle,'PluginVarSetVariable');
|
||||||
|
|
||||||
Instance := NumPlugins+1;
|
Instance := NumPlugins+1;
|
||||||
|
|
||||||
RegisterVariation(PluginClass);
|
RegisterVariation(PluginClass);
|
||||||
|
Loading…
Reference in New Issue
Block a user