MaterialLibrary
 
 
 

MaterialLibrary

Object Hierarchy | Related C++ Class: MaterialLibrary

Inheritance

SIObject

ProjectItem

Source

Library

MaterialLibrary

Introduced

v5.0

Description

The material library object is a specialized source library for storing and sharing materials. The storage may be internal or external. If internal, the library is saved in the scene file. If external, the library is saved in a separate file. The library can be exported to and imported from dotXSI or a native binary format.

Methods

AddCustomOp AddICEAttribute AddProperty AddScriptedOp
AddScriptedOpFromFile AnimatedParameters2 BelongsTo operator CreateMaterial
EvaluateAt GetICEAttributeFromName IsA IsAnimated2
IsClassOf operator IsEqualTo operator IsKindOf IsLocked operator
IsSelected operator LockOwners RemoveICEAttribute SetAsSelected operator
SetCapabilityFlag operator SetLock TaggedParameters UnSetLock

Properties

Application BranchFlag operator Capabilities operator Categories
EvaluationID Families operator FullName operator Help
HierarchicalEvaluationID ICEAttributes Items LockLevel operator
LockMasters operator LockType operator Model Name operator
NestedObjects ObjectID Origin OriginPath
Owners PPGLayout operator Parameters operator Parent
Parent3DObject Properties Selected operator Type operator

Examples

Python Example

#
#   This example illustrates how to get a material library and how to 
#   enumerate all materials in a library
#
from win32com.client import constants as c
app = Application
app.NewScene( "", 0 )
# First create some libraries and materials
sph = app.ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface" )
app.ApplyShader( "", sph, "", "", c.siLetLocalMaterialsOverlap )
rtn = app.CreateLibrary( "", 1 )
lib = rtn(0)
#app.Selection.Add( lib )
lib.Name = "MyLibrary"
app.SetCurrentMaterialLibrary( lib )
# Now enumerate all materials in all libraries
scn = app.ActiveProject.ActiveScene
matlibs = scn.MaterialLibraries
app.LogMessage( "There are " + str(matlibs.Count) + " libraries under the scene." )
for currlib in matlibs :
        app.LogMessage( currlib.Name + " has " + str(matlibs.Count) + " defined materials." )
        for currmat in currlib.Items :
                app.LogMessage( "  - " + currmat.Name )
# Expected result:
#INFO : There are 2 libraries under the scene.
#INFO : DefaultLib has 2 defined materials.
#INFO :   - Scene_Material
#INFO :   - Material
#INFO : MyLibrary has 2 defined materials.

See Also

Library