Jump to content
Sign in to follow this  
saca

Keep expression-strings with python

Recommended Posts

hi,

how to keep expression-strings in parameter when export as string?
bellow python code output key-value into ini-style.

selected = hou.selectedNodes()

for n in selected:
    print('[' + n.name() + ']')
    #print(n.parms())
    for i, p in enumerate(n.parms()):
        parmName=n.parms()[i].name()
        parmVal=n.evalParm(parmName)
        print(parmName + '=' + str(parmVal))


but output expand-strings not expression, ex. filePath expression.
thanks

Share this post


Link to post
Share on other sites

Hi,

you can use parm.rawValue()

Edited by Drughi

Share this post


Link to post
Share on other sites

thanks, Drughi

that's work well.

selected = hou.selectedNodes()

for n in selected:
    print('[' + n.name() + ']')
    #print(n.parms())
    for i, p in enumerate(n.parms()):
        parmName=n.parms()[i].name()
        #parmVal=n.evalParm(parmName)
        parmVal=n.parm(parmName).rawValue()
        print(parmName + '=' + str(parmVal))

 

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  

×