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.
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>
Public Member Functions |
|
ActionDelta () | |
~ActionDelta () | |
ActionDelta (const CRef &in_ref) | |
ActionDelta (const ActionDelta &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
ActionDelta & | operator= (const ActionDelta &in_obj) |
ActionDelta & | operator= (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 |
ActionDelta | ( | ) |
Default constructor.
~ActionDelta | ( | ) |
Default destructor.
ActionDelta | ( | const CRef & | in_ref | ) |
Constructor.
in_ref | constant reference object. |
ActionDelta | ( | const ActionDelta & | in_obj | ) |
Copy constructor.
in_obj | constant class object. |
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from SIObject.
siClassID GetClassID | ( | ) | const [virtual] |
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.
in_obj | constant class 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.
in_ref | constant class 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).
in_Target | Target path for source item |
in_KeyValueArray | An 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_Interpolation | The interpolation of the FCurve (default siCubicInterpolation). |
in_Type | The type of the FCurve (siStandardFCurve). |
in_Extrapolation | The extrapolation of the FCurve (default siConstantExtrapolation). |
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).
in_preset | The type of constraint to add. |
in_cnsned | An array of references to X3DObject elements that will be constrained (see Constraint::GetConstrained). |
in_cnsning | An array of references to X3DObject elements that will act as constrainers (see Constraint::GetConstraining). |
in_bComp | Compensation mode: true to turn compensation on. |
in_offsetCnsned | Optional offset which is applied in translation on the constrained object. The offset is used for Distance and Position constraints. |
in_offsetCnsning | Optional 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. |
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).
in_Target | Target path for source item |
in_Value | The value of the static value |
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).
in_Target | Target path for source item |
in_Expression | The definition (formula) that defines the expression. For more information on how to define an expression, see "Expression Reference" in the Softimage User�s Guide. |
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.
Reimplemented from SIObject.
CString GetType | ( | ) | const |
Returns the type of the ActionDelta.
Reimplemented from SIObject.
Removes an ActionDeltaItem from the ActionDelta.
in_target | The name of the ActionDeltaItem to remove. |
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.
CRefArray GetItems | ( | ) | const |
Returns all ActionDeltaItem objects that make up the ActionDelta.