Yes. You can. Unsure as to how this would help with using Python and the “unreal” module?
OH… but bringing up a suggestion unrelated to the topic does remind me to update this post to state the solution.
Here is a snippet of code to gather the texture and material assets using Python and the built in “unreal” module.
def get_textures_and_materials():
"""
Return lists for all available Texture2D and Material assets.
"""
all_assets = unreal.AssetRegistryHelpers.get_asset_registry().get_all_assets()
textures = [x for x in all_assets if x.asset_class == 'Texture2D' and x.object_path.__str__().startswith('/Game/')]
materials = [x for x in all_assets if x.asset_class == 'Material' and x.object_path.__str__().startswith('/Game/')]
return textures, materials
textures, materials = get_textures_and_materials()
This will give you all the expected Texture2D and Material assets currently in your open project.
However keep in mind that these are the AssetData objects of the desired assets. So you need to reach in a little deeper in order to find the properties.
Lets get an actual asset. Lets just grab the first Material that would be in the list.
my_material = materials[0].get_asset()
The AssetData has a method called “get_asset()” that returns the actual asset class to work with.
Now that we have this, simply doing a “dir” will list all methods and attributes. Yes, this is a dump of just everything in that class, but it includes it’s attributes.
Alternately, you can go to that class’s page in the documentation, which lists all the available attributes you can get or set.
e.g.
https://docs.unrealengine.com/en-US/PythonAPI/class/Material.html
This provides the information this post was looking for.
Hopefully this will help someone new to the Unreal Python.