SPDL: Disabling Buttons from Logic


In this contrived example, a button is disabled when a parameter value is set to the value 4.

# SPDL Generated by XSI Shader Wizard
SPDL
Version = "2.0.0.0";
Reference = "{5601FF52-7A06-4473-973A-93D504161CC1}";
PropertySet "MyTestShader_pset"
{
 Parameter "out" output
 {
  GUID = "{99DDC0A6-C6A1-48DB-8AA0-64086E2C3A38}";
  Type = color;
 }
 Parameter "paramdd" input
 {
  GUID = "{37DF9349-5D1D-4277-9A9D-8BB44666E6FF}";
  Type = scalar;
  Value = 0.0;
 }
}

MetaShader "MyTestShader_meta"
{
 Name = "My Test Shader";
 Type = texture;
 Renderer "mental ray"
 {
  Name = "MyTestShader";
  FileName = "MyTestShader";
  Options
  {
   "version" = 1;
  }
 }
}

Layout "Default"
{
 Button TestButton,continue = "Test Button";
 param; 
}

Plugin = Shader
{
 FileName = "MyTestShader";
}


Language ="JScript";
BeginScript

function TestButton_OnClicked()
{
 LogMessage( "Test" );
}

function param_OnChanged()
{
 LogMessage( param.Value );
 
   oPPGLayout = PPG.PPGLayout ;

   // Lookup the PPGItem associated with the button
   oPPGItem = oPPGLayout.Item( "TestButton" ) ;

   if ( param.Value == 4 )
   {
       oPPGItem.SetAttribute( "buttondisable", true ) ;
          
       // We only call refresh if we determine the state has
       // actually changed
       PPG.Refresh() ;
   }
   else
   {
       oPPGItem.SetAttribute( "buttondisable", false ) ;
       PPG.Refresh() ;
   }

}


EndScript

This page was last modified 18:48, 2 Nov 2010.
This page has been accessed 2996 times.

© Copyright 2009 Autodesk Inc. All Rights Reserved. Privacy Policy | Legal Notices and Trademarks | Report Piracy