View Single Post
Old 17th June 2014, 16:13   #1  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Passing values between runtime scripts

Hi All,

I'm having trouble reliably updating information between separate runtime scripts. The runtime scripts are used to track and display input clip frame number at frame serving time. As a rule the top ScriptClip only records the input clip frame number for the bottom one to display, the idea being that a Subtitle at the end of the script should better survive geometric transformation.
Code:
function TrackClip(clip c, bool "debug") {
    ScriptClip(c, """ClipFrame = current_frame
                     debug = """" + String(debug) + """"
                     (debug == "true") ? Subtitle("Clip runtime:" + "\n" + \
                                                  "ClipFrame:" + String(ClipFrame), align=7, lsp=1) \
                                       : last
    """, after_frame=false)
}

global ClipFrame = 0

BlankClip(fps=25.0, color=$000000)
clip1 = TrackClip(debug=true)
BlankClip(fps=25.0, color=$FFFFFF)
clip2 = TrackClip(debug=true)

clip1.Trim(199, 201) ++ clip2.Trim(49, 51)

ScriptClip("""Subtitle("Script runtime:" + "\n" + \
                       "ClipFrame: " + String(ClipFrame) + "\n" + \
                       "script current_frame: " + String(current_frame), align=9, lsp=1)
""", after_frame=true)
This works correctly for monotonically increasing frame numbers. When the output is scrolled forwards and backwards the "Script runtime" starts displaying incorrect ClipFrame values. In some cases the ClipFrame values do not even change for a number of frames.

However, in all cases the "Script runtime" is still invoked every frame as shown by it correctly updating the "script current_frame" value, and the "Clip runtime" is also still invoked every frame as shown by correct updates to its ClipFrame display when enabled. It's just that somehow the "Script runtime" does not see these ClipFrame updates!

I've played with after_frame settings and the ones above seem to work best. Using FrameEvaluate() instead of ScriptClip() for the "Clip runtime" makes no difference.

What else can I try to get this to work for shuttled output? If for some fundamental reason this won't work, what other method can I use to track input clip frame numbers and display them at render time for shuttled output?

Many thanks,
Francois
fvisagie is offline   Reply With Quote