Copy link to clipboard
Copied
Hi All,
There is a change in AE 2015 where two separate threads where presented: UI thread and Rendering thread.
Here is my issue:
Let's take a Panelator project as example.
- I've a window with a button.
- The click on this button is recognized as part of an idle hook function
- This idle hook function called within the UI thread.
The question is:
- If I would like to render as a response to "Click Me" button. How can I do it?
Whenever the button action performs any lengthy operation the AE hangs.
Right now, I perform a rendering as a response to the click, but it's not a correct way to work in AE 2015.
So, what is the right way to do it in AE?
Copy link to clipboard
Copied
some thoughts:
1. is the AEGP doing the render, or is it triggering some effect render on
a layer?
2. if you're checking out layer pixels there are some async checkout
methods in 2015 that are specific for UI thread use.
Copy link to clipboard
Copied
Hi,
The AEGP does the rendering.
It places several items into a render queue and then updates the Start Rendering flag.
The rendering is done by our propriety output module, but I don't think it's related somehow to the UI/Render thread issue.
Copy link to clipboard
Copied
sooo... where does the hang happen?
what does it show if you pause the process during a debug session?
Copy link to clipboard
Copied
The hang happens cause I do not return from my idlehook function.
I've to perform a long rendering while my "click me" button pressed down and while I'm not done the AE is not responsive to any other UI actions.
When I pause in the debug process, I basically see nothing, as currently the rendering code performed somewhere in the output module.
For the sake of simplicity, let's assume that I make a request to render current layer to an mp4 video.
Copy link to clipboard
Copied
dumb question:
do you have to have the render finish before you return from the idle hook?
Copy link to clipboard
Copied
Yes.. that would be a preferable solution.
Copy link to clipboard
Copied
for the sake of experiment, can you try returning from the idle call? just
to see if it still hangs.
Copy link to clipboard
Copied
It's not.
I see the issue only when I try to render some length compositions.
On short ones, everything works as a charm.
(Btw, it works this way in AE 2014, and as there are no UI/Render threads there, I don't see any issues)
Copy link to clipboard
Copied
there might not be a different solution...
on 2015 there are multiple copies of the project. the UI thread updates the
render thread's project after a change is made. perhaps not returning from
the idle call prevents AE from updating the render thread's project.
unless you can provide some more debug info, for instance what's the last
line executed on the UI thread before the hang, then i can't suggest
another solution.
Copy link to clipboard
Copied
I can provide any debug info you need:
The last line executed is:
renderQueueSuite->AEGP_SetRenderQueueState( AEGP_RenderQueueState_RENDERING )
Copy link to clipboard
Copied
and the following line never gets executed?
Copy link to clipboard
Copied
Probably I explained myself badly.
It is. It gets executed whenever the actual rendering is finished.
However, it can take several minutes and meanwhile the UI is stack..
Copy link to clipboard
Copied
Shachar?
Any ideas on how I can request async calls to render staff?
Copy link to clipboard
Copied
good question...
it might be a design flaw in 2015, that made this call not return until the
queue finishes. i honestly don't have a solution for that.
you might want to contact Zac Lam with this issue.
Copy link to clipboard
Copied
Can you send me his contacts details in the private message, please?
Copy link to clipboard
Copied
Hi Yuri,
Most likely you're looking for a way to get this working in the current version, not waiting for a future update to get this working again.
Taking a step back... - You have an AEGP to export to your own proprietary format. And you have a custom panel to drive exports to this format. Panels can be developed using either the plug-in API, or using the HTML5 panel API. If you were to use an HTML5 panel, you could have a script that adds the Comp to the Render Queue, applies any settings you wish, and starts the render queue. Alternatively, you could call such a script from a plug-in panel using AEGP_ExecuteScript(). I may be missing several requirements of your project, but I wanted to step back to make sure we're not missing another path that could be achievable in the current version of AE.
Cheers
Copy link to clipboard
Copied
Hi Zac,
Yes, I'm trying to get this working with the current 13.5(.1) SDK.
Yes, you're right about my setup. I've a custom panel (developed using plug-in API) and propriety format I'm exporting into it.
Yes, I can use a script to execute the rendering logic, but I don't see it as a preferable solution because:
- I don't see how executing a script can help me to solve the issue of blocking UI thread (AEGP_ExecuteScript() is a synchronous operation)
- Sometimes, there're conditions where scripts do not work. Those condition are not documented and personally, I prefer not to base a business logic on a pure lack.
Please, tell me if you need additional information about my setup.
From your message: are there any planned future updates that introduce asynchronous rendering API?
Copy link to clipboard
Copied
Hi Yuri,
Ah, you're right about the scripting call RenderQueue render() being synchronous also.
Yet another approach is to use the command line application aerender to render a comp in a project.
Yes we'd like to make more of these calls asynchronous going forward. In the meantime, there should be a way forward in the current version.
Copy link to clipboard
Copied
Hi Zac,
Let me restate your answer once again to make sure I understood it correctly.
Currently, there is no support for asynchronous rendering in AEGP and this support is planned in the following update (updates). If this is correct, do you've an estimation for the update release dates?
I can make asynchronous rendering using an external tool/process aerender (with the script you provided). The question about this script is as follows:
- Is AEGP working on it's own copy of the project or the main project?
- Assuming I create temporary compositions for rendering.... can the external renderer still render this temporary data?
Copy link to clipboard
Copied
Hi Yuri,
AEGPs work on the actual project itself.
Whatever you render using aerender would need to be saved as an AEP project file. So you could create temporary comps for rendering, but it would need to be saved in the AEP.
Copy link to clipboard
Copied
More on scripting... here is some code that starts the render queue, and defines callback functions that are called when the render queue item status changes:
var done = false;
var queue = app.project.renderQueue;
var rqitem = queue.item(1);
rqitem.onReorder(function (theItem) {
$.writeln("reordered!") ; });
rqitem.onStatus(function (theItem, status) {
$.writeln("status: " + status) ;
});
rqitem.onComplete(function (theItem) {
my_file = theItem.outputModule(1).file;
$.writeln("completed: " + my_file.toString()) ;
this.done = true;
});
queue.renderAsync();
$.writeln("Waiting for render to complete");
while (!done) {
$.sleep(20);
}
$.writeln("OK, we're done");
Copy link to clipboard
Copied
Thanks, Zac!
Copy link to clipboard
Copied
I wonder regarding this async functionality.
From what I can see on my platform:
- queue.renderAsync(); // not supported on AE 2014 (function not found)
- queue.renderAsync(); // supported on AE 2015, but the function is still blocking
Any ideas?