v5.0
指定のソース オブジェクトから目的のオブジェクトにシェイプ アニメーションを転送します。転送されるアニメーションは Animation Mixer に保存され、元の ShapeKey 上で接続された既存のマッピングを含んでいます。
このコマンドを使用するには、転送元オブジェクト、転送先オブジェクト、およびシェイプ キー クラスタ プロパティの 2 つのリストを指定する必要があります。 シェイプ キーのリストは同じ長さでなければなりません。また、リストの順序により転送元のシェイプ キーと転送先のシェイプ キーの対応付けが決まるため、順序は重要です。
クラスタ シェイプ コンバイナ オペレータが転送先オブジェクトに存在しない場合は、それが追加されます。 転送先シェイプ キー リストに対応するシェイプ アニメーションがすでに存在する場合、そのアニメーションは削除されます。
TransferShapeAnimation( SourceObject, DestinationObject, SourceShapeKeys, DestinationShapeKeys ); |
| パラメータ | タイプ | 説明 |
|---|---|---|
| SourceObject | X3DObject | シェイプ アニメーションのオリジナルとなるオブジェクト |
| DestinationObject | X3DObject | シェイプ アニメーションの転送先となるオブジェクト |
| SourceShapeKeys | XSICollection | 転送するアニメーションを含む転送元オブジェクトのシェイプ キー コレクション |
| DestinationShapeKeys | XSICollection | 転送するアニメーションを受け取る転送先オブジェクトのシェイプ キー コレクション |
/*
This example demonstrates how to transfer shape animation from one object to the other
*/
NewScene( null, false );
// Create source animation object
CreatePrim("Cone", "MeshSurface", null, null);
SetValue("Context.constructionmode", 1, null);
ActivateVertexSelTool(null);
SelectGeometryComponents("cone.pnt[1,4,7,10,13,16,19,22,LAST]");
Translate(null, -3.98256016551092, 0, 0, siRelative, siGlobal, siObj, siXYZ, null, null, siXYZ, null, null, null, null, null, null, 1);
SaveShapeKey("cone.pnt[1,4,7,10,13,16,19,22,LAST]", null, null, 1, null, null, null, null, siShapeObjectReferenceMode);
SetValue("PlayControl.Key", 30, null);
SetValue("PlayControl.Current", 30, null);
SelectGeometryComponents("cone.pnt[1,4,7,10,13,16,19,22,LAST]");
Translate(null, -3.98256016551092, 0, 0, siRelative, siGlobal, siObj, siXYZ, null, null, siXYZ, null, null, null, null, null, null, 1);
SaveShapeKey("cone.polymsh.cls.Shape", null, null, 30, null, null, null, null, siShapeObjectReferenceMode);
SelectObj("cone.polymsh.cls.Shape.ShapeKey1", null, null);
SelectObj("cone.polymsh.cls.Shape.ShapeKey", null, null);
SetValue("PlayControl.Key", 27, null);
SetValue("PlayControl.Current", 27, null);
// Create destination animation object
CreatePrim("Cylinder", "MeshSurface", null, null);
CreateModel(null, null, null, null);
SelectObj("Model.cylinder", null, true);
ActivateVertexSelTool(null);
SelectGeometryComponents("Model.cylinder.pnt[4-6,10,39,40]");
Translate(null, -2.92834449479742, 0, 0, siRelative, siGlobal, siObj, siXYZ, null, null, siXYZ, null, null, null, null, null, null, 1);
StoreShapeKey("Model.cylinder.pnt[4-6,10,39,40]", null, siShapeObjectReferenceMode, 27, 0, 0, siShapeContentPrimaryShape, false);
SelectFilter("object");
Translate(null, 2.05775559093871, 0, 0, siRelative, siGlobal, siObj, siXYZ, null, null, siXYZ, null, null, null, null, null, null, 1);
Translate(null, 0, 2.8035894047944, 0, siRelative, siGlobal, siObj, siXYZ, null, null, siXYZ, null, null, null, null, null, null, 1);
SaveShapeKey("Model.cylinder.polymsh.cls.Shape", null, null, 27, null, null, null, null, siShapeObjectReferenceMode);
Selection.SetAsText("cone,Model.cylinder");
// Gather data to transfer
var oSource = Selection(0);
var oDestination = Selection(1);
var oSourceList = new ActiveXObject("XSI.Collection") ;
var oSourceClusterProperties = oSource.ActivePrimitive.Geometry.Clusters(0).Properties;
for ( var i=0; i<oSourceClusterProperties.Count; i++ ) {
if ( oSourceClusterProperties(i).IsClassOf(siShapeKeyID) ) {
oSourceList.Add(oSourceClusterProperties(i));
}
}
var oDestList = new ActiveXObject("XSI.Collection");
var oDestClusterProperties = oDestination.ActivePrimitive.Geometry.Clusters(0).Properties;
for ( var i=0; i<oDestClusterProperties.Count; i++ ) {
if ( oDestClusterProperties(i).IsClassOf(siShapeKeyID) ) {
oDestList.Add(oDestClusterProperties(i));
}
}
TransferShapeAnimation(oSource, oDestination, oSourceList, oDestList); |