0

Return path(s) of source

I want to return a path of the source files, use that path to navigate to a different folder, get a new path pythonically, and replace the footage. Is this possible? I've been trying to do the following but it's telling me and argument needs an integer. a = rv.commands.getStringProperty("#RVFileSource.media.movie", [], True)




dotrvrc.py

댓글 7개

  • 0
    Avatar
    Jon Morley

    Hi Corey,

    I think you can do all of those things. Take a look at the following example ~/.rvrc.py file:

     

    from rv import rvui, commands

    def initialize():

        rvui.defineDefaultBindings()
        return rvui.newStateObject()

    def setup():

        def swapEyes(event):

            nodes = commands.nodesOfType("RVFileSource")
            for node in nodes:
                paths = []
                update = False
                sources = commands.sourceMediaInfoList(node)
                for source in sources:
                    path = source['file']
                    if path.endswith("L.mov"):
                        path = path.replace("L.mov","R.mov")
                    elif path.endswith("R.mov"):
                        path = path.replace("R.mov","L.mov")
                    if path != source['file']:
                        update = True
                    paths.append(path)
                if update:
                    commands.setSourceMedia(node,paths,None)
        commands.bind("default", "global", "key-down--X", swapEyes, "")

     

    This example is a little silly. It just swaps left and right eye movies in the sources it finds, but it should give you an idea about how to walk your sources and replace the files. Please let me know if this helps.

    Thanks,

    Jon

  • 0
    Avatar
    Jon Morley

    I have attached the .rvrc.py file if copying off this web page messes things up. It will need to be renamed from dotrvrc.py to .rvrc.py and put in your home directory for RV to find it.

    The rvrc files (both .mu and .py forms) can be a great place to rapidly prototype your scripts before building a package.

    The file is linked/attached at the top of the thread in the original post.

  • 0
    Avatar
    Corey Drake

    Thanks. Reading that seems to be exactly what I'm looking for. I mean, minus the change I need to make with our hierarchy of course but that's trivial. Though I am having a problem with the sourceMediaInfoList function. Does this exist in 3.12.14? It doesn't recognize it and I don't see it in the api. The closest command is sourceMediaInfo but I'm unclear if 'geometric timing info about the image' is what I'm looking for from that function. 

  • 0
    Avatar
    Corey Drake

    I've answered my own question and indeed, it is not implemented until 3.12.15. Unfortunately we have to stick with version 14. We're on windows and I'm told someone from Tweak recommended using 14 on windows because of a bug in qt. I haven't tried 3.12.16 though.

    I'm having another problem in 3.12.15 with setSourceMedia:
    ERROR: event = render
    ERROR: functions = rvui.render (void; Event event) 

  • 0
    Avatar
    Corey Drake

    Sorry to keep adding comments... I don't see any edit buttons. I think my paths might be incorrectly formatted. Currently I'm sending path/that/needs/navigating/to/imageName.start-end@@@@@@@@.ext

    This format has worked in previous code where I've needed to import footage. But this simply says that there are 'No files in sequence (path)'

  • 0
    Avatar
    Brogan Ross

    So, I'm trying to do the same thing however when my code gets to the setSourceMedia RV locks up and I have force quit it.  I thought it was the paths but I've tried both UNC paths:

    \\path\to\some\imgseq.%08d.exr

    and switching it over to:

    //path/to/some/imgseq.%08d.exr

    I've also tried paths that Corey mentioned with no success.  Does anyone know what the issue is?  And also is there a pythonic way to do this in previous version of RV?

  • 0
    Avatar
    Jon Morley

    Hi guys,

    Were you able to get to the bottom of your path setting issues? The easiest way to sort out the path RV is looking for is to manually open one of the sources in interactive RV that you are having trouble with. Then save RV's session state (File -> Save Session As...). Finally inspect the resulting session file on disk with a text editor and see how the path was written out. Then you can mimic that format in your own python file setter. Please let me know if that helps.

    Thanks,

    Jon

댓글을 남기려면 로그인하세요.