ActionDelta

Object Hierarchy | Related C++ Class: ActionDelta

Inheritance

SIObject

ActionDelta

Introduced

v6.0

Description

The ActionDelta object tracks changes made on a parameter that is part of a reference model. Every ActionDelta contains one or more ActionDeltaItems, 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 (ActionDeltaCollection) and are accessible via the Delta.ActionDeltas property. To add a new ActionDelta to an existing Delta object, use the Delta.AddAction method.

Methods

AddConstraintItem AddExpressionItem AddFCurveItem AddStaticValueItem
IsClassOf operator IsEqualTo operator RemoveAllItems RemoveItem

Properties

Application Categories FullName operator Help
Items Name operator NestedObjects Origin
OriginPath Parent Type operator  
       

Examples

1. JScript Example

/*

	This example demonstrates how to add an ActionDeltaItem of type siModificationDeltaConstraint to a ActionDelta.

*/

NewScene (null, false);

// Create a reference model from a cube

var oRoot = Application.ActiveProject.ActiveScene.Root;

var oCube = oRoot.AddGeometry("Cube","MeshSurface");

var emdlFileRefModel = XSIUtils.BuildPath(Application.InstallationPath(siProjectPath), "Models", "MyModel.emdl"); 

CreateModelAndConvertToRef(oCube, emdlFileRefModel );

// Create a cone

var oCone = oRoot.AddGeometry("Cone","MeshSurface");

Translate(oCone, 3.20, 0.00, 1.65, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0, null);

// Add the Delta object

var oDelta = AddDelta(oCube.Model);

// Add an action of type siModificationDeltaConstraint

var oActionDelta = oDelta.AddAction(siModificationDeltaConstraint);

// Add the fcurve item

var oActionDeltaItems = oActionDelta.AddConstraintItem("Position",oCube,oCone);

for(var i=0; i<oActionDeltaItems.Count; i++) {

	Application.LogMessage ( " The item " +  oActionDeltaItems(i).Name + " is active: " + oActionDeltaItems(i).Mute );

}

// Apply modification

oDelta.Apply();

// Output of above script:

//INFO :  The item cube.kine.global.sclx is active: true

//INFO :  The item cube.kine.global.scly is active: true

//INFO :  The item cube.kine.global.sclz is active: true

//INFO :  The item cube.kine.global.rotx is active: true

//INFO :  The item cube.kine.global.roty is active: true

//INFO :  The item cube.kine.global.rotz is active: true

//INFO :  The item cube.kine.global.posx is active: false

//INFO :  The item cube.kine.global.posy is active: false

//INFO :  The item cube.kine.global.posz is active: false

2. JScript Example

/*

	This example demonstrates how to get the type of the item.

*/

NewScene (null, false);

// Create a reference model from a cube

var oRoot = Application.ActiveProject.ActiveScene.Root;

var oCube = oRoot.AddGeometry("Cube","MeshSurface");

var emdlFileRefModel = XSIUtils.BuildPath(Application.InstallationPath(siProjectPath), "Models", "MyModel.emdl"); 

CreateModelAndConvertToRef(oCube, emdlFileRefModel );

// Add the Delta object

var oDelta = AddDelta(oCube.Model);

// Add an action of type siModificationDeltaStaticValue

var oDeltaAction = oDelta.AddAction(siModificationDeltaStaticValue)

// Add a static value item	

oDeltaAction.AddStaticValueItem ( oCube + ".kine.global.posx",  10 );

// Get the first ActionDeltaItem in the first ActionDelta

var oActionDelta = oDelta.ActionDeltas(0);

// Print the type

Application.LogMessage(oActionDelta.Type);

// Output of above script:

//INFO : siModificationDeltaStaticValue