Skip to content

Commit 135a2cf

Browse files
author
Nik Ska
committed
no message
1 parent 45b679f commit 135a2cf

13 files changed

+160
-3
lines changed

LongShadow.ffx

34 KB
Binary file not shown.

TextPlate.ffx

35.6 KB
Binary file not shown.

addRoundedShape.jsx

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Just adds a blank shape object with rounded Line Cap and Line Join
3+
Exclusively for Al Medwedsky
4+
5+
CC-BY, Nik Ska, 2014
6+
*/
7+
8+
var addRoundedShape = function(){
9+
var activeComp = app.project.activeItem;
10+
if(activeComp && activeComp instanceof CompItem){
11+
var sel = activeComp.selectedLayers; //selected layers
12+
13+
app.beginUndoGroup("Add a rounded shape");
14+
var newShape = activeComp.layers.addShape();
15+
var shapeGroup = newShape.property("ADBE Root Vectors Group").addProperty("ADBE Vector Group");
16+
17+
shapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Group");
18+
var shapeFill = shapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Graphic - Fill");
19+
shapeFill.enabled = false;
20+
21+
var shapeStroke = shapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Graphic - Stroke");
22+
shapeStroke.property("ADBE Vector Stroke Line Cap").setValue(2);
23+
shapeStroke.property("ADBE Vector Stroke Line Join").setValue(2);
24+
25+
if(sel){ //if anything is selected
26+
sel.sort(function(a,b){ //sort by index
27+
return a.index - b.index;
28+
});
29+
newShape.moveBefore(sel[0]); //placing before the 1st
30+
};
31+
32+
app.endUndoGroup();
33+
}
34+
}
35+
36+
addRoundedShape();

disableExpressions.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//Disable all expressions on a layervar switchExpressions = this;AVLayer.prototype.disableExpression = function(activate, removeExpr){ var enableDisableExpressions = function(_prop, activate, removeExpr){ for(var i=1;i<=_prop.numProperties;i++){ var curProp=_prop.property(i); if(curProp instanceof PropertyGroup) enableDisableExpressions(curProp, activate, removeExpr); else if (curProp.canSetExpression === true){ try{ if(curProp.expressionEnabled === true && activate === false){ curProp.expressionEnabled = false;//вырубаем экспрешн } if(curProp.expressionEnabled === false && activate === true){ curProp.expressionEnabled = true;//врубаем экспрешн } if(removeExpr) curProp.expression = ''; } catch(err){ null } } } } enableDisableExpressions(this, activate, removeExpr);}ShapeLayer.prototype.disableExpression = function(activate, removeExpr){ var enableDisableExpressions = function(_prop, activate, removeExpr){ for(var i=1;i<=_prop.numProperties;i++){ var curProp=_prop.property(i); if(curProp instanceof PropertyGroup) enableDisableExpressions(curProp, activate, removeExpr); else if (curProp.canSetExpression === true){ try{ if(curProp.expressionEnabled === true && activate === false){ curProp.expressionEnabled = false;//вырубаем экспрешн } if(curProp.expressionEnabled === false && activate === true){ curProp.expressionEnabled = true;//врубаем экспрешн } if(removeExpr) curProp.expression = ''; } catch(err){ null } } } } enableDisableExpressions(this, activate, removeExpr);}switchExpressions.go = function(activate, removeExpr){ 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++){ sel[s].disableExpression(activate, removeExpr); } } }}switchExpressions.buildGUI = function(thisObj){ //building main GUI thisObj.w = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Switch Expressions", undefined, {resizeable:true}); thisObj.w.alignChildren = ['left', 'top'] var g = thisObj.w.add("group{orientation:'Column', alignChildren: ['left', 'top']}"); // var soundToShots = g.add("button", undefined, "Sound to shots"); g.preferredSize = [120,80]; //tabs var disableBttn = g.add('button', undefined, "Disable Expressions"); disableBttn.size = [120, 20]; var enableBttn = g.add('button', undefined, "Enable Expressions"); enableBttn.size = [120, 20]; var removeBttn = g.add('button', undefined, "Remove Expressions"); removeBttn.size = [120, 20]; disableBttn.onClick = function(){ app.beginUndoGroup("Disable Expressions"); switchExpressions.go(false, false); app.endUndoGroup(); } enableBttn.onClick = function(){ app.beginUndoGroup("Disable Expressions"); switchExpressions.go(true, false); app.endUndoGroup(); } removeBttn.onClick = function(){ app.beginUndoGroup("Disable Expressions"); switchExpressions.go(false, true); app.endUndoGroup(); } if (thisObj.w instanceof Window){ thisObj.w.center(); thisObj.w.show(); } else thisObj.w.layout.layout(true);}switchExpressions.buildGUI(switchExpressions);

