The freeze is likely because the process you are calling is blocking and After Effects is waiting for it to finish. It likely won’t unfreeze when you close the GUI either, because of the raw_input() holding onto the process until you hit enter.
Does it unfreeze when you close the Pyblish Standalone terminal?
My thoughts are that we could have function that accepts a string for execution. You could then execute a ExtendScript string and get all the data you want.
If anyone know ExtendScript I would appreciate help on this, but will update here as I go along:)
Should be pretty much the same. Don’t know where the two differ, but its Adobe’s Java flavour.
I guess they have pretty much just added some variables for interacting with the AE products.
Good thing is that if we can crack this, it should open up for all Adobe products.
Locking AE shouldn’t be a problem. In practice, when the publishing dialog pops up, it would simply appear to have taken priority. Like most dialogs in AE anyway.
Secondly, I’m sure there is a way to not have it lock. Javascript is a highly asynchronous language, should just be a matter of finding the right callback in place for the while loop you’ve got there.
Thirdly, I was sure there already was already a way of connecting to an Adobe app, without starting a server. If it’s anything like Photoshop, then these might help.
I can’t remember why I abandoned the com interface, but I did investigate it the last time. Note to self, to make notes to self:)
There is one problem I might forsee which is that you can have multiple instances of AE running with the -m command flag.
Also using win32com module I’m guessing limits it to Windows?
Run the server.jsx, which will launch pyblish-lite and go into server mode.
I had to make pyblish-standalone accept an optional “–port”.
Now the problem is how to stop AE serving again, when done :s Guessing this is where I’ll get into similar issues as with pyblish-qml not shutting down correctly etc.
Thinking I might be able to send a “stop server” command when closing down pyblish-lite. Will just be a problem if the user closes the terminal window first.
That could be a problem, if the COM interface doesn’t let you specify a target connection or if Adobe hasn’t put something in place to let you choose a target at run-time. I would be surprised if at least one of those wasn’t true.
That’s a good point, that does sound likely. But again, I wouldn’t be surprised of they had something similar in store for OSX.
Yes, welcome to my world.
As with QML, I would first try and find a way in which you don’t need to have it shutdown on closing the GUI. See if there’s any way of having your server run asynchronously.
Once you’re sure there isn’t a way, then the only reliable way I know is to start dealing with heartbeats. Having the server continuously ask “is there a client? is there a client? …” And once the GUI isn’t there to reply, shutdown.
It’s ugly (I think) but such a common and accepted practice that you’ll find plentiful of resources about how to go about it online. Especially with a Javascript server, which is what frameworks like Node.js is all about.
It just has to wait for something, as otherwise the process quits when showing the GUI, which would kill the GUI immediately.
You’ll just need to find a way of having a window show and block, so that closing it means “go ahead to the next line”, where the next line is quitting the process.
For pyblish-lite, that might be setting a window flag. For pyblish-qml, that might involve forwarding the close-event into something you can listen or wait for. The point being, the blocking mechanism will differ across GUIs.
I’ve tried a test where I called the the GUI to show and on the next line called the something else like stopping the ae server.
It worked fine. The GUI was showing and I could continue to refresh. When I closed the ui, the terminal closed as well.
Now I don’t know whether there is some code in pyblish-lite that keeps the instance of the ui going, and if other uis would close immediately?
I’ve got a working version now that I’m going to roll with. Have limited time to experiment
Its working quite nicely now. The user aren’t presented with a terminal window by using start pythonw, this prevents them from closing the terminal window before closing the pyblish-lite ui.