SelectMaterialsUsedBy

SelectMaterialsUsedBy

導入

v5.0

詳細

入力オブジェクトによって「使用されている」すべてのマテリアルを選択します。これには、3DObjects、クラスタ、グループ、レイヤ、パーティションが含まれます。 3DObject の場合、クラスタおよびサブサーフェイス上のマテリアルが含まれます。

スクリプト構文

SelectMaterialsUsedBy( InputObjs );

パラメータ

パラメータ タイプ 説明
InputObjs 文字列 オブジェクトのリスト

デフォルト値: 現在選択されている値

1. VBScript の例

'

' The following example creates a couple of objects and places them in a group.

' Then it adds a material (green in color) to the group.  Thus that material is

' inherited by the two objects.  Then it demonstates this command.

'

NewScene , False

' Create a couple of objects

SetDisplayMode "Camera", "shaded"

set oRoot = Application.ActiveSceneRoot

set oCube = oRoot.AddGeometry("Cube","MeshSurface", "Green_Cube")

set oCone = oRoot.AddGeometry("Cone","MeshSurface", "Green_Cone")

Translate "Green_Cone", 7.57946639200555, -4.14387414395287E-02, 4.14387414395287E-03, siRelative, siView, siObj, siXYZ, , , , , , , , , , 0

' Create a group and add the two objects

set oGroup = oRoot.AddGroup

oGroup.AddMember(oCube)

oGroup.AddMember(oCone)

' Create a material (green in color) on the group

set oMaterial = oGroup.AddMaterial("Phong", siBranch, "GREEN_Material")

SetValue "Sources.Materials.DefaultLib.GREEN_Material.GREEN_Material.diffuse.red", 0

SetValue "Sources.Materials.DefaultLib.GREEN_Material.GREEN_Material.diffuse.green", 1

SetValue "Sources.Materials.DefaultLib.GREEN_Material.GREEN_Material.diffuse.blue", 0

' Select the material 'used by' an object in the group.

DeselectAll

SelectMaterialsUsedBy "Green_Cone"

' The material 'GREEN_Material' should now be selected.

2. JScript の例

/*

	The following example creates an object and adds a material (red in color)

	on it.  Then it demonstates this command.

*/

NewScene( null, false );

// Create an object

SetDisplayMode("Camera", "shaded");

var oRoot = Application.ActiveSceneRoot;

var oObject = oRoot.AddGeometry( "Cylinder", "MeshSurface" );

// Add a material (red in color) on it

var oMaterial = oObject.AddMaterial( "Phong", siNode, "RED_Material" );

SetValue("Sources.Materials.DefaultLib.RED_Material.RED_Material.diffuse.red", 1, null);

SetValue("Sources.Materials.DefaultLib.RED_Material.RED_Material.diffuse.green", 0, null);

SetValue("Sources.Materials.DefaultLib.RED_Material.RED_Material.diffuse.blue", 0, null);

// Select the material(s) used by the object

DeselectAll();

SelectMaterialsUsedBy("cylinder");

// The material 'RED_Material' should now be selected.

//

関連項目

SelectObjectsUsingMaterial