View Full Version : Bug or script error? Texture reload removes transparency

08 August 2012, 01:02 PM
I've downloaded a script for reloading all textures in the scene. This way I can do whatever changes I need in Photoshop, save the stuff with my action - one button - and click one button in Maya to get all the textures reloaded.

This is the script:
string $textureName;
string $fileSelected[];

$fileSelected = `ls -sl -type "file"`;

if ((size($fileSelected)) == 0)
$fileSelected = `listConnections defaultTextureList1`;
select $fileSelected;
$fileSelected = `ls -sl -type "file"`;

for ($i = 0; $i < `size $fileSelected`;++$i)
$textureName = `getAttr ($fileSelected[$i] + ".fileTextureName")`;
setAttr -type "string" ($fileSelected[$i] + ".fileTextureName") $textureName;
print("\nUpdated: ");

select -cl;
For some unknown reason, this script removes the transparency display in the viewport on some meshes. All of these meshes uses the same material and texture source.
I've tried making a new material from scratch and reassigning everything (texture and material->object). I've also split and combined the meshes to make sure there's no corruption.
And the strangest thing is that I have other alpha textures in the scene, and they are not affected.

So now everytime I press refresh, it's just like I took "break connection" on the transparency attribute of the material. BUT, according to the graph editor - the material is unchanged.
Is this just a display bug?

Note: The texture is a PNG - so it doesn't have an alpha channel. NOTHING is wrong with the texture! Alpha works as it should when I make the material from scratch - but disappears on texture reload.

08 August 2012, 01:50 PM
dumb question, but have you tried reloading the texture after modification using the Reload Button in the Attribute Editor?

try to isolate the problem as much as possible by ruling out other workflows.

08 August 2012, 02:49 PM
What do you mean by modify it? In Photoshop or Maya?

Workflow is like this:
I create a new material, assign it to the mesh, assign my texture (24bit PNG) to my material. Viewport displays the semi-transparenty just as it's supposed to do. I hit reload, script is run, and the semi-transparency disappears in the same way as it does if you were to right click "transparency" and break the connection - although the connection -is- still there according to well... everything but the viewport :P

Viewport 1 as well so it's not some viewport 2 thingie.

One theory is that it's some memory bug. I can't use my isolate select -script either for some reason (even though I know it DOES work).

08 August 2012, 03:11 PM
That script works fine with my png's here (Maya 2013 win64).

Any chance of an example scene/texture for further testing? :)

08 August 2012, 03:19 PM
I tried to reproduce your problem in maya 2013 (windows) using 3 different PNGs from here

I mapped them to color and transparency of a lambert and a phong and applied the materials to different surfaces. I could not reproduce the problem. Both transparency and isolate select worked before and after setting the fileTextureName attribute (both to the same and different files)

I have to add that I have had problems with transparency in PNG's when using the mentalray renderer, so I stopped using them years ago, and have therefore never tried with vray.


08 August 2012, 03:26 PM
I'm getting more and more convinced this is just some display bug: the things even work in the game so obviously it's Maya who "believes" that the alpha is ****ed or something... silly Maya :rolleyes:

Unfortunatly I'm stuck with PNG because that's the image format we use for our game so...
And 99% of the stuff we create are for real-time rendering anyways so whatever Mentalray issues might arise from PNG-use, I have not experienced them. Thanks for trying to help though.

CGTalk Moderation
08 August 2012, 03:26 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.