Jump to content
Sign in to follow this  

make a parm use python instead hscript

Recommended Posts

I have a parameter in my node that I want to convert to use python,   usually we can right click> expression >change language to python  but for some reason  is gray out =(

and reading documentation I could do parm.setExpression("2+2". language=Something)  but I thought using hou.lenguage.Python as argument but wants a value?   do we have something like

parm.setScriptLenguage?  or an easy way to switch all the node to use python,  or just that parameter?

Share this post

Link to post
Share on other sites

it's grayed out, because you don't have any keyframe or existing expression there, if you had one, you can convert

you can also set your node language to Python and then when your parm is in expression editing mode, you can just type it in and it will create expression keyframe for you

but this should work too, what errors are you getting?:

yourParm.setExpression("2+2", hou.exprLanguage.Python)


Share this post

Link to post
Share on other sites

if I do something like

    exp = """
node = hou.pwd()
geo = node.geometry()
prim0 = geo.prim(0)
return len(prim0.points())
    attribvop_node.parm("num_points_per_line").setExpression(exp, hou.exprLanguage.Python)


now it works =)   in the UI shows purple,  and not green  I think is because just that parm is python and the rest are hscript.


thanks =)!!!! 


(go to sleep  is 1 am)

Edited by pelos

Share this post

Link to post
Share on other sites

yes, the colors may be confusing

- it all depends on what is the node's default scripting language (shown top-right next to cog icon)

- if expression on the parameter is the same language, it is green, if it is other language then purple


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this