Public Member Functions
Factory Class Reference

Detailed Description

This class represents a Factory class and is used to create certain types of objects.

See also:
CustomOperator, Application::GetFactory
Since:
4.0
Example:
        using namespace XSI;
        Application app;
        Factory factory = app.GetFactory();

        CString strCode = L"function MyOperator_Update( ctx, Out, InPosY ) { Out.Value = InPosY.Value; }";

        CustomOperator op = factory.CreateScriptedOp( L"MyOperator", strCode, L"JScript" );

        Model root = app.GetActiveSceneRoot();

        CStatus st;
        Null null1; st = root.AddNull(L"MyNull1", null1);
        Null null2; st = root.AddNull(L"MyNull2", null2);

        op.AddOutputPort(null1.GetParameter( L"PosX" ));
        op.AddInputPort(null2.GetParameter( L"PosY" ));

        op.Connect();

#include <xsi_factory.h>

Inheritance diagram for Factory:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Factory ()
 ~Factory ()
 Factory (const CRef &in_ref)
 Factory (const Factory &in_obj)
bool IsA (siClassID in_ClassID) const
siClassID GetClassID () const
Factoryoperator= (const Factory &in_obj)
Factoryoperator= (const CRef &in_ref)
CRef CreateObject (const CString &name, CStatus *pst=0)
CRef CreateObjectFromPreset (const CString &presetname, const CString &family=L"", CStatus *pst=0)
CRef CreateObjectFromFile (const CString &in_filename, CStatus *out_st=0)
CRef CreateScriptedOp (const CString &name=L"", const CString &code=L"", const CString &language=L"", CStatus *pst=0)
CRef CreateScriptedOpFromFile (const CString &name, const CString &filename, const CString &language=L"", CStatus *pst=0)
CRef CreateParamDef (const CString &in_scriptname, CValue::DataType in_type, INT in_capabilities, const CString &in_name, const CString &in_description, const CValue &in_default, const CValue &in_min, const CValue &in_max, const CValue &in_suggestedmin, const CValue &in_suggestedmax, CStatus *pst=0)
CRef CreateParamDef (const CString &in_scriptname, CValue::DataType in_type, const CValue &in_default, const CValue &in_min, const CValue &in_max, CStatus *pst=0)
CRef CreateParamDef (const CString &in_scriptname, CValue::DataType in_type, const CValue &in_default, CStatus *pst=0)
CRef CreateFCurveParamDef (const CString &in_scriptname, CStatus *pst=0)
CRef CreateGridParamDef (const CString &in_scriptname, CStatus *pst=0)
CRef CreateTimeTransport (CStatus *pst=0)
CRef CreateICENodeDef (const CString &in_name, const CString &in_description=CString(), CStatus *pst=0)
CRef CreateShaderDef (const CString &in_parserName, const CString &in_className, ULONG in_major, ULONG in_minor)
CStatus RemoveShaderDef (const CRef &in_shaderdef)
CRef CreateShaderParamDefOptions ()

Constructor & Destructor Documentation

Factory ( )

Default constructor.

~Factory ( )

Default destructor.

Factory ( const CRef in_ref)

Constructor.

Parameters:
in_refconstant reference object.
Factory ( const Factory in_obj)

Copy constructor.

Parameters:
in_objconstant class object.

Member Function Documentation

bool IsA ( siClassID  in_ClassID) const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassIDclass type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from SIObject.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from SIObject.

Factory& operator= ( const Factory in_obj)

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:
in_objconstant class object.
Returns:
The new Factory object.
Factory& operator= ( const CRef in_ref)

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:
in_refconstant class object.
Returns:
The new Factory object.

Reimplemented from SIObject.

CRef CreateObject ( const CString name,
CStatus pst = 0 
)

Creates an XSI object from a type name. This function can be used to create a temporary CustomProperty that is not connected to the scene. It can also be used to instantiated a new instance of a Self-Installed CustomOperator.

Parameters:
nameType name. In the case of a Self-Installed CustomProperty or CustomOperator this is the name as provided in PluginRegistrar::RegisterProperty and PluginRegistrar::RegisterOperator.
Return values:
pstThe return status (optional).
Returns:
A reference to the new object, for example a CustomOperator or CustomProperty.
See also:
ProjectItem::CreateCustomOp, PluginRegistrar::RegisterOperator, PluginRegistrar::RegisterProperty
CRef CreateObjectFromPreset ( const CString presetname,
const CString family = L"",
CStatus pst = 0 
)

Creates an object from a preset and optional preset family name.

Parameters:
presetnamePreset name.
familyPreset family name.
Return values:
pstThe return status (optional).
Returns:
A reference to the new Factory object.
CRef CreateObjectFromFile ( const CString in_filename,
CStatus out_st = 0 
)

Creates an object from a preset file. The preset filename can be relative or partially complete for example you can find the Shear operator by specifying Operators\Shear. If the preset is not found in the users folder then the users addon, workgroup, workgroup addon and factory locations will be searched in that order.

