trigger.library.shading

Collection of shading related functions

Functions

assign_shader(shader[, mesh, shading_group])

Assign given shader to all available shading groups of mesh.

collect_material_database()

Collect all basic shader information from scene into a dictionary.

create_preview_shader(database, material_id[, name, mesh])

Create a preview shader based on the template on given database.

create_shading_engine(mesh[, name])

Create a new shading engine and connect it to the given mesh.

find_file_node(plug)

Find recursively the first file node connected to the plug.

get_all_materials()

Return all materials IN USE.

get_file_nodes(mesh_transforms)

Returns all file nodes connected to the given mesh transforms.

get_shaders(mesh)

Return all shaders connected to the given mesh

get_shading_groups(mesh)

Return all shading groups of the given mesh.

Module Contents

assign_shader(shader, mesh=None, shading_group=None)

Assign given shader to all available shading groups of mesh.

collect_material_database()

Collect all basic shader information from scene into a dictionary.

Note that, this function ONLY collects the shader attribute values as it is. It does not collect any connected node information like ramp, file etc.

create_preview_shader(database, material_id, name=None, mesh=None)

Create a preview shader based on the template on given database.

Args:

database: (dictionary) dictionary item collected with ‘collect_material_database’ function material_id: (string) key id which needs to exist in the provided dictionary. If not, default standardSurface

will be used instead

name: (string) Name of the new shader. Optional. If not provided <material_id>_M template will be used mesh: (string) Mesh that will be assigned. The Shading groups will be preserved if there are multi sgs

Returns:

create_shading_engine(mesh, name=None)

Create a new shading engine and connect it to the given mesh.

find_file_node(plug)

Find recursively the first file node connected to the plug.

get_all_materials()

Return all materials IN USE.

get_file_nodes(mesh_transforms)

Returns all file nodes connected to the given mesh transforms.

get_shaders(mesh)

Return all shaders connected to the given mesh

get_shading_groups(mesh)

Return all shading groups of the given mesh.