Daniel
2012-01-26 11:15:08
Hey guys, here I present to you the MayaPlugin! :) A, well, umm… plugin for Simba! :D
Basically, it provides access to a few Windows API methods, quite a bit of fast methods found Embarcadero's Mathematical library, and quite a bit of other methods from external libraries too. Not to worry, all legal! :)
Hopefully most scripters will find these incredibly useful. NOTE, I plan to add to this plugin if I (or people) want some methods imported :)
[SCRIPTER] How do I use this plugin?
Simply extract the plugin to your plugins path, and then add the following after your program X; line:
Methods Exported By The Plugin:
…follows (click the links to see documentation of the methods. If there is no link, look just below it ;)):
Enjoy :) Plugin is attached (it's extremely tiny!) :)
NOTE: Source WILL come tomorrow. I'm just too tired right now and about to head to bed. Don't worry, no "backdoors" or anything is hidden within this. I'm a Senior SRL Member for a reason ;) Also, most of these functions I have at least required once or twice (or more!) while scripting, hence why they are in there - plus a few additions I thought people would like :)
Basically, it provides access to a few Windows API methods, quite a bit of fast methods found Embarcadero's Mathematical library, and quite a bit of other methods from external libraries too. Not to worry, all legal! :)
Hopefully most scripters will find these incredibly useful. NOTE, I plan to add to this plugin if I (or people) want some methods imported :)
[SCRIPTER] How do I use this plugin?
Simply extract the plugin to your plugins path, and then add the following after your program X; line:
{$loadlib MayaPlug.dll}
Methods Exported By The Plugin:
…follows (click the links to see documentation of the methods. If there is no link, look just below it ;)):
- Data Types:
type TabCoef = array[0..9] of Extended;type TVector = TExtendedArray;type TMatrix = T2DExtendedArray;type TRect = record
Left, Top, Right, Bottom: LongInt;
TopLeft, BottomRight: TPoint;
end;
type HDC = Cardinal;- (Utilises) Windows API
- function QueryPerformanceCounter(var lpPerformanceCount: Integer): Boolean;
- function QueryPerformanceFrequency(var lpFrequency: Integer): Boolean;
- function MarkTimePrecision: Integer; [INDENT]Starts a timer (similar to SRL's MarkTime method), returning the ID of the timer. NOTE: This timer is very high precision and records to the microsecond.[/INDENT]
- function TimeFromMarkPrecision(const ID: Integer): Extended; [INDENT]Returns the amount of microseconds passed since ID was last marked. NOTE: This timer is very high precision and records to the microsecond.[/INDENT]
- function GetLastFromMarkPrecision(const ID: Integer): Extended; [INDENT][/INDENT] [INDENT]Returns the amount of microseconds passed since the last TimeFromMarkPrecision(ID). NOTE: This value will always stay the same, unless you call TimeFromMarkPrecision(ID) again.[/INDENT]
- function GetLastError: Cardinal;
- function DecryptFileA(lpFilename: String; dwReserved: Cardinal): Boolean;
- function EncryptFileA(lpFilename: AnsiString): Boolean;
- function FindWindowEx(Parent, Child: HWND; ClassName, WindowName: String): HWND;
- function FindWindow(lpClassName, lpWindowName: String): HWND;
- function FindWindowByName(lpWindowName: String): HWND; [INDENT]Return's the handle to a window if lpWindowName is within its caption[/INDENT]
- function GetParent(hWnd: HWND): HWND;
- function SetParent(hWndChild, hWndNewParent: HWND): HWND;
- function WindowFromPoint(Point: TPoint): HWND;
- function SetWindowText(hWnd: HWND; lpString: String): Boolean;
- function GetForegroundWindow: HWND;
- function MoveWindow(hWnd: HWND; X, Y, nWidth, nHeight: Integer; bRepaint: Boolean): Boolean;
- function BringWindowToTop(hWnd: HWND): Boolean;
- function GetWindowRect(hWnd: HWND; lpRect: TRect): Boolean;
- function GetClientRect(hWnd: HWND; lpRect: TRect): Boolean;
- function GetCursorPos(var lpPoint: TPoint): Boolean;
- function GetMouseRealPos: TPoint; [INDENT]Returns a TPoint of the mouse position, NOT relative to Simba's client[/INDENT]
- function SetCursorPos(X, Y: Integer): Boolean;
- function LoadCursorFromFileA(lpFileName: String): Boolean;
- function DrawText(hDC: HDC; lpString: String; lpRect: TRect; uFormat: Cardinal): Integer; [INDENT]NOTE: Doesn't require to input length[/INDENT]
- function SetBkMode(DC: HDC; BkMode: Integer): Integer;
- function SetBkColour(DC: HDC; Colour: Cardinal): Cardinal;
- function SetTextColor(DC: HDC; Colour: Cardinal): Cardinal;
- Embarcadero Math Library
- function EnsureRange(const AValue, AMin, AMax: Integer): Integer;
- function EnsureRangeE(const AValue, AMin, AMax: Extended): Extended;
- function DegToRad(const Degrees: Extended): Extended;
- function RadToDeg(const Radians: Extended): Extended;
- function GradToRad(const Grads: Extended): Extended;
- function RadToGrad(const Radians: Extended): Extended;
- function CycleToRad(const Cycles: Extended): Extended;
- function RadToCycle(const Radians: Extended): Extended;
- function DegToGrad(const Degrees: Extended): Extended;
- function DegToCycle(const Degrees: Extended): Extended;
- function GradToDeg(const Grads: Extended): Extended;
- function GradToCycle(const Grads: Extended): Extended;
- function CycleToDeg(const Cycles: Extended): Extended;
- function CycleToGrad(const Cycles: Extended): Extended;
- function IntPower(const Base: Extended; const Exponent: Integer): Extended;
- function Power(const Base, Exponent: Extended): Extended;
- function Sum(const Data: array of Extended): Extended;
- function SumOfSquares(const Data: array of Extended): Extended;
- function MaxValue(const Data: array of Extended): Extended;
- function MaxIntValue(const Data: array of Integer): Integer;
- function StdDev(const Data: array of Extended): Extended;
- procedure MeanAndStdDev(const Data: array of Extended; var Mean, StdDev: Extended);
- function PopnStdDev(const Data: array of Extended): Extended;
- function Variance(const Data: array of Extended): Extended;
- function PopnVariance(const Data: array of Extended): Extended;
- function TotalVariance(const Data: array of Extended): Extended;
- function Norm(const Data: array of Extended): Extended;
- function RandG(Mean, StdDev: Extended): Extended;
- function RandomFrom(const AValues: array of Integer): Integer;
- function RandomFromE(const AValues: array of Extended): Extended;
- Other libraries (math):
- function Sgn(X: Extended): Integer; [INDENT]Returns the sign of X. -1 for negative, 1 for positive. Sgn(0) = 1[/INDENT]
- function Sgn0(X: Extended): Integer; [INDENT]Returns the sign of X. -1 for negative, 1 for positive. Sgn(0) = 0[/INDENT]
- function DSgn(A, B: Extended): Extended; [INDENT]DSgn(A, B) = Sgn(B) * |A|[/INDENT]
- function PolEvl(var X: Extended; Coef: TabCoef; N: Integer): Extended; [INDENT]Polynomial evaluation (coeff. of x^n <> 1)[/INDENT]
- function P1Evl(var X: Extended; Coef: TabCoef; N: Integer): Extended; [INDENT]Polynomial evaluation (coeff. of x^n = 1)[/INDENT]
- function SgnGamma(X: Extended): Integer; [INDENT][/INDENT]
- function Stirling(X: Extended): Extended; [INDENT]Stirling's formula for the gamma function[/INDENT]
- function StirLog(X: Extended): Extended; [INDENT]Approximate Ln(Gamma) by Stirling's formula, for X >= 13[/INDENT]
- function Gamma(X: Extended): Extended; [INDENT]Gamma function[/INDENT]
- function LnGamma(X: Extended): Extended; [INDENT]{ Logarithm of Gamma function }[/INDENT]
- function DiGamma(X: Extended): Extended; [INDENT]DiGamma function (Psi function)[/INDENT]
- function TriGamma(X: Extended): Extended; [INDENT]TriGamma function (Psi-prime function)[/INDENT]
- function IGamma(A, X: Extended): Extended; [INDENT]Incomplete Gamma function[/INDENT]
- function JGamma(A, X: Extended): Extended; [INDENT]Complement of incomplete Gamma function[/INDENT]
- function Beta(X, Y: Extended): Extended; [INDENT]Beta function[/INDENT]
- function IBeta(A, B, X: Extended): Extended; [INDENT]Incomplete Beta function[/INDENT]
- function Binomial(N, K: Integer): Extended; [INDENT]Binomial coefficient[/INDENT]
- function PBinom(N: Integer; P: Extended; K: Integer): Extended; [INDENT]Probability of binomial distribution[/INDENT]
- function TrapInt(X, Y: TVector; N: Integer): Extended; [INDENT]Integration by trapezoidal rule[/INDENT]
- Other (my own/ones created by me):
- function RoundN(X: Extended; D: Integer): Extended; [INDENT]Round's real number to D decimal places[/INDENT]
- function GetUNIXStamp: Cardinal; [INDENT]Get's the current (local) UNIX time stamp[/INDENT]
Enjoy :) Plugin is attached (it's extremely tiny!) :)
NOTE: Source WILL come tomorrow. I'm just too tired right now and about to head to bed. Don't worry, no "backdoors" or anything is hidden within this. I'm a Senior SRL Member for a reason ;) Also, most of these functions I have at least required once or twice (or more!) while scripting, hence why they are in there - plus a few additions I thought people would like :)
