PSetUIDemo
 
 
 

PSetUIDemo

This example shows how to use a custom property (a set of custom parameters) to build a user interface for a plug-in. The example is not a functional user interface, but rather a demonstration of UI capabilities such as:

  • Using different types of controls, such as list boxes, radio buttons, multi-line text boxes, file controls and images.
  • Creating tabs for related sets of controls.
  • Using groups and rows to lay out the controls on a tab.
  • Controlling the behavior of a custom property using custom logic code.

The example shows how to implement a custom property as a self-installing plug-in (in either JScript or C++) or as a SPDL-based plug-in. JScript is a quick and convenient way to add a user interface to your custom Softimage tools, but C++ developers may prefer to use C++. SPDL has generally been replaced by self-installing custom properties, but for purposes of comparison, a SPDL example is included.

Note This example does not demonstrate every type of UI control. For example, the example custom property does not include grid, and fcurve controls. See the SDK Customization Guide for a full list of the available controls.

To create your own custom property, you can use the Custom Property Wizard to get started.

Example Files

Location
Files
PSetUIDemoJScript.js
PSetUIDemoCPP.cpp
PSetUIDemo.spdl
GNUmakefile
PSetUIDemoCPP.vcproj
logo.bmp

Running the Example

To see the self-installing custom property (JScript or C++ version)

  1. Select a scene object, for example, the scene root.
  2. Do one of the following:

    • On the Model toolbar, click
      Property > PSetUIDemo - JScript Version
      - or -
      Property > PSetUIDemo - C++ API Version
    • Create an instance of the custom property using SceneItem.AddProperty and then open the property page with InspectObj:

      // JScript
      // Create an instance of the JScript custom property
      var oCustomProperty = ActiveSceneRoot.AddProperty( "PSetUIDemoJscript",false ) ;
      InspectObj( oCustomProperty ) ;
      
      ' VBscript
      ' Create an instance of the C++ custom property
      set oPSet = ActiveSceneRoot.AddProperty( "PSetUIDemoCPP" )
      InspectObj oPSet
      
    • Click one of these links: PSetUIDemoJscript or PSetUIDemoCPP

      These links run the scripting code given above for you.

To see the SPDL version of the custom property

  • Run this code in the script editor:
  • ' VBscript
    Dim rtn, oProp, oParam
    
    SelectObj "Scene_Root"
    SIAddProp "PSetUIDemo", , , , rtn
    InspectObj "PSetUIDemo"
    

Building the C++ Example

The Softimage SDK includes a compiled version of PSetUIDemoCPP. If you want to modify the code, you can rebuild the example by following these instructions.

To build the example on Windows

  1. Open an Softimage command prompt, and type devenv to start Visual Studio .NET.

    Starting Visual Studio .NET from an Softimage command prompt ensures that environment variables such as XSISDK_ROOT are set (otherwise you'll get build and link errors).

    Tip To load the PSetUIDemoCPP project from the command line, type:

    devenv PSetUIDemoCPP.vcproj
    
  2. In Visual Studio .NET, open the project file .vcproj.
  3. Select a configuration (Win32 Release or Win32 Debug) and build the DLL.

To build the example on Linux

  1. In a shell (tcsh) window, type:

    source $XSI_HOME/.xsi_<xsi_version>
    
  2. Change directories to

    cppsrc
    
  3. To remove all intermediate files before building the example, run this command:

    gmake clean
    
  4. To compile the example, run this command:

    gmake
    

Keywords

This example uses the following keywords:

C++ example, SPDL, RegisterProperty, RegisterMenu, Parameter, CustomProperty, AddParameter, Define, DefineLayout, PPGEvent, PPGEventContext, GetEventID, siParameterChange, siTabChange, siButtonClicked, siOnInit, PPGLayout, PPGItem, AddTab, AddGroup, AddRow, EndGroup, EndRow, AddItem, PutAttribute, siUIThumbWheel, siUIImageFile, siUIOpenFile, siUIFileMustExist, siUIInitialDir, siUISubFolder, siPPGItemAttribute, AddString, AddButton, PutWidthPercentage, AddEnumControl, AddStaticText, PutParameterValue, GetPPGLayout, ExecuteCommand, GetAsText, siTabChange, siParameterChange, GetAttribute, Button, Tab, PutParameterValue, AddCallbackItem, SetAttribute, AddColor, AddEnumControl, siControlCombo, UIItems, AddSpacer, AddProperty