Basic Python question regarding expression for TypeMesh

Basic Python question regarding expression for TypeMesh

J-Fry
Enthusiast Enthusiast
1,205 Views
0 Replies
Message 1 of 1

Basic Python question regarding expression for TypeMesh

J-Fry
Enthusiast
Enthusiast

Hi All!

I'm trying to write a script to create 3d text using the python function under "generator" on the type node but I'm afraid I'm brand new (as in this is my first time ever) using Python, so I got a bit hung up on writing the python expression. I would imagine this is a very easy fix, but I've searched around and couldn't find a solution so I'm posting here.

 

I had an expression that was working fine:

round(cmds.getAttr('locator1.ty'), 4)

But I wanted to add a label to it so it was more than just the number. I can't seem to figure out how to do this. Currently I have this:

def addText():
    attr = round(cmds.getAttr('locator1.ty'), 4)
    label = "ty = {}"
    entireText = label.format(attr)
    return entireText
addText()

Which gives me this warning:

// Warning: No valid input. Check the Script Editor for more info. // 

and no text.

 

Any help would be greatly appreciated. Thanks in advance!

0 Likes
1,206 Views
0 Replies
Replies (0)