Expressions/Scripts/Presets

Moderator: byronnash

 
Navstar
Topic Author
Posts: 68
Joined: Mon Feb 16, 2009 12:41 pm

Global quality switch to Draft?

Tue Mar 17, 2015 5:42 pm

Is there a script to globally control the quality switch of all layers in all (selected) comps?

I'm dying with a 4K project and would like to turn everything to Draft quality while I'm assembling layers together (without having to open every comp and flick all the switches)

Screen Shot 2015-03-17 at 5.49.05 PM.png
Screen Shot 2015-03-17 at 5.49.05 PM.png (12.13 KiB) Viewed 2564 times
 
Dan Ebberts
Posts: 319
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Global quality switch to Draft?

Wed Mar 18, 2015 10:36 pm

I think this will work:

var myComps = app.project.selection;
var myComp;
for (var i = 0; i < myComps.length; i++){
   myComp = myComps[i];
   if (! (myComp instanceof CompItem)) continue;
   for (var j = 1; j <= myComp.numLayers; j++){
      try{
         myComp.layer(j).quality = LayerQuality.DRAFT;
      }catch(err){
      }
   }
}


Dan
 
Navstar
Topic Author
Posts: 68
Joined: Mon Feb 16, 2009 12:41 pm

Re: Global quality switch to Draft?

Fri Mar 20, 2015 11:01 am

Thanks Dan! Top notch!
 
Navstar
Topic Author
Posts: 68
Joined: Mon Feb 16, 2009 12:41 pm

Re: Global quality switch to Draft?

Sun Mar 22, 2015 11:16 am

Would it be a big deal to add code for it to work on nested comps too?
 
Dan Ebberts
Posts: 319
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Global quality switch to Draft?

Sun Mar 22, 2015 11:38 am

That's a little trickier, but I think this works:

var myComps = app.project.selection;
var myComp;
for (var i = 0; i < myComps.length; i++){
  myComp = myComps[i];
  if (myComp instanceof CompItem){
    setLayers(myComp);
  }
}

function setLayers(theComp){
   for (var i = 1; i <= theComp.numLayers; i++){
      try{
         theComp.layer(i).quality = LayerQuality.DRAFT;
      }catch(err){
        continue;
      }
      if (theComp.layer(i).source instanceof CompItem){
        setLayers(theComp.layer(i).source);
      }
   }
}



Dan

Who is online

Users browsing this forum: No registered users and 3 guests