top of page

Assets Analysis Tool

This is an Assets Analysis Tool developed in Python & Unreal 5.2.

The reason I chose to develop the tool is because one of my main tasks as a technical artist in our school project is optimization project.

I'm working on a large project that has huge assets inside the folder, and it would have taken me a lot of time to click on each asset in order to get the internal attribute value, but this tool helped me quickly read the asset information I wanted and process the asset.

As a technical artist, asset optimization is one of my responsibilities, and I also like problem solving,  so it's a good opportunity for me to explore that.

  • Report information about asset mesh/class/material/texture name, and number of material/textures applying.

  • Report mesh information about LOD group, LOD number, and Triagnle/Vertex count.

  • Auto detect mesh diameter and assign LOD group for it.

  • Enable Nanite system for select mesh.

  • Export select assets / textures to the specified folder.

Demo of Tool Running
Blueprint Of Editor Utility Widget

Develop Blog

Part 0: Preparation before Code

I had a list of features I wanted to implement in unreal before I started working on this tool, but the first difficulty I faced when I started working on this tool was that the official python API was confusing because it wasn't as clean as Maya's API. So I spent some extra time reading tutorials in Unreal's community.

My Function List

Part 1: Select Actor Information Class

I find that unreal.EditorActorSubsystem().get_selected_level_actors() Allows me to get the actor in the scene. I decide to call the unreal._objectbase instructions based on this code, and then I can get the name and class of the selected actor or more basic information about the actor.

Create a class to organize each function, and declaration get_selected_level_actors()

Create a list, append the resulting name to the list, and print the list so that I get the actor's name every time when select the actor and run the code.

Result of excute code

Function get_select_class(). using the same method as above to complete the code, we call the unreal._objectbase data by adding actor.class(). to the for loop to get the class of the selected Actor.

Function get_materials(). passes in the data from function get_select_class(). and can call get_selected_level_actors(). directly. It uses the same approach as the following function get_textures(). But to get the number of materials and textures, I can't just print the list, I need to add len() in front of the list to get the number in the list instead of the string.

Code of Function

Result of execute code

Part 2: Select Mesh LOD Class

In the reading unreal community to know when to unreal. The EditorUtilityLibrary. Get_selected_assets () can directly read the project's assets in the folder, So I decided to call this API to help me read the selected folder assets data.

The number of LODs for selected assets is read by calling unreal.objectbase().

Using get_editor_property("lod_group"), you can get the data in the project property directly and print it out

To get the triangle mesh and vertex data need to use the

unreal ProceduralMeshLibrary. Get_section_from_static_mesh(). invoked, query the code it cost me a lot of time.

But to call the data I need a select_assets, get_lod, number_section. To do this, I use multiple for loops to append the resulting data to a list.  Execute  the code can get all LOD level's triangle and vertex data.

Code of Function

Result of execute code

Part 3: LOD Data Convert Class

To automatically convert the LOD group of a mesh, I must first obtain its dimensions. After getting the selected assets through get_selected_assets(), using unreal.objectbase() in the for loop can get the bound box of assets, which can also get the dimensions of the mesh.

Using sphere_radius to multiply the radius of the resulting bound box by 2 to get the diameter of the bound box can more accurately obtain the mesh size.

48630c6506d7be93880ccd796fe74d4.png

If the size is greater than 200, LargeProp is enabled. If the size is smaller than 200, SmallProp is enabled.

Part 4: Nanite Edit Class

The projects I worked on used a lot of large complex program Assets and scenarios that took time to load each time I switched levels. Using the Nanite system for assets reduced the time spent optimizing the model.

Calling Nanite is similar to class lod_data_convert(). I need to use get_editor_property("nanite_settings") to get the Nanite Settings in the Mesh. Then use the unreal. StaticMeshEditorSubsystem (.) set_nanite_settings () to open it.

With get_selected_level_actors(). To obtain the selected asset, run enable_nanite() when the asset is selected. Enables the Nanite system to select assets.

Part 5: Assets Manager Class

unreal.AssetExportTask().  Enables assets data to be exported. Calling automated(), prompt() will allow the data to be automatically exported to the specified folder.
unreal.FbxExportOption() can export files to FBX format. I tried to use OBJ export, but it exported files with multiple folders instead of a single file, so I chose FBX format finally.

Code of Function

The path is preset using the same method and the selected textures are exported in tga format.

Before asset export in Unreal

Export files in folder

bottom of page