Creating texture assets from python

I would like to create texture assets from a python script. I can’t find any examples of how to do this. I see examples of how to use AssetTools.create_asset for other types of assets but that doesn’t seem to work for textures.

Suggestions?

Thanks,
Chris King
Spire Animation Studios

I realize this is kinda old now, but it’s the top result on Google right now.

You can use AssetTools to create a Texture2D asset. The issue is getting your hands on a Texture2DFactoryNew instance to feed to the AssetTools.

You can use Python to create a default Texture2DFactoryNew instance, feed that into the AssetTools to create the asset, then use a render target to write to the new asset while overriding all the asset’s properties, such as format, compression, etc… Sadly, there’s very little you can do to/with the factory instance, so you can’t really initialize your Texture2D asset to the expected values, but the render to texture call can do that for you.

1 Like