SceneItem.Material

Description

Returns the object's applied Material object.

Examples

VBScript Example

set root = Application.Activeproject.ActiveScene.Root
set Cyl = root.AddGeometry("Cylinder","MeshSurface")
Cyl.AddMaterial "Phong",,"PhongInNode"
set mat1 = Cyl.Material
mat1.Parameters("name").Value = "MatOnCyl"
mat1.Shaders("PhongInNode").Parameters("diffuse").blue = 0.453
' Create a group containing the Cylinder, apply a material on it.
set aGroup = root.AddGroup( Cyl )
aGroup.AddMaterial "Phong"
set mat2 = aGroup.Material
mat2.Parameters("name").Value = "MatOnGroup"
mat2.Shaders("Phong").Parameters("diffuse").red = 0.031
' Display the applied material of the cylinder
'   the Group material "MatOnGroup" should be returned, but not "MatOnCyl"
logmessage Cyl & " material : " & Cyl.Material