Thursday, January 20, 2011

Maya caching UI images?

I'm curious if anyone else doing Maya UI development has noticed that Maya will cache images used in UI elements, and not refresh them if the image data changes. I haven't done a thorough test to see if it's specific to certain image formats, as I'm only using XPM files, but this problem has been there for ages. If you haven't seen it in action, try this:
  • Make a small image (100 x 100 is good) in your favorite image editing application, and save/export it in XPM format.
  • Script a simple Maya interface that assigns this image to a control, like the iconTextButton. Open your UI and confirm that the image displays correctly.
  • Go back to your image editing app, make some obvious change to the image, and save/export it with the same name as before.
  • In Maya, reload your UI, and you should still see the original image, without the change you just made.
  • Restart Maya and load your UI again. The changed image should appear this time.
I've tried a number of things in an attempt to work around the problem, but it appears that the only way to force Maya to see the change in the image file is to close it and re-open it. Not exactly the most productive option.

If the test above doesn't operate as described for you, I'd love to hear about it. Post the Maya version and OS that you're using. I'm curious if there's a pattern to this problem. I'd also appreciate hearing if you know of any proven work-arounds.