kaolin.io.materials¶
API¶
Functions
API¶
- exception kaolin.io.materials.MaterialNotSupportedError¶
- exception kaolin.io.materials.MaterialWriteError¶
- kaolin.io.materials.group_materials_by_name(materials_list, material_assignments)¶
Groups materials that have the same name. Does not group materials that do not have any name set.
- Parameters
materials_list (list of objects) – each item is expected to have material_name member, or ‘material_name’ key if dictionary.
material_assignments (torch.LongTensor or None) – with integer value corresponding to material
- Returns
materials (list): list of material parameters, with any grouped materials replaced by single material
- material_assignments (torch.LongTensor): copy of material_assignments, modified according to grouped
materials (or None if input material_assignments were None)
- Return type
(tuple) of
- kaolin.io.materials.process_materials_and_assignments(materials_dict, material_assignments_dict, error_handler, num_faces, error_context_str='')¶
Converts dictionary style materials and assignments to final format (see args/return values).
- Parameters
materials_dict (dict of str to dict) – mapping from material name to material parameters
material_assignments_dict (dict of str to torch.LongTensor) – mapping from material name to either 1) a K x 2 tensor with start and end face indices of the face ranges assigned to that material or 2) a K, tensor with face indices assigned to that material
error_handler – handler able to handle MaterialNotFound error - error can be thrown, ignored, or the handler can return a dummy material for material not found (if this is not the case, assignments to non-existent materials will be lost), e.g. obj.create_missing_materials_error_handler.
num_faces – total number of faces in the model
error_context_str (str) – any extra info to attach to thrown errors
- Returns
materials (list): list of material parameters, sorted alphabetically by their name
- material_assignments (torch.ShortTensor): of shape ( ext{num_faces},) containing index of the
material (in the above list) assigned to the corresponding face, or -1 if no material was assigned.
- Return type
(tuple) of
Exceptions¶
- class kaolin.io.materials.MaterialError¶
- class kaolin.io.materials.MaterialLoadError¶
- class kaolin.io.materials.MaterialFileError¶
- class kaolin.io.materials.MaterialNotFoundError¶