无法在Nuke11.3v4中创建旧的“文本”节点

2024-10-06 11:27:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我在macOS Mojave上使用Nuke11.3v4。这里有一个问题:我不能使用新的class2节点Text2。每次我选择它-我的应用程序预期退出。我只有在macOS上才会有这种行为。在Windows和Linux上运行良好。所以我编写了一个小脚本来解决这个问题(我想使用旧的Text节点而不是新的Text2节点)。但我的剧本不行。为什么?你知道吗

menu.py文件中的代码:

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.")

Tags: textimport节点ossysmacosaltmenu
1条回答
网友
1楼 · 发布于 2024-10-06 11:27:38

我解决了这个问题。它只是我代码中的一个typo

'crtl+alt+shift+t'

而不是:

'ctrl+alt+shift+t'

这是调用Text节点的快捷方式:

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.")

希望这有帮助。你知道吗

相关问题 更多 >