Skip to content

Commit ce6b2d4

Browse files
author
fabiantheblind
committed
added ignore again
2 parents 3a8a68d + 9e9e054 commit ce6b2d4

17 files changed

+894
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
.DS_Store
2+
build-tmp/
3+
*.sublime-workspace
4+
*.sublime-project

HUD_placer.jsx

+203
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
//HUD text placer
2+
//Written by Nik Ska
3+
//Excusively for George Hurdubae
4+
//http://aescripts.com/authors/nik-ska/
5+
//dokluch@gmail.com
6+
7+
var textSetter = this;
8+
9+
if($.os.substr(0,7).toLowerCase() == "windows"){var prefix = "explorer "};
10+
else{var prefix = "open ";}
11+
12+
textSetter.link1 = prefix + "http://videohive.net/item/animated-hud-alphabet/5080801";
13+
textSetter.link2 = prefix + "http://aescripts.com/authors/m-p/nik-ska/";
14+
textSetter.link3 = prefix + "mailto:dokluch@gmail.com";
15+
textSetter.letterMap = ['0','1','2','3','4','5','6','7','8','9',"'",'-','!','"','#','$','%','&','(',')',',','.','/',':',';','?','@','[',"\\",']','€','+','<','=','>','A','a','B','b','C','c','D','d','E','e','F','f','G','g','H','h','I','i','J','j','K','k','L','l','M','m','N','n','O','o','P','p','Q','q','R','r','S','s','space','T','t','U','u','V','v','W','w','X','x','Y','y','Z','z'];
16+
17+
18+
19+
textSetter.setTextLayers = function(thisObj, _text){
20+
var activeComp = app.project.activeItem;
21+
if(activeComp != null && (activeComp instanceof CompItem)) {
22+
if(_text){
23+
var lettersFolder = thisObj.getLettersFolder();
24+
if(lettersFolder){
25+
app.beginUndoGroup("Placing HUD text");
26+
27+
thisObj.posNull = activeComp.layers.addNull();
28+
thisObj.posNull.name = "Text Controller_"+String(thisObj.posNulls);
29+
30+
thisObj.posNull.property("Marker").setValueAtTime(0, new MarkerValue("Adjust " + '"'+ _text +'"' + " size, tracking and position"));
31+
32+
var spacing = thisObj.posNull("Effects").addProperty("ADBE Slider Control");
33+
spacing.name = "Tracking";
34+
spacing.value = 0;
35+
36+
var textSize = thisObj.posNull("Effects").addProperty("ADBE Slider Control");
37+
textSize.name = "Size";
38+
39+
thisObj.posNull.effect(2).slider.setValue(100);
40+
41+
thisObj.posNulls++;
42+
43+
thisObj.posNull.label = (posNulls)%4+11;
44+
thisObj.posNull.transform.position.setValue([-1104,584,0]);
45+
46+
47+
for(var i = 0; i<_text.length; i++){
48+
if(_text[i]!= ' '){
49+
var letterToPlace = thisObj.getLetter(_text[i], lettersFolder, thisObj.letterMap);
50+
if(letterToPlace) var lettr = activeComp.layers.add(letterToPlace);
51+
}
52+
else{
53+
var lettr = activeComp.layers.add(thisObj.getLetter("space", lettersFolder, thisObj.letterMap));
54+
}
55+
if(lettr){
56+
lettr.position.setValue([0,0,0]);
57+
lettr.position.expression = "cntrl = thisComp.layer("+"'"+thisObj.posNull.name+"'"+");\ncntrl.toComp(cntrl.transform.anchorPoint) - (cntrl.index-index)*(7*cntrl.effect(2)(1)+cntrl.effect(1)(1))+value";
58+
lettr.scale.expression = "value*thisComp.layer("+"'"+thisObj.posNull.name+"'"+").effect(2)(1)/100";
59+
lettr.threeDLayer = true;
60+
lettr.collapseTransformation = true;
61+
lettr.label = thisObj.posNull.label;
62+
if(i>0) lettr.moveAfter(activeComp.layers[i+1])
63+
}
64+
}
65+
66+
if(activeComp.layers[1]!=thisObj.posNull){
67+
thisObj.posNull.moveBefore(activeComp.layers[1])
68+
}
69+
70+
for(var k = 1; k<=activeComp.layers.length; k++){
71+
var l = activeComp.layers[k];
72+
if((l.name == "Master Controller") || (l.name == "Camera Controller") || (l.name == "Camera")){
73+
l.moveBefore(activeComp.layers[1]);
74+
}
75+
}
76+
app.endUndoGroup();
77+
}
78+
}
79+
}
80+
}
81+
82+
textSetter.buildGUI = function(thisObj){
83+
thisObj.posNulls = thisObj.findPreviousInstances();
84+
thisObj.w = (thisObj instanceof Panel) ? thisObj : new Window("palette", thisObj.scriptTitle, undefined, {resizeable:false});
85+
thisObj.w.alignChildren = ["left", "top"];
86+
//thisObj.w.setBG([0,.03,.03]);
87+
thisObj.w.minimumSize = "width: 180, height: 110";
88+
thisObj.w.maximumSize = "width:180, height: 110";
89+
90+
thisObj.w.add("staticText", undefined, "HUD text placer");
91+
var textSet = thisObj.w.add("editText", undefined, "Write text and hit Enter");
92+
textSet.size = [150,20];
93+
94+
var lineTwo = thisObj.w.add("group{orientation:'row'}");
95+
lineTwo.size = "width: 155, height: 25"
96+
97+
var aboutBttn = lineTwo.add("button",undefined, "?");//.setFG([1,1,1]);
98+
aboutBttn.alignment = ['right', 'top'];
99+
aboutBttn.size = [20,20];
100+
101+
textSet.onEnterKey = function(){
102+
setTextLayers(thisObj, textSet.text);
103+
}
104+
105+
106+
aboutBttn.onClick = function(){
107+
thisObj.abt = new Window("palette", "About the script",undefined, {resizeable:false});//.setBG([0,.03,.03]);
108+
thisObj.abt.alignChildren = ["left", "top"];
109+
110+
var abtPanel = thisObj.abt.add("panel{text: '', justify: 'center', alignment:['fill','top'], properties:{borderStyle: 'black'}}");
111+
abtPanel.margins = 10;
112+
abtPanel.alignChildren = ['left', 'top'];
113+
114+
abtPanel.add("staticText", undefined, "Script for the HUD Alphabet by IronykDesign");//.setFG([1,1,1]);
115+
abtPanel.add("staticText", undefined, "http://videohive.net/item/animated-hud-alphabet/5080801").setFG([1, 0.58, 0.0]).addEventListener("mouseup", function(k){
116+
if(k.button == 0){
117+
system.callSystem(thisObj.link1)
118+
}
119+
});
120+
121+
abtPanel.add("staticText", undefined, "");
122+
abtPanel.add("staticText", undefined, "Code by Nik Ska");
123+
abtPanel.add("staticText", undefined, "http://aescripts.com/authors/m-p/nik-ska/").setFG([1, 0.58, 0.0]).addEventListener("mouseup", function(k){
124+
if(k.button == 0){
125+
system.callSystem(thisObj.link2);
126+
}
127+
});
128+
abtPanel.add("staticText", undefined, "dokluch@gmail.com").setFG([1, 0.58, 0.0]).addEventListener("mouseup", function(k){
129+
if(k.button == 0){
130+
system.callSystem(thisObj.link3);
131+
}
132+
});
133+
134+
thisObj.abt.center();
135+
thisObj.abt.show();
136+
}
137+
138+
if (thisObj.w instanceof Window){
139+
thisObj.w.center();
140+
thisObj.w.show();
141+
}
142+
else thisObj.w.layout.layout(true);
143+
}
144+
145+
146+
textSetter.getLetter = function(_name, _folder, _map){
147+
function find(n, m){
148+
for(var i = 0; i<m.length; i++){
149+
if(m[i] == n) return i
150+
}
151+
return -1
152+
}
153+
154+
var letterNumber = find(_name, _map);
155+
156+
if(letterNumber>=0){
157+
return _folder.item(letterNumber+1)
158+
}
159+
else return null
160+
}
161+
162+
textSetter.getLettersFolder = function(){
163+
for(var i = 1; i<= app.project.numItems; i++){
164+
if(app.project.item(i).name == "2. Letters"){
165+
return app.project.item(i);
166+
}
167+
}
168+
return null
169+
}
170+
171+
textSetter.findPreviousInstances = function(){
172+
var activeComp = app.project.activeItem;
173+
var rx = /(Text Controller_)(\d)/;
174+
if(activeComp){
175+
var init = 1;
176+
var tmp = 1;
177+
for(var k = 1; k<=activeComp.layers.length; k++){
178+
var match = activeComp.layers[k].name.match(rx);
179+
if(match){
180+
if(Number(match[2])>init) init = Number(match[2]);
181+
}
182+
if(init>tmp) tmp = init;
183+
else if(init == tmp) tmp ++;
184+
}
185+
}
186+
return tmp;
187+
}
188+
189+
Object.prototype.setBG = function (colorArray) {
190+
if (typeof colorArray != 'undefined' && colorArray.length >=3) {
191+
this.graphics.backgroundColor = this.graphics.newBrush(this.graphics.BrushType.SOLID_COLOR, colorArray);
192+
}
193+
return this;
194+
}
195+
196+
Object.prototype.setFG = function(colorArray) {
197+
if (typeof colorArray != 'undefined' && colorArray.length >=3) {
198+
this.graphics.foregroundColor = this.graphics.newPen(this.graphics.PenType.SOLID_COLOR, colorArray, 1);
199+
}
200+
return this;
201+
}
202+
203+
textSetter.buildGUI(textSetter)

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
#These are some snippets
2+
<<<<<<< HEAD
3+
=======
4+
5+
Made mostly for education purposes
6+
>>>>>>> 9e9e0547fbc754a1397d9d937f7cf1cab00d3026

bake-repeat.jsx

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// BakeRepeat - tool similar to Cinema 4D's "curret state object"
2+
// Creates copies of shape populated by Repeater modifier
3+
var repeaterInstances = [{}]; //array for repeater(s)
4+
5+
function doit(){
6+
var activeItem = app.project.activeItem;
7+
if(activeItem != null && activeItem instanceof CompItem){
8+
app.beginUndoGroup("Bake repeater");
9+
var sel = activeItem.selectedLayers;
10+
var selProp = activeItem.selectedProperties;
11+
if(selProp.length == 1 && selProp[0].matchName == "ADBE Vector Filter - Repeater"){
12+
repeaterInstances[0].repeater = selProp[0];
13+
getRepeaterAttr(selProp[0], repeaterInstances[0]);
14+
}
15+
var _obj = app.project.item(1).layer("tst_bake").property("Contents").property("Rectangle 1");
16+
makeCopies(_obj, repeaterInstances[0]);
17+
app.endUndoGroup();
18+
}
19+
}
20+
21+
function makeCopies(_obj, _repeater){
22+
var numCopies = Number(_repeater["ADBE Vector Repeater Copies"]);
23+
_repeater.repeater.enabled = false;
24+
25+
var tmp = _obj;
26+
var offset = Number(_repeater["ADBE Vector Repeater Offset"]);
27+
for (var i = offset; i < numCopies+offset; i++) {
28+
setAttrFromRepeater([tmp], _repeater, i);
29+
tmp = tmp.duplicate();
30+
31+
};
32+
}
33+
34+
function setAttrFromRepeater(_shape, _repeater, _num){
35+
//function to set shape properties based on repeater object
36+
//_shape is a set of shapes to appy transform to
37+
//_repeater is a repeater instance
38+
//_num is the copy number
39+
40+
/* Matchnames`
41+
ADBE Vector Repeater Copies: 3
42+
ADBE Vector Repeater Offset: 1
43+
ADBE Vector Repeater Order: 1
44+
ADBE Vector Repeater Anchor: 0,27
45+
ADBE Vector Repeater Position: 100,0
46+
ADBE Vector Repeater Scale: 77,77
47+
ADBE Vector Repeater Rotation: 19
48+
ADBE Vector Repeater Opacity 1: 61
49+
ADBE Vector Repeater Opacity 2: 100
50+
*/
51+
52+
for(var k = 0 ; k < _shape.length ; k++){
53+
var tr = _shape[k].property("ADBE Vector Transform Group");
54+
var offset = Number(_repeater["ADBE Vector Repeater Offset"]);
55+
if(_num == offset){
56+
//moving first copy
57+
tr.property("ADBE Vector Anchor").setValue(tr.property("ADBE Vector Anchor").value + _repeater["ADBE Vector Repeater Anchor"] - tr.property("ADBE Vector Position").value);
58+
tr.property("ADBE Vector Position").setValue(_repeater["ADBE Vector Repeater Anchor"]);
59+
}
60+
else{
61+
//all the others
62+
tr.property("ADBE Vector Position").setValue(tr.property("ADBE Vector Position").value +_repeater["ADBE Vector Repeater Position"]);
63+
tr.property("ADBE Vector Scale").setValue([tr.property("ADBE Vector Scale").value[0]*(_repeater["ADBE Vector Repeater Scale"][0]/100), tr.property("ADBE Vector Scale").value[1]*(_repeater["ADBE Vector Repeater Scale"][1]/100)]);
64+
tr.property("ADBE Vector Rotation").setValue(tr.property("ADBE Vector Rotation").value+_repeater["ADBE Vector Repeater Rotation"]);
65+
}
66+
tr.property("ADBE Vector Opacity").setValue(_repeater["ADBE Vector Opacity 1"] + (_num-offset)*(_repeater["ADBE Vector Opacity 2"]-_repeater["ADBE Vector Opacity 1"])/_repeater["ADBE Vector Repeater Copies"]);
67+
}
68+
}
69+
70+
function setExpression(){
71+
//placeholder for the expression setter
72+
73+
}
74+
75+
function bakeExpression(){
76+
//placeholder for expressions baker
77+
}
78+
79+
80+
function getRepeaterAttr(_property, repInstance){
81+
//recursive function to collect all repeater settings
82+
//first - check if we walk over a property group
83+
if(_property.propertyType == PropertyType.NAMED_GROUP){
84+
var tmp = _property.numProperties;
85+
for(var i = 1; i <= tmp; i++){
86+
if(_property.property(i).propertyType == PropertyType.NAMED_GROUP){
87+
getRepeaterAttr(_property.property(i), repInstance)
88+
}
89+
else{
90+
//set repeater instance's values
91+
repInstance[_property.property(i).matchName] = _property.property(i).value;
92+
$.writeln(_property.property(i).matchName + ' ' + String(_property.property(i).value));
93+
}
94+
}
95+
}
96+
else return null
97+
}
98+
99+
100+
101+
doit();

0 commit comments

Comments
 (0)