Houdini Engine for 3ds Max
 All Files Pages
Scripting

MaxScript

The Houdini Engine for 3ds Max plug-in supports basic scripting functionality via MaxScript. The scripting functionality allows for the creation of HDAs, changing parameter values, and cooking an HDA.

MaxScript Functions

Name Signature Success Return Value Failure Return Value Description Since
CreateSession CreateSession <> True False This will start an out-of-process HARS Thrift named pipe thin client and then create a session using the thin client. 18.5.1
CloseSession CloseSession <> True N/A If there is an active session, this will close the session. 18.5.1
IsSessionActive IsSessionActive <> Bool (True/False) N/A This method will return true if a Houdini Engine session is active and false otherwise. 18.5.420
IsHdaLoaded IsHdaLoaded<HdaPath::Required> Bool (True/False) N/A This method will check if an HDA is loaded and return true or false depending on if it is loaded. An HDA is identified by its filepath. 18.5.1
LoadHda LoadHda<HdaPath::Required> True False This will load an HDA. It will return true if the asset was successfully loaded and false otherwise. 18.5.1
CreateGeometryHda CreateGeometryHda <PathToHda::required> <AssetIndex::default=0> INode Undefined Creates a geometry object HDA in the scene from the specified HDA using the specified asset (0 by default). If it succeeds, it will return the top-level container INode (containing the Dummy object). If the operation fails, it will return an undefined value. 18.5.1
CreateModifierHda CreateModifierHda <INode::required> <PathToHda::required> <AssetIndex::default=0> Modifier Undefined Creates a modifier HDA on the specified node from the specified HDA using the specified asset (0 by default). If it succeeds, it will return the created Modifier. If the operation fails, it will return an undefined value. 18.5.1
CookHda CookHda<INode::required> True False Cooks a geometry HDA. The method must be passed the container node (INode containing the dummy object) of the geometry HDA. 18.5.1
CookHda CookHda<INode::required> <Modifier::required> True False Cooks a modifier HDA. The method must be passed the INode and Modifier in order to identify the HDA to cook. 18.5.1
DeleteHda DeleteHda<INode::required> True N/A When passed the container node of a geometry HDA, this method will fully delete the HDA from the scene. If the HDA is not found, this method will throw a RuntimeError exception. 18.5.555
DeleteHda DeleteHda<INode::required> <Modifier::required> True N/A When passed a modifier HDA and the node that it belongs to, this method will delete the HDA from the modifier stack of the node. If the HDA is not found, this method will throw a RuntimeError exception. 18.5.555
GetGeometryHdas GetGeometryHdas <> Array<MAXNode> N/A Returns a list of container nodes for all of the geometry HDAs in the scene. 18.5.512
GetHdaType GetHdaType<INode::required> Name N/A When passed the container node of a geometry HDA, this method will return the HDA type. If an HDA is not found, this method will throw a RuntimeError exception. 18.5.512
GetHdaType GetHdaType<INode::required> <Modifier::required> Name N/A When passed a modifier HDA and the node that it belongs to, this method will return the HDA type. If an HDA is not found, this method will throw a RuntimeError exception. 18.5.512
GetHdaParameterValue GetHdaParameterValue<INode::required> <Parameter Name::required> <Index::required> Float/Integer/String/MAXNode N/A This method will retrieve the value of a parameter from a geometry HDA. An index argument must be supplied which specifies the tuple index of the value to be retrieved. This method will return a Float value, Integer value, String value, or MAXNode value depending on the type of the parameter. 18.5.605
GetHdaParameterValue GetHdaParameterValue<INode::required> <Modifier::required> <Parameter Name::required> <Index::required> Float/Integer/String/MAXNode N/A This method will retrieve the value of a parameter from a modifier HDA. An index argument must be supplied which specifies the tuple index of the value to be retrieved. This method will return a Float value, Integer value, String value, or MAXNode value depending on the type of the parameter. 18.5.605
SetGeometryHdaParameter SetGeometryHdaParameter <INode::required> <ParameterName::required> <ListOfValues::required> True False This function updates the parameter of a geometry HDA specified by the node and parameter name. The ListOfValues is where the values of the parameter are specified. The values specified in this list must all be of the same type (e.g. 3 floats for a position parameter). This method will return True on success and will return False if something went wrong and the operation failed. 18.5.1
SetModifierHdaParameter SetModifierHdaParameter <INode::required> <Modifier::required> <ParameterName::required> <ListOfValues::required> True False This function updates the parameter of a modifier HDA specified by its node, modifier, and parameter name. The ListOfValues is where the values of the parameter are specified. The values specified in this list must all be of the same type (e.g. 3 floats for a rotation parameter). This method will return True on success and will return False if something went wrong and the operation failed. 18.5.1
BakeHda BakeHda <INode::required> INode Undefined This method will bake out a geometry HDA. The method must be passed the container node (INode containing the dummy object) of the geometry HDA. If the operation succeeds, it will return the container node (Node containing the dummy object) of the baked out geometry. If the operation fails, it will return an undefined value. 18.5.1
CopyModifierHda CopyModifierHda <SourceINode::required> <SourceModifier::required> <DestinationINode::required> Modifier Undefined Copies a modifier HDA and all of its parameter values onto another node. If the operation succeeds, it will return the created Modifier. If the operation fails, it will return an undefined value. 18.5.1
CloneObjectHda <INode::required> INode Undefined Clones the specified object HDA and all of its parameter values. The INode passed to this function must be the top-level node of the object HDA, not any of its children nodes. If the operation succeeds, it it will return the top-level container INode (containing the Dummy object) of the cloned object HDA. If the operation fails, it will return an undefined value. 18.5.1
GetListOfGeometryHdaParameters <INode::required> Array<Name> Undefined This will return a list of the names of all the parameters on the geometry HDA. The function must be passed the the top-level container node (the INode containing the dummy object) of the HDA. On success, it will return an Array of Names that are the parameter names of the HDA. On failure, it will return undefined.18.5.1
GetListOfModifierHdaParameters <INode::required> <Modifier::required> Array<Name> Undefined This will return a list of the names of all the parameters on the modifier HDA. This function must be passed the INode and Modifier to identify the HDA. On success, it will return an Array of Names that are the parameter names of the HDA. On failure, it will return undefined. 18.5.1
SetGeometryHdaInput <INode::required> <Integer::required> <INode/undefined::required> True False This method allows a subnetwork input to be set on a geometry HDA. The first argument specifies the container node (INode containing the dummy object) of the geometry HDA. The second argument specifies the index (0-based) of the subnetwork. The third argument specifies the INode of the geometry to be used as the input. If undefined is passed instead of an INode, this method will remove the input. 18.5.1
SetModifierHdaInput <INode::required> <Modifier::required> <Integer::required> <INode/undefined::required> True False This method allows a subnetwork input to be set on a modifier HDA. The first argument specifies the INode of the modifier, and the second argument specifies the modifier itself. The third argument specifies the index (0-based) of the subnetwork. The fourth arugment specifies the INode of the geometry to be used as the input. If undefined is passed instead of an INode, this method will remove the input. 18.5.1
SetGeometryHdaOpParmInput <INode::required> <String::required> <INode/undefined::required> True False This method allows an operator path parameter input to be set on a geometry HDA. The first argument specifies the container node (INode containing the dummy object) of the geometry HDA. The second argument specifies the name of the operator path parameter. The third argument specifies the INode of the geometry to be used as the input. If undefined is passed instead of an INode, this method will remove the input. 18.5.1
SetModifierHdaOpParmInput <INode::required> <Modifier::required> <String::required> <INode/undefined::required> True False This method allows an operator path parameter input to be set on a modifier HDA. The first argument specifies the INode of the modifier, and the second argument specifies the modifier itself. The third argument specifies the name of the operator path parameter. The fourth argument specifies the INode of the geometry to be used as the input. If undefined is passed instead of an INode, this method will remove the input. 18.5.1
SetGeometryHdaAutoRecookingEnabled <INode::required> <boolean::required> True False Sets whether auto recooking is enabled for the geometry HDA. When auto recooking is enabled, the node will automatically cook whenever a parameter value is changed. 18.5.399
SetModifierHdaAutoRecookingEnabled <INode::required> <Modifier::required> <boolean::required> True False Sets whether auto recooking is enabled for the modifier HDA. When auto recooking is enabled, the node will automatically cook whenever a parameter value is changed. 18.5.399
SetHdaSelectionLocked <boolean::required> True N/A If passed true, this will lock the parameter user interface to the current HDA selection if an HDA is selected. If passed false, this will unlock the parameter user interface's selection. 18.5.415
GetHoudiniEngineOption <String::required: Option Name> String/Boolean/Integer False Gets the value of a Houdini Engine option. The supplied name must be one of the settings listed here. This method will return a String, Boolean, or Integer depending on the type of the option. 18.5.618
SetHoudiniEngineOption <String::required: Option Name> <String/Boolean/Integer::required: Option Value> True N/A This method will set a Houdini Engine option. The supplied name must be one of the settings listed here. The second argument can be a String, Boolean, or Integer, and must match the option type. 18.5.618
GetHoudiniVersion <> Array<String> N/A Returns an array that contains the Houdini versions (major, minor, and build number). 18.5.674

