通过 Python 在 The Foundry Nuke 中挤出二维文本的方法

A way to extrude 2d text in The Foundry Nuke via Python

我想知道是否有办法将 Nuke 的文本(包含在 Text 节点中)转换为多边形对象,然后沿 Z 轴拉伸它?这在 Blackmagic Fusion 中是可能的,甚至在 Apple Motion 5 中也是可能的。谁知道如何通过 Python 在 Nuke 中做到这一点?

logoPlate = nuke.nodes.Text(name="forExtrusion") 
logoPlate['font'].setValue("~/Library/Fonts/Cuprum-Bold.ttf") 
logoPlate['xjustify'].setValue("center")
logoPlate['yjustify'].setValue("center")
logoPlate['box'].setValue([0,0,512,256])
logoPlate['translate'].setValue([-20, 50])
logoPlate['size'].setValue(48)
logoPlate['message'].setValue("TV Channel logo")
logoPlate.setInput(0,nuke.selectedNode())

I am not interested in using exported obj, fbx or abc from 3D packages or any third party plugins.

通常您会使用 3D 建模程序,如 Modo、Maya、Cinema 4D 等。创建文本并将其输出为模型,然后将其导入 Nuke。要直接在 Nuke 中创建 3D 文本,您需要 Geometry Tools plugin。然后只需使用 PolyText 节点。

Documentation on PolyText

Download site for Geometry Tools

目前(在 NUKE 版本 10.5 中)挤出文本的唯一方法是使用 ModelBuilder 节点跟踪带有 Polygon shape tool 的文本徽标。

modelBuilder = nuke.createNode('ModelBuilder')
camera = nuke.createNode('Camera2')
nuke.toNode('ModelBuilder1').setSelected(True)
nuke.toNode('Camera1').setSelected(True)
nuke.connectNodes(2, camera)
nukescripts.connect_selected_to_viewer(0)
n = nuke.toNode('ModelBuilder1')
k = n.knob('shape').setValue(6)   #'Polygon' tool in dropdown 'shape' menu
k.execute()

跟踪徽标后,我使用 ModelBuilder 的上下文菜单中的 Extrude,然后烘焙出一个几何图形。但是由于 NUKE 中多边形建模的性质,您只能使用直线。

没有 NURBS 几何体。

script = nuke.thisNode()['bakeMenu'].value() 
eval(script)