Overview (Macros For Effects)

   Print  Previous  Next

Introduction

Macros can be used to manipulate its result or to change its settings. They are bound to the particular effect. Macros are written in MADRIX Script. The main difference between a macro and a script of the MAS Script effect are the functions MADRIX calls. In addition, each MADRIX effect has its own functions that can be called from a macro to control it.

Macros are stored as a part of the effect. This means they are part of a stored effect or setup. Moreover, it is possible to save macros as separate files. The file extension of a macro is *.mms. The extension of a compiled macro is *.mcm.

Macros are used to manipulate the result of an effect. A macro is called before and after an effect has been rendered.

 

Effect Macro

Effect Macro ButtonTo run a macro for an effect, please select the 'Macro' button in the effect area.

 

Functions Called By MADRIX

The following functions are called by MADRIX for each effect and can be implemented by a macro in order to react to different events:

void InitEffect() 
void PreRenderEffect
void PostRenderEffect() 
void MatrixSizeChanged()

 

InitEffect

(automatically included in a new macro)

InitEffect is called by MADRIX whenever the script 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 field is empty as long as it has not been initialized with any value.

PreRenderEffect

(automatically included in a new macro)

PreRenderEffect is called before the effect is going to be rendered. Changes done here affect the current frame, but may be overwritten by the effect itself.  In most times, this function may be used to change the mapping of an effect, for example to move it around the matrix.

PostRenderEffect

(automatically included in a new macro)

This function is called immediately after the effect has been rendered. Here, the result of the effect can be manipulated. You could use a grey filter on it, for example.

Please 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.

Please 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.

MatrixSizeChanged

(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 Effect Macro Editor, the empty standard macro will look like this:

@scriptname="";

@author="";

@version="";

@description="";

 

void InitEffect()

{

 

}

 

void PreRenderEffect()

{

 

}

 

void PostRenderEffect()

{

 

}

 

void MatrixSizeChanged()

{

 InitEffect();

}