FCurve.SI3DStyle

Introduced

v3.0

Description

Sets or returns the SI3DStyle property of the fcurve as a Boolean (true for SI3DStyle). If the fcurve is set as SI3DStyle then the key tangents are constrained using the SI3D tangent constraints. This forces all the key tangents to have a slope length where the horizontal component is 1/3 of the distance between 2 consecutive keys. Furthermore, the adjust tangent constraint (siFCurveKeyConstraint) is turned off. If you change an existing fcurve to use the SI3D style then all tangents are adjusted to meet the SI3D tangent constraints.

The SI3D style is only applicable to standard fcurves (FCurve.Type == siStandardFCurve). If you set this property on other fcurve types the method returns S_FALSE in C++ and getting the SI3DStyle always returns VARIANT_FALSE.

Examples

1. VBScript Example

'
'       This example illustrates how to create an fcurve with
'       the SI3D style for constraining tangents.
'
set o = getprim( "Null" )
set fc = o.posx.addfcurve()
fc.setkeys( Array(1,50,50,0,100,50) )
fc.si3dstyle = true
' Get the object as though it was selected and get the fcurve 
' on its local.posx parameter
set o = selection(0)
set fc = o.posx.source
if fc.si3dstyle then
        LogMessage "fcurve has SI3D style of tangent constraints."
end iF
' Outputs:
'INFO : fcurve has SI3D style of tangent constraints.

2. JScript Example

/*
        This example illustrates how to create an fcurve with
        the SI3D style for constraining tangents.
*/
// Create a null
Application.NewScene( "", false );
var nullobj = ActiveSceneRoot.AddNull();
// Get the posx, posy parameters from the null
var posx = nullobj.posx;
var posy = nullobj.posy;
// Create an fcurve on posx, posy
var fc1 = posx.AddFCurve();
var fc2 = posy.AddFCurve();
// Define the number of keys
var nbkeys = 100;
// Start editing the fcurves
fc1.BeginEdit();
fc2.BeginEdit();
// Set the style of fc1 to SI3D style
fc1.SI3DStyle = true;
var tangents = new Array( nbkeys * 4 );
// Add keys to the fcurve
for ( i=0, j=0; i<nbkeys; i++, j+=4 )
{
        val = (Math.cos( (i+1)/10 ) * 100);
        fc1.AddKey( i, val );
        fc2.AddKey( i, val );
        tangents[j] = 0;
        tangents[j+1] = 0;
        tangents[j+2] = 0;
        tangents[j+3] = 0;
}
// Set the tangent to zero to illustrate the difference 
// between the Softimage & SI|3D styles
fc1.SetKeyTangents(tangents);
fc2.SetKeyTangents(tangents);
// End editing the fcurve and put undo event onto the
// undo/redo stack
fc1.EndEdit();
fc2.EndEdit();
// Print the key tangents from both curves to compare
var key1;
var key2;
for ( i=0; i<nbkeys; i++ )
{
        key1 = fc1.GetKeyAtIndex(i);
        key2 = fc2.GetKeyAtIndex(i);
        str = "fc1: " + key1.lefttanx + ","+ key1.lefttany + ","+ key1.righttanx + ","+ key1.righttany;
        str += " fc2: " + key2.lefttanx + ","+ key2.lefttany + ","+ key2.righttanx + ","+ key2.righttany;
        LogMessage(str);
}
// Outputs:
//INFO : fc1: 0,0,0.3333333333333333,0 fc2: 0,0,0,0
//INFO : fc1: -0.33333333333333326,0,0.33333333333333326,0 fc2: 0,0,0,0
//INFO : fc1: -0.33333333333333326,0,0.3333333333333335,0 fc2: 0,0,0,0
//      etc.
//INFO : fc1: -0.3333333333333343,0,0.3333333333333343,0 fc2: 0,0,0,0
//INFO : fc1: -0.3333333333333343,0,0.3333333333333343,0 fc2: 0,0,0,0
//INFO : fc1: -0.3333333333333343,0,0,0 fc2: 0,0,0,0