unreal.MaterialValidationLibrary

class unreal.MaterialValidationLibrary(outer: Object | None = None, name: Name | str = 'None')

Bases: BlueprintFunctionLibrary

Material validation functionality exposed as a library of Blueprint functions.

C++ Source:

  • Plugin: MaterialValidation

  • Module: MaterialValidation

  • File: MaterialValidationLibrary.h

classmethod add_missing_materials_to_group(group) None

Add all UMaterials to the Material Validation Group which are found in its material search directories. This will only add materials, and not remove existing ones. Materials are not updated with their permutations, so that newly found materials will have no approved permutations.

Parameters:

group (MaterialValidationGroup) – The group to add materials to.

classmethod get_all_groups(sync_load) Array[MaterialValidationGroup]

Get all configured Material Validation Groups.

Parameters:

sync_load (bool) – Whether to sync load the group assets. When false we don’t return unloaded group objects, but we do trigger async loading for them.

Returns:

out_groups (Array[MaterialValidationGroup]): The returned array of groups.

Return type:

Array[MaterialValidationGroup]

classmethod get_material_hierarchy_info(group, base_material_path) MaterialDatabaseAssetHierarchyInfo

Get all of the material instance data for a single material hierarchy.

Parameters:
Returns:

out_info (MaterialDatabaseAssetHierarchyInfo): Returnsa an object containing all of the material instance data.

Return type:

MaterialDatabaseAssetHierarchyInfo

classmethod get_material_properties(info) Array[MaterialDatabaseAssetPropertyDesc]

Get all the material properties for a material hierarchy.

Parameters:

info (MaterialDatabaseAssetHierarchyInfo) – The full hierarchy info. This is typically resolved by first calling GetMaterialHierarchyInfo().

Returns:

out_properties (Array[MaterialDatabaseAssetPropertyDesc]): Returns an array of property descriptions.

Return type:

Array[MaterialDatabaseAssetPropertyDesc]

classmethod get_material_property_values(info, material_index) Array[MaterialDatabaseAssetPropertyValue]

Get all the material property values for a material instance in a material hierarchy.

Parameters:
  • info (MaterialDatabaseAssetHierarchyInfo) – The full hierarchy info. This is typically resolved by first calling GetMaterialHierarchyInfo().

  • material_index (int32) – The index of the material instance in the hierarchy. The instances are in the order defined by FMaterialDatabaseAssetHierarchyInfo::MaterialPaths.

Returns:

out_values (Array[MaterialDatabaseAssetPropertyValue]): Returns an array of property values, one for each of the material properties as returned by GetProperties().

Return type:

Array[MaterialDatabaseAssetPropertyValue]

classmethod get_material_validation_desc_diff(group_old, group_new, base_material_path, allow_asset_load) Array[MaterialInstanceDiffResult]

Get the diff between two versions of a UMaterialValidationGroup for a single base material. Compares the raw stored data. There is no asset registry dependency and it works for deleted instances. The first entry in OutDiffs always contains the base material entry if it changed.

Parameters:
  • group_old (MaterialValidationGroup) – The older version of the group for comparison.

  • group_new (MaterialValidationGroup) – The newer version of the group for comparison.

  • base_material_path (SoftObjectPath) – The path of the base material to find in the groups and diff.

  • allow_asset_load (bool) – If true then the base UMaterial is loaded to resolve static parameter names. If false then static parameters are given generic names.

Returns:

out_diffs (Array[MaterialInstanceDiffResult]): Returns one entry per changed material instance. Empty if no differences found.

Return type:

Array[MaterialInstanceDiffResult]

classmethod get_modified_shader_count(group, material, modified_objects, replacement_objects, force_load_objects=False) int32

Get the number of shaders used by all permutations of a base material taking into account local changes in the materials.

Parameters:
  • group (MaterialValidationGroup) – The group to use.

  • material (Material) – The base material to evaluate.

  • modified_objects (Array[MaterialInterface]) – An array of loaded material objects that should be used instead of the corresponding stored database values when evaluating permutations.

  • replacement_objects (Array[MaterialInterface]) – An array of loaded material objects in sync with InModifiedObjects. When the corresponding array item exists and is valid it is used to replace the object in InModifiedObjects when evaluation permutations. This can be used to evaluate the impact of using a different object.

  • force_load_objects (bool) – When true, any hierarchy asset not already in memory is synchronously loaded from disk.

Returns:

The total number of shaders. This value is the best estimate that we can give without triggering asset loads if bForceLoad=false.

Return type:

int32

classmethod get_shader_count(group, material) int32

Get the number of shaders used by all permutations of a base material using only the information stored in the group.

Parameters:
Returns:

The total number of shaders calculated at the last time we updated the group.

Return type:

int32

classmethod is_material_in_group(group, material) -> (out_is_in_group_path=bool, out_is_in_group=bool)

Get whether a material belongs to a group.

Parameters:
Returns:

out_is_in_group_path (bool): Returns true if the material is in the validation group search path.

out_is_in_group (bool): Returns true if the material is in the validation group material list.

Return type:

tuple

classmethod is_material_instance_in_group(group, material_instance) -> (out_material_in_group=bool, out_material_permutation_in_group=bool)

Get whether a material instance belongs to the group and whether it has a known permutation.

Parameters:
Returns:

out_material_in_group (bool): Returns true if the base material is in the validation group material list.

out_material_permutation_in_group (bool): Returns true if the material instance permutation is in the permutation list.

Return type:

tuple

classmethod remove_invalid_materials_from_group(group) None

Remove all UMaterials that no longer exist on disk from the Material Validation Group.

Parameters:

group (MaterialValidationGroup) – The group to update.

classmethod reset_group(group) None

Remove all UMaterials from a Material Validation Group.

Parameters:

group (MaterialValidationGroup) – The group to reset.

classmethod update_material_permutations_in_group(group) None

Recalculate and reregister all existing permutations for all the existing materials in a Material Validation Group (can be slow to load and analyze the tree of material instances).

Parameters:

group (MaterialValidationGroup) – The group to update.