ActionDeltaItem.Value

説明

ActionDeltaItem の値を設定したり、戻したりします。ActionDeltaItem のタイプに応じて(「siModificationDeltaType」を参照)、このプロパティはさまざまなタイプの値を設定または戻します。

siModificationDeltaFCurves の場合、FCurve を設定/戻します

siModificatio DeltaStaticValue の場合、Double を設定/戻します

それ以外の場合、String を設定/戻します

C#構文

// get accessor

Object ActionDeltaItem.get_Value();

// set accessor

ActionDeltaItem.set_Value( FCurve out_pvValue );

1. JScript の例

/*

	This example demonstrates how to set a value for ActionDeltaItem of type 

	siModificationTypeConstraints

*/

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

// Create a sphere

var oSphere = oRoot.AddGeometry("Sphere", "MeshSurface");

// Translate the 

Translate(oCone, 3.0, 3.0, 0.0, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0, null);

Translate(oSphere, -2.0, -2.0, 0.0, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0, null);

ApplyCns("Position", oCube, oCone, null);

// Get the Delta object

var oDelta = Dictionary.GetObject("Model.Delta");

// Get the collection of the first ActionDelta

var oActionDeltaItemsColl = oDelta.ActionDeltas(0).Items;

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

	 // Replace the cone as constraining object by the Sphere

	 oActionDeltaItemsColl(i).Value = "Scene_Root." + oSphere.Fullname;

}

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

2. JScript の例

/*

	This example demonstrates how get and set value for ActionDeltaItem of type siModificationDeltaFCurves

*/

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 an FCurve on the model local kine

SaveKey("Model.kine.local.posx,Model.kine.local.posy,Model.kine.local.posz", 1, null, null, null);

// Get the Delta object

var oDelta = Dictionary.GetObject("Model.Delta");

// Get the Fcurve in the ActionDeltaItem of type siModificationDeltaFCurves

var oFCurve = oDelta.ActionDeltas(0).Items(0).value;

// Define the number of keys

var nbkeys = 100;

// Start editing the fcurve

oFCurve.BeginEdit();

// Add keys to the fcurve

for (var i=0; i<nbkeys; i++) {

	val = (Math.sin( 1/(i+1) ) * 10);

	oFCurve.AddKey( i, val );

}

// End editing the fcurve and put the undo event onto 

// the undo/redo stack

oFCurve.EndEdit();

// Set the Fcurve in the ActionDeltaItem of type siModificationDeltaFCurves

oDelta.ActionDeltas(0).Items(0).value = oFCurve;

// Apply the change

oDelta.Apply();