enableDisableExpressions.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//Disable all expressions on a layer#script "Enable Disable Expressions";var switchExpressions = this;AVLayer.prototype.disableExpression = function(activate, removeExpr){ var enableDisableExpressions = function(_prop, activate, removeExpr){ for(var i=1; i<=_prop.numProperties; i++){ var curProp=_prop.property(i); if(curProp instanceof PropertyGroup || curProp instanceof MaskPropertyGroup){ enableDisableExpressions(curProp, activate, removeExpr); } else if (curProp.canSetExpression == true){ try{ if(curProp.expressionEnabled == true && activate == false){ curProp.expressionEnabled = false;//выкл } if(curProp.expressionEnabled == false && activate == true){ curProp.expressionEnabled = true;//вкл } if(removeExpr) curProp.expression = ''; } catch(err){ null } } } } enableDisableExpressions(this, activate, removeExpr);}ShapeLayer.prototype.disableExpression = function(activate, removeExpr){ var enableDisableExpressions = function(_prop, activate, removeExpr){ for(var i=1; i <= _prop.numProperties; i++){ var curProp=_prop.property(i); if(curProp instanceof PropertyGroup || curProp instanceof MaskPropertyGroup){ enableDisableExpressions(curProp, activate, removeExpr); } else if (curProp.canSetExpression == true){ try{ if(curProp.expressionEnabled == true && activate == false){ curProp.expressionEnabled = false;//выкл } if(curProp.expressionEnabled == false && activate == true){ curProp.expressionEnabled = true;//вкл } if(removeExpr) curProp.expression = ''; } catch(err){ null } //кароч не хочу искать причину этой ошибки } } } enableDisableExpressions(this, activate, removeExpr);}switchExpressions.go = function(activate, removeExpr){ 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++){ sel[s].disableExpression(activate, removeExpr); } } } else alert("Select at least one layer");}switchExpressions.buildGUI = function(thisObj){ //building main GUI thisObj.w = (thisObj instanceof Panel) ? thisObj : new Window("palette", "expr on|off", undefined, {resizeable:true}); thisObj.w.alignChildren = ['left', 'top'] var g = thisObj.w.add("group{orientation:'Column', alignChildren: ['left', 'top']}"); g.preferredSize = [120,80]; var disableBttn = g.add('button', undefined, "Disable Expressions"); disableBttn.size = [120, 20]; var enableBttn = g.add('button', undefined, "Enable Expressions"); enableBttn.size = [120, 20]; var removeBttn = g.add('button', undefined, "Remove Expressions"); removeBttn.size = [120, 20]; disableBttn.onClick = function(){ app.beginUndoGroup("Disable Expressions"); switchExpressions.go(false, false); app.endUndoGroup(); } enableBttn.onClick = function(){ app.beginUndoGroup("Enable Expressions"); switchExpressions.go(true, false); app.endUndoGroup(); } removeBttn.onClick = function(){ app.beginUndoGroup("Remove Expressions"); switchExpressions.go(false, true); app.endUndoGroup(); } if (thisObj.w instanceof Window){ thisObj.w.center(); thisObj.w.show(); } else thisObj.w.layout.layout(true);}switchExpressions.buildGUI(switchExpressions);

guiTemplate.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//CC-BY-SA, Nik Ska 2014#script "somescript"var somescript = this; //назови не somescript а как тебе хочетсяsomescript.scriptTitle = "Somescript";somescript.run = function(){ this.buildGUI(this);}somescript.buildGUI = function(thisObj){ thisObj.w = (thisObj instanceof Panel) ? thisObj : new Window("palette", thisObj.scriptTitle, undefined, {resizeable:true}); thisObj.w.alignChildren = ['left', 'top'] var g = thisObj.w.add("group{orientation:'row', alignChildren: ['left', 'top']}"); /* * Поле для цифр */ var timeText = g.add("editText", undefined, "0"); timeText.size = [50, 25]; /* * Кнопка */ var goBttn = g.add("button", undefined, "Go!"); goBttn.onClick = function(){ //callback для кнопки app.beginUndoGroup("name"); //какое-то Undo /* * НЕ ЗАБУДЬ ПРОПИСАТЬ АРГУМЕНТЫ ЕСЛИ ОНИ ЕСТЬ */ thisObj.runThisShit(); app.endUndoGroup(); }; timeText.onChanging = function(){ //эта херня делает так что вводятся только цифры preFilter = /(\d*)/; this.text = this.text.match(preFilter)[0]; } if (thisObj.w instanceof Window){ thisObj.w.center(); thisObj.w.show(); } else thisObj.w.layout.layout(true);}somescript.runThisShit = function(){ //ТУТ ТВОЯ ОСНОВНАЯ ФУНКЦИЯ}somescript.run()