Samples

Setting a float parameter and float vector parameter

LoadHda "C:/Assets/sample.hda"
myHda = CreateGeometryHda "C:/Assets/sample.hda"
SetGeometryHdaParameter myHda "singlefloat" 5.5
SetGeometryHdaParameter myHda "floatvec" 2.2 3.3 4.4

Setting a integer parameter and integer vector parameter

LoadHda "C:/Assets/sample.hda"
myHda = CreateGeometryHda "C:/Assets/sample.hda"
SetGeometryHdaParameter myHda "singleinteger" 2
SetGeometryHdaParameter myHda "integervec" 3 4 5

Setting a string parameter

LoadHda "C:/Assets/sample.hda"
myHda = CreateGeometryHda "C:/Assets/sample.hda"
SetGeometryHdaParameter myHda "singlestring" "Hello, world!"

Create modifier and geometry HDA, set integer parameters, and cook the HDAs

CreateModifierHda $Teapot001 "C:/Program Files/Autodesk/3ds Max 2018/Plugins/MountainModifierHDA.hda" 0
SetModifierHdaParameter $Teapot001 $Teapot001.MountainModifier "height" 5
CreateGeometryHda "C:/Program Files/Autodesk/3ds Max 2018/Plugins/SideFX_spaceship.otl" 0
SetGeometryHdaParameter $spaceship1 "smoothness" 1
CookHda $Teapot001 $Teapot001.MountainModifier
CookHda $spaceship1

