Documentation

SpeedTree Modeler

SpeedTree Modeler

Create a simple slider Rule

Compose a simple Rule, using a slider that controls the trunk height of an existing tree model.
Read time 2 minutesLast updated 2 hours ago

This procedure builds a single slider that adjusts the trunk height of an existing tree model, working up through the following sections.
Note
To get proper and meaningful results from this example Rule, you need to use a tree with a first level branch generator named "Trunk" that can afford a height value between 20 and 80. For example, use the Conifer available in the Samples provided with the Modeler.

Create a slider

  1. From the menu, select Window > Rules.
  2. In the script editor of the Rules window, compose the following statement:
    HeightValue = rule("Height", 45.0, 20.0, 80.0)
  3. Click anywhere outside the Rules window.
The UI section of the Rule window displays a slider named Height. The slider allows you to change the value of a variable named
HeightValue
between
20
and
80
and the default value is
45
.

Make the slider control the trunk height

  1. Select the Trunk generator of the tree.
  2. In the Property Bar, select the Spine tab.
  3. Under Spine > Length, right-click on the Absolute property and select Copy edit line for script.
  4. Under the first statement you composed in the Rule editor, paste the copied information:
    HeightValue = rule("Height", 45.0, 20.0, 80.0)set_property_value("=Trunk", "Spine:Length:Absolute", VALUE)
  5. Update the
    VALUE
    parameter of the
    set_property_value
    function to match the Rule's variable name (
    HeightValue
    ):
    HeightValue = rule("Height", 45.0, 20.0, 80.0)set_property_value("=Trunk", "Spine:Length:Absolute", HeightValue)
  6. Click anywhere outside the Rules window.
When you adjust the slider, the trunk of the tree gets longer or shorter.

Additional resources