Posted on 06/06/2015 |

Here are some short and simple maxscript snippets that I use quite often. They are very simple and there’s probably a cleaner way to do what they do, but who knows, it can be useful for someone…

Replace a map by another
In this example, the code collects all the Normal_Bump maps, to replace them by a VRayNormalMap one, while keeping the same bitmap input.

 

Get all the node’s dependances
This code get all nodes that have speficic node linked to. The node can be a mesh, a map, a light… Here it collects all the Normal_Bump maps, and collects all the VRayMtl material linked to them.

 

Reload PointCache
This snippet reloads the pointcache modifier for a given array of objects.

 

Get modifier’s instances
This one gives you all the objects that use an instance of a specified modifier from your selection. For example, you want to get all the objects sharing a twist modifier, just select one of them and type:  getInstanceMod(twist).

 

Track a vertex position
This function allows to snap, frame by frame, an object to a given vertex. In this example, $myHelper is snapped to the vertex 100 in $myMesh:

 

Create a zero out helper
This function creates a zero out helper for each objects (from a given array), and automaticaly renames the newly created helper, based on the source object’s name, with a search & replace. For example, if you have an object named « myCharacter_armL_Controller », you can execute the function while looking for « _Controller » and replacing it by « _ZeroOut » and you’ll get a new helper nammed « myCharacter_armL_ZeroOut ».