tagosaku Posted July 11, 2019 Share Posted July 11, 2019 Hi, I am studying python to set a parameter of string (cachePath) by script. After executing the code, ideally it pastes original, "`chs("resouceA")`_`chs("resouceB")`", instead of expanded result "G:/Projects/RnD_000_001/geo_element " So far, I am thinking two methods: A a = r(\"\`chs(\"resouceA\")\`_\`chs(\"resouceB\")\` ") # this way is too many back splash and so confusing B resA = hou.node('.').parm('resourceA').unexpandedString() resA = hou.node('.').parm('resourceB').unexpandedString() a = resA + resB # this way is ok, but when there are 5-10 parmeters, it would be too much work. Do we have a simplest way or special command?? Ideally something like this: a = unexpandedExpression("`chs("resouceA")`_`chs("resouceB")` ") Thanks Quote Link to comment Share on other sites More sharing options...
animknight Posted July 11, 2019 Share Posted July 11, 2019 There's no direct method AFAIK. I don't understand the purpose of doing this. The whole point of channel reference is that if either of resourceA or resourceB is changed, it will be updated automatically in your cachePath. Instead of getting the unexpandedstring and setting them, why don't you just evaluate the parameter and set the value directly ? -J Quote Link to comment Share on other sites More sharing options...
tagosaku Posted July 11, 2019 Author Share Posted July 11, 2019 >> I don't understand the purpose of doing this This is just for a test, and I want to study how much we have option with python. >> why don't you just evaluate the parameter and set the value directly ? For example, $F4, as frame number, we don't want to put the result of evaluation. Houdini should automatically update $F to number. It also can produces substep numbers, but not python. I already know we can write \$F to make unexpanding in python. 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.