You can define special parameters on your self-installed custom operator using the DefineLayout callback and tweak the property page where they appear with the DefineLayout callback.
// Add an Alpha parameter in the Define callback
CStatus MyOp_Define( CRef& in_ref )
{
Context ctxt( in_ref );
CustomOperator op( ctxt.GetSource() );
Factory fact = Application().GetFactory();
// Define the parameters
Parameter param;
CRef pdef = fact.CreateParamDef( L"Alpha", siDouble, CValue(0.5), CValue(0.01), CValue(0.99) );
op.AddParameter( pdef, param );
}
// Put the Alpha parameter in its own grouping
CStatus MyOp_DefineLayout( CRef& in_ref )
{
Context ctxt( in_ref );
PPGLayout layout( ctxt.GetSource() );
layout.Clear();
// Add a group for the Alpha parameter
layout.AddGroup( L"Intensity" );
layout.AddItem( L"Alpha" );
layout.EndGroup();
//...
}
// Add an Alpha parameter in the Define callback
function MyOp_Define( ctxt )
{
var op = ctxt.Source;
// Define the parameters
var pdef = XSIFactory.CreateParamDef2( "Alpha", siDouble, 0.5, 0.01, 0.99 );
var param = op.AddParameter( pdef );
// ...
}
// Put the Alpha parameter in its own grouping
function MyOp_DefineLayout( ctxt )
{
var layout = ctxt.Source;
layout.Clear();
// Add a group for the Alpha parameter
layout.AddGroup( "Intensity" );
layout.AddItem( "Alpha" );
layout.EndGroup();
//...
}
For runtime (non-Self-Installed) operators, you can use the XSIFactory.CreateParamDef or Factory::CreateParamDef method which allows you to define and create new parameters on the fly.
Parameters on a custom operator are very similar to parameters on a custom property. However FCurve or FCurve and GridData or GridData type parameters are not supported.
Custom operators can have an input connection from a custom property as an alternative to having its own parameters. This is useful when FCurve or GridData parameters are needed or when the custom property acts as a central control panel for one or more operators that are deeply hidden in the scene.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License