Hi Bruno,

RV's customization system is needlessly complex, particularly when it comes to 
overriding or unbinding existing hotkeys. In your case, it looks like you just 
need to make sure you're passing the right arguments to `MinorMode.init`. The 
required arguments are `name`, `globalBindings`, and `overrideBindings`, in 
that order, with optional menu commands after that.

The `globalBindings` and `overrideBindings` args are lists of three-tuples in 
the form ('eventName', eventHandler, 'docString'), and keyboard event names 
take the form 'key-down--<KEY>'. To be thorough, you probably want to specify 
the hotkey in both the event binding and the menu item.

I think this should be what you need:

self.init(
    'py-mystuff-mode',
    [('key-down--d', self.lookLut, 'Custom LookLUT key override')],
    None,
    [('Color', [('Look LUT', self.lookLut, 'd', None)])]
)

Hopefully I didn't mismatch any parentheses or otherwise screw up the syntax... 
my email client doesn't do syntax highlighting. ;)


-Nathan

On 3/27/2017 7:51 AM, Bruno-Pierre Jobin wrote:
Hey,

Can anyone tell me what I doing wrong here? I'm trying to assign the "D" key to 
an RV's Color/LookLUT command. I'm putting this script in my /home/.rv/mystuff 
directory as explained in the doc. Then I zip it using the PACKAGE and this py 
file. Does anything seem odd in this script? I just started playing with RV 
modules last week.

Thank you!


from rv.rvtypes import *
from rv.commands import *
from rv.extra_commands import *

class PyMyStuffMode(MinorMode):

   def __init__(self):
      MinorMode.__init__(self)
        self.init(
           "py-mystuff-mode",
            [
            (
            "Color",
            [("Look LUT", self.lookLut, 'd')]
            )
            ],
            None,
            [("Color",[("Look LUT", self.lookLut, "", None)]) ] )

   def lookLut(self,event):
      toggleLookLUT()
      if isLookLUTActiveState:
         displayFeedback("Look LUT ON")
         print isLookLUTActiveState.value()
      else:
         displayFeedback("Look LUT OFF")
         print isLookLUTActiveState.value()


def createMode():
   return PyMyStuffMode()






--
Bruno-Pierre Jobin
www.bpjobin.com<http://www.bpjobin.com>



_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk<mailto:Nuke-python@support.thefoundry.co.uk>,
 http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python


_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to