jon3de Posted March 20, 2017 Share Posted March 20, 2017 Currently I wanted to change some rops´s image path parameters with python. I have the problem that python converts my strings with e.g. "$F4" or "$JOB" expressions in it to absolute paths. Can I avoid that? e.g. : c.parm("vm_picture").set("//testDirectory/teststring_$F4.v001.exr") turns to: //testDirectory/teststring_0079.v001.exr How can I set this up with keeping the $JOB or $F expressions in it? is this possible? Quote Link to comment Share on other sites More sharing options...
Atom Posted March 20, 2017 Share Posted March 20, 2017 (edited) Hmm.. this auto conversion may not be avoidable. The first thing that comes to mind, however, is that you could place your code inside the pre-render event of the ROP. Then your code will evaluate on every frame and still construct the correct filename for that frame. Edited March 20, 2017 by Atom Quote Link to comment Share on other sites More sharing options...
galagast Posted March 20, 2017 Share Posted March 20, 2017 (edited) What version of Houdini are you using? It seems to be working on my end.. PYTHON SHELL: PYTHON SHELF: Or are you doing something differently to execute the Python code? If not, one possible reason why it is showing as the expanded value is that you have middle clicked your parameter. Edited March 20, 2017 by galagast 1 Quote Link to comment Share on other sites More sharing options...
jon3de Posted March 20, 2017 Author Share Posted March 20, 2017 (edited) Thank you for the gifs! I´m working with 15.5.717 Hm dont know if that makes any difference but i used this method to submit my code. http://www.tokeru.com/cgwiki/index.php?title=HoudiniPython#Make_a_general_python_input_window I will try it with the python shelf and with houdini 16. 21 minutes ago, galagast said: If not, one possible reason why it is showing as the expanded value is that you have middle clicked your parameter. No, I checked that already. kind regards EDIT: I checked it via python shelf and there it works! Thank you Jeff. Would be interesting whats the problem with this self build python text editor... Edited March 20, 2017 by jon3de Quote Link to comment Share on other sites More sharing options...
galagast Posted March 20, 2017 Share Posted March 20, 2017 That's a cool tip from tokeru! Seeing that that was the method used, I believe the reason why it gets expanded is because it is using the "exec()" function to evaluate the code. You can escape it using a backslash like so: c.parm("vm_picture").set("//testDirectory/teststring_\$F4.v001.exr") This seemed to work 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.