Public Member Functions
ActionDeltaItem Class Reference

Detailed Description

The ActionDeltaItem object tracks changes made on a parameter that is part of a reference model. Each ActionDeltaItem represents a single change, or modification, to a referenced parameter. So each time there a change to a static value, an FCurve, a Constraint, an Expression or a GroupRelation, a new ActionDeltaItem is generated.

You can also create new ActionDeltaItems from a data set using one of these functions:

ActionDeltaItem objects of the same type (see siModificationDeltaType) are stored in an ActionDelta which is accessible via the ActionDelta::GetItems function.

Since:
6.0
Example:
Illustrates how to assign a new value to 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();

        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();

        ActionDelta ActionDelta0 = myDelta.GetActionDeltas().GetItem(0);
        CRefArray ActionDeltaItems = ActionDelta0.GetItems();
        CString strmgs;
        for ( LONG i=0; i<ActionDeltaItems.GetCount(); ++i ) {

            ActionDeltaItem item = ActionDeltaItems[i];

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

            //Print the current value
            strmgs = L"Initiale Value: "; strmgs += item.GetValue();
            Application().LogMessage(strmgs);

            // Change the value of the item
            item.PutValue ( 1.2 * i );

            //Print the new value + some AuditInformation
            strmgs = L"New value: "; strmgs += item.GetValue();
            strmgs+= L", "; strmgs += item.GetAuditInfo();
            Application().LogMessage(strmgs);
        }

#include <xsi_actiondeltaitem.h>

Inheritance diagram for ActionDeltaItem:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ActionDeltaItem ()
 ~ActionDeltaItem ()
 ActionDeltaItem (const CRef &in_ref)
 ActionDeltaItem (const ActionDeltaItem &in_obj)
bool IsA (siClassID in_ClassID) const
siClassID GetClassID () const
ActionDeltaItemoperator= (const ActionDeltaItem &in_obj)
ActionDeltaItemoperator= (const CRef &in_ref)
CString GetName () const
CStatus PutName (const CString &in_Name) const
CString GetType () const
bool GetMute () const
CStatus PutMute (const bool in_Mute)
CValue GetValue () const
CStatus PutValue (CValue in_value)
CString GetAuditInfo ()

Constructor & Destructor Documentation

Default constructor.

Default destructor.

ActionDeltaItem ( const CRef in_ref)

Constructor.

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

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

Reimplemented from SIObject.

CString GetName ( ) const

Returns the name of the ActionDeltaItem.

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

Reimplemented from SIObject.

CStatus PutName ( const CString in_Name) const

Sets the name of the ActionDeltaItem.

Parameters:
in_NameNew name for the object.
Returns:
CStatus::OK success
CStatus::Fail is returned in case of failure
CString GetType ( ) const

Returns the type of the ActionDeltaItem.

Returns:
One of the values from siModificationDeltaType.
Example:
See the main ActionDeltaItem example which demonstrates how to use this function.

Reimplemented from SIObject.

bool GetMute ( ) const

Returns whether the ActionDeltaItem is muted or not.

Returns:
True if the ActionDeltaItem is muted; false if it's active.
Example:
See the ActionDeltaItem::PutMute example which demonstrates how to use this function.
CStatus PutMute ( const bool  in_Mute)

Sets whether the ActionDeltaItem is muted or not.

Parameters:
in_MuteTrue to mute the ActionDeltaItem is muted; false to make it active.
Returns:
CStatus::OK success
CStatus::Fail is returned in case of failure
Example:
Illustrates how to mute a 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();

        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);

        // Mute the Item
        myActionDeltaItem.PutMute (true);
        app.LogMessage(L"muting " + myActionDeltaItem.GetName());

        // Apply modification
        myDelta.Apply();

        // UpdateReferencedModel command
        cargs.Add( L"Model" );
        app.ExecuteCommand( L"UpdateReferencedModel", cargs, oarg );
        cargs.Clear();
CValue GetValue ( ) const

