Version 3 of Shade and Tcl

Updated 2006-05-27 16:23:35

GS - Shade [L1 ] is a 3D modeling and rendering software that is being developed for 20 years in Japan. Even if it is not very well known outside of its country, it gathers around 200000 users. Shade embeds Tcl scripting language since 1999 and it gives access to its API.

http://shade.e-frontier.co.jp/85/images/shade8screen_s.jpg

Here is a simple example that creates an UI to enter data and to render colored a sphere.

http://gersoo.free.fr/wiki/w15977/shade_ui.jpg

 # Simple sphere demo with UI for Shade

 # Variables: radius, center coordinates, RGB color 
 set r 600
 set X 0
 set Y 0
 set Z 0
 set R 1.0 
 set G 0.1 
 set B 0.1 

 # The UI starts here 
 begin_dialog

 # Create a dialog box with 7 typed entries
 append_float_dialog_item "Radius"
 append_float_dialog_item "X center"
 append_float_dialog_item "Y center"
 append_float_dialog_item "Z center"
 append_float_dialog_item "Red value (0..1)"
 append_float_dialog_item "Green value (0..1)"
 append_float_dialog_item "Blue value (0..1)"

 # Initial values for items
 set_float_property_value 0 to $r
 set_float_property_value 1 to $X
 set_float_property_value 2 to $Y
 set_float_property_value 3 to $Z
 set_float_property_value 4 to $R
 set_float_property_value 5 to $G
 set_float_property_value 6 to $B

 # ask_dialog is true if we hit on OK button
 if [ask_dialog] {
   set r [get_float_property_value 0]
   set X [get_float_property_value 1]
   set Y [get_float_property_value 2]
   set Z [get_float_property_value 3]
   set R [get_float_property_value 4]
   set G [get_float_property_value 5]
   set B [get_float_property_value 6]
   if {$R > 1.0} {set R 1.0}
   if {$G > 1.0} {set G 1.0}
   if {$B > 1.0} {set B 1.0}
   end_dialog
 } else {
   end_dialog
   error cancel_dialog
 }
 # End of UI

 # Create a tagged sphere with radius r at <X,Y,Z> coordinates
 create_sphere at [list $X $Y $Z] r $r sphere_1

 # set color to sphere_1
 set base_color [list $R $G $B]

 # Render the result
 render

If you are curious and if you master a bit japanese language you can have a look to this script repository [L2 ].


[ Category Graphics ]