Thanks to both of you.

@Magno, your workaround seems to work only on functions that have a "nil"
shortcut. I tried change "L" from Color/Cineon to Color/Alexa and the
hotkey still triggered Cineon.

@Nathan, thanks for helping me understand what were all these "None" in the
doc's example. I'm still getting an error though. Not sure

File "/home/bpjobin/.rv/Python/mystuff.py", line 9, in PyMyStuffMode
self.init(
NameError: name 'self' is not defined



Here's line 9 :


class PyMyStuffMode(MinorMode):

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


Another question, once the package as been zipped and added to RV's
packages, do I need to recompile it every time or, as Nuke works, simply
making changes to my .py file when restarting RV will do it?

On Mon, Mar 27, 2017 at 12:54 PM, Nathan Rusch <nathan_ru...@hotmail.com>
wrote:

> 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
>
>
> _______________________________________________
> Nuke-python mailing listnuke-pyt...@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
>
>


-- 
Bruno-Pierre Jobin
www.bpjobin.com
_______________________________________________
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