Scene Data Dump

Hello everyone, I wasn’t sure what the appropriate thread was for this question. I’m wondering if UE enables you too query the scene elements? I’d like to query attributes for each object in the scene, specifically:

  • Vertices
  • Normals (I’m assuming this is how textures are mapped to the object?)
  • Location in scene
  • Material configurations

It is for analytical purposes. Can this be done via Python?

Thanks.

Basically you will be able to get many (but not all) parameters that are exposed in editor UI:
You will be able to get information from the world outliner such as parenting and transform of actors.
You can also read material slots information both from static meshes or static mesh components.

However, under the hood information such as vertices, normals, etc. are not exposed to the python API (afaik)

Hmm okay. Well good to know I can read material slots. I guess I’ll take a closer look at the API and see what it offers. I wonder if you can export a scene in an FBX file via Python? That way I could read the vertices.

Anyway, thank you UE_FlavienP.

Actually a colleague show me that you can get some info on vertices / tris counts using the following sample:

import unreal

smas = unreal.EditorFilterLibrary.by_class(unreal.EditorLevelLibrary.get_all_level_actors(),unreal.StaticMeshActor)

for sma in smas:
    verts, tris, normals, uvs, tangents = unreal.ProceduralMeshLibrary.get_section_from_static_mesh(sma.static_mesh_component.static_mesh, 0, 0)
    print(sma.static_mesh_component.static_mesh)
    print("Face Count: " + str(len(tris) / 3))
    print("Vert Count: " + str(len(verts) / 3))

If you want to export to FBX you can find some sample there