Returns the value of an ActionDeltaItem. Depending on the type of the ActionDeltaItem (see ActionDeltaItem::GetType) the returned CValue may contain several different types of data.

Returns:
CValue::m_t == CValue::siRef for item of type siModificationDeltaFCurves (CRef containing a reference to the FCurve).
CValue::m_t == CValue::double for item of type siModificationDeltaStaticValue.
CValue::m_t == CValue::string for item of other type.
See also:
Parameter::GetValue
Example:
Illustrates how to get and set value for ActionDeltaItem of type siModificationDeltaFCurves
        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;

        // SaveKey command
        cargs.Add( L"Model.kine.local.posx,Model.kine.local.posy,Model.kine.local.posz" ); cargs.Add( 1 );
        app.ExecuteCommand( L"SaveKey", cargs, oarg );
        cargs.Clear();

        FCurve myFCurve;

        ActionDelta ActionDelta0 = myDelta.GetActionDeltas().GetItem(0);
        ActionDeltaItem ActionDeltaItem0 = ActionDelta0.GetItems().GetItem(0);
        myFCurve = ActionDeltaItem0.GetValue();

        LONG nbkeys = 100;
        myFCurve.BeginEdit();

        for(LONG i = 0; i < nbkeys; i++ )
        {
            double val = sin(1.0/(i+1.0) *10.0);
            myFCurve.AddKey(i, val);
        }

        myFCurve.EndEdit();

        CValue MyFCValue(myFCurve);
        ActionDeltaItem0.PutValue(MyFCValue);

        // Apply modification
        myDelta.Apply();
CStatus PutValue ( CValue  in_value)

Sets the value of an ActionDeltaItem. Depending on the type of the ActionDeltaItem (see ActionDeltaItem::GetType) you may specify several different types of data in in_value.

Parameters:
in_valueCValue::m_t == CValue::siRef for item of type ::siModificationDeltaFCurves (CRef containing a reference to the FCurve).
in_valueCValue::m_t == CValue::double for item of type siModificationDeltaStaticValue.
in_valueCValue::m_t == CValue::string for item of any other type.
Returns:
CStatus::OK success
CStatus::Fail is returned in case of failure
Example:
Illustrates how to set a value for ActionDeltaItem of type siModificationTypeConstraints
        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, cone and sphere geometries and create the reference model
        Model root = app.GetActiveSceneRoot();
        X3DObject myCube, myCone, mySphere;
        root.AddGeometry( L"Cube", L"MeshSurface",L"",myCube);
        root.AddGeometry( L"Cone", L"MeshSurface",L"",myCone);
        root.AddGeometry( L"Sphere", L"MeshSurface",L"",mySphere);

        // 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(myCone.GetFullName()); cargs.Add(3.0); cargs.Add(3.0); 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();

        // Translate command
        cargs.Add(mySphere.GetFullName()); cargs.Add(-2.0); cargs.Add(-2.0); 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();

        // ApplyCns command
        cargs.Add( L"Position" ); cargs.Add(myCube.GetFullName()); cargs.Add(myCone.GetFullName());
        app.ExecuteCommand( L"ApplyCns", cargs, oarg );
        cargs.Clear();

        ActionDelta ActionDelta0 = myDelta.GetActionDeltas().GetItem(0);
        CRefArray ActionDeltaItems = ActionDelta0.GetItems();
        for ( LONG i=0; i<ActionDeltaItems.GetCount(); ++i ) {
            ActionDeltaItem item = ActionDeltaItems[i];
            item.PutValue(L"Scene_Root." + mySphere.GetFullName());
        }

        // Apply modification
        myDelta.Apply();

        // UpdateReferencedModel command
        cargs.Add( L"Model" );
        app.ExecuteCommand( L"UpdateReferencedModel", cargs, oarg );
        cargs.Clear();
CString GetAuditInfo ( )

Returns the Audit Information on the ActionDeltaItem.

Returns:
The string containing the audit information
Example:
See the main ActionDeltaItem example which demonstrates how to use this function.

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