Search code examples
pythonnuke

Can't create old "Text" node in NUKE 11.3v4


I'm using NUKE 11.3v4 on macOS Mojave. Here's one problem: I can't use new class2 node Text2. Every time I choose it – my app expectedly quits. I'm having such a behaviour only on macOS. On Windows and Linux it runs fine. So I've written a little script to get rid of this issue (I wanna use old Text node instead of new Text2 node). But my script doesn't work. Why?

Code in menu.py file:

import os
import sys
import nuke

toolbar = nuke.menu('Nodes')

if os.name == 'posix' and sys.platform == 'darwin':
    toolbar.addCommand('Draw/Text', 'nuke.createNode("Text")', 'crtl+alt+shift+t', icon='Text.png')
    nuke.message("Oops! Only Text1 node is accessible.")
else:
    toolbar.addCommand('Draw/Text', 'nuke.createNode("Text2")', 'crtl+alt+shift+t', icon='Text.png')
    nuke.message("Fine! Text2 node's ready for use.")

Solution

  • I fixed this issue. It just was a typo in my code:

    'crtl+alt+shift+t'
    

    instead of:

    'ctrl+alt+shift+t'
    

    It's a shortcut for calling a Text node:

    Ctrl-Alt-Shift-T

    Now my script works fine!!

    import os
    import sys
    import nuke
    
    toolbar = nuke.menu('Nodes')
    
    if os.name == 'posix' and sys.platform == 'darwin':
        toolbar.addCommand('Draw/Text', 'nuke.createNode("Text")', 'ctrl+alt+shift+t', icon='Text.png')
        nuke.message("Oops! Only Text1 node is accessible.")
    else:
        toolbar.addCommand('Draw/Text', 'nuke.createNode("Text2")', 'ctrl+alt+shift+t', icon='Text.png')
        nuke.message("Fine! Text2 node's ready for use.")
    

    Hope this helps.