gfx = growfx2 name:"Tree_01" position:[10,10,0]
When true, activates "paths as lines" display mode in the Viewport, otherwise activates the Mesh display mode in the Viewport.
Save and Open preset files.
Updates the GrowFX internal caches and viewport display to account for all the changes made by other functions in this kit.
Generate a new random seed.
Returns the number of sequences. It equals the number of objects that are used in the distributors (the GrowFX icon, points, surfaces, etc.).
Returns the number of lines for the specified sequence, index are 1-based.
After calling this function, GrowFX generates a mesh for only the specified line, indexes are 1-based.
Resets the state of the previous function.
Creates separate splines for each path line. This method does not working in the Demo version!
Returns an array of Editable poly nodes of the elements in the hierarchy.
is_group_by_pathcolor : boolean - when true, the algorithm will group adjacent branches if they have the same path color.
Returns an array of Editable spline nodes of the elements in the hierarchy.
is_group_by_pathcolor : boolean - when true, the algorithm will group adjacent branches if they have the same path color.
Sets your own Copyright. For more information see Abouts rollout.
<url_string> must include protocol "http:\\" or "https:\\".
gfx.SetCopyright "My Name" "https:\\example.com" "1234" true
When true - displays additional information on nodes in the node editor that can be useful when programming MaxScript code, such as connector indexes, parameter indexes and node coordinates.
Specifies the spacing between grid lines in the Node Editor's viewport.
Get/Set the visibility of the grid lines in the Node Editor's viewport.
Get/Set the state of the grid snap option in the Node Editor's viewport.
Important! All methods do not save the state of the system. Accordingly, after using them, please do not use Undo/Redo. Otherwise, the application's behavior will be unpredictable and may result in a fatal error.
Creates a new node.
The <type_node> must be one of the following name values:
#NPath, #NDistr, #NDistrPoint, #NDistrPath, #NDistrPathPos, #NDistrSurf, #NDirRandom, #NDirVector, #NDirNoise, #NDirDeviation, #NDirSpline, #NDirHardBend, #NDirWind, #NDirCopy, #NDirAlignCh, #NDirRadial, #NDirSpiral, #NDirZigzag, #NDirTwist, #NDirReact, #NDirPathReact, #NDirObjSlice, #NDirVecOrient, #NDirSESlice, #NDirOptimize, #NDirEraser, #NDirTrim, #NDirOverrideSteps, #NDirShape, #NMeshCyl, #NMeshMeta, #NMeshLeafs, #NMeshIG, #NMeshSTDLeafs, #NAffect, #NUVWMap, #NChaosMatID, #NVertexColorCE, #NVertexColorCP, #NVertexColorIP, #NCurve, #NPathPos, #NIGElement, #NValue, #NRandom, #NSwitch, #NMath, #NGroup, #NAttrPos, #NAttrDist;Creates a new Public node from the indexed connector of the specified node.
name_string: name of node;To create a Public node with the type "Caption", you need to set <node_index_integer> or <connector_index_integer> equals 0.
Creates a new Curve node from the indexed connector of the specified node.
curve_as_factor_boolean: When true, connects a new Curve node with Curve as Factor mode. Otherwise, it will be connected with Curve as Value mode (Float or Universe), depending on the type of parameter that this curve node will connect to. For more information see Curve node;Returns number of nodes as an integer.
Returns the name of node.
Sets the new name of node.
Returns true if node is on.
Sets On or Off of the specified node.
Returns the type of node.
Returns number of connectors in the specified node as an integer.
Returns the type of connector in the specified node for the indexed connector.
Returns one of the following name values:
Creates a new connection between two nodes with specific connector indexes. Use the ShowNodeInfo property to find out the index of the connector on the node.
Finds the first node named name_string, and returns the index of the found node. If not found, it returns 0.
name_string - searched name (case sensitive).
Returns the value of the indexed parameter in the specified node.
Sets the value of the indexed parameter in the specified node.
Returns the color value of the indexed color parameter in the specified node.
Sets the color value of the indexed color parameter in the specified node.
Returns the output value type of the node for the Value, Random generation, or Math nodes.
Returns one of the following name values: #VInteger, #VFloat, #VUniverse, #VTime.
Sets the output value type of the specified node for the Value, Random generation, or Math nodes.
The <value_type> must be one of the following name values: #VInteger, #VFloat, #VUniverse, #VTime.
Returns the operation type of the specified Math node.
Returns one of the following name values:
Sets the operation type of the specified Math node.
The <value_type> must be one of the following name values:
Attaches an object node to a specified Public node. The public node must be with an object type.
Returns true if the object was attached successfully, false otherwise.
Attaches a texture map to a specified Public node. The public node must be with a Texture map type.
Returns true if the texture map was attached successfully, false otherwise.
-- Creating a new GrowFX object and set some parameters:
gfx = growfx2 name:"Tree_01" position: [0, 0, 0]
gfx.IconSize = 20
gfx.LineOnly = false -- Set the Meshes mode display in the viewport.
gfx.ShowNodeInfo = on -- Display an additional information on nodes.
-- Creating trunk with distributor and mesh builder:
trunk_path = gfx.AddNode #NPath "Trunk" 0 0
trunk_distr = gfx.AddNode #NDistr "Trunk_Distr" 0 -675
trunk_mesh = gfx.AddNode #NMeshCyl "Trunk_Mesh" 0 315
gfx.createConnection trunk_path 2 trunk_distr 20
gfx.createConnection trunk_path 5 trunk_mesh 2
-- Set the Length for the Trunk path:
gfx.setNodeParamValue trunk_path 1 200.0
-- Set the Radius for the Mesh:
gfx.setNodeParamValue trunk_mesh 1 4.0
-- Adding a curve node for the Radius of mesh:
trunk_meshR = gfx.addCurveNode trunk_mesh 4 true "Trunk_MeshR" 270 315
-- Adding Random and Vector modifiers for the Trunk path:
t_dir1 = gfx.AddNode #NDirRandom "t_dir_1" -270 270
gfx.createConnection trunk_path 3 t_dir1 2
t_dir2 = gfx.AddNode #NDirVector "t_dir_2" -270 450
gfx.createConnection t_dir1 9 t_dir2 2
gfx.setNodeParamValue t_dir2 11 100.0
-- Creating branches of 1 level:
b1_path = gfx.AddNode #NPath "B_1" 810 0
b1_distr = gfx.AddNode #NDistrPath "B1_Distr" 810 -900
b1_mesh = gfx.AddNode #NMeshCyl "B1_Mesh" 810 315
gfx.createConnection b1_path 2 b1_distr 32
gfx.createConnection b1_path 5 b1_mesh 2
gfx.createConnection trunk_path 12 b1_distr 2
b1_meshR = gfx.addCurveNode b1_mesh 4 true "B1_MeshR" 1080 315
gfx.setNodeParamValue b1_path 1 80.0
gfx.setNodeParamValue b1_distr 10 15.0
-- Adding an Affect node for branches:
aff1 = gfx.AddNode #NAffect "Aff_LB1" 1080 -810
gfx.createConnection b1_distr 5 aff1 2
b1_AffF = gfx.addCurveNode aff1 6 false "B1_AffF" 1350 -675
gfx.createConnection aff1 11 b1_path 6
-- Adding a Random and Vector modifiers for branches:
t_dir3 = gfx.AddNode #NDirRandom "t_dir_3" 540 270
gfx.createConnection b1_path 3 t_dir3 2
t_dir4 = gfx.AddNode #NDirVector "t_dir_4" 540 450
gfx.createConnection t_dir3 9 t_dir4 2
-- Creating a Caption Public node:
pub_1 = gfx.addPublicNode 0 0 "Tree parameters" -450 -200
-- Creating a Public node to control the Length of the Trunk path:
pub_2 = gfx.addPublicNode trunk_path 6 "Height" -450 0
-- Creating fruits path on the end of branches:
b2_path = gfx.AddNode #NPath "Fruits" 1845 0
-- Set the Length and Steps = 5:
gfx.setNodeParamValue b2_path 1 5.0
gfx.setNodeParamValue b2_path 3 5.0
-- Adding a Path Position distributor:
b2_distr = gfx.AddNode #NDistrPathPos "B2_Distr" 1845 -900
b2_distrpos1 = gfx.AddNode #NPathPos "B2_DistrPos1" 1575 -675
gfx.createConnection b2_distr 5 b2_distrpos1 2
gfx.createConnection b2_path 2 b2_distr 23
gfx.createConnection b1_path 12 b2_distr 2
-- Adding a Vector modifier for fruits:
t_dir5 = gfx.AddNode #NDirVector "t_dir_5" 1575 270
gfx.createConnection b2_path 3 t_dir5 2
gfx.setNodeParamValue t_dir5 11 -100.0
-- Adding an Instanced geometry mesh for fruits:
b2_mesh = gfx.AddNode #NMeshIG "B1_Mesh2" 1845 360
gfx.createConnection b2_path 5 b2_mesh 2
b2_ig1 = gfx.AddNode #NIGElement "B2_IG1" 1575 630
gfx.createConnection b2_mesh 7 b2_ig1 2
gfx.setNodeParamValue b2_mesh 1 100.0
-- Creating a Public node to attach the fruit object:
pub_3 = gfx.addPublicNode b2_ig1 3 "IG_1" 1350 800
-- Creating some fruit:
fruits = sphere name:"Fruit" position:[100, 100, 0] radius:7
-- Attach a fruit to the Public node:
gfx.attachObjectToPublicNode pub_3 fruits
-- Update the GrowFX object:
gfx.Update()
The example above will generate the following node graph:
Specifies the name of the new cache file. Returns true if the file was successfully prepared, false if it failed.
Loads the specified cache file. Returns true if the cache file was found and loaded successfully.
Records the cache data of the given GrowFX object to the disk.
Resets the cache data.
Deletes the cache file from the disk.