AddMaterial (SceneItem)
Description
Creates and adds material to a SceneItem object. If the SceneItem is a Model then the BranchFlag will be ignored since a material can only be added on a Model in branch.
Scripting Syntax
SceneItem.AddMaterial( [Preset], [BranchFlag], [Name] )
C# Syntax
Material SceneItem.AddMaterial( Object in_Preset, Boolean in_Branch, String in_name );Parameters
|
Parameter |
Type |
Description |
|
Preset |
Variant containing a preset object (see SIGetPreset) or name |
Shader preset or the name of a shader preset to apply to an object. You can use a value from one of the following lists: Material (Surface) Shader Presets, Illumination (Surface) Shader Presets, Raytracing (Surface) Shader Presets, Legacy Shader Presets, Subsurface Shader Presets Default Value: If no shader preset is supplied then a material is created and added but it will have no shaders connected to its parameters.
|
|
BranchFlag |
Apply material on branch or the node of object Default Value: false |
|
|
Name |
Represents the name of the new Material object |
Return Value
Examples
VBScript Example
set oRoot = application.activeproject.activescene.root
set oCube = oRoot.AddGeometry("Cube","MeshSurface")
set oMaterial = oCube.AddMaterial("Phong", siBranch)
LogMessage "Cube's material name: " & oMaterial.FullNameAutodesk Softimage v7.5