Retrieving actor layer

Hello,

I’m creating a python script in which I would like to find out the layer of the actor. With the new datasmith exporter from Revit every object is now divided into a layer. I am wondering if it is possible to retrieve this information through Python.
First off I am getting every actor like this: actor_list = unreal.EditorLevelLibrary.get_all_level_actors()
After that I want to iterate over those actors and check their respective layer.

In case the above is not possible:
I did find the unreal.LayersBlueprintLibrary in the Python documentation: unreal.LayersBlueprintLibrary — Unreal Python 4.27 (Experimental) documentation. There is a get_actors method, I assume this will retrieve every object on a particular layer. What I am struggling with though are the inputs for it: it asks for a “*world_context_object” *and I can’t seem to figure out how to get one. Does anyone have a working example of this method to share?

Hello,
I am yet to find a way to retrieve the layer of an actor or list the existing layers.

Regarding your second question you could retrieve actors belonging to a layer using one of the two following methods, LevelName is a string:



def listActorsInLevel(LevelName):
    #v1
    print unreal.EditorFilterLibrary.by_layer(unreal.EditorLevelLibrary.get_all_level_actors(),LevelName)
    #v2
    level = unreal.ActorLayer(LevelName)
    print unreal.LayersBlueprintLibrary.get_actors(unreal.EditorLevelLibrary.get_editor_world(),level)


Great, thanks for the help!