Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Bitmaptexture.alphaSource always return 0 before I clicked the texture in the MaterialEditor, is it a bug?
Solved! Go to Solution.
Bitmaptexture.alphaSource always return 0 before I clicked the texture in the MaterialEditor, is it a bug?
Solved! Go to Solution.
This cannot be called a bug, although there is certainly uncertainty. 😀
I already explained this problem on the "now defunct" CGTalk...
In a nutshell:
- when a BitmapTexture is created, its default alpha source is defined as "what the image file says" - 0.
- but as soon as you upload it for editing, the system reads the actual alpha state from the file.
- and if the system finds out that there is no alpha...
- sets None(Opaque) - 2 (according to UI numbering).
So, to know "what the alphaSource will be" without editing the texture, you need to look to see if alpha is available in the file. If yes, then 0, if no, then 2.
Yes, it sounds pretty weird and complicated, but that's the way it's always been.
@denisT.MaxDoctor Thanks for the quick response!
But what if a png file (which alpha is avaliable) manually set to `None(Opaque)` ? It should return 2 rather than 0, then how can I get the real state before editing? 🤣
There is no problem with this. If alphasource has been set programmatically or manually, the value can be directly get via MXS.
By the way... the easiest way to check if alpha is available is to check #hasalpha of the texture bitmap
When you create a new BitmapTexture in Max Script, its alphaSource always returns 0 until you click it in the Material Editor to display the UI, after which it changes to 2 (None). I believe this is indeed a bug because the default value of alphaSource for BitmapTexture should be consistent with the UI, which should be 2.