longShadow.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//Long Shadow script//adds long shadow effect to the layer//as simple as that!var longShadow = this;this.run = function(){ 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++){ longShadow.addLongShadow(sel[s]); } } }}this.addLongShadow = function(_layer){ var pr = _layer.property("ADBE Effect Parade"); //add Angle control var shadowAngle = pr.addProperty("ADBE Angle Control"); shadowAngle.name = "Shadow Angle"; shadowAngle.property("ADBE Angle Control-0001").setValue(135); //add Slider control var shadowLength = pr.addProperty("ADBE Slider Control"); shadowLength.name = "Shadow Length"; shadowLength.property("ADBE Slider Control-0001").setValue(100); //add Color Control var shadowColor = pr.addProperty("ADBE Color Control"); shadowColor.property("ADBE Color Control-0001").setValue([0,0,0,1]); //add CC Radial Blur var blur = pr.addProperty("CC Radial Blur"); blur.property("CC Radial Blur-0001").setValue(0); //add Levels var lvls = pr.addProperty("ADBE Easy Levels2"); //add Fill var fill = pr.addProperty("ADBE Fill"); //add CC Composite var composite = pr.addProperty("CC Composite");}this.run();

newTrimmedNull.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//Snippet for new trimmed null creation//creates a null trimmed to the highest selected layer//inherits its color//CC-BY-SA Nik Ska, 2013var newNull = {}newNull.go = function(){ var activeComp = app.project.activeItem; //active item if(activeComp && activeComp instanceof CompItem){ //if it's a comp var sel = activeComp.selectedLayers; //selected layers app.beginUndoGroup("Create smart null"); //Undo var nullLayer = activeComp.layers.addNull(); //adding Null if(sel){ //if anything is selected sel.sort(function(a,b){ //sort by index return a.index - b.index; }); nullLayer.moveBefore(sel[0]); //placing before the 1st nullLayer.startTime = sel[0].startTime; //trim nullLayer.inPoint = sel[0].inPoint; nullLayer.outPoint = sel[0].outPoint; nullLayer.label = sel[0].label; //inherit color for(var s = 0; s < sel.length; s++){ sel[s].parent = nullLayer; } } app.endUndoGroup(); //closing undo }}newNull.go()
1+
//Snippet for new trimmed null creation//creates a null trimmed to the highest selected layer//inherits its color//CC-BY-SA Nik Ska, 2013var newNull = {}newNull.go = function(){ var activeComp = app.project.activeItem; //active item if(activeComp && activeComp instanceof CompItem){ //if it's a comp var sel = activeComp.selectedLayers; //selected layers app.beginUndoGroup("Create smart null"); //Undo var nullLayer = activeComp.layers.addNull(); //adding Null if(sel.length > 0){ //if anything is selected sel.sort(function(a,b){ //sort by index return a.index - b.index; }); nullLayer.moveBefore(sel[0]); //placing before the 1st nullLayer.startTime = sel[0].startTime; //trim nullLayer.inPoint = sel[0].inPoint; nullLayer.outPoint = sel[0].outPoint; nullLayer.label = sel[0].label; //inherit color for(var s = 0; s < sel.length; s++){ sel[s].parent = nullLayer; } } app.endUndoGroup(); //closing undo }}newNull.go()

openProjectFolder.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//Opens Project Folder//CC-BY-SA Nik Ska, 2014var ddOpenProjectFolder = function(){ if($.os.substr(0,7).toLowerCase() == "windows") var prefix = "explorer "; else var prefix = "open "; var prjPath = app.project.file; if(prjPath){ var prjFldr = new Folder(prjPath.path); prjFldr = prjFldr.fsName; system.callSystem(prefix + "'" + prjFldr + "'"); } else alert("You should first save the project");}ddOpenProjectFolder()
1+
//Opens Project Folder//CC-BY-SA Nik Ska, 2014var ddOpenProjectFolder = function(){ if($.os.substr(0,7).toLowerCase() == "windows") var prefix = "explorer "; else var prefix = "open "; var prjPath = app.project.file; if(prjPath){ var prjFldr = new Folder(prjPath.path); prjFldr = prjFldr.fsName; system.callSystem(prefix + prjFldr); } else alert("You should first save the project");}ddOpenProjectFolder()

