Python in Nuke 9

541 views Asked by At

Is there a way to force the scale on the entire message of a text in Text node. I see there is a way for Nuke 9.0v7 or 10 but this is not available for me.

I have even tried to force a roundabout way to reinforce the font, but still not able to figure this out.

nuke.toNode("shot_" + str(c+1) + "_text")['message'].setValue("")
nuke.toNode("shot_" + str(c+1) + "_text")['font_size'].setValue(33)
nuke.toNode("shot_" + str(c+1) + "_text")   ['baseline_shift'].setValue(-13)
nuke.toNode("shot_" + str(c+1) + "_text")['message'].setValue((ntpath.basename(thumbnailShots[c+ contactSheetUp])[:-4])[:17])

Very similar to this blogs comments. (Fonts are displayed with native 100 font size and also a font size of 33).

http://community.thefoundry.co.uk/discussion/topic.aspx?f=190&t=113652

1

There are 1 answers

0
Andy Jazz On

It definitely works in NUKE 10.5. Change a font_size value using this syntax:

import nuke

p = nuke.nodes.Text2(name="myNode")
p['box'].setValue([0,0,2000,1500]) 
p['xjustify'].setValue("center")
p['yjustify'].setValue("center")
p['message'].setValue("NUKE [version]")
p['font_size'].setValue(175)
nuke.connectViewer(0, p)

If you want to change a global_font_scale value you should use this approach:

nuke.toNode('myNode')['global_font_scale'].setValue(5)