SIObject.Categories

Introduced

v4.0

Description

Sets or returns the categories defined for this object. Categories are used to extend the categorization of objects. Categories of SPDL objects are initialized with the values of the Keyword field whereas the categories of custom objects (such as Filter and Command) can be set when plug-in items are registered with PluginRegistrar.

Categories are returned as as an Array of Strings. If no categories are specified, an empty array is returned.

Categories must be set in a comma-separated string. Use PluginRegistrar.Categories to set the categories for all plug-in items defined in a plug-in or use PluginItem.Categories to set the categories of a specific plug-in item. No other interfaces support the 'set' component of this property.

Note: For the deprecated (v1.0) style of creating commands, you can only set the categories by specifying one of the siCommandCategory enum values in the Category parameter of the XSIApplication.CreateCommand method.

C# Syntax

// get accessor
Object SIObject.get_Categories();
// set accessor
SIObject.set_Categories( String pArrayVal );

Examples

1. VBScript Example

'
'	This example shows how to get the categories of a SPDL object
'
set cone = ActiveSceneRoot.AddPrimitive( "cone" )
cat = cone.Categories
for i=LBound( cat, 1 ) to UBound( cat, 1 )
	LogMessage "category: " & cat(i)
next
'the example above will output the following:
'INFO: category: General
'INFO: category: Primitive
'INFO: category: Modeling

2. VBScript Example

'
'	This example shows how to set the categories of a plug-in and specific plug-in items
'
Function XSILoadPlugin( in_reg )
	' register plugin information
	in_reg.Author = "Softimage Co." 
	in_reg.Name = "Mesh Filter plugin"
	in_reg.URL = "http://www.softimage.com"
	in_reg.Email = "webmaster@softimage.com"
	in_reg.Categories = "Mesh component filter"
	' set the version number of this plugin
	in_reg.Major = 1
	in_reg.Minor = 0 
	' register filter plugin items
	set item = in_reg.RegisterFilter( "Border Edge", siFilterSubComponentEdge )
	item.Categories = "Mesh,Edge"
	set item = in_reg.RegisterFilter( "Triangle", siFilterSubComponentPolygon )
	item.Categories = "Mesh"
	set item = in_reg.RegisterFilter( "Quad", siFilterSubComponentPolygon )
	item.Categories = "Mesh"
	set item = in_reg.RegisterFilter( "N-gon", siFilterSubComponentPolygon )
	item.Categories = "Mesh"
	set item = in_reg.RegisterFilter( "Border Point", siFilterSubComponentPoint )
	item.Categories = "Point"
	set item = in_reg.RegisterFilter( "Polygon Island", siFilterSubComponentPolygon )
	item.Categories = "Mesh,Polygon"
	in_reg.RegisterFilter "Local Material", siFilterProperty
	XSILoadPlugin = true
end Function

3. JScript Example

/*
	This example shows how to get the plug-in items categories
*/
var items = Application.Plugins("Mesh Filter plugin").Items;
for (var i=0; i<items.Count; i++) 
{
	LogMessage( items(i).Name + " categories: " );
	var vba = new VBArray(items(i).Categories);
	var	categories = vba.toArray();
	for (var j=0; j<categories.length; j++) 
	{
		LogMessage( categories[j] );		
	} 
}