Create session, create a geometry HDA, and bake the HDA

CreateSession()
LoadHda "C:/Assets/spaceship.hda"
geoHda = CreateGeometryHda "C:/Assets/spaceship.hda"
BakeHda geoHda

Setting the input of an HDA

mountainHda = CreateGeometryHda "C:/Assets/mountain.hda"
SetGeometryHdaInput mountainHda 0 $Teapot001

Setting an operator path parameter

booleanHda = CreateModifierHda $Sphere001 "C:/Assets/boolean.hda"
SetModifierHdaOpParmInput $Sphere001 booleanHda "objpath1" $Box001

Setting a multiparameter length and setting instance parameter values

myHda = CreateGeometryHda "C:/Assets/multiparm_test.hda"
SetGeometryHdaParameter myHda "integer_list" 3
SetGeometryHdaParameter myHda "my_int_parm_1" 1
SetGeometryHdaParameter myHda "my_int_parm_2" 2
SetGeometryHdaParameter myHda "my_int_parm_3" 3

Python

Because MaxScript can be executed from a Python script, the plug-in's MaxScript API is also available to be used via Python. Below is an example of how to execute MaxScript function from a Python script:

1 import MaxPlus
2 MaxPlus.Core.EvalMAXScript("CreateGeometryHda #'C:/Program Files/Autodesk/3ds Max 2018/Plugins/SideFX_spaceship.otl' 0")