Some way to tell when draw-style-change is completed?
![bluelake_2cfb0bd048](https://secure.gravatar.com/avatar/c505671e0206fa252fb599ff07d3da57?&r=pg&s=100&d=https%3A%2F%2Fvanillicon.com%2Fc505671e0206fa252fb599ff07d3da57_100.png)
As part of my workflow, I produce a filament render that I combine with the regular render in postwork. I have the code below to switch to filament rendering, and then to kick off a render. But I often get strange colors since the switch over to filament has not completed yet.(And if I cancel it and restart the render, it does so correctly then.)
Is there some callback or message or value I can poll to tell when the switch to filament is complete after setUserDrawStyle? So that I can synch the render up to kick off then?
Thank you in advance for any help!
-- John
------------
var oViewportMgr = MainWindow.getViewportMgr();
var oViewport = oViewportMgr.getActiveViewport();
var o3DViewport = oViewport.get3DViewport();
var sDrawStyle = o3DViewport.getUserDrawStyle();
o3DViewport.setUserDrawStyle( "Filament (PBR)" ); // set to fila
var oRenderMgr = App.getRenderMgr();
var oRenderOptions = oRenderMgr.getRenderOptions();
var nRenderType = oRenderOptions.renderType; // 0=Viewport, 2=3Delight
oRenderOptions.renderType = 0; // set to viewport
sleep(1000); // sometimes 1 second is enough, often it's too short -- how to synch render with completion?
oRenderMgr.doRender( oRenderOptions );
------------
Comments
There is a signal here http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/3dviewport_dz#a_1a9e49fa3a5b75ae572435d4fe053bc463 , belonging to Dz3DViewport. You can, as you may be aware, use DzCallback to listen for the signal http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/callback_dz . This sample script demonstrates the methods http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/elements/callbacks_element_post_load_create/start . Note that you will want to clean up after finishing.
Thank you, Richard -- these examples look perfect to follow!