ddg.visualization.blender.material module

ddg.visualization.blender.material.set_material(ob, material, protect=True)[source]

Assigns given material or material with given name to the object. A new material is creates if it did not exist before!

Parameters:
ob: bpy.types.Object

Blender object the material is assigned to.

material: str or bpy.types.Material

Name of the material or actual material object

protect: bool (default=True)

If True, the material is protected from being deleted when unused. Is only applied if the material did not exist before!

ddg.visualization.blender.material.protect_material(material)[source]

Protects given material from being deleted after reloading the file if not in use.

Parameters:
mat_name: str or bpy.types.Material

Name of the material or actual material object. Must exist.

ddg.visualization.blender.material.material(name='DDG Material', color=(1, 1, 1), specular=1, roughness=0.5, alpha=1, input_dict={})[source]

Create a Principled BSDF material.

Parameters:
namestr, (default=”DDG Material”)

The name of the material.

color3-tuple, (default=(1,1,1))

The color in RGB base.

specularint, (default=1)

The specular value in [0,1]

roughnessint, (default=0.5)

The roughness value in [0,1]

alphaint, (default=1)

The alpha value in [0,1]

input_dictdict, (default={})

An input dictionary for the the bsdf inputs

Returns:
bpy.types.Material