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 get_material(), but it may be a more convenient way to access it.

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

Adds a new Material to the collection.

add_materials_from(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.

find_material(name: str) Material

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

get_material(index: int) Material

Returns the nth Material in the collection.

get_num_materials() int

Returns the number of Materials in the collection.

has_material(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.

remove_duplicate_materials()

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.

remove_material(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.

remove_materials_from(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 get_num_materials().

write(out: ostream, indent_level: int)

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