Custom Linden Plants

From Second Life Wiki
Revision as of 08:15, 26 March 2007 by Argent Stonecutter (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Background

Currently, all plants are defined in trees.xml, which looks like this

<tree name="Pine 1" species_id="0" texture_id="0187babf-6c0d-5891-ebed-4ecab
1426683" droop="60.0" twist="5.0" branches="5.0" depth="1" scale_step="0.7" trun
k_depth="6" branch_length="8.0" trunk_length="11.5" leaf_scale="22.0" billboard_
scale="39.5" billboard_ratio="1.1" trunk_aspect="0.1" branch_aspect="0.05" leaf_
rotate="20.0" noise_mag="0.5" noise_scale="2.5" taper="0.8" repeat_z="3" /

and grass.xml, which looks like this:

  <grass
    name="Grass 0"
        species_id="0"
        texture_name="grass_texture_2.tga"
        blade_size_x="1.35"
        blade_size_y="1.35"
     />

Either of these are is a pretty small chunks of data, and could easily be attached to a prim and configured with an LSL call similar to LLParticleSystem. Any other shape attributes of the prim so equipped could be ignored (and as an optimization, could simply not be downloaded). The prim would display as the selected plant.

Implementation

llPlantSystem(list plant)

Set the "plant system" parameters for the prim.

Parameters:

  • PLANT_TEXTURE, texture_id
    • texture_id is a key or string.
    • For grass, this is the billboard for the grass.
    • For trees, this contains the trunk, the leaves, and the billboard.
  • PLANT_TYPE_GRASS, blade_size_x, blade_size_y
    • No other parameters are allowed but PLANT_TEXTURE.
  • PLANT_TYPE_TREE, species_id
    • species_id is one of SPECIES_PINE_1 through SPECIES_WINTER_ASPEN, integer constants 0 through 12.
    • All parameters will be copied from the matching species_id in trees.xml, and then modified by additional parameters in the list. This allows further savings in download, since most people will probably simply replace the texture in an existing tree.
  • Additional parameters from trees.xml
    • PLANT_DROOP, float droop
    • PLANT_TWIST, float twist
    • PLANT_BRANCHES, float branches
    • Etcetera...