Closed hsouders closed 3 years ago
We talked about this a long time ago, but I don't remember what they final decision was.... should these PRs merge into a dev branch? Also, I wasn't sure who to mark as a reviewer.
Maybe it's just my machine, but I have the same problem as when I tried - I can never get the 'esc' key to work unless I add a delay statement (which I don't want to do because it artificially slows down export). I'm on a Macbook Pro which has the escape key on the touch bar, so maybe that's why. It just seem like Maya doesn't have enough time to register the event. So maybe it's better with a physical escape key. I even tried only checking every 5%, but that didn't do the trick either.
In any case, as long as it works for some people some of the time, it's probably worth keeping in there?
On the note of performance, instead of using export_progress != prev_progress
, we could use something like export_progress % 5 == 0
to only update every 5%. Thoughts?
On the dev branch - seems like a good idea. I just made a branch dev_main
for us so moving forward you should be able to pick that to merge into when you submit the PR (it doesn't seem like there's a way for me to change that on my end)
@hsouders So I tried on my Windows virtual machine and it worked like a charm - so must be something on the Mac side. Definitely worth publishing in my opinion. Hopefully it's more consistent on other people's macs though. Thanks for taking this one!
That's interesting about Maya on a Mac... My hunch is that your Mac isn't sending the key repeat signal fast enough? I've noticed on my PC I sometimes need to hold down the Esc key to cancel. It seems like Maya is dropping OS key events... another weird Maya-ism.
Regarding performance, I don't know if any additional optimization is worth it. In my test, I saved ~.5 sec by avoiding 900 progressWindow updates, which means that an update call is roughly 5.5e-4 secs. Right now we're limiting the progressWindow update to 100 updates per export (every 1%) - this only costs us .055 seconds total. If we only update 20 times (every 5%), our total cost is only 0.011 seconds. Not a huge savings.
Also, if you had rejected the branch, we could have merged into dev instead. If you want to revert the main branch, we can still do this, and I can open a PR for dev - happy to do this if you'd like. Also, don't feel like you have to accept the pull request right away.. there's no problem leaving it open and having a discussion + making revisions before accepting/rejecting it.
Yeah super weird. At least it'll work for some people some amount of times
Good call on the performance, I just reverted it back to your original 1% increments.
I ended up accepting it into the main branch then pushed those back into the Dev branch this time, so it's all good. And now that that branch exists we should be good moving forward
Tried unsuccessfully to use the progress bar API to cancel an export. Per Maya docs, it's only possible to interrupt Maya's main progress bar (not the progress bar inside the Mimic window), but I wasn't even able to get that to work.
The only solution I found was to use a progress window instead of a progress bar. Users can press 'Esc' to cancel path saving/analysis. It's not super responsive, but it works. I also changed the progress update behavior to only update the Maya UI when there was visible progress being made (ie: 5% -> 6%, but not 5% -> 5.1%). This seemed to speed up my test scene export by about 10%. I'm sure this is a best case situation, and I would assume that more complex scenes would see very little performance improvement.
Resolves #15