Python

Allows you to create Python scripts to affect your MASH network. When you create a new Python node, a default script automatically inhabits the editor which reads MASH network data into a class called "md".

The list of attributes available for querying are as follows:

For example, to query the fifth object's position in your MASH network, you can use the code:
md.position[5]
You can also query a specific axis. For example, to query the x value only:
md.position[5].x
Note: The ID and Visibility arrays are stored as doubles.

The list of attributes for writing are as follows:

For example, to set the fifth object's Y position, you can use the code:
outPosition[5].y = 5
Or to make the same object invisible:
outVisibility[5] = 0
where a value of 1 is visible and 0 is invisible.

Helper Functions

The following is a list of built-in helper functions to make specific tasks faster.

count()
Returns the number of MASH points.
getFrame()
Returns the current frame number.
getFalloffsCount
Returns the number of falloff objects connected to this Python node.
getFalloff(int index)
Returns a list of strengths from the specified Falloff object.
For example, to query the strength array of the first falloff object, you can use the code:
 fallofs=md.getFalloff(0)
You could then apply the falloff strengths to point positions with the following code:
for i in range(count):
md.outPosition[i].x=md.position[i].x*fallofs[i]
md.outPosition[i].y=md.position[i].y*fallofs[i]
md.outPosition[i].z=md.position[i].z*fallofs[i]
getVectorArray(string channelName), getDoubleArray(string channelName), getIntArray(string channelName)
Returns the values of the channel specified in the argument as an array of the respective type.
setVectorArray(string channelName, array), setDoubleArray(string channelName, array), setIntArray(string channelName, array)
Sets the values of the channel specified in the argument with the values of the specified array.
getMatrix(int id)
Returns a transformation matrix for the point specified by the id.
setMatrix(matrix, int id)
Sets the specified matrix to the point specified by the id.

Advanced Functions

The Python node has inputPoints and outputPoints attributes which allow it to be added by hand between the Waiter and MASH_Repro node. These give you access to the following arrays.

Inputs

Outputs

Strength

Strength
Fades the node's effect for all the points at the same time.
Random Strength
Smoothly fades the node's effect on all the points in a random order.
Step Strength
Turns the node's effect off one point at a time.
Strength Map
Determines the input file (2D texture, animated texture, etc) that controls the shape of this node's effect.
Map Projection Axis
Determines the axis along which the Strength Map is projected.
Map Helper
Displays the object being used to interactively place the Strength Map in the scene. You can right-click the field to create a new helper object (a plane) if none exists. You can also middle-drag a mesh into this field or right-click to connect a selected mesh. If a mesh is already connected, you can also right-click to break its connection or show it in the Outliner.
Note: For the best results, assign the same texture to both the Strength Map and the Map Helper (this automatically happens when creating a new helper object).