Object Hierarchy | 関連する C++クラス:ActionDeltaItem
ActionDeltaItem
v6.0
ActionDeltaItem オブジェクトは、リファレンスモデルの一部であるパラメータに加えられた変更を追跡します。各 ActionDeltaItem は、参照されるパラメータへの 1 つの変更を表します。そのため、静的な値、F カーブ、コンストレイント、エクスプレッション、またはグループ関係に変更があるたびに、新しい ActionDeltaItem が生成されます。
ActionDelta.AddConstraintItem、ActionDelta.AddExpressionItem、ActionDelta.AddFCurveItem、またはActionDelta.AddStaticValueItemのいずれかのメソッドを使用して、データセットから新しい ActionDeltaItems を作成することもできます。
同じタイプ(「siModificationDeltaType」を参照)の ActionDeltaItem オブジェクトは、ActionDelta.Itemsプロパティを使用してアクセスできるActionDelta(ActionDeltaItemCollection)に格納されます。
Application | AuditInfo | Categories | FullName |
Help | Mute | Name | NestedObjects |
Origin | OriginPath | Parent | Type |
Value | |||
/* 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 : |
/* 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, ""); } } |