Skip to content

Materials

Curtis Holt edited this page Oct 5, 2020 · 11 revisions

Materials

create_material(name)

Creates a material with an appropriate name.

material_exists(ref)

Returns a true or false value depending on if the ref material exists.

delete_material(ref)

Deletes the provided ref material.

get_material(ref)

Get the ref material (expecting a string) and return a reference to it.

add_material_to_object(ref, mat)

Adds material mat to an object with ref.

remove_material_from_object(ref, matname)

Removes the material matname from the ref object.

Convenience functions:

  • remove_material(ref, matname)

get_all_materials()

Returns a list of all materials in the file, provided by bpy.data.materials.

get_materials(ref)

A multipurpose function. If ref is not provided, it will return bpy.data.materials. If ref is provided, then it will return a list of materials that belong to that object.

get_materials_from_object(ref)

Get the ref object and return a list of all materials from it.

get_material_names_from_object(ref)

Returns a list of all material from the ref object.