Wait for textures to load before executing script in maya

Anybody figured this one out? I’m trying to batch playblast multiple maya files but it playblasts without textures displayed because their loading is deferred. I first tried using evalDeferred, but that doesn’t work if the meshes with the textures aren’t visible before the playblast starts. Maybe there’s a way to query if a texture node has been loaded?

I haven’t tested this but what if you attached your playblast command to a scriptJob that was set to execute on the “idle” event? Or on conditionFalse for the “busy” condition?

I would imagine those would only be triggered after textures had been loaded but that’s just a guess.

Thanks but I need something that guarantees that they’re loaded in case something is hidden at the start of the sequence, or out of frame.

I don’t know of a way to force textures to load besides making them visible in the viewport. As a brute force method you could play through the timerange first and then playblast afterwards to ensure everything that will be seen has been seen.

Also how are you managing to playblast in batch mode without a UI for it to get screengrabs from?

Maybe just script a hardware render?

Yeah Theodox+ There is a great little bit of code that you can use to render a swatch, that would force textures to load.

So… Found this while looking for solution to the same problem. What is that bit of code? :smiley:

Posted one possible solution here:

Posted one possible solution here: