Created
August 20, 2017 17:19
-
-
Save JustinPedersen/f64a68f8f8431464932c95a82e0f46e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pre roll script for Astra | |
// Coded by Justin Pedersen | |
if (`window -ex PreRollScript`) | |
deleteUI PreRollScript; | |
window -wh 200 200 -s 1 PreRollScript; | |
frameLayout -l "Pre Roll Script"; | |
columnLayout -cw 1; | |
intFieldGrp -l "Pre roll Amount" -cal 1 left -cat 1 right 5 PreRollInt; | |
button -c AddPreRoll -l "Add PreRoll" -w 225 -h 30; | |
showWindow PreRollScript; | |
proc AddPreRoll(){ | |
string $objects[] = `ls -dagObjects`; | |
select -cl; | |
for ($i=0; $i < `size $objects`; $i++) | |
{ | |
if(`keyframe -query -keyframeCount $objects[$i]` != 0) | |
{ | |
print ($objects[$i] + " "); | |
select -tgl $objects[$i]; | |
} | |
} | |
string $sel[] = `ls-sl`; | |
int $PR = `intFieldGrp -q -v1 PreRollInt`; | |
// finding the current time slider range | |
int $minSlider = `playbackOptions -q -min`; | |
int $maxSlider = `playbackOptions -q -max`; | |
// Moving all the keys for selected by amount of preroll required. | |
keyframe -edit -relative -timeChange $PR -time ($minSlider + ":" + $maxSlider); | |
//adding amount of preroll added to end of time slider | |
playbackOptions -max ($maxSlider + $PR); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment