Public Member Functions
ActionDelta Class Reference

Detailed Description

The ActionDelta object tracks changes made on a parameter that is part of a reference model. Every ActionDelta contains one or more ActionDeltaItem objects, each of which represents a single change, or modification, to a referenced parameter. Each ActionDelta object has a specific type (see siModificationDeltaType) and each ActionDeltaItem it contains is of the same type.

ActionDeltas are stored in the Delta and are accessible via Delta::GetActionDeltas. To add a new ActionDelta to an existing Delta object, use Delta::AddAction.

Since:
6.0
Example:
Illustrates how to print some info about an ActionDelta
        using namespace XSI;
        Application app;

        // NewScene command
        CValueArray cargs; CValue oarg;
        cargs.Add( L"" ); cargs.Add( false );
        app.ExecuteCommand( L"NewScene", cargs, oarg );
        cargs.Clear();

        //Add cube geometry and create the reference model
        Model root = app.GetActiveSceneRoot();
        X3DObject myCube, myCone;
        root.AddGeometry( L"Cube", L"MeshSurface",L"",myCube);

        // CreateModelAndConvertToRef command
        CString strFactPath = app.GetInstallationPath(siProjectPath) ;
            strFactPath += L"/Models/MyModel.emdl";
        cargs.Add( myCube.GetFullName() ); cargs.Add( strFactPath );
        app.ExecuteCommand( L"CreateModelAndConvertToRef", cargs, oarg );
        cargs.Clear();

        Delta myDelta;

        // AddDelta command
        cargs.Add( L"Model" );
        app.ExecuteCommand( L"AddDelta", cargs, oarg );
        cargs.Clear();
        myDelta = oarg;

        // Translate command
        cargs.Add(myCube.GetFullName()); cargs.Add(2.0); cargs.Add(1.3); cargs.Add(0.0);
        cargs.Add(L"siRelative"); cargs.Add(L"siView"); cargs.Add(L"siObj"); cargs.Add(L"siXYZ");
        app.ExecuteCommand( L"Translate", cargs, oarg );
        cargs.Clear();

        CRefArray ActionDeltas = myDelta.GetActionDeltas();
        for ( LONG i=0; i<ActionDeltas.GetCount(); ++i ) {

            ActionDelta item = ActionDeltas[i];

            // Print info about the current ActionDelta
            Application().LogMessage(L"ActionSourceItem[" + CValue(i).GetAsText() + L"]");
            Application().LogMessage(L"Name: " + item.GetName());
            Application().LogMessage(L"Type: " + item.GetType());

        }

#include <xsi_actiondelta.h>

Inheritance diagram for ActionDelta:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ActionDelta ()
 ~ActionDelta ()
 ActionDelta (const CRef &in_ref)
 ActionDelta (const ActionDelta &in_obj)
bool IsA (siClassID in_ClassID) const
siClassID GetClassID () const
ActionDeltaoperator= (const ActionDelta &in_obj)
ActionDeltaoperator= (const CRef &in_ref)
ActionDeltaItem AddFCurveItem (const CString &in_Target, const CDoubleArray &in_KeyValueArray, siFCurveInterpolation in_Interpolation=siCubicInterpolation, siFCurveType in_Type=siStandardFCurve, siFCurveExtrapolation in_Extrapolation=siConstantExtrapolation)
CRefArray AddConstraintItem (const CString &in_preset, const CRefArray &in_cnsned, const CRefArray &in_cnsning, bool in_bComp, const MATH::CVector3 &in_offsetCnsned, const MATH::CVector3 &in_offsetCnsning)
ActionDeltaItem AddStaticValueItem (const CString &in_Target, double in_Value)
ActionDeltaItem AddExpressionItem (const CString &in_Target, const CString &in_Expression)
CString GetName () const
CString GetType () const
CStatus RemoveItem (const CString &in_target)
CStatus RemoveAllItems ()
CRefArray GetItems () const

Constructor & Destructor Documentation

Default constructor.

Default destructor.

ActionDelta ( const CRef in_ref)

