ActionDeltaItem

Object Hierarchy | Related C++ Class: ActionDeltaItem

Inheritance

SIObject
   ActionDeltaItem

Introduced

6.0

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 group relation, a new ActionDeltaItem is generated.

You can also create new ActionDeltaItems from a data set using one of these methods: ActionDelta.AddConstraintItem, ActionDelta.AddExpressionItem, ActionDelta.AddFCurveItem, or ActionDelta.AddStaticValueItem.

ActionDeltaItem objects of the same type (see siModificationDeltaType) are stored in an ActionDelta (ActionDeltaItemCollection) which is accessible via the ActionDelta.Items property.

Methods

IsClassOf

IsEqualTo

Properties

Application

AuditInfo

Categories

FullName

Help

Mute

Name

NestedObjects

Origin

OriginPath

Parent

Type

Value

 

 

 

Examples

1. JScript Example

/*
   This example demonstrates how to assign a new value to an ActionDeltaItem
*/

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

// Translate the cube that also generate a delta
Translate(oCube, 2.0, 1.3, 0, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0, null);

// Get the Delta object
var oDelta = Dictionary.GetObject("Model.Delta");

// Get the ActionDeltaItem collection of the first ActionDelta
var oActionDeltaItemsColl = oDelta.ActionDeltas(0).Items;
for (var i=0; i<oActionDeltaItemsColl.Count; i++) {
    // Print info about the current ActionDeltaItem
    Application.LogMessage("ActionSourceItem[" + i + "]");
    Application.LogMessage("Name: " + oActionDeltaItemsColl(i).Name)
    Application.LogMessage("Type: " + oActionDeltaItemsColl(i).Type)

    //Print the current value
    Application.LogMessage("Initiale Value: " +oActionDeltaItemsColl(i).Value)

    // Change the value of the item
    oActionDeltaItemsColl(i).Value = 1.2 * i

    // Print the new value
    Application.LogMessage("New Value: "+ oActionDeltaItemsColl(i).Value)
    Application.LogMessage("");
}

// Apply modification on the target reference asset container (the reference model)
oDelta.Apply()

// Output of above script:
//INFO : ActionSourceItem[0]
//INFO : Name: cube.kine.local.posx
//INFO : Type: siModificationDeltaStaticValue
//INFO : Initiale Value: 2
//INFO : New Value: 0
//INFO : 
//INFO : ActionSourceItem[1]
//INFO : Name: cube.kine.local.posy
//INFO : Type: siModificationDeltaStaticValue
//INFO : Initiale Value: 1.3
//INFO : New Value: 1.2
//INFO : 
//INFO : ActionSourceItem[2]
//INFO : Name: cube.kine.local.posz
//INFO : Type: siModificationDeltaStaticValue
//INFO : Initiale Value: 0
//INFO : New Value: 2.4
//INFO : 

2. JScript Example

/*
   This example demonstrates how to set the name 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 the Static value item
   var oActionDeltaItem = oDeltaAction.AddStaticValueItem(oCube + ".kine.global.posx", 10);

// Get the relative name for the sclx parameter
var rp = GetRelativeNameForTarget(oCube.sclx);

// Replace posx parameter by sclx
oActionDeltaItem.name = rp;

// Apply modification on the target reference asset container (the reference model)
oDelta.Apply()

// Reload the reference model to reset cube.kine.local.posx value
UpdateReferencedModel("Model");

// Convenience function
function GetRelativeNameForTarget(in_param) {
   var mdlname = in_param.Model.FullName;
   if (mdlname == "Scene_Root") {
       return in_param.FullName;
   } else {
       var tmp = in_param.FullName;
       var re = new RegExp(mdlname + ".", "i");
       return tmp.replace(re, "");
   }
}

See Also

ActionDelta

ActionDelta.Items

ActionDelta.AddFCurveItem

ActionDelta.AddStaticValueItem

ActionDelta.AddExpressionItem

 

 

 



Autodesk Softimage v7.5