-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathsetExpressionToPaths.jsx
56 lines (47 loc) · 1.78 KB
/
setExpressionToPaths.jsx
1
//setting one expression to all pathsvar shapeWorksSetStrokeExpression = this;shapeWorksSetStrokeExpression.go = function(expr){ var activeComp = app.project.activeItem; if(activeComp && activeComp instanceof CompItem){ var sel = activeComp.selectedLayers; if(sel.length > 0){ for(var s = 0; s < sel.length; s++){ if(sel[s] instanceof ShapeLayer){ $.writeln( sel[s].property("ADBE Root Vectors Group") instanceof PropertyGroup) sel[s].property("ADBE Root Vectors Group").setStrokeExpression(expr); } } } }}PropertyGroup.prototype.setStrokeExpression = function(expr){ if(this.property("ADBE Vector Graphic - Stroke")){ //if we found a strokename this.property("ADBE Vector Graphic - Stroke").property("ADBE Vector Stroke Width").expression = expr; } else{ for(var i=1;i<=this.numProperties;i++){ var curProp=this.property(i); if(curProp instanceof PropertyGroup){ curProp.setStrokeExpression(expr); } } }}AVLayer.prototype.findEffectByName = function(_name){ //looks for an effect with given name inside given layer var eff = this.property("ADBE Effect Parade"); for(var e = 1; e <= eff.numProperties; e++){ if(eff.property(e).name == _name) return eff.property(e); } return null;}AVLayer.prototype.setSlider = function(_name, _value, _expression){ //adding a slider to the layer var sl = this.property("ADBE Effect Parade").addProperty("ADBE Slider Control"); sl.name = _name; sl.property("ADBE Slider Control-0001").setValue(_value); sl.property("ADBE Slider Control-0001").expression = _expression; return sl}shapeWorksSetStrokeExpression.go();