v4.0
ヒューリスティックを使用して、ジェネレータ オペレータの指定の入力オブジェクトの全プロパティおよびクラスタ プロパティを、指定の出力オブジェクトに転送します。
注: クラスタ プロパティのみを転送するには、TransferClusterPropertiesAcrossGenOp コマンドを使用します。
注: プロパティのみを転送するには、TransferPropertiesAcrossGenOp コマンドを使用します。
oReturn = TransferAllPropertiesAcrossGenOp( Operator, Object, PropertyTransferType, ShareProperty, [IncludeAllClusters] ); |
新しい転送プロパティの作成済みXSICollection を戻します。
| パラメータ | タイプ | 説明 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Operator | 文字列 | プロパティの転送を実行するジェネレータ オペレータを指定します。 | ||||||||||||
| Object | 文字列 | 新しいプロパティを追加する出力オブジェクトを指定します。 | ||||||||||||
| PropertyTransferType | 文字列 |
指定のジェネレータ オペレータの入力オブジェクトから指定の出力オブジェクトへと転送するプロパティのタイプを指定します。空の文字列は、転送可能なすべてのプロパティを意味します。特定の文字列のプロパティタイプは、siType 列挙型に一覧表示されます。 注: siMaterialTypeを指定すると、すべてのリファレンスクラスタプロパティも転送されます。 デフォルト値:空の文字列(転送可能なすべてのプロパティおよびクラスタプロパティ)
|
||||||||||||
| ShareProperty | Boolean |
True の場合は転送されたプロパティが共有されます。 注: この値はクラスタプロパティではなくプロパティに適用されます(現在のとことマテリアルのみ)。 デフォルト値: True |
||||||||||||
| IncludeAllClusters | Boolean |
true にすると、プロパティなしの偶数クラスタが転送されます。デフォルトでは、プロパティなしのクラスタは転送されません。
デフォルト値: False |
' ' This example transfers properties across generator ' operators that admit transfer of properties. ' Dim l_NewProperties NewScene ,false ' Create objects CreatePrim "Grid", "MeshSurface", "grid" CreatePrim "Grid", "MeshSurface", "grid1" Translate "grid1", 8.2, 0, 0, siRelative, siView, siObj, siXYZ ' Add some properties to objects: Materials and texture coordinates. ApplyShader , , , , siLetLocalMaterialsOverlap SetValue "grid1.Material.Phong.diffuse.red", 0.750 SIApplyShaderToCnxPoint "Image", "grid1.Material.Phong.diffuse" SelectObj "grid", , True SetSelFilter "Polygon" AddToSelection "grid.poly[18-21,26-29,34-37,42-45,50-53]", , True ApplyShader , , , , siLetLocalMaterialsOverlap SetValue "grid.polymsh.cls.Polygon.Material.Phong.diffuse.green", 0.250 SIApplyShaderToCnxPoint "Image", "grid.polymsh.cls.Polygon.Material.Phong.diffuse" CreateProjection "grid", siTxtPlanarXZ, siTxtDefaultSpherical, _ "Texture_Support", "Texture_Projection" SetInstanceDataValue , "grid.polymsh.cls.Polygon.Material.Phong.Image.tspace_id", _ "Texture_Projection" SelectObj "grid1", , True CreateProjection "grid1", siTxtPlanarXZ, siTxtDefaultSpherical, "Texture_Support", _ "Texture_Projection" SetInstanceDataValue , "grid1.Material.Phong.Image.tspace_id", "Texture_Projection" ' Add cluster property: weight map on both objects. SelectObj "grid", , True ActivateVertexSelTool AddToSelection "grid.pnt[48-51,57-60,66-69]", , True CreateWeightMap , , "Weight_Map" SelectObj "grid1", , True ActivateVertexSelTool AddToSelection "grid1.pnt[20-25,29-34,38-43,47-52]", , True CreateWeightMap , , "Weight_Map" ' Apply merge operator. ApplyGenOp "MeshMerge", , "grid,grid1", 3, siPersistentOperation, siKeepGenOpInputs SetValue "polymsh.polymsh.mergemesh.tolerance", 2.0 Translate , -4.0, 3.0, -0.0, siRelative, siView, siObj, siXYZ ' Transfer all properties across the merge operator. The empty string is passed to ' transfer all allowable properties. set l_NewProperties = TransferAllPropertiesAcrossGenOp( "polymsh.polymsh.mergemesh", _ "polymsh", "", True ) ' View results. SetValue "Camera.camvis.objctrlpropmaps", True SetDisplayMode "Camera", "texturedecal" SelectObj "polymsh.polymsh.cls.Point.Weight_Map" for each item in l_NewProperties Application.LogMessage "New Property : " & item next ' Expected results ' INFO : New Property : polymsh.polymsh.cls.Polygon.Material1 ' INFO : New Property : polymsh.polymsh.cls.grid.Scene_Material ' INFO : New Property : polymsh.polymsh.cls.grid1.Material ' INFO : New Property : polymsh.polymsh.cls.Texture_Coordinates_AUTO.Texture_Projection ' INFO : New Property : polymsh.polymsh.cls.Point.Weight_Map |
/*
This example transfers properties across generator
operators that admit transfer of properties.
*/
NewScene( null, false );
// Create objects
CreatePrim("Grid", "MeshSurface", "grid", null);
CreatePrim("Grid", "MeshSurface", "grid1", null);
Translate( "grid1", 8.2, 0.0, 0.0,
siRelative, siView, siObj, siXYZ,
null, null, null, null, null, null, null, null, null);
// Add some properties to objects: Materials and texture coordinates.
ApplyShader(null, "", null, "", siLetLocalMaterialsOverlap);
SetValue("grid1.Material.Phong.diffuse.red", 1, null);
SIApplyShaderToCnxPoint("Image", "grid1.Material.Phong.diffuse", null, null);
CreateProjection("grid1",
siTxtPlanarXZ,
siTxtDefaultSpherical,
"Texture_Support",
"Texture_Projection",
null, null, "");
SetInstanceDataValue(null,
"grid1.Material.Phong.Image.tspace_id",
"Texture_Projection");
SelectObj("grid", null, true);
SetSelFilter("Polygon");
AddToSelection("grid.poly[26-29,34-37,42-45]", null, true);
ApplyShader(null, "", null, "", siLetLocalMaterialsOverlap);
SetValue("grid.polymsh.cls.Polygon.Material.Phong.diffuse.blue", 0.006, null);
SIApplyShaderToCnxPoint("Image",
"grid.polymsh.cls.Polygon.Material.Phong.diffuse",
null, null);
CreateProjection("grid",
siTxtPlanarXZ,
siTxtDefaultSpherical,
"Texture_Support",
"Texture_Projection1",
null, null, "");
SetInstanceDataValue(null,
"grid.polymsh.cls.Polygon.Material.Phong.Image.tspace_id",
"Texture_Projection1");
// Add cluster property: weight map on both objects.
SetSelFilter("Point");
AddToSelection("grid.pnt[20-23,29-32,38-41,47-50,56-59]", null, true);
CreateWeightMap(null, null, "Weight_Map", null, null);
SelectObj("grid1", null, true);
ActivateVertexSelTool(null);
AddToSelection("grid1.pnt[30-32,39-41,48-50]", null, true);
CreateWeightMap(null, null, "Weight_Map", null, null);
// Apply merge operator.
ApplyGenOp("MeshMerge", "", "grid,grid1", 3, siPersistentOperation,
siKeepGenOpInputs);
SetValue("polymsh.polymsh.mergemesh.tolerance", 2, null);
Translate( "polymsh", -4.0, 4.0, -5.0,
siRelative, siView, siObj, siXYZ,
null, null, null, null, null, null, null, null, null);
// Transfer all properties across the merge operator. Pass in empty string
// to transfer all properties.
l_NewProperties = TransferAllPropertiesAcrossGenOp(
"polymsh.polymsh.mergemesh",
"polymsh",
"",
true);
// View results
SetDisplayMode("Camera", "texturedecal");
SetValue("Camera.camvis.objctrlpropmaps", true, null);
var eNewProps = new Enumerator( l_NewProperties );
for ( ; !eNewProps.atEnd(); eNewProps.moveNext() )
{
Application.LogMessage( "New Property : " + eNewProps.item().FullName );
}
// Expected results:
// INFO : New Property : polymsh.polymsh.cls.Polygon.Material1
// INFO : New Property : polymsh.polymsh.cls.grid.Scene_Material
// INFO : New Property : polymsh.polymsh.cls.grid1.Material
// INFO : New Property : polymsh.polymsh.cls.Texture_Coordinates_AUTO.Texture_Projection1
// INFO : New Property : polymsh.polymsh.cls.Point.Weight_Map |