Copy link to clipboard
Copied
Hello. Guys, i don't understand how can i get access to Fill property in JS.
Pls, Help. I want to disable it with the code.
Copy link to clipboard
Copied
This property and value is written in one of the Preference files - find all the prefs files and look for that property.
Unless you need to change the Fill color of the Shape layer, which is a totally different thing.
Copy link to clipboard
Copied
//Unless you need to change the Fill color of the Shape layer, which is a totally different thing//
Yes, but my shape layer is a text and he has many sub shapes, and i can't find a solution to select them all. Becouse each subshape has his own position of Fill property.
Copy link to clipboard
Copied
Well, it's not a Text layer, but a Shape Layer.
To change the Fill effect of each group inside the Shape layer, you need to iterate through all the groups and set Fill value separately.
Here's a basic example that will change all Fill colors
(function() {
var composition = app.project.activeItem;
if (!composition || !(composition instanceof CompItem)) {
return alert('Please select composition first');
}
var layer = composition.selectedLayers[0];
if (!layer) {
return alert('Please select a layer');
}
app.beginUndoGroup('Set fill Color');
setFillColor(layer, [0.123, 0.456, 0.789]);
app.endUndoGroup();
function setFillColor(baseProperty, color) {
var property;
for (var i = 1, il = baseProperty.numProperties; i <= il; i++) {
property = baseProperty(i);
if (property.propertyType === PropertyType.PROPERTY && property.matchName === 'ADBE Vector Fill Color') {
property.setValue(color);
} else {
setFillColor(property, color);
}
}
}
})();
Copy link to clipboard
Copied
Thanks, i try this!!