Parameters:
in_filenameThe filename of the preset.
Return values:
out_stThe return status (optional).
Returns:
A reference to the new object.
Empty reference if the function failed.
CRef CreateScriptedOp ( const CString name = L"",
const CString code = L"",
const CString language = L"",
CStatus pst = 0 
)

Creates a scripted version of a CustomOperator object with the code specified (a runtime scripted operator). To create a Self-Installed Custom Operator use Factory::CreateObject instead.

Parameters:
nameThe name of the operator.
codeThe implementation code.
languageThe implementation language.
Return values:
pstThe return status (optional).
Returns:
A reference to the new object.
Empty reference if the function failed.
CRef CreateScriptedOpFromFile ( const CString name,
const CString filename,
const CString language = L"",
CStatus pst = 0 
)

Creates a scripted version of a CustomOperator object with the logic in an associated script file.

Parameters:
nameThe name of the operator.
filenameThe file where the operator is implementated.
languageThe implementation language.
Return values:
pstThe return status (optional).
Returns:
A reference to the new object.
Empty reference if the function failed.
CRef CreateParamDef ( const CString in_scriptname,
CValue::DataType  in_type,
INT  in_capabilities,
const CString in_name,
const CString in_description,
const CValue in_default,
const CValue in_min,
const CValue in_max,
const CValue in_suggestedmin,
const CValue in_suggestedmax,
CStatus pst = 0 
)

Creates a parameter definition (simplified API for creating parameters of type long, double, etc.).

Parameter definitions contain the definition of a parameter from which you can create new parameters on the fly for one or more property sets or operators. For example, you may want to use a double with the same min/max range and use it on multiple property sets or you may simply want a quick way to add parameters to a runtime custom operator. You can create new parameter definitions from the Factory class.

By default the parameter is persistable and animatable with the exception of string parameters which are not animatable. The recommended parameter types are: siString, siBool, siInt4, siUByte, and siDouble.

The supported types are: siString, siBool, siDouble, siFloat, siInt4, siInt2, siUInt4, siUInt2, siByte, siUByte.

Parameters:
in_scriptnameThe script name for the new Parameter object.
in_typeThe data type of the new Parameter object.
in_capabilitiesThe capabilities of the parameter. This is a mask of siCapabilities values and is used to determine whether the parameter is read-only or animatable etc.
in_nameThe name of the Parameter object. This is the string that will be displayed in the scene explorer.
in_descriptionDescription of the custom parameter. If specified, this is a more descriptive name that will appear as the parameter label when the customer property is inspected. For example, the long name of a parameter might be a user friendly "Use Light Color as Energy" while the name is a more script friendly "use_color"
in_defaultThe default value of the custom parameter. A default value is required for parameter types other than siString and siBool.
in_minMinimum value of the custom parameter. A value is required for parameter types other than siString and siBool.
in_maxMaximum value of the custom parameter. A value is required for parameter types other than siString and siBool.
in_suggestedminSuggested minimum value of the custom parameter. The minimum value will be used if this parameter is not specified. The suggested minimum should be equal or larger than the minimum. This value is used to configure the range of UI controls.
in_suggestedmaxSuggested maximum value of the custom parameter. The maximum value will be used if this parameter is not specified. The suggested maximum should be equal or smaller than the Maximum. This value is used to configure the range of UI controls.
Return values:
pstThe return status (optional).
Returns:
A reference to the new parameter definition.
CRef CreateParamDef ( const CString in_scriptname,
CValue::DataType  in_type,
const CValue in_default,
const CValue in_min,
const CValue in_max,
CStatus pst = 0 
)

Creates a parameter definition (simplified API for creating parameters of type long, double, etc.).

Parameter definitions contain the definition of a parameter from which you can create new parameters on the fly for one or more property sets or operators. For example, you may want to use a double with the same min/max range and use it on multiple property sets or you may simply want a quick way to add parameters to a runtime custom operator. You can create new parameter definitions from the Factory class.

By default the parameter is persistable and animatable with the exception of string parameters which are not animatable. The recommended parameter types are: siString, siBool, siInt4, siUByte, and siDouble.

The supported types are: siString, siBool, siDouble, siFloat, siInt4, siInt2, siUInt4, siUInt2, siByte, siUByte

Parameters:
in_scriptnameThe script name for the new Parameter object.
in_typeThe data type of the new Parameter object.
in_defaultThe default value of the custom parameter. A default value is required for parameter types other than siString and siBool.
in_minMinimum value of the custom parameter. A value is required for parameter types other than siString and siBool.
in_maxMaximum value of the custom parameter. A value is required for parameter types other than siString and siBool.
Return values:
pstThe return status (optional).
Returns:
A reference to the new parameter definition.
CRef CreateParamDef ( const CString in_scriptname,
CValue::DataType  in_type,
const CValue in_default,
CStatus pst = 0 
)

Creates a parameter definition (simplified API for creating parameters of type long, double, etc.).

