Some way to tell when draw-style-change is completed?

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 );
    ------------

 

Sign In or Register to comment.