Option box scheme example
 
 
 

The following are the scheme files of the createTree.plugin in the supplied examples. This code defines the option box used by the tree growing code. As mentioned above, the default values for these widgets are set from a separate file, invoked in the plug-in’s initialization function. That file is also used to define the string names for the widgets. That way, these extra Scheme statements do not need to be reread each time the option box file is invoked. The file that defines the default values and the strings is called createTree_init.scm:

createTree_init.scm:
 (ui-symbol 'seed 0) 
(ui-string 'seed "Seed")  
(ui-symbol 'max_branch 15) 
(ui-string 'max_branch "Max Branch Limit");  
(ui-symbol 'bend 0.2) 
(ui-string 'bend "Bend")  
(ui-symbol 'fork_angle 30.0) 
(ui-string 'fork_angle "Fork Angle (deg)")  
(ui-symbol 'branch_frequency 50.0) 
(ui-string 'branch_frequency "Branch Frequency %")  
(ui-symbol 'gravity -0.1) 
(ui-string 'gravity "Gravity")  
(ui-symbol 'branch_length 5.0) 
(ui-string 'branch_length "Grow Length")  
(ui-symbol 'trunk_taper 95.0 ) 
(ui-string 'trunk_taper "Trunk Taper %")  
(ui-symbol 'min_branch_size 0.025 ) 
(ui-string 'min_branch_size "Minimum Branch Size")  
(ui-symbol 'twist 45.0 ) 
(ui-string 'twist "Twist Angle (deg)")  
(ui-symbol 'leaf.choice 0) 
(ui-string 'leaf.choice "Type of Leaves")  
(ui-string 'leaf_none   "None") 
(ui-string 'leaf_oak    "Oak") 
(ui-string 'leaf_maple  "Maple") 
(ui-string 'leaf_pine   "Pine")

The other file is called createTree.scm and contains the actual definition of the option box:

createTree.scm:  
(ui-editor 'tree.options      
(list 'title "Fractal Tree Options")     
(list 'symbols  'seed 'bend 'fork_angle 'branch_frequency 'gravity                     'branch_length 'trunk_taper 'min_branch_size 'twist                     'leaf.choice 'max_branch )      
(ui-integer-widget 'seed         
(list 'range 0 65535)     
)      
(ui-integer-widget 'max_branch         
(list 'range 1 100)     
)      
(ui-double-widget 'bend         
(list 'precision "%f6.4")         
(list 'range -1.0 1.0)     
)      
(ui-double-widget 'fork_angle         
(list 'precision "%f6.1")         
(list 'range 0.0 90.0)     
)      
(ui-double-widget 'branch_frequency         
(list 'precision "%f6.1")         
(list 'range 0.0 100.0)     
)      
(ui-double-widget 'gravity         
(list 'precision "%f6.4")         
(list 'range -1.0 1.0)     
)      
(ui-double-widget 'branch_length         
(list 'precision "%f6.4")         
(list 'range 0.0 10.0)     
)      
(ui-double-widget 'trunk_taper         
(list 'precision "%f6.1")         
(list 'range 0.0 100.0)     
)      
(ui-double-widget 'min_branch_size         
(list 'precision "%f6.4")         
(list 'range 0.0001 1.0)     
)      
(ui-double-widget 'twist         
(list 'precision "%f6.4")         
(list 'range 0.0 90.0)     
)      
(list 'title "Leaf Options")     
(ui-radio-widget 'leaf.choice         
(ui-choice 'leaf_none   0)         
(ui-choice 'leaf_oak    1)         
(ui-choice 'leaf_maple  2)         
(ui-choice 'leaf_pine   3)     
) 
)