UE4.20 Python to change mesh lightmap resolution

Hi,
Using the built in Python in UE4.20.3, I’m trying to get selected meshes (in content browser) to change the lightmap resolution for each, based on object size.

I’m a Python beginner, and having a hard time understanding the python documentation:
https://api.unrealengine.com/INT/PythonAPI/index.html

I’ve got this working code so far:



import unreal
@unreal.uclass()

class EdUtBase(unreal.GlobalEditorUtilityBase):
    pass

EdUtBaseObj = EdUtBase()
Selected = EdUtBaseObj.get_selected_assets()

print(Selected)
print(Selected[0].get_bounding_box())


I can’t figure out the syntax of how to get / set the “Light map resolution” (found in static mesh editor, details tab > general settings rollout)

My guess was to use “target_light_map_resolution”, so my wild stab in the dark was:
unreal.MeshMergingSettings.target_light_map_resolution(Selected[0])

Which gives the cryptic error (at least for me!):
TypeError: ‘getset_descriptor’ object is not callable

Can anyone help me understand how this is supposed to be written?
For example:
unreal.GlobalEditorUtilityBase is an unreal class according to the docs. Is this why we need to make it into a class too? (see above code)).
unreal.MeshMergingSettings is also an unreal class, but treating it the same way as GlobalEditorUtilityBase does not work.

I think I’m missing some fundamentals!
Any pointers, hints, tips and discussions welcome!

Many thanks
Graham Macfarlane

I would do something as presented in the linked file.

You could look at the following python classes, you can check their content by typing help() in the python command line
unreal.EditorAssetLibrary: manage asset in content folder
unreal.EditorLevelLibrary: manage actors in level
unreal.Actor
unreal.StaticMeshActor
unreal.StaticMeshComponent
unreal.StaticMesh

Bests.

Thank you very much UE_FlavienP!!
Works beautifully!

I will look into the classes you listed.

Cheers
Graham