Constructor.

Parameters:
in_refconstant reference object.
ActionDelta ( const ActionDelta 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.

ActionDelta& operator= ( const ActionDelta 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 ActionDelta object.
ActionDelta& 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 ActionDelta object.

Reimplemented from SIObject.

ActionDeltaItem AddFCurveItem ( const CString in_Target,
const CDoubleArray in_KeyValueArray,
siFCurveInterpolation  in_Interpolation = siCubicInterpolation,
siFCurveType  in_Type = siStandardFCurve,
siFCurveExtrapolation  in_Extrapolation = siConstantExtrapolation 
)

Adds a new ActionDeltaItem of type ::siModificationDeltaFCurves to an ActionDelta created with Delta::AddAction.

The ActionDelta should be of type ::siModificationDeltaFCurves to use this function (see siModificationDeltaType for a list of ActionDelta types).

Parameters:
in_TargetTarget path for source item
in_KeyValueArrayAn array containing 6 values per key for FCurve objects of interpolation type siCubicInterpolation (see siFCurveInterpolation) and 2 values per keys for the other FCurve interpolation types. The first value is the key time (in frames) and the second is the key value (in value units). For Cubic (or bezier) FCurves the remaining 4 values are the tangency values for: lefttanx (in frames), lefttany (in value units), righttanx (in frames), and righttany (in value units).
in_InterpolationThe interpolation of the FCurve (default siCubicInterpolation).
in_TypeThe type of the FCurve (siStandardFCurve).
in_ExtrapolationThe extrapolation of the FCurve (default siConstantExtrapolation).
Returns:
The new ActionDeltaItem
Example:
Illustrates how to add an ActionDeltaItem of type siModificationDeltaFCurves to a ActionDelta.
        using namespace XSI;
        Application app;

        // NewScene command
        CValueArray cargs; CValue oarg;
        cargs.Add( L"" ); cargs.Add( false );
        app.ExecuteCommand( L"NewScene", cargs, oarg );
        cargs.Clear();

        //Add cube geometry and create the reference model
        Model root = app.GetActiveSceneRoot();
        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface",L"",myCube);

        // CreateModelAndConvertToRef command
        CString strFactPath = app.GetInstallationPath(siProjectPath) ;
            strFactPath += L"/Models/MyModel.emdl";
        cargs.Add( myCube.GetFullName() ); cargs.Add( strFactPath );
        app.ExecuteCommand( L"CreateModelAndConvertToRef", cargs, oarg );
        cargs.Clear();

        Delta myDelta;

        // AddDelta command
        cargs.Add( L"Model" );
        app.ExecuteCommand( L"AddDelta", cargs, oarg );
        cargs.Clear();
        myDelta = oarg;

        // Add an action of type siModificationDeltaFCurve
        ActionDelta myDeltaAction = myDelta.AddAction(siModificationDeltaFCurve);

        // Set the array
        CDoubleArray keys(12);
        keys[0] = 1.0; keys[1] = 5.0; keys[2] = 0.0; keys[3] = 0.0; keys[4] = 0.0; keys[5] = 0.0;
        keys[6] = 100.0; keys[7] = 8.0; keys[8] = 0.0; keys[9] = 0.0; keys[10] = 0.0; keys[11] = 0.0;

        // Add the fcurve item
        ActionDeltaItem myActionDeltaItem = myDeltaAction.AddFCurveItem ( myCube.GetFullName() + L".kine.global.posx", keys );

        // Apply modification
        myDelta.Apply();
CRefArray AddConstraintItem ( const CString in_preset,
const CRefArray in_cnsned,
const CRefArray in_cnsning,
bool  in_bComp,
const MATH::CVector3 in_offsetCnsned,
const MATH::CVector3 in_offsetCnsning 
)

Adds a new ActionDeltaItem of type siModificationDeltaConstraint to an ActionDelta created with Delta::AddAction.

The ActionDelta should be of type siModificationDeltaConstraint to use this function (see siModificationDeltaType for a list of ActionDelta types).

Parameters:
in_presetThe type of constraint to add.
in_cnsnedAn array of references to X3DObject elements that will be constrained (see Constraint::GetConstrained).
in_cnsningAn array of references to X3DObject elements that will act as constrainers (see Constraint::GetConstraining).
in_bCompCompensation mode: true to turn compensation on.
in_offsetCnsnedOptional offset which is applied in translation on the constrained object. The offset is used for Distance and Position constraints.
in_offsetCnsningOptional offset applied on the constraining object for Distance, Position, Surface and Trajectory constraints. The offset will be applied in rotation for the Orientation constraint, in translation for the Direction constraint and in scaling for the Scaling constraint.
Returns:
An array of references to the new ActionDeltaItems (one for each parameter now being driven by the constraint)
Example:
Illustrates how to add an ActionDeltaItem of type siModificationDeltaConstraint to a ActionDelta.
        using namespace XSI;
        Application app;

        // NewScene command
        CValueArray cargs; CValue oarg;
        cargs.Add( L"" ); cargs.Add( false );
        app.ExecuteCommand( L"NewScene", cargs, oarg );
        cargs.Clear();

        //Add cube geometry and create the reference model
        Model root = app.GetActiveSceneRoot();
        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface",L"",myCube);

        // CreateModelAndConvertToRef command
        CString strFactPath = app.GetInstallationPath(siProjectPath) ;
            strFactPath += L"/Models/MyModel.emdl";
        cargs.Add( myCube.GetFullName() ); cargs.Add( strFactPath );
        app.ExecuteCommand( L"CreateModelAndConvertToRef", cargs, oarg );
        cargs.Clear();

        X3DObject myCone;
        root.AddGeometry( L"Cone", L"MeshSurface",L"",myCone);

        // Translate command
        cargs.Add(myCone.GetFullName()); cargs.Add(2.0); cargs.Add(1.3); cargs.Add(0.0);
        cargs.Add(L"siRelative"); cargs.Add(L"siView"); cargs.Add(L"siObj"); cargs.Add(L"siXYZ");
        app.ExecuteCommand( L"Translate", cargs, oarg );
        cargs.Clear();

        Delta myDelta;
        // AddDelta command
        cargs.Add( L"Model" );
        app.ExecuteCommand( L"AddDelta", cargs, oarg );
        cargs.Clear();
        myDelta = oarg;

        // Add an action of type siModificationDeltaConstraint
        ActionDelta myDeltaAction = myDelta.AddAction(siModificationDeltaConstraint);

        CRefArray constraineds(1);
        constraineds[0] = myCube;

        CRefArray constrainings(1);
        constrainings[0] = myCone;

        // Add the constraint item
        CRefArray myActionDeltaItems = myDeltaAction.AddConstraintItem ( L"Position",
            constraineds, constrainings, false, MATH::CVector3(), MATH::CVector3());

        // Apply modification
        myDelta.Apply();
ActionDeltaItem AddStaticValueItem ( const CString in_Target,
double  in_Value 
)

Adds a new ActionDeltaItem of type siModificationDeltaStaticValue to an ActionDelta created with Delta::AddAction.

The ActionDelta should be of type siModificationDeltaStaticValue to use this function (see siModificationDeltaType for a list of ActionDelta types).

Parameters:
in_TargetTarget path for source item
in_ValueThe value of the static value
Returns:
The new ActionDeltaItem object
Example:
Illustrates how to add an ActionDeltaItem of type siModificationDeltaStaticValue to a ActionDelta.
        using namespace XSI;
        Application app;

        // NewScene command
        CValueArray cargs; CValue oarg;
        cargs.Add( L"" ); cargs.Add( false );
        app.ExecuteCommand( L"NewScene", cargs, oarg );
        cargs.Clear();

        //Add cube geometry and create the reference model
        Model root = app.GetActiveSceneRoot();
        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface",L"",myCube);

        // CreateModelAndConvertToRef command
        CString strFactPath = app.GetInstallationPath(siProjectPath) ;
            strFactPath += L"/Models/MyModel.emdl";
        cargs.Add( myCube.GetFullName() ); cargs.Add( strFactPath );
        app.ExecuteCommand( L"CreateModelAndConvertToRef", cargs, oarg );
        cargs.Clear();

        Delta myDelta;

        // AddDelta command
        cargs.Add( L"Model" );
        app.ExecuteCommand( L"AddDelta", cargs, oarg );
        cargs.Clear();
        myDelta = oarg;

        // Add an action of type siModificationDeltaStaticValue
        ActionDelta myDeltaAction = myDelta.AddAction(siModificationDeltaStaticValue);

        // Add the Static value item
        ActionDeltaItem myActionDeltaItem = myDeltaAction.AddStaticValueItem ( myCube.GetFullName()
                + L".kine.global.posx",  10.0);

        // Apply modification
        myDelta.Apply();
ActionDeltaItem AddExpressionItem ( const CString in_Target,
const CString in_Expression 
)

Adds a new ActionDeltaItem of type siModificationDeltaExpression to an ActionDelta created with Delta::AddAction.

The ActionDelta should be of type ""siModificationDeltaExpression to use this function (see siModificationDeltaType for a list of ActionDelta types).

Parameters:
in_TargetTarget path for source item
in_ExpressionThe definition (formula) that defines the expression. For more information on how to define an expression, see "Expression Reference" in the Softimage User’s Guide.
Returns:
The new ActionDeltaItem
Example:
Illustrates how to add an ActionDeltaItem of type siModificationDeltaExpression to a ActionDelta.
        using namespace XSI;
        Application app;

        // NewScene command
        CValueArray cargs; CValue oarg;
        cargs.Add( L"" ); cargs.Add( false );
        app.ExecuteCommand( L"NewScene", cargs, oarg );
        cargs.Clear();

        //Add cube geometry and create the reference model
        Model root = app.GetActiveSceneRoot();
        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface",L"",myCube);

        // CreateModelAndConvertToRef command
        CString strFactPath = app.GetInstallationPath(siProjectPath) ;
            strFactPath += L"/Models/MyModel.emdl";
        cargs.Add( myCube.GetFullName() ); cargs.Add( strFactPath );
        app.ExecuteCommand( L"CreateModelAndConvertToRef", cargs, oarg );
        cargs.Clear();

        X3DObject myCone;
        root.AddGeometry( L"Cone", L"MeshSurface",L"",myCone);

        // Translate command
        cargs.Add(myCone.GetFullName()); cargs.Add(2.0); cargs.Add(1.3); cargs.Add(0.0);
        cargs.Add(L"siRelative"); cargs.Add(L"siView"); cargs.Add(L"siObj"); cargs.Add(L"siXYZ");
        app.ExecuteCommand( L"Translate", cargs, oarg );
        cargs.Clear();

        Delta myDelta;
        // AddDelta command
        cargs.Add( L"Model" );
        app.ExecuteCommand( L"AddDelta", cargs, oarg );
        cargs.Clear();
        myDelta = oarg;

        // Add an action of type siModificationDeltaExpression
        ActionDelta myDeltaAction = myDelta.AddAction(siModificationDeltaExpression);

        // Add the Expression item
        ActionDeltaItem myActionDeltaItem = myDeltaAction.AddExpressionItem ( myCube.GetFullName() + L".kine.global.posx",
            L"5*sin(" + myCone.GetFullName() + L".kine.local.posx * 15)");

        // Apply modification
        myDelta.Apply();
CString GetName ( ) const

Returns the name of the ActionDelta.

Returns:
The name of the ActionDelta
Example:
See the main ActionDelta example which demonstrates how to use this function.

Reimplemented from SIObject.

CString GetType ( ) const

Returns the type of the ActionDelta.

Returns:
A value from the siModificationDeltaType enum.
Example:
See the main ActionDelta example which demonstrates how to use this function.

Reimplemented from SIObject.

CStatus RemoveItem ( const CString in_target)

Removes an ActionDeltaItem from the ActionDelta.

Note:
After a removal, the ActionDeltaItem object may not target the same item (see example).
Parameters:
in_targetThe name of the ActionDeltaItem to remove.
Returns:
CStatus::OK success
CStatus::Fail is returned in case of failure
Example:
Illustrates how to to remove an ActionDeltaItem.
        using namespace XSI;
        Application app;

        // NewScene command
        CValueArray cargs; CValue oarg;
        cargs.Add( L"" ); cargs.Add( false );
        app.ExecuteCommand( L"NewScene", cargs, oarg );
        cargs.Clear();

        //Add cube geometry and create the reference model
        Model root = app.GetActiveSceneRoot();
        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface",L"",myCube);

        // CreateModelAndConvertToRef command
        CString strFactPath = app.GetInstallationPath(siProjectPath) ;
            strFactPath += L"/Models/MyModel.emdl";
        cargs.Add( myCube.GetFullName() ); cargs.Add( strFactPath );
        app.ExecuteCommand( L"CreateModelAndConvertToRef", cargs, oarg );
        cargs.Clear();

        X3DObject myCone;
        root.AddGeometry( L"Cone", L"MeshSurface",L"",myCone);

        // Translate command
        cargs.Add(myCone.GetFullName()); cargs.Add(2.0); cargs.Add(1.3); cargs.Add(0.0);
        cargs.Add(L"siRelative"); cargs.Add(L"siView"); cargs.Add(L"siObj"); cargs.Add(L"siXYZ");
        app.ExecuteCommand( L"Translate", cargs, oarg );
        cargs.Clear();

        Delta myDelta;
        // AddDelta command
        cargs.Add( L"Model" );
        app.ExecuteCommand( L"AddDelta", cargs, oarg );
        cargs.Clear();
        myDelta = oarg;

        // Translate command
        cargs.Add(myCube.GetFullName()); cargs.Add(2.0); cargs.Add(1.3); cargs.Add(0.0);
        cargs.Add(L"siRelative"); cargs.Add(L"siView"); cargs.Add(L"siObj"); cargs.Add(L"siXYZ");
        app.ExecuteCommand( L"Translate", cargs, oarg );
        cargs.Clear();

        // Get the static item
        ActionDelta ActionDeltaStatic = myDelta.GetActionDeltas().GetItem(0);
        ActionDeltaItem ActionDeltaItem0 = ActionDeltaStatic.GetItems().GetItem(0);
        ActionDeltaItem ActionDeltaItem1 = ActionDeltaStatic.GetItems().GetItem(0);

        // Print the name of ActionDeltaItem1
        app.LogMessage ( L"Second item name before removing oActionDeltaItem1: " + ActionDeltaItem1.GetName());

        // Remove oActionDeltaItem0
        ActionDeltaStatic.RemoveItem(ActionDeltaItem0.GetName());

        // Print the name of ActionDeltaItem1
        app.LogMessage ( L"Second item name after removing oActionDeltaItem1: " + ActionDeltaItem1.GetName());


        // Add an action of type siModificationDeltaExpression
        ActionDelta DeltaActionExp = myDelta.AddAction(siModificationDeltaExpression);

        // Add the Expression item
        ActionDeltaItem myActionDeltaItem = DeltaActionExp.AddExpressionItem ( myCube.GetFullName() + L".kine.global.posx",
            L"5*sin(" + myCone.GetFullName() + L".kine.local.posx * 15)");

        DeltaActionExp.RemoveAllItems();

        // Apply modification
        myDelta.Apply();
CStatus RemoveAllItems ( )

Removes all ActionDeltaItem objects from the ActionDelta.

Returns:
CStatus::OK success
CStatus::Fail is returned in case of failure
Example:
See the ActionDelta::RemoveItem example which demonstrates how to use this function.
CRefArray GetItems ( ) const

Returns all ActionDeltaItem objects that make up the ActionDelta.

Returns:
Array of references to each ActionDeltaItem contained in the ActionDelta.
Example:
See the main ActionDelta example which demonstrates how to use this function.

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