Set number of lods in SM with python

Hi :smiley:

Is it possible to change in a SM (already in the project) the LOD Settings->Number of LODs?
I can set the number of lods while importing but i would like to change it based on the triangle count once is already in the project.

Thanks

Look at the functions in unreal.StaticMeshEditorSubsystem

e.g.

import unreal

sm = unreal.EditorAssetLibrary.load_asset('/Game/...')

smes = unreal.get_editor_subsystem(unreal.StaticMeshEditorSubsystem)

smro = unreal.StaticMeshReductionOptions()

myReductionSettings = []
myReductionSettings.append(unreal.StaticMeshReductionSettings())
myReductionSettings.append(unreal.StaticMeshReductionSettings())
myReductionSettings.append(unreal.StaticMeshReductionSettings())
#Lod 0
myReductionSettings[0].percent_triangles = 1.0
myReductionSettings[0].screen_size = 0.9
#Lod 1
myReductionSettings[1].percent_triangles = 0.5
myReductionSettings[1].screen_size = 0.5
#Lod 2
myReductionSettings[2].percent_triangles = 0.2
myReductionSettings[2].screen_size = 0.1
smro.auto_compute_lod_screen_size = False
smro.reduction_settings = myReductionSettings
print(smes.set_lods(sm, smro))
2 Likes