Page 1 of 1

Global quality switch to Draft?

Posted: March 17th, 2015, 5:42 pm
by Navstar
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 14965 times

Re: Global quality switch to Draft?

Posted: March 18th, 2015, 10:36 pm
by Dan Ebberts
I think this will work:

Code: Select all

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

Re: Global quality switch to Draft?

Posted: March 20th, 2015, 11:01 am
by Navstar
Thanks Dan! Top notch!

Re: Global quality switch to Draft?

Posted: March 22nd, 2015, 11:16 am
by Navstar
Would it be a big deal to add code for it to work on nested comps too?

Re: Global quality switch to Draft?

Posted: March 22nd, 2015, 11:38 am
by Dan Ebberts
That's a little trickier, but I think this works:

Code: Select all

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