Buttons

It is possible to add buttons in Layout that call subroutines in the Logic section without having to define parameters in PropertySet. The syntax for one of these buttons is:

Layout
{
   Button <#Rabu78943">script_name> [= "caption" [, pixel_width] ];
}

For example, here are valid Layout buttons:

Button MyButton;
Button MyButton = "Log a message...";
Button MyButton, AlignRight = "Log another message...", 300;

On button up, the PPG is temporarily locked and the following Logic event handler is called:

BeginScript
   Sub <#Rabu78943">script_name>_OnClicked()
       ...
   End Sub
EndScript

 

script_name

Each button calls a script defined inside a Logic section. Th e button script name cannot contain spaces.

caption

By default, the button caption is set to the script name but you can optionally specify your own caption. For example, say your spdl file contains these lines:

Layout "Default"
{
   Button CreateDevilRay;
   ...
}

BeginScript
   Sub CreateDevilRay_OnClicked()
       ' ... 
   End Sub
   ...
EndScript

The resulting button uses the declared name of the button as its caption:

 

If you want the caption to be more readable or completely different, you can specify your own caption value:

Button CreateDevilRay = "Unleash the Demons (mwa ha ha)";

 

 

pixel_width

By default, Softimage will set the size of the button to fit the display text. However, you can use this if you prefer to set a custom size (for example, to make all buttons in a column to be the same size regardless of text size). For example, if we had buttons with short and long captions, we could set a fixed size for all of them so they appear aligned in the column.

Here is what the buttons would look like without resizing

:

Layout "Default"
{
   Group, ShowFrame
   {
       Button CreateDevilRay = "Create Devil Ray";
       Button AddMultiParams = "Add Multiple Parameterizations";
       Button Repeat;
   }
}

BeginScript
   Sub CreateDevilRay_OnClicked()
       '... 
   End Sub
   Sub AddMultiParams_OnClicked()
       '... 
   End Sub
   Sub Repeat_OnClicked()
       '... 
   End Sub
EndScript

To align all buttons, set the width to 200 pixels:

Group, ShowFrame
{
   Button CreateDevilRay = "Create Devil Ray", 200;
   Button AddMultiParams = "Add Multiple Parameterizations", 200;
   Button Repeat = "Repeat", 200;
}

 

 

Notice that in order to set a width value for the button you must explicitly specify a caption, even if it is the same as the button name:

Button Repeat = "Repeat", 200;

Omitting the caption value will result in a spdlcheck error.

 



Autodesk Softimage v7.5