Jump to content
Sign in to follow this  
Spike

Assign global variables with python

Recommended Posts

Hi

i want to assign a global variable as path for a rop node with python - but the thing is that python translates $F to the current frame, and every other parameter...

node_rop.parm('sopoutput').set("$JOB/render/$HIPNAME.$F.bgeo.sc") gets translatet to /Users/xxxx/Project/render/path.12.bgeo.sc in the rop network

so how can i assign a $F to a textinput field with python

thank you for help!

 

 

Share this post


Link to post
Share on other sites
1 hour ago, Spike said:

gets translatet to /Users/xxxx/Project/render/path.12.bgeo.sc

Do you mean translated in UI? Cos it's wired. It could be translated when getting this parameter with node.parm('name').eval() , so you need to use node.parm('name').rawValue() instead.

Share this post


Link to post
Share on other sites
1 hour ago, kiryha said:

Do you mean translated in UI? Cos it's wired. It could be translated when getting this parameter with node.parm('name').eval() , so you need to use node.parm('name').rawValue() instead.

so node.parm('$F').rawValue() ? - looks strange cause its no parm of node - yes i mean in the UI of the rop

 

Share this post


Link to post
Share on other sites

Can you post the file with code in Python Source editor reproducing the issue?
 

In node.parm('$F').rawValue(), parm('...') should contain string parameter name, which you take value from.

Share this post


Link to post
Share on other sites
22 hours ago, kiryha said:

Can you post the file with code in Python Source editor reproducing the issue?
 

In node.parm('$F').rawValue(), parm('...') should contain string parameter name, which you take value from.

still cant figure out the solution

pythonRop.hiplc

Edited by Spike

Share this post


Link to post
Share on other sites

Ah, Python node... I don't know why it happened and I don't have a solution for this case.
From the other side, this code is working and you will get correct images in your ROP. And why are you doing it with Python node when you can do the same in ROP directly?

Share this post


Link to post
Share on other sites

You can set values with variables in them by escaping the $:

node_rop.parm('sopoutput').set("\$JOB/render/\$HIPNAME.\$F.bgeo.sc") 

 

  • Like 2

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  

×