Overview (Storage Place Macro) |
Print Previous Next |
Introduction
Overview There are several functions called by MADRIX in order to let the macro react to different events.
If a function is not needed by a macro, it is not necessary to implement it. Regarding InitEffect, PreRenderEffect, and PostRenderEffect a message is printed out if one of them is missing. This is not an error, but only information for the developer of the script.
InitEffect (Automatically included in a new macro) InitEffect is called by MADRIX whenever the macro needs to be initialized. This is the case after compiling and starting a new macro or when the user pressed the Start button of the »Script Editor. A macro can assume that any global variable is initialized with 0 and that any global array is empty as long as it has not been initialized with a value. This function is the right place to initialize global variables, reset any arrays, set the speed of an effect, or whatever is necessary to (re)start the macro.
PreRenderEffect (Automatically included in a new macro) This function is called before PostRenderEffect. It may be used if the macro has to initialize any settings before an effect is rendered. void InitEffect() {
} void PreRenderEffect() { color c = {random(0, 255), random(0, 255)}; Clear(c); }
This example uses the function PreRenderEffect to fill the matrix and after initializing a random color for this task. Note: The matrix, which the macro manipulates, is the same matrix that the effect uses to calculate its own effect. The effect may rely on the output being the input for the next frame with undefined behavior. Also note: Mapping operations done in PostRenderEffect will effect the next frame, but not the current one. To control the current frame, please use PreRenderEffect
PostRenderEffect (Automatically included in a new macro) This function is called after an effect has been rendered completely. Certain functions might want to be called. That could be a filter, for example.
MartrixSizeChanged (Automatically included in a new macro) MatixSizeChanged is called after the size of the matrix has been changed. This may be due to a change to the matrix settings or because a new map setting was set, e.g. caused by the call of a map function.
Standard Outline When you open the Storage Place Macro Editor, the empty standard macro will look like this: @scriptname=""; @author=""; @version=""; @description="";
void InitEffect() {
}
void PreRenderEffect() {
}
void PostRenderEffect() {
}
void MatrixSizeChanged() { InitEffect(); }
|
MADRIX Version: 3.6j | Script Version: 2.22 |
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100% |
Print Previous Next |