Sets or returns the value of an ActionDeltaItem. Depending on
the type of the ActionDeltaItem (see siModificationDeltaType), this
property sets or returns different types of values:
- For siModificationDeltaFCurves, sets/returns FCurves
- For siModificationDeltaStaticValue, sets/returns Doubles
- Otherwise, sets/returns String
/* 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"); |
/* 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(); |