Force load textures in viewport, batch playblast


#1

I’m trying to batch playblast a lot of maya scenes, but it does not wait for textures to load.

Is there a way to force Maya’s VP2.0 to load textures before proceeding with the script?

I could just use render instead of playblast, but I would really not like to go down that road.

I saw this thread: Wait for textures to load before executing script in maya but there’s an incomplete answer.


Wait for textures to load before executing script in maya
#2

In case anyone’s interested, this hacky way seems to do the trick:

cmds.modelEditor(panel, e=True, dtx=False)
cmds.refresh(f=True)
cmds.modelEditor(panel, e=True, dtx=True)
for i in range(0, 10):
    log.debug("Refresh", i)
    cmds.refresh()

Turns texture display off then on, and refreshes the viewport a few times. I tried just once - did not work. 10 might be too much, seems like 2-5 times is enough.

Still hope to find a better way.


#3

Hi Nix!

Instead of playblasting you can render your scene(s) with the “Hardware 2.0” renderer (which is just the viewport renderer). So you can make all your desired Render settings and kick of a “Batch render”. This might fix your texture issues.
Hope that helps a little bit. :slight_smile:

Cheers,
Fabian


#4

Hi, Fasbue, thanks for reply!

Yes, I thought about it, but it’s just much easier to run a playblast, which can also include viewport HUD information which may sometimes be needed, as well as whichever Background is set in viewport.

Adding those manually would take more script development time and render time in the end, which is crucial when you need to playblast 100+ files now and then.