0

shortcut not working

Hi

I'm tripping up somewhere but cant figure out where. I have a custom menu but cant get the assigned shortcut key (f8) to work. 

def __init__(self):
    MinorMode.__init__(self)
    self.init("py-moonraker_menu-mode",
        [ ("Key-down--f8", self.eyePublish, "Publish") ],
        None,
        [("Moonraker", [("Publish shot", self.eyePublish, "F8", None)] )]
    )

Any pointers on where I'm going wrong appreciated.

Thanks

Steve

ps. Im running RV-6.2.7 on Windows (if needed)

6 comments

  • Avatar
    (Michael) Kessler Official comment

    Hi Steve!

     

    Thanks for posting your question!

    There are two minor things you need to change; your casing isn't quite consistent; you have a capital 'K' for key-down where it should be lower-cased.   Also, F8 is already a built-in keyboard shortcut, but you can overriding that by adding a sort order for your package to one more argument in your self.init()

    Check out the following example that works with the F8 key.

     self.init(
    "PackageName",
    [
    (
    'key-down--f8',
    self.toggleMute,
    "ToggleMute"
    )
    ],
    None,
    menu,
    'zzzzPackageName'
    )

    Throwing the zzzz in front of the sort name makes sure this package is loaded near the end and therefore overrides the built in f8 keyboard shortcut.

     

     

    Let me know if those two changes work for you!

  • 0
    Avatar
    steve

    all good! Thanks Michael :)

  • 0
    Avatar
    steve

    another question.

    Im trying to grab the file path of the image sequence that's currently being viewed. Im currently using:

     
    activeNode = rv.commands.viewNode("RVFileSource")
    activeSource = rv.commands.sourceMediaInfoList(activeNode)
    path = activeSource['file']

    this seems to return the file path of the sequence at the top of the 'SOURCES' list and not what's being viewed. 

  • 0
    Avatar
    steve

    actually the above doesn't work at all. I think, to be clearer Im trying to grab the path to the sequence at the top of the stack

  • 0
    Avatar
    (Michael) Kessler

    Hi Stevem

     

    From the sounds of you probably want to grab your first top source with something like:

     

    rv.commands.sourcesAtFrame(rv.commands.frame())

    That should give you a list of your sources n your current view at the current frame; or as the docs puts it:

    Returns an array of the names of source nodes (RVFileSource or RVImageSource) which would be evaluated at the given frame.


    Does that provide the source[s] you expect?

  • 0
    Avatar
    steve

    Thanks Michael, that did indeed return the names of the sources in the current view!

     

    Here's my full code if anyone else is trying the same thing or have any comments on how to make better:

    :)

    from rv.rvtypes import *
    from rv.commands import *
    import os
    import subprocess

    class MyPublishMenu_menuMode(MinorMode):

    def MyPublish(self,currentShot):

    #get active nodes
    activeNode = rv.commands.sourcesAtFrame(rv.commands.frame())
    paths = []

    for node in activeNode:
    sources = rv.commands.sourceMediaInfoList(node)
    for source in sources:
    paths.append(source['file'])

    #assign the top image sequence in the 'STACK' (which should be the currently sequence currently playing) to currentShot
    currentShot = paths[0]
    print 'Publishing: ' + str(currentShot)

    #open pub tool
    subprocess.Popen(['python.exe','path/to/your/publishing/app.py', currentShot], shell=True)

    def __init__(self):
    MinorMode.__init__(self)
    self.init("py-mypublish_menu-mode",
    [ ("Key-down--F9", self.MyPublish, "Publish") ],
    None,
    [("Publish Shot", [("Publish", self.MyPublish, "F9", None)] )]
    )

    def createMode():
    return MyPublishMenu_menuMode()

     

Please sign in to leave a comment.