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