Parameter definitions contain the definition of a parameter from which you can create new parameters on the fly for one or more property sets or operators. For example, you may want to use a double with the same min/max range and use it on multiple property sets or you may simply want a quick way to add parameters to a runtime custom operator. You can create new parameter definitions from the Factory class.

By default the parameter is persistable and animatable with the exception of string parameters which are not animatable. The recommended parameter types are: siString, siBool, siInt4, siUByte, and siDouble.

The supported types are: siString, siBool, siDouble, siFloat, siInt4, siInt2, siUInt4, siUInt2, siByte, siUByte

Parameters:
in_scriptnameThe script name for the new Parameter object.
in_typeThe data type of the new Parameter object.
in_defaultThe default value of the custom parameter. A default value is required for parameter types other than siString and siBool.
Return values:
pstThe return status (optional).
Returns:
A reference to the new parameter definition.
CRef CreateFCurveParamDef ( const CString in_scriptname,
CStatus pst = 0 
)

Creates an FCurve parameter definition for use with the CustomProperty or CustomOperator. An FCurve of this type is often called a Profile Curve because, unlike most FCurves, this curve does not animate any parameter, but instead is available for use in any fashion the plug-in developer or user wishes.

Unlike parameters that have simple types like an Integer or a String, this Parameter is an instance of an FCurve. It uses units of Frames for its X axis, but because it does not directly animate any object this axis can actually be interpreted in any fashion. An example use of an FCurve parameter can be found on the bulgeop Bulge operator .

You can access the FCurve object via Parameter::GetValue. This should not be confused with the function for retrieving an FCurve that is animating a basic parameter (Parameter::GetSource).

In order to view the FCurve on the Property Page for the CustomProperty or CustomOperator, use PPGLayout::AddFCurve.

Parameters:
in_scriptnameThe script name for the new Parameter object.
Return values:
pstThe return status (optional).
Returns:
A reference to the new ParamDef object.
Since:
5.0
CRef CreateGridParamDef ( const CString in_scriptname,
CStatus pst = 0 
)

Creates a GridData parameter definition for use with the CustomProperty or CustomOperator. The grid is a convenient way to store 1- or 2-dimensional arrays and the user can view and edit this data via ::siControlGrid (see ::siPPGControlType enum).

To change the contents of the grid via scripting use the GridData object, which is accessible via Parameter::GetValue.

To include the GridData in the Property Page of the CustomProperty or CustomOperator, use the PPGLayout::AddItem.

Parameters:
in_scriptnameThe ICENode script name.
Return values:
pstThe return status (optional).
Since:
5.0
CRef CreateTimeTransport ( CStatus pst = 0)

Create a connection with time transport service. This will be initialized with the current time setting; which is normally defined by the project's play control property. Call the TimeTransport::SetTimeContext() method change the time context used by the time transport.

Since:
6.5.x
CRef CreateICENodeDef ( const CString in_name,
const CString in_description = CString(),
CStatus pst = 0 
)

Creates an ICENodeDef object, which defines a custom ICENode.

Parameters:
in_nameThe ICENode type name.
in_descriptionThe ICENode type description name. If empty, the in_name value is used.
Return values:
pstThe return status (optional).
Returns:
A reference to the new ICENodeDef object.
Since:
7.0
CRef CreateShaderDef ( const CString in_parserName,
const CString in_className,
ULONG  in_major,
ULONG  in_minor 
)

Creates a new shader definition. Softimage shader definitions can be accessed via either Application::GetShaderDefinitions or by ShaderDef::GetProgID via Application::GetShaderDef.

Note:
Each shader definition has a unique ProgID which is built from the four specified components. For more information, see cus_shaders_ProgID Instantiating Shader Definitions and the ProgID
Tip:
On-the-fly (nonpersisted) shader definitions act like parser-based shader definitions that are never parsed (ShaderDef::GetParsed always returns false) and have no definition file (ShaderDef::GetDefinitionPath is always empty). However, you must specify a parser name, and it cannot be either "Softimage" or the name of a parser already registered.
Parameters:
in_parserNameName of the parser for the new shader definition. This is basically a dummy string, since shader definitions created with this function are not defined by either plug-ins or parsers.
in_classNameName of the shader class. If you don't specify a UI name for the shader definition, this is the name that appears on the shader node when instantiated in the render tree.
in_majorMajor version number ('2' in v2.5)
in_minorMinor version number ('5' in v2.5)
Returns:
A reference to the new ShaderDef object.
See also:
ShaderDef::GetParser, ShaderDef::GetPlugin, cus_shaders_ProgID Instantiating Shader Definitions and the ProgID
Since:
9.0 (2011)
CStatus RemoveShaderDef ( const CRef in_shaderdef)

Removes an existing shader definition.

Parameters:
in_shaderdefA reference to the ShaderDef to remove.
Returns:
Success/failure
Since:
9.0 (2011)
CRef CreateShaderParamDefOptions ( )

Creates a shader parameter definition options.

Returns:
A reference to the new ShaderParamDefOptions object.
Since:
9.0 (2011)

The documentation for this class was generated from the following file: