@ -13,17 +13,6 @@
- Get artist initials in Windows too .
* /
/ / r e s i z e C o m p s C a n v a s C e n t e r e d ( [ 1 0 8 0 , 1 9 2 0 ] , t r u e )
/ / D e f i n e t h e P a n e l
( function wcHelperPanel ( thisObj ) {
/* Build UI */
@ -35,6 +24,7 @@
var thirdButton = "render" ;
var fourthButton = "rename" ;
var fifthButton = "resize Comp" ;
var sixthButton = "Add Letterbox" ;
var win = ( thisObj instanceof Panel ) ? thisObj : new Window ( 'palette' , windowTitle ) ;
@ -66,7 +56,9 @@
win . button5 = myButtonGroup3 . add ( "button" , undefined , fifthButton ) ;
myButtonGroup2 . alignment = "center" ;
myButtonGroup2 . alignChildren = "center" ;
var myButtonGroup4 = win . add ( "group" ) ;
win . button6 = myButtonGroup4 . add ( "button" , undefined , sixthButton ) ;
win . spacing = 0 ;
win . margins = 1 ;
myButtonGroup . spacing = 4 ;
@ -83,13 +75,17 @@
btnRender ( ) ;
}
win . button4 . onClick = function ( ) {
btn Test ( ) ;
btn Herd ( ) ;
}
win . button5 . onClick = function ( ) {
var newSize = [ parseInt ( w . resizeWidth . text ) , parseInt ( w . resizeHeight . text ) ] ;
win . button5 . onClick = function ( ) {
var newSize = [ parseInt ( w . resizeWidth . text ) , parseInt ( w . resizeHeight . text ) ] ;
resizeCompsCanvasCentered ( newSize , true )
}
win . button6 . onClick = function ( ) {
btnAddLetterbox ( ) ;
}
win . onResizing = function ( ) {
updateProjectPath ( ) ;
@ -193,12 +189,12 @@ function getSelectedProjectItems(){
}
return items ;
}
function get LayersByParented( isParented ) {
function get Comp LayersByParented( aComp , isParented ) {
/ * T O D O
not use activeItem . but have the function take a comp as an argument , to avoid activItem becoming obsolete .
* /
var active _comp = a pp. project . activeItem ;
var active _comp = a Comp ;
var filtered _layers = [ ] ;
for ( var i = 1 ; i <= active _comp . layers . length ; i ++ )
@ -218,15 +214,20 @@ function resizeCompCanvas( comp, new_size ){
comp . height = new _size [ 1 ] ;
} ;
function resizeCompCanvasCentered ( my _comp , new _size , keep _scaler ) {
/ / a p p . b e g i n U n d o G r o u p ( " R e s i z e C o m p C a n v a s C e n t e r e d " )
/* TO DO AVOID SUCCESEIVE RESCALES TO ADD MORE AND MORE NULLS */
var n = my _comp . layers . addNull ( ) ;
/ / c e n t e r n u l l o n a c t u a l c o m p s i z e
n . position . setValue ( [ my _comp . width / 2 , my _comp . height / 2 ] ) ;
resizeCompCanvas ( my _comp , new _size ) ;
var unparenterLayers = getCompLayersByParented ( my _comp , false ) ;
/ / p a r e n t u n p a r e n t e d l a y e r s t o M A I N _ S C A L E R
var unparenterLayers = getLayersByParented ( false ) ;
for ( var i = 0 ; i < unparenterLayers . length ; i ++ ) {
var current _layer = unparenterLayers [ i ] ;
@ -236,7 +237,7 @@ function resizeCompCanvasCentered( my_comp, new_size, keep_scaler ){
current _layer . locked = true ;
}
}
/ / c e n t e r n u l l t o n e w c o m p s i z e
n . position . setValue ( new _size / 2 ) ;
@ -247,24 +248,20 @@ function resizeCompCanvasCentered( my_comp, new_size, keep_scaler ){
} else {
n . remove ( )
}
/ / a p p . e n d U n d o G r o u p ( ) ;
}
function resizeCompsCanvasCentered ( new _size , keep _scaler ) {
/ / a l e r t ( ) ;
app . beginUndoGroup ( "Resize Comps' Canvas Centered" )
var my _comps = getSelectedProjectItems ( ) ;
for ( var i = 0 ; i < my _comps . length ; i ++ ) {
var my _comp = my _comps [ i ] ;
/ / a l e r t ( m y _ c o m p . n a m e )
resizeCompCanvasCentered ( my _comp , new _size , true ) ;
var myComps = getSelectedProjectItems ( ) ;
for ( var i = 0 ; i < myComps . length ; i ++ ) {
var myComp = myComps [ i ] ;
resizeCompCanvasCentered ( myComp , new _size , keep _scaler ) ;
}
app . endUndoGroup ( ) ;
}
function setFPS ( comp , newFPS ) {
comp . frameDuration = 1 / newFPS ;
} ;
function getOfflineRevCode ( myComp ) {
/ / v a r r e g e x = / [ 0 - 9 ] { 2 } [ a - z ] { 2 } / g ; / / M a i x m u m r e v n u m b e r 9 9
@ -343,8 +340,8 @@ function versionUpComp( myComp, inc ){
}
function getOutputBasePath ( ) {
var f ile = app . project . file ;
var f ile _path = String ( app . project . file ) ;
var f = app . project . file ;
var f _path = String ( f ) ;
var output _base = "6_Output" ;
var offline _output _extra = "1_Offline" ;
@ -353,13 +350,13 @@ function getOutputBasePath(){
var offline _string = "1_Offline" ;
var finishing _string = "2_Finish" ;
var search _offline = f ile _path . search ( offline _string ) ;
var search _finishing = f ile _path . search ( finishing _string ) ;
var search _ae = f ile _path . search ( ae _string ) ;
var search _offline = f _path . search ( offline _string ) ;
var search _finishing = f _path . search ( finishing _string ) ;
var search _ae = f _path . search ( ae _string ) ;
var base _path = f ile _path . substr ( 0 , search _ae ) + output _base ;
var base _path = f _path . substr ( 0 , search _ae ) + output _base ;
if ( f ile _path == "null" ) {
if ( f _path == "null" ) {
base _path = "~/Desktop" ;
}
@ -525,6 +522,35 @@ function versiounUpTodaySelectedComp( myComp, inc ){
myComp . selected = false ;
new _comp . selected = true ;
}
function addLetterbox ( ) {
var LetterboxLayer = app . project . activeItem . layers . addShape ( )
var aspectControl = LetterboxLayer . property ( "Effects" ) . addProperty ( "ADBE Slider Control" )
aspectControl . name = "Aspect Ratio"
aspectControl . property ( "Slider" ) . setValue ( 16 / 9 )
var colorControl = LetterboxLayer . property ( "Effects" ) . addProperty ( "ADBE Color Control" )
colorControl . name = "Color"
colorControl . property ( "Color" ) . setValue ( [ 0 , 0 , 0 , 1 ] )
LetterboxLayer . name = "Letterbox"
var compFrame = LetterboxLayer . property ( "Contents" ) . addProperty ( "ADBE Vector Shape - Rect" )
compFrame . name = "CompFrame"
compFrame . property ( "Size" ) . expression = "[ thisComp.width , thisComp.height ]"
var letterboxRect = LetterboxLayer . property ( "Contents" ) . addProperty ( "ADBE Vector Shape - Rect" )
letterboxRect . name = "Letterbox"
letterboxRect . property ( "Size" ) . expression = ' w = thisComp . width ; \
h = thisComp . height ; \
compAspect = w / h ; \
aspect = effect ( "Aspect Ratio" ) ( "Slider" ) ; \
if ( compAspect <= aspect ) { \
[ w , w / aspect ] \
} else { \
[ h * aspect , h ] \
} '
var letterboxMerge = LetterboxLayer . property ( "Contents" ) . addProperty ( "ADBE Vector Filter - Merge" )
letterboxMerge . mode . setValue ( 3 )
var letterboxFill = LetterboxLayer . property ( "Contents" ) . addProperty ( "ADBE Vector Graphic - Fill" )
letterboxFill . color . setValue ( [ 0 , 0 , 0 , 1 ] )
}
/* UI Buttons */
function btnPlus1 ( ) {
@ -551,12 +577,20 @@ function btnOwn(){
function btnRender ( ) {
renderSelectedToProjectPath ( ) ;
}
function btn Test ( ) {
function btn Herd ( ) {
compHerder = new CompHerder ( ) ;
compHerder . activate ( ) ;
/ / a l e r t ( " N o t h i n g t o t e s t r i g h t n o w . " )
}
function btnAddLetterbox ( ) {
alert ( "wtf" )
addLetterbox ( ) ;
/ *
app . beginUndoGroup ( "Add Letterbox" )
addLetterbox ( ) ;
app . endUndoGroup ( )
* /
}
function CompHerder ( ) {
this . methods = {
pad : function ( n , pad ) {
@ -834,5 +868,3 @@ function CompHerder(){
}
} ) ( this ) ;