Created
November 18, 2017 13:38
-
-
Save JustinPedersen/ea1531e0ef0138570869643ff704789f 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