Page 1 of 1

script to toggle cast shadows ON / OFF throughout project?

Posted: May 25th, 2012, 12:26 pm
by Varangian
this would be awesome!

Re: script to toggle cast shadows ON / OFF throughout projec

Posted: July 2nd, 2012, 4:54 am
by AlexG
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();
}

Re: script to toggle cast shadows ON / OFF throughout projec

Posted: July 3rd, 2012, 11:10 am
by sahara
hi here is one for Cast Shadows,Accepts lights,Accepts shadows

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