Wait for textures to load before executing script in maya


#1

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?


#2

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.


Force load textures in viewport, batch playblast
#3

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.


#4

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?


#5

Maybe just script a hardware render?


#6

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


#7

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


#8

Posted one possible solution here: