Is there any way to access the Build Settings of a static mesh through the Python API?

I’m hoping to write a script that will allow me to batch-edit all static meshes within a folder and change their Build Settings, specifically the Min Lightmap Resolution. Is there any way to do this currently? I can’t find anything in the Python API. The only lightmap-related parameter exposed in unreal.StaticMesh is Lightmap Resolution (not allowing you to adjust the padding).

If I recall correctly, a lot of that static mesh stuff is handled in the mesh editor UI code, not on the mesh object itself, meaning it wouldn’t be possible to update it through script, or if you could you’d end up with some dependent logic not being run causing further problems.

I know a staff member referenced it somewhere recently and said they are working to gradually refactor that sort of thing, but it’s a problem throughout the engine codebase, so realistically if it’s important you’d need to make the changes yourself and submit a PR, if you don’t want to wait months/years.

The Min Lightmap parameter is stored in a unreal.MeshBuildSettings object.

https://docs.unrealengine.com/4.26/en-US/PythonAPI/class/MeshBuildSettings.html

To edit any of these you need to create (or get) a unreal.MeshBuildSettings object with the right settings and then apply it to the mesh using unreal.EditorStaticMeshLibrary.set_lod_build_settings()

https://docs.unrealengine.com/4.26/en-US/PythonAPI/class/EditorStaticMeshLibrary.html

1 Like

does this sort of thing have to be done in Python, or can it be done in BP with say an Editor Utility Widget? I have many static meshes and materials I want to import and modify (for example) Build Settings such as [full precision UVs = true] and [generate lightmap UVs = false], I need to be able to automate this process.

Hey hi, did you got any solution for this.

i am trying to get proper answer to change Precision UV for all the static meshes at once.

I created a blueprint and it’s working great.

can you share it with us if u dont mind

Hey, can anyone help me further understand using python to do these sorts of tasks, I am currently learning using python in Unreal and just need some places to help me learn writing and applying, I don’t mind paying for a tutorial series or similar stuff, thanks in advance :slight_smile:

1 Like