Change import settings for textures from script
Forum rules
Please add your OS and Hardware Configuration in your signature, it makes it easier for us to help you analyze problems. Example: Win 7 64 | Geforce GTX680 | i7 3770 | 16GB
Please add your OS and Hardware Configuration in your signature, it makes it easier for us to help you analyze problems. Example: Win 7 64 | Geforce GTX680 | i7 3770 | 16GB
Hi, I'm trying to change the import settings of every texture in my Orbx scenes to optimize my rendering through Lua coding. The problem is that when I try to access the attribute A_TYPE, which is the attribute that stores that information according to the documentation, nothing happens. I can read the value inside that attribute, but I cannot set it. Is there a way to achieve this through code?
The type is used to interpret the data in the buffer so I don't think you can change this arbitrarily, it needs to be compatible with what's already in the buffer, unless you are also changing the buffer.
There is also a A_RELOAD attribute that you may need to use to trigger reloading the texture. (set it to TRUE once and it will auto-reset to false after evaluation).
PS: there is a forum dedicated to Lua scripting under "Resources and Sharing".
There is also a A_RELOAD attribute that you may need to use to trigger reloading the texture. (set it to TRUE once and it will auto-reset to false after evaluation).
PS: there is a forum dedicated to Lua scripting under "Resources and Sharing".
I want to change the import setting because by default every texture is loaded as 32-bit RGBA, and that looks like a waste of resources. I want to change all my textures to an 8-bit RGBA BC7 format. Maybe not all my textures are compatible with this format, but it is enough for me if the ones that could be converted are actually converted because they are the vast majority. I already tried the reload and evaluate but still nothing happens.
Code: Select all
textures = rootGraph:findNodes(octane.NT_TEX_IMAGE, true)
texture = textures[1]
if(texture ~= nil) then
print("Found")
texture:setAttribute(octane.A_TYPE,10)
texture:setAttribute(octane.A_RELOAD,true)
texture:evaluate()
print(texture:getAttribute(octane.A_TYPE))
end