Deform Operators

This example shows how to create deform operators. These are operators which change an existing polygon or nurbs mesh.

Custom Deform
The Custom Deform example is a self-installed plug-in that defines two custom commands:

There is no Self-Installed Custom Operator in this example. Instead, the ApplyCustomDeformExample_Execute callback creates the operator on the fly using XSIFactory.CreateScriptedOp and the Object Model. The CustomDeformOp_Update function contains the implementation of the operator.

The operator has no parameters. Instead, the user controls it by working with a custom property that is connected to the operator. This allows the user interface for the plugin to use new features like the FCurve parameter type. There is no SPDL file for the custom property, instead it is defined entirely in this script file. An instance of the custom property is created whenever the operator is applied and can be found nested underneath the Polygon Mesh object.

Splatter (JScript version)
The Splatter example has been a "classic" operator example for many versions of Softimage. For this release, two JScript variations of Splatter are included, to demonstrate the difference between Runtime and Plugin based operators.

You can apply Splatter to any polygon or Nurbs mesh and it will "squish" all points with negative values in the y-axis. You can use this used to simulate a ball being squished as it hits a flat surface.

The disadvantage of the runtime operator version is that, unlike the plugin-based operator, every instance of the operator contains its own copy of the source code for the Update method. So, if you later discover a bug in the operator, it may be hard to find and fix all scenes where the operator was applied. On the positive side, after the runtime version is applied, it continues to work, even if the Splatter plug-in is deleted.

The plugin version provides a custom layout for the Property Page of the operator, by implementing the _DefineLayout callback. This gives precise control over the parameters which are shown on the Operators property page. This feature is not available for the runtime version.

Splatter (C++ version)

The C++ version uses a self-installed custom operator and is identical to the plug-in JScript version

Splatter (C# version)

The C# version uses a self-installed custom operator and is identical to the plug-in JScript version

Example Files

Location
Files
ApplySplatterRuntime.js
ApplySplatterPlugin.js
CustomDeformExample.js
SplatterCpp.cpp
SplatterCpp.vcproj
GNUmakefile
CSSplatterOp.cs
CSSplatterOp.csproj

Running the Example

To run the CustomDeform example

To run the Runtime JScript Splatter example

To run the Plugin JScript Splatter example

To run the C++ Splatter example

To run the C# Splatter example

Building the C++ Splatter Example

Softimage SDK includes a compiled version of SplatterCpp. 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 SplatterCpp project from the command line, type:

    devenv cppsrc_Splatter/SplatterCpp.vcproj
  2. In Visual Studio .NET, open the project file .vcproj.
  3. Select a configuration (Release or 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_Splatter
  3. To remove all intermediate files before building the example, run this command:

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

    gmake

Building the CSSplatterOp Example

Softimage SDK includes a compiled version of CSSplatterOp. 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 XSI_HOME are set (otherwise you'll get build and link errors).

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

    devenv cssrc_SplatterOp\CSSplatterOp.csproj
  2. In Visual Studio .NET, open the project file .csproj.
  3. Select a configuration (Release or Debug) and build the DLL.

Keywords

This example uses the following keywords:

C++ example, JScript example, dynamic operator, C++, operator, SPDL, self-installed operator, self-installed plug-in, deform, deformations, Custom Operator, AddIOPort, AddInputPort, Connect, AddFCurveParameter, FCurve, FCurve.BeginEdit, FCurve.AddKeys, FCurve.RemoveKey, XSIFactory.CreateScriptedOp,RegisterOperator,OperatorContext, Update, AddCommandItem, AddParameter2, Geometry.Points.PositionArray,