'
' 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.
|