Hi
does anybody know an expression/script to turn on/off the above mentioned properties.That would be quite useful.
cheers
This simple example script turns off accept lights and shadows for selected layers (it assumes those properties haven't been keyframed):
{
var myLayers = app.project.activeItem.selectedLayers;
for (var i = 0; i < myLayers.length; i++){
myLayers[i].acceptsShadows.setValue(false);
myLayers[i].acceptsLights.setValue(false);
}
}
Dan
Hi Dan
thx for that.
i'm trying to create a dockable panel for this script.
basically i'd like only 2 buttons=> accept shadows >option with on or off
accept lights>option with on or off
//that's what i have so far
function createUI(thisObj) {
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "My Tools",
[100, 100, 300, 300]);
myPanel.add("button", [10, 10, 150, 30], "Accept Shadows on");
return myPanel; }
var myToolsPanel = createUI(this);
How can i add more buttons to this?
How can i make the buttons run the script?
cheers
Something like this should get you headed in the right direction:
{
function shadowsOn(){
var myLayers = app.project.activeItem.selectedLayers;
for (var i = 0; i < myLayers.length; i++){
myLayers[i].acceptsShadows.setValue(true);
}
}
function shadowsOff(){
var myLayers = app.project.activeItem.selectedLayers;
for (var i = 0; i < myLayers.length; i++){
myLayers[i].acceptsShadows.setValue(false);
}
}
function lightsOn(){
var myLayers = app.project.activeItem.selectedLayers;
for (var i = 0; i < myLayers.length; i++){
myLayers[i].acceptsLights.setValue(true);
}
}
function lightsOff(){
var myLayers = app.project.activeItem.selectedLayers;
for (var i = 0; i < myLayers.length; i++){
myLayers[i].acceptsLights.setValue(false);
}
}
function createUI(thisObj) {
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "My Tools", [100, 100, 300, 300]);
myPanel.shadowsOnBtn = myPanel.add("button", [10, 10, 150, 30], "Accept Shadows on");
myPanel.shadowsOffBtn = myPanel.add("button", [10, 50, 150, 70], "Accept Shadows off");
myPanel.lightsOnBtn = myPanel.add("button", [10, 90, 150, 110], "Accept Lights on");
myPanel.lightsOffBtn = myPanel.add("button", [10, 130, 150, 150], "Accept Lights off");
myPanel.shadowsOnBtn.onClick = shadowsOn;
myPanel.shadowsOffBtn.onClick = shadowsOff;
myPanel.lightsOnBtn.onClick = lightsOn;
myPanel.lightsOffBtn.onClick = lightsOff;
return myPanel;
}
var myToolsPanel = createUI(this);
myToolsPanel.show();
}
Dan
North America
Europe, Middle East and Africa
Asia Pacific
Copyright © 2012 Adobe Systems Incorporated. All rights reserved.
Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).