Object Hierarchy | 関連する C++クラス:Material









Material オブジェクトは、SceneItem オブジェクトのマテリアルプロパティです。SceneItem.AddMaterial を使用して作成できます。


AddCustomOp AddICEAttribute AddProperty AddScriptedOp
AddScriptedOpFromFile AddSharedTextureLayer AnimatedParameters2 BelongsToオペレータ
CreateTextureLayer EvaluateAt FindShaders GetAllShaders
GetICEAttributeFromName GetShaderInputType IsA IsAnimated2
IsClassOfオペレータ IsEqualToオペレータ IsKindOf IsLockedオペレータ
IsResolved IsSelectedオペレータ LockOwners RemoveICEAttribute
RemoveTextureLayer Resolve SetAsSelectedオペレータ SetCapabilityFlagオペレータ
SetLock TaggedParameters UnSetLock  


AllImageClips Application Branchオペレータ BranchFlagオペレータ
Capabilitiesオペレータ Categories CurrentImageClip CurrentTexture
CurrentUV EvaluationID Familiesオペレータ FullNameオペレータ
Help HierarchicalEvaluationID ICEAttributes ImageClips
Library LockLevelオペレータ LockMastersオペレータ LockTypeオペレータ
Model Nameオペレータ NestedObjects OGLMaterial
OGLTexture ObjectID Origin OriginPath
Owners PPGLayoutオペレータ Parametersオペレータ Parent
Parent3DObject Properties Selectedオペレータ Shaders
Singletonオペレータ TextureLayers Typeオペレータ UnresolvedFullname

VBScript の例



'	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


' The following information is logged in Softimage:

'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


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


	' 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 


end sub