Skip to main content
Brontzai
Inspiring
August 24, 2023
Question

all rendered buttons (with onDraw) disappear after opening any inline modal window after effects

  • August 24, 2023
  • 0 replies
  • 108 views

I draw buttons using the onDraw method.
After rendering and running the script, I open any modal window after effects, for example, cmd+shift+s (save as) and all my interface rendered by the onDraw method disappears
and after restarting the script, an error occurs.

"Can not run a script while a modal dialog is waiting for response"

I do not understand what could be the problem to solve it.

I know the interface can be lost if a rendering error occurs. But it was not possible to catch the error using try catch(
I so understand it is the conflict of modal windows.

I tested on different operating systems on different versions of after effects

Simple Code

 

(function (thisObj) {
 var objWinPan=thisObj;
 {
  function myScript(){
   function myScript_buildUI(){
    var w = (objWinPan instanceof Panel) ? objWinPan : new Window ('palette',"ae",undefined,{resizeable:true});
    return run_scr(w)
    }
   var myScriptPal=myScript_buildUI(objWinPan);
   if (myScriptPal != null && !(myScriptPal instanceof Panel)){
    myScriptPal.center();
    myScriptPal.show();
   }
  }
 myScript(objWinPan);
 }
 function run_scr(w) {
  w.orientation="column";
  w.margins = 10;
  w.spacing=0;
  g=w.graphics;
  var myButtonGroup5=w.add("group");
  var patchMake =myButtonGroup5.add ("button");
  patchMake.preferredSize=[100,20]
  patchMake.onDraw=function(){
   app.beginSuppressDialogs()
   with(this){
    graphics.drawOSControl();
    sze=10;
    graphics.newPath();
    graphics.rectPath(4,1,size[0]-8,size[1]-2)
    graphics.fillPath(g.newBrush(g.BrushType.SOLID_COLOR,[255/255, 0/255, 0/255]));
   }
  app.endSuppressDialogs(alert) 
  }
  w.layout.layout(true);
  return w;
 }
})(this);

 

And I suppress all possible errors in rendering

This topic has been closed for replies.