script to toggle cast shadows ON / OFF throughout project?

What type of scripts do you need?

Moderator: byronnash

Post Reply
Varangian
Posts: 38
Joined: December 16th, 2004, 11:15 am

May 25th, 2012, 12:26 pm

this would be awesome!
User avatar
AlexG
Posts: 4
Joined: June 2nd, 2012, 10:08 am

July 2nd, 2012, 4:54 am

Works with selected layers.

Select layers and click on checkbox.

Here you are:

Image

Code: Select all

function mainFun() 
{

    this.windowRef = null;
}


mainFun.prototype.run = function(){
    
   var retval = true;
   var win = new Window("palette", "On/Off Shadows", [150, 150, 460, 350]);
   this.windowRef = win;

    
   win.checkPanel = win.add("panel", [25, 25, 285, 140], "Cast Shadows");
   win.checkPanel.chkOne = win.checkPanel.add("checkbox", [10, 15, 125, 35], "On/Off Shadows");
   //win.checkPanel.chkTwo = win.checkPanel.add("checkbox", [10, 45, 250, 65], "Current layers (reserved)");
   //win.checkPanel.chkThree = win.checkPanel.add("checkbox", [10, 75, 250, 95], "All layers (reserved)");
     win.quitBtn = win.add("button", [110,160,200,180], "Close");
     

//win.checkPanel.chkTwo.enabled = false;
//win.checkPanel.chkThree.enabled = false;

win.checkPanel.chkOne.onClick = allLayers;

function allLayers () {

if (win.checkPanel.chkOne.value == false){

var curItem = app.project.activeItem; 
for (var a = 1; a <= curItem.numLayers; ++a){
var curLayer = curItem.layer(a);
if (curLayer.selected){

var shad = curLayer.property("ADBE Material Options Group").property("ADBE Casts Shadows");

var  pp = shad.setValue(0); 
}
}
    }else{
var curItem = app.project.activeItem; 
for (var a = 1; a <= curItem.numLayers; ++a){
var curLayer = curItem.layer(a);
if (curLayer.selected){


var shad = curLayer.property("ADBE Material Options Group").property("ADBE Casts Shadows");

var  pp = shad.setValue(1); 
}
}
}
}
win.quitBtn.onClick = function() { 
       win.close(); 
   }

    win.center();
   win.show();
    
   return retval;
   
}

if(typeof(mainFun_unitTest) == "undefined") {
    new mainFun().run();
}
Last edited by AlexG on July 3rd, 2012, 2:27 pm, edited 1 time in total.
aw-Autosaver powerfull Auto-Save replacement
sahara
Posts: 3
Joined: August 12th, 2010, 1:50 am

July 3rd, 2012, 11:10 am

hi here is one for Cast Shadows,Accepts lights,Accepts shadows

http://digitalvideoschnitt.de/forum/ado ... cript.html
Post Reply