0

Can I get the existing RV session in memory as an object and manipulate it?

Hi all,

I have RV open with a session in memory and I want to insert/remove sources via my own python based tool which runs within RV as a package.

I've been able to list the sessions in memory (no access to the objects) and print the sources in the active sessions but i am wondering if there is some  class which can be obtained which will let me update the sources of a session dynamically from a python/mu based package. I'm most interested in adding sources arbitrarily within the time line, changing their order, removing sources.

 

Thanks for any tips.

2 条评论

  • 0
    Avatar
    Richard Monette

    Seconded, this would be very useful!

  • 0
    Avatar
    Jon Morley

    Hi Adam, Richard,

    I think you will find that the API available to you for writing Python and Mu packages has the functionality your are after. I am going to highlight some of specific methods here, but I first want to explain a bit more about the session and RV.

    When RV is running there is really only one session. Therefore the design of the methods in the RV modules take that into consideration rather than requiring you to ask for the session before making changes. The idea of writing session files is really just a way to capture the state of RV to restore it later. With a running instance of RV you can make changes to any part of its state, even remotely over a network connection. It is very powerful.

    Below are some of the methods I think you will find useful for managing sources:

    Adding Sources:
    commands.addSourceVerbose(string; string[] fileNames, string tag = nil)

    This method takes a list of file names and constructs a RVFileSource node the name of which is returned. If tag is not nil (or None in Python) it will be included in the payload of the internal events that are triggered as a result of adding the new source.

    Changing Media:
    commands.setSourceMedia(void; string sourceNode, string[] fileNames, string tag = nil)

    This method works much like addSourceVerbose except instead of returning the RVFileSource node the method requires it as an input argument. Any previous media file association will be replaced by the contents of the string list of fileNames. Tag works as before.

    Deleting Nodes:
    commands.deleteNode(void; string nodeName)

    This method simply deletes any type of node named nodeName. If the RVFileSource node name collected from addSourceVerbose call is passed to deleteNode, then the source and the media it references will be removed.

    Timeline Ordering:
    commands.nodeConnecitons((string[],string[]); string nodeName, bool traverseGroups = false)
    commands.setNodeInputs (void; string nodeName, string[] inputNodes)

    Timeline ordering in this context refers to ordering the RVSourceGroups for a specific RVSequenceGroup view node. Unless you already know all of the RVSourceGroup inputs to the RVSequenceGroup of interest, then you will want to use nodeConnections to retrieve the list. The result of calling nodeConnections is a tuple of two lists. The first list is the inputs to the sequence and the second is the output. The you can reorder the inputs list as you see fit and then set the new order in the sequence with setNodeInputs.

    This breakdown should help get anyone started on managing the "session" in an open instance of RV. Don't forget about the searchable Mu Command API Browser under RV's Help menu. That is where I collected all of the information presented here. Please keep the questions coming if you have follow-ups or need more clarification.

    Please refer to the Mu to Python data type conversion chart when looking at how to use these methods with Python. That chart can be seen here:
    http://www.tweaksoftware.com/static/documentation/rv/current/html/rv_reference.html#toc-Section-2.3

请先登录再写评论。