[MtoA] MayaFile node uses a default color for missing textures

Here’s something important to remember when you’re debugging a scene…

By default, the MayaFile node uses a default color if a texture is missing.


This means the render won’t abort because of missing textures, and you won’t see ERRORs like these in the Arnold log for missing texture files:

ERROR   |   [texturesys] OpenImageIO could not open "sourceimages/noicon.tx" as tx: Could not open file "sourceimages/noicon.tx"
ERROR   |   [texturesys] Invalid image file "sourceimages/noicon.tx"

So missing textures can easily go unnoticed.

If you need to disable Use Default Color for testing, an easy way is to export an ASS file and then render it with kick -set MayaFile.useDefaultColor false.

I suppose you could also modify the Maya scene file directly:

import maya.cmds as cmds
import os

def set_useDefaultColor(b):
    for item in filenodes:
        cmds.setAttr( "%s.aiUseDefaultColor" % item, b )

set_useDefaultColor( False )

And finally, you can change the default value of the Use Default Color parameter by adding this to shaders/mtoa_shaders.mtd:

[node MayaFile]
	[attr useDefaultColor]
		default		BOOL	false

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s