From 83116bd0af3c4e1c409cf1d1d0d7af4dfb48d395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1squez=20P=C3=A9rez?= Date: Wed, 17 Aug 2022 12:23:56 -0700 Subject: [PATCH] Defined functions to set the duration of selected comps to a specific frame/second amount. --- main.jsx | 19 +++++++++++++++++-- y.jsx | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/main.jsx b/main.jsx index e0abbd4..2cab7db 100644 --- a/main.jsx +++ b/main.jsx @@ -122,7 +122,7 @@ function addLetterbox( aspect ){ var letterboxFill = LetterboxLayer.property("Contents").addProperty("ADBE Vector Graphic - Fill") letterboxFill.property("Color").expression = 'effect("Color")("Color")' } -function setCompsDurations( new_duration_in_seconds ){ +function setCompsSecondsDuration( new_duration_in_seconds ){ app.beginUndoGroup("x"); //DANGER Comps might not be the same, they only have to be NAMED the same. var allCompItems = getAllProjectComps(); @@ -136,8 +136,23 @@ function setCompsDurations( new_duration_in_seconds ){ } app.endUndoGroup(); } +function setCompsFramesDuration( new_duration_in_frames ){ + app.beginUndoGroup("x"); + //DANGER Comps might not be the same, they only have to be NAMED the same. + var allCompItems = getAllProjectComps(); + var myItems = getSelectedProjectComps(); + // var allMyItems = []+myItems; + var newSource = myItems.pop(); + + for ( var i = 0 ; i < allCompItems.length ; i ++){ + var curComp = allCompItems[i]; + setDuration( curComp, new_duration_in_frames * curComp.frameDuration ) + } + app.endUndoGroup(); +} -setCompsDurations(5); +//setCompsSecondsDuration(15); +setCompsFramesDuration(1440); //addLetterbox( "2.1:1" ); diff --git a/y.jsx b/y.jsx index 33ec95d..fc467a9 100644 --- a/y.jsx +++ b/y.jsx @@ -72,6 +72,7 @@ function setFPS( comp, newFPS ){ comp.frameDuration = 1/newFPS; }; function setDuration( myComp, newSecondsDuration ){ + myComp.duration = newSecondsDuration; }; function setDurationInFrames( myComp, newFrameDuration ){ //myComp. @@ -99,6 +100,7 @@ function resizeCompCanvasCentered( my_comp, new_size, keep_scaler ){ //get rid of scaling null or not. if (keep_scaler) + { n.name = 'MAIN_SCALER'; }else{