Library
 
 
 

Library

Object Hierarchy | Related C++ Class: Library

Inheritance

SIObject

ProjectItem

Source

Library

Introduced

v4.0

Description

A library is a container of objects of the same kind. For example, a material library contains a list of materials. The storage of a library can be either internal or external. For internal storage, it is saved within the scene file. For external, it is saved in a separate file. The library can be exported and imported into a dotXSI format or a native binary format.

Methods

AddCustomOp AddICEAttribute AddProperty AddScriptedOp
AddScriptedOpFromFile AnimatedParameters2 BelongsTo operator 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

JScript Example

/*
        This example illustrates how to get a material library and how to 
        enumerate all materials in a library
*/
NewScene(null, false);
// First create some libraries and materials
CreatePrim("Sphere", "MeshSurface");
ApplyShader(null, "", null, "", siLetLocalMaterialsOverlap);
CreateLibrary();
SelectObj("Sources.Materials.MaterialLibrary");
SetValue("Sources.Materials.MaterialLibrary.Name", "MyLibrary");
SetCurrentMaterialLibrary("Sources.Materials.MyLibrary");
SelectObj("sphere", null, true);
ApplyShader(null, "", null, "", siLetLocalMaterialsOverlap);
// Now enumerate all materials in all libraries
var oScene = Application.ActiveProject.ActiveScene;
var oMaterialLibraries = oScene.MaterialLibraries;
Application.LogMessage("There are " + oMaterialLibraries.Count + " libraries under the scene.");
for( var i=0; i<oMaterialLibraries.Count; i++ ) {
        var oLibrary = oMaterialLibraries(i);
        Application.LogMessage(oLibrary.Name + " has " + oLibrary.Items.Count + " defined materials");
        var oMaterials = oLibrary.Items;
        for( var j=0; j<oMaterials.Count; j++ ) {
                Application.LogMessage("  - " + oMaterials(j).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 1 defined materials
// INFO :   - Material

See Also

Scene.ActiveMaterialLibrary