setKeysForPaths.jsx

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//Set keyframe for all paths in a shape layer
2+
//CC-BY, Nik Ska, 2014
3+
4+
ShapeLayer.prototype.setKeysForPaths = function(){
5+
//sets keys inside shapes
6+
var thisShape = this.containingComp;
7+
var findPath = function(_group){
8+
for(var p = 1; p <= _group.numProperties; p++){
9+
//cycle through the properies
10+
if(_group.property(p) instanceof PropertyGroup){
11+
//when found a group – going deeper
12+
findPath(_group.property(p))
13+
}
14+
if(_group.property("ADBE Vector Shape")){
15+
//when found a Path and it's legit
16+
if(_group.property("ADBE Vector Shape").canVaryOverTime){
17+
_group.property("ADBE Vector Shape").addKey(thisShape.time);
18+
}
19+
}
20+
}
21+
}
22+
23+
findPath(this.property("ADBE Root Vectors Group"))
24+
}
25+
26+
var setKeysForPathsMain = function(){
27+
//wrapper function
28+
var activeComp = app.project.activeItem;
29+
if(activeComp && activeComp instanceof CompItem){
30+
var sel = activeComp.selectedLayers;
31+
if(sel.length > 0){
32+
app.beginUndoGroup("Setting keyframes for shapes");
33+
34+
for(var s = 0; s < sel.length; s++){
35+
if(sel[s] instanceof ShapeLayer){
36+
sel[s].setKeysForPaths();
37+
}
38+
}
39+
40+
app.endUndoGroup();
41+
}
42+
}
43+
}
44+
45+
setKeysForPathsMain();

setRoundCaps.jsx

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//Sets all Stroke caps to Round in all shape groups
2+
//CC-BY, Nik Ska, 2014
3+
4+
ShapeLayer.prototype.setRoundStrokeCap = function(){
5+
//sets keys inside shapes
6+
var thisShape = this.containingComp;
7+
var findPath = function(_group){
8+
for(var p = 1; p <= _group.numProperties; p++){
9+
//cycle through the properies
10+
if(_group.property(p) instanceof PropertyGroup){
11+
//when found a group – going deeper
12+
findPath(_group.property(p))
13+
}
14+
if(_group.property("ADBE Vector Graphic - Stroke")){
15+
//when found a Stroke and it's legit
16+
//set Line Cap to Round
17+
_group.property("ADBE Vector Graphic - Stroke").property("ADBE Vector Stroke Line Cap").setValue(2);
18+
}
19+
}
20+
}
21+
22+
findPath(this.property("ADBE Root Vectors Group"))
23+
}
24+
25+
var setRoundCaps = function(){
26+
//wrapper function
27+
var activeComp = app.project.activeItem;
28+
if(activeComp && activeComp instanceof CompItem){
29+
var sel = activeComp.selectedLayers;
30+
if(sel.length > 0){
31+
app.beginUndoGroup("Making all caps round");
32+
33+
for(var s = 0; s < sel.length; s++){
34+
if(sel[s] instanceof ShapeLayer){
35+
sel[s].setRoundStrokeCap();
36+
}
37+
}
38+
39+
app.endUndoGroup();
40+
}
41+
}
42+
}
43+
44+
setRoundCaps();

textToKeys.jsx

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
Sets keyframes so that you have hard-coded "typewriter" effect
3+
of a Text Layer
4+
5+
*/
6+
7+
var textToKeys = function(){
8+
9+
var activeComp = app.project.activeItem;
10+
if(activeComp && activeComp instanceof CompItem){
11+
var sel = activeComp.selectedLayers;
12+
if(sel.length > 0){
13+
app.beginUndoGroup("Make txt keys");
14+
15+
for(var s = 0; s < sel.length; s++){
16+
if(sel[s] instanceof TextLayer){
17+
var txt = sel[s].property("ADBE Text Properties").property("ADBE Text Document");
18+
var txtString = sel[s].property("ADBE Text Properties").property("ADBE Text Document").value.text;
19+
// txt.setValueAtTime(activeComp.time, '')
20+
for(var t = 0; t <= txt.length; t++){
21+
txt.setValueAtTime(activeComp.time + t*activeComp.frameDuraiton*2, txtString.substr(0,t))
22+
}
23+
}
24+
}
25+
app.endUndoGroup();
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)