Simple Filter

This example shows how to implement a custom filter as a self-installing plug-in. Softimage installs the custom filter at startup and automatically adds it to the filter menu in the Select panel of the main command area. When Simple Filter is the active selection filter, you cannot select polygon meshes with less than fifty vertices.

The example includes JScript, Python, VBScript, and C++ versions of the filter. A more advanced C# filter called Triangle Filter is also included here. You can find more examples of custom filters in the %XSISDK_ROOT%\Application\Filters folder.

Example Files

Location
Files
simplejsfilter.js
simplepyfilter.py
simplevbsfilter.vbs
simplefilter.cpp
GNUmakefile
simplefilter.vcproj
CSTriangleFilter.cs
CSTriangleFilter.csproj

To run the example

  1. Create some polygon mesh objects, such as a cube and a sphere.
  2. In the Select panel, click to display the list of filters.

  3. In the list of filters, click Simple Filter (or JScript Simple Filter or Python Simple Filter or VBScript Simple Filter or CSTriangleFilter).
  4. Try to select different polygon meshes. The custom filter limits the selection to meshes with at least fifty points. Note 1: The C# Triangle Filter limits the selection to triangles. Note 2: The python filter can be configured by clicking the PythonFilterMenu | PPG menu in the main menu bar.

Building the C++ Example

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

    devenv SimpleFilter.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

Building the C# Triangle Filter Example

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

    devenv cssrc_TriangleFilter\CSTriangleFilter.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++, JScript, Python, VBScript, C++ example, JScript example, Python example, VBScript example, RegisterFilter, siFilter3DObject, X3DObject, IsA, siX3DObjectID, siPrimitiveID, SIObject, GetParent, Match, Context, GetAttribute, Input, IsValid, GetActivePrimitive, GetGeometry, GetPoints, GetCount, Applicable, Subset, GetArrayAttribute, Input, PutArrayAttribute, PutUserData, GetUserData, CValue::siPtrType, Init, Reload, Term, ClassName