progressBar and playblast working together?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  06 June 2013
progressBar and playblast working together?

I have a large number of playblasts happening in a script. It has to happen in the current instance of Maya (for now anyways). I am trying to set up a progressBar so the user can see how much of the entire process is complete (4/18 playblasts, for example) and also cancel out if they want.

Displaying progress to the user is working okay, but other features are, of course, having trouble because the playblast command is also being called. The playblast command is hijacking the ability to use the escape key to escape the process, and it is also hijacking the status message for the progress bar (I have actually had many issues in the past with the status message just not showing for some reason, so this might not even be entirely responsible to the playblast command). The escape key will still work to cancel the current playblast but it is not cancelling out of the loop handling all the playblasts, so it will cancel the current one and then start on the remaining 15 or whatever.

Is there some other way I can go about implementing the functionality I am looking for here? Is there some way to check if Maya is "currently playblasting", for example?
  06 June 2013
I actually started off by using progressWindow instead of progressBar, which seemed to be working better for what I wanted. Displayed the status message just fine, escaped the current playblast as well as all future playblasts. The problem with the progressWindow was that another plugin I am calling during this process, and unfortunately do not have the source code for, is also bringing up a progressWindow. Since only on progressWindow can exist at a time, it is killing mine, showing for about half a second, then disappearing without bringing mine back.

I was thinking a possible solution would be to create a Python decorator that would store the current state of the progress window, call the command that kills it, and then restore it afterwards with the same settings. Unfortunately there is no clear way to determine whether the progressWindow is currently active and showing (I don't want to bring it back if it wasn't showing in the first place). Whenever I query any of the flags for the progressWindow command it returns whatever the last value of it was. There is nothing telling whether or not it is active and showing or not. The only other thing I could think of was going through all the scriptedPanels, or whatever it is classified as, and see if I can find it in there. I can't recall how to do this though.

Another option is to create my own progress window in PyQt. I would just rather not be re-writing something that already exists, and also sucks to be bringing in a dependency on PyQt when it really shouldn't be required.
  07 July 2013
Since I just fought with playblast today here's what I did to check if the user interrupted the playblast:
Create a temporary cmdScrollFieldReporter and check it's output for mayas warning text "Playblast was interrupted. File still created but may be incomplete."
If you find this after a blast, stop your loop, since escape was pressed.

tempWindow = window()        
tempReporter = cmdScrollFieldReporter(width=200, height=100)   
cmdScrollFieldReporter(tempReporter, e = 1, clear = 1, fst = "", sw = 0)          
#do the actual blast        
playblast( ...)                      
#check the printed messages         
text = cmdScrollFieldReporter(tempReporter, q = 1, text = 1)  
if text.find("Playblast was interrupted. File still created but may be incomplete.") > -1:            
 #escape here        

Not nice, but works.

Last edited by colt : 07 July 2013 at 04:07 PM.
  07 July 2013
Awesome, thanks. I will be giving this a try.
  07 July 2013
Just wanted to reply and say it worked like a charm. Thanks!
  07 July 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:57 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.