0

Event when changing to a new clip on timeline?

Hey,

Is there an event I can bind that is fired when the current playhead moves to a new clip on the timeline, either through normal playing or the user scrubbing?

To be specific, you open up Screening Room, select multiple versions, and say Play Selected.  This loads all the versions up into RV in a timeline of back to back versions.  We want to Do Things(tm) to each version separately as it is viewed.

11 comments

  • 0
    Avatar
    Doug MacMillan
  • 0
    Avatar
    Jon Morley

    Hi John and Doug,

    First off thank you Doug for replying to John. I think new-source might be the ticket only if you want to catch the first time you see any of your newly loaded sources. I think what John was looking for might instead be a bit more nuanced.

    Unfortunately there isn't one event that captures the transition from one source to another when viewing a Sequence. At least not from RV. It is possible that Shotgun generates their own events for this with the advanced timeline they have, but the normal default timeline of RV does not.

    In order to figure out when you are viewing a new source without changing the view node (i.e. continue looking at a Sequence of sources) you will have to check in two steps.

    1) Bind a method to the frame-changed event that sets your own internal tracking boolean.

    2) From within your render method check if the frame has changed and look at the commands.sourcesRendered to see if the source has changed from its previous value (something you will also need to store internally).

    The reason you will want to check what sources are rendered from your mode's render method is because that will get called only once RV has finished rendering and the list will be guaranteed accurate.

    John, it would be great to know what you mean by Do Things (tm) too. It might help inform us on a better strategy. Also here is the link to the list of internal events:

     3.6: Internal Events

    Please take a look and let me know if you have any more questions.

    Thanks,

    Jon

  • 0
    Avatar
    John Vanderbeck

    Hi guys,

     

    Yes indeed I was looking for something more than the New Source event, and what you describe Jon looks like a sensible, if somewhat extended, way of doing it.

    Ironically though, at the moment we don't need to do this anymore.  Most of the desire to do this stemmed from a lack of understanding of how to handle nodes that were specific to individual sources.  This was posted a while back and i've since learned, mainly through trial and error, how to assign things like luts and stereo settings per source in the timeline.

    If I could make a suggestion here, I think it would be helpful to others to expand the documentation a bit to show how to address individual source nodes, and things like the use of associatedNode() to do so.  Once I managed to figure this out it went a lot smoother, but the documentation glossed over this.

  • 0
    Avatar
    Jon Morley

    Hi John,

    Thank you for that feedback. It has been a while since I was developing with RV on a production and I kind of forget what it was like looking for help. Can you please tell me (in order) where you check for answers when you get stumped?

    I would like to make sure that users are drawn into our online reference manual in particular which I think is often missed. With you experience as a good example, it would be great to know how you traversed what we have out there.

    Thanks,

    Jon

  • 0
    Avatar
    John Vanderbeck

    Hi Jon,

    I'll try and recall approximately the process that was involved, though I might be forgetting some of it.

    I don't recall the documentation being easily found on the tweaksoftware website, but I looked again and it is now.  Not sure if something changed, or I was just blind before.

    I think last time I started with a google search for rv tweak python and ended up at:https://support.shotgunsoftware.com/entries/96056247 and from there the documentation link isn't valid, so I did more googling and eventually found the main documentation page (http://www.tweaksoftware.com/static/documentation/rv/current/), and then I just started reading the RV Reference Manual.

    The main problem with this manual though is that while it gives a good overview, and some good details on very specific cases, it starts to fall apart when dealing with things a bit off the beaten path.  In my case my first project was to figure out how to automatically set RV to use the proper stereo offset for a source based on data pulled form Shotgun.

    The section of the docs on nodes and properties especially was just very unclear when trying to figure out how to address nodes on specific sources.  At first I stumbled upon some code that showed something like "sourceGroup0000_blah" and I tried various versions of that until I got something working, but then it didn't work on another type of node.  Then finally I stumbled upon code that used associatedNode() to determine the proper node names, and after that things started falling in place.  The journey to that point though was rocky :)

    What would be really helpful is an ACTUAL reference manual that details all the rv commands available and what they do.  This doesn't seem to exist, or I never found it.

    So in the end I ended up doing a lot of googling, which got me snippets of code here and there that I just tried and started to build my own picture of how the various pieces worked.

    If NOTHING else, having some documentation on all the RV commands and Extra Commands would be invaluable.

  • 0
    Avatar
    Jon Morley

    Hi John,

    Thank you again for the feedback. I appreciate the challenges you faced. There is certainly always room for improved documentation. Can you please comment on what if any the "Mu Commands API Browser" under the "Help" menu had for you? It does have more comments and information about some the most useful commands and extra_commands calls (which are accessible in both Python and Mu). I was wondering were that fit in your search process.

    We have addressed the stale link in the thread you pointed out. Thank you very much for that too. Sometimes we are not as fast to our forums as we would like and have the unintended preference to answer private support tickets faster. We are certainly working to change this as answers here are answers for all. However please do not hesitate to send us a private message if you get stuck like this again and we are slow to respond on the forums. More than anything we don't want you to lose your motivation to extend RV.

    Thanks again for your thoughts here. This is really helpful. Please do not hesitate to start new threads or tickets.

    Sincerely,

    Jon

  • 0
    Avatar
    John Vanderbeck

    Wow major facepalm there.  I never even saw that! That makes a HUUUGE difference in my work. 

    This is a case of my going straight to the internet and the documentation, without ever even looking at the Help menu in RV.  :(

  • 0
    Avatar
    Jon Morley

    Hi John,

    Better late than never! We still expect those who prefer Python to make the mild mental translation from Mu, but it does have at least the function signatures for all of the commands out there.

    Keep in mind Python also doesn't support having more than one method of the same name with different arguments like Mu does. So in those cases you will only have access to the first defined method from Python.

    We use those calls in lots of places in RV ourselves. If you want to get examples of code using methods you read about in the API browser you might consider searching RV's Mu and Python code.

    Thanks,

    Jon

  • 0
    Avatar
    Pumplerod

    I'm trying to follow the suggestion here...

    1) Bind a method to the frame-changed event that sets your own internal tracking boolean.

    2) From within your render method check if the frame has changed and look at the commands.sourcesRendered to see if the source has changed from its previous value (something you will also need to store internally).

    which I've done.  However, when I call commands.sourcesRendered() or even commands.sourceNameWithoutFrame() I only ever get back an empty string. 

    I am trying to create an alternate playlist with some additional functionality.  One of the things I'd like it to do is select the correct row of my table based on which source is being played.  calling commands.sources() shows me a list of the source files which I use to populate my table.  I'm able to bind to the frame-changed event, however I get no information about the current source.  I am using python and not Mu, if that matters.

  • 0
    Avatar
    Pumplerod

    Apologies.  I noticed that I was actually trying to call commands.sourcesRendered rather than commands.sourcesRendered()

  • 0
    Avatar
    Pumplerod

    and in the event it helps anyone...

     

    I notice that when I track commands.sourcesRendered[0]['node'] there is a single frame delay before it will switch to show the new node.

    meaning that my code looks like this...

     

    onFrameChange(self, event):

        curSource = commands.sourcesRendered()[0]['node']

        if curSource != self.prevSource:

            self.prevSource = curSource

Please sign in to leave a comment.