Advertisement
duquesne9

Make video with fades

Oct 29th, 2020 (edited)
5,134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (*
  2. Create New Video Cue with Fades
  3. This script will create a new video cue with master audio and opacity set to 0, a fade in with default master audio and opacity 100, and a stop target when done a/v fade out. It will place the video and the fade in in a group cue, and number them all.
  4.  
  5. tested October 2020 on QLab 4.6.5
  6. Report any issues to robotlightsyou@gmail.com
  7.  
  8. enterSomeText subroutine shamelessly stolen from the Rich Walsh template
  9. www.allthatyouhear.com
  10. *)
  11.  
  12. global dialogTitle
  13. set dialogTitle to "New Projections Cue"
  14.  
  15. tell application id "com.figure53.qlab.4" to tell front workspace
  16.    
  17.     --this block prompts user, hard code if this feature unnecessary
  18.     set surf to my enterSomeText("Which surface?", "1", false)
  19.     set qNum to my enterSomeText("What Q number?", "1", false)
  20.     set myColor to "purple"
  21.    
  22.     make type "Video"
  23.     set newQ to last item of (selected as list)
  24.     set myCue to q number of newQ
  25.     set myOSC to "/cue/" & myCue & "/colorName " & myColor
  26.     set originalLevel to newQ getLevel row 0 column 0
  27.     newQ setLevel row 0 column 0 db "-INF"
  28.     --this is the QLab3 method for applescripting color. Handy to remember but could also be
  29.     --set q color of newQ to "purple"
  30.     do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  31.     set opacity of newQ to 0
  32.     --change next line for different number scheme
  33.     set q number of newQ to "Proj " & qNum
  34.     --comment out this line if you use cue notes
  35.     set notes of newQ to "Surface " & surf
  36.    
  37.     delay 0.2
  38.     make type "Fade"
  39.     set fadeIn to last item of (selected as list)
  40.     set inCue to q number of fadeIn
  41.     set inOSC to "/cue/" & inCue & "/colorName " & myColor
  42.     do shell script "echo " & inOSC & " | nc -u -w 0 127.0.0.1 53535"
  43.     set do opacity of fadeIn to true
  44.     set opacity of fadeIn to 100
  45.     set cue target of fadeIn to newQ
  46.     --change next line for different number scheme
  47.     set q number of fadeIn to "In P" & qNum
  48.     --comment out this line if you use cue notes
  49.     set notes of fadeIn to "Surface " & surf
  50.     fadeIn setLevel row 0 column 0 db originalLevel
  51.    
  52.     delay 0.01
  53.     make type "Group"
  54.     set groupQ to last item of (selected as list)
  55.     --change next line for different number scheme
  56.     set q number of groupQ to "P" & qNum
  57.     set mode of groupQ to fire_all
  58.     --comment out this line if you use cue notes
  59.     set notes of groupQ to "Surface " & surf
  60.     set gCue to q number of groupQ
  61.     set gOSC to "/cue/" & gCue & "/colorName " & myColor
  62.     do shell script "echo " & gOSC & " | nc -u -w 0 127.0.0.1 53535"
  63.     set myQs to {newQ, fadeIn}
  64.     repeat with eachQ in myQs
  65.         tell parent of eachQ
  66.             set eachQID to uniqueID of eachQ
  67.             move cue id eachQID to end of groupQ
  68.         end tell
  69.     end repeat
  70.    
  71.     delay 0.1
  72.     make type "Fade"
  73.     set fadeOut to last item of (selected as list)
  74.     set outCue to q number of fadeOut
  75.     set outOSC to "/cue/" & outCue & "/colorName " & myColor
  76.     do shell script "echo " & outOSC & " | nc -u -w 0 127.0.0.1 53535"
  77.     set cue target of fadeOut to newQ
  78.     set do opacity of fadeOut to true
  79.     set opacity of fadeOut to 0
  80.     set stop target when done of fadeOut to true
  81.     --change next line for different number scheme
  82.     set q number of fadeOut to "Out P" & qNum
  83.     --comment out this line if you use cue notes
  84.     set notes of fadeOut to "Surface " & surf
  85.     fadeOut setLevel row 0 column 0 db "-INF"
  86.    
  87.     tell current cue list
  88.         set playback position to newQ
  89.     end tell
  90.    
  91. end tell
  92.  
  93. --subroutines
  94. on enterSomeText(thePrompt, defaultAnswer, emptyAllowed) -- [Shared subroutine]
  95.     tell application id "com.figure53.QLab.4"
  96.         set theAnswer to ""
  97.         repeat until theAnswer is not ""
  98.             set theAnswer to text returned of (display dialog thePrompt with title dialogTitle default answer defaultAnswer buttons {"Cancel", "OK"} ¬
  99.                 default button "OK" cancel button "Cancel")
  100.             if emptyAllowed is true then exit repeat
  101.         end repeat
  102.         return theAnswer
  103.     end tell
  104. end enterSomeText
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement