MaterialCollection

from panda3d.core import MaterialCollection
class MaterialCollection

Bases:

Inheritance diagram

Inheritance diagram of MaterialCollection

__add__(other: MaterialCollection) MaterialCollection
__getitem__(index: int) Material

Returns the nth Material in the collection. This is the same as getMaterial(), but it may be a more convenient way to access it.

__iadd__(other: MaterialCollection) MaterialCollection
__init__()
__init__(copy: MaterialCollection)
addMaterial(node_material: Material)

Adds a new Material to the collection.

addMaterialsFrom(other: MaterialCollection)

Adds all the Materials indicated in the other collection to this material. The other materials are simply appended to the end of the materials in this list; duplicates are not automatically removed.

assign(copy: MaterialCollection) MaterialCollection
clear()

Removes all Materials from the collection.

findMaterial(name: str) Material

Returns the material in the collection with the indicated name, if any, or NULL if no material has that name.

getMaterial(index: int) Material

Returns the nth Material in the collection.

getNumMaterials() int

Returns the number of Materials in the collection.

hasMaterial(material: Material) bool

Returns true if the indicated Material appears in this collection, false otherwise.

output(out: ostream)

Writes a brief one-line description of the MaterialCollection to the indicated output stream.

removeDuplicateMaterials()

Removes any duplicate entries of the same Materials on this collection. If a Material appears multiple times, the first appearance is retained; subsequent appearances are removed.

removeMaterial(node_material: Material) bool

Removes the indicated Material from the collection. Returns true if the material was removed, false if it was not a member of the collection.

removeMaterialsFrom(other: MaterialCollection)

Removes from this collection all of the Materials listed in the other collection.

size() int

Returns the number of materials in the collection. This is the same thing as getNumMaterials().

write(out: ostream, indent_level: int)

Writes a complete multi-line description of the MaterialCollection to the indicated output stream.