Material

Object Hierarchy | Related C++ Class: Material | Supported Parameter List: material

Inheritance

SIObject
  ProjectItem
    Property
      Material

Introduced

1.0

Description

The Material object represents the material property of a SceneItem object and can be created with SceneItem.AddMaterial.

Methods

AddCustomOp

AddProperty

AddScriptedOp

AddScriptedOpFromFile

AddSharedTextureLayer

AnimatedParameters

AnimatedParameters2

BelongsTo

CreateTextureLayer

EvaluateAt

FindShaders

GetShaderInputType

IsA

IsAnimated

IsAnimated2

IsClassOf

IsEqualTo

IsKindOf

IsLocked

IsResolved

IsSelected

LockOwners

RemoveTextureLayer

Resolve

SetAsSelected

SetCapabilityFlag

SetLock

TaggedParameters

UnSetLock

 

 

 

Properties

Application

Branch

BranchFlag

Capabilities

Categories

CurrentImageClip

CurrentTexture

CurrentUV

Families

FullName

Help

ImageClips

Library

LockLevel

LockMasters

LockType

Model

Name

NestedObjects

OGLMaterial

OGLTexture

Origin

OriginPath

Owners

Parameters

Parent

Parent3DObject

PPGLayout

Properties

Selected

Shaders

Singleton

TextureLayers

Type

UnresolvedFullname

UsedBy

Examples

VBScript Example

'===================================================================
'
'  This example demonstrates how you can recursively 
'  find and print all the material in a scene.
'

' Set up the scene first with three separate materials on
' the three mesh objects
NewScene , false
dim oThing
set oThing = ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface" )
oThing.AddMaterial "Phong", , "Wanda" 

set oThing = ActiveSceneRoot.AddGeometry( "Disc", "MeshSurface" )
oThing.AddMaterial "Lambert", , "Stewart" 

set oThing = ActiveSceneRoot.AddGeometry( "Torus", "MeshSurface" )
oThing.AddMaterial "Blinn", , "Lulu" 

' Start a running tally (as a global index)
dim g_Count
g_Count = 0



' Now call the first routine
FindAndPrintAllNodeMaterials


' The following information is logged in XSI:
'INFO : "These (3) materials were found:"
'INFO : "sphere.Material"
'INFO : "disc.Material"
'INFO : "torus.Material"



'-------------------------------------------------------------------
' This routine just launches the search for the materials by 
' calling the workhorse routine. Notice how the second argument
' uses the byref keyword: that is so we preserve the collection
sub FindAndPrintAllNodeMaterials
   ' Create an empty collection that the worker routine
   ' will fill with found materials
   dim oMats, m
   set oMats = CreateObject ( "XSI.Collection" )
   SIGetAllNodeMaterial ActiveSceneRoot, oMats 

   ' When it's all done we'll have a collection of all
   ' the materials under the root (ie., all)
   Application.LogMessage "These (" & g_Count & ") materials were found:" 
   for each m in oMats
       Application.LogMessage m
   next
end sub



'-------------------------------------------------------------------
' This routine is the 'workhorse', it crawls down the whole graph, 
' visiting each node to see if it's a material and collects 
' it if it is.
sub SIGetAllNodeMaterial( in_Obj, byref io_materials )
   ' Get the input objects properties and then loop
   ' through them looking for materials
   dim oProps, p
   set oProps = in_Obj.Properties
   for each p in oProps
       if TypeName(p) = "Material" Then
          ' Only add node materials
          if Not p.Branch then
              ' Add them to the collection 
              ' & increment the counter
              g_Count = g_Count + 1
              io_materials.Add p
          end if
       end if
   next 

   ' This is the recursive part: by calling the 
   ' SIGetAllNodeMaterial routine from inside the
   ' SIGetAllNodeMaterial routine, we're basically
   ' drilling down through the children.
   dim oChildren, c
   set oChildren = in_Obj.FindChildren
   for each c in oChildren
       SIGetAllNodeMaterial c, io_materials 
   next
end sub

See Also

TextureLayer



SOFTIMAGE|XSI v6.01     

Return to Softimage XSI Index