Error referring to attribute in transform sop parameter

   2961   7   2
User Avatar
Member
80 posts
Joined: 4月 2020
Online
Hello All,

This is probably glaringly obvious, but I have been stuck on it for a while. In a transform sop I am trying to refer to an attribute created further back in the network. For instance, if I have a wrangle that creates a point attribute f@try = 1.5, I'd like to use that value in a parameter in the transform sop, for instance to scale in the X direction. I've tried referring to it as

point("../attribwrangle2/", instancepoint(), "try", 0)
point(0, instancepoint(), "try", 0)
@try

For all of these I get an error. I believe that point() is supposed to take a string. For those versions I get an error that the expression cannot be evaluated because the name "point" is not defined.

I attach the hip file and screen shots of the parameters to the sops and the error I get.

Any advice would be much appreciated.

Thanks,
Mary
Image Not Found



Attachments:
test error.hip (117.6 KB)
test error transform string.png (121.4 KB)
test error wrangle.png (96.7 KB)
test error.png (62.4 KB)

User Avatar
Member
8838 posts
Joined: 7月 2007
Offline
several things:
- your node's default expression language is set to Python, so creating any expression would automatically expect it to be a python expression and point() is not a valid python function
you can RMB/Expression/Change to HScript or delete the channel, change Default lang for node to Hscript and paste the expression again
- once it's set to Hscript, this one will work:
point(0, instancepoint(), "try", 0)
but not in a way you probably expect
- instancepoint() is valid only during evaluating per point instance and only on object level
so in your case while it will not error out it will always return 0, so essentialy you can write this to get the same result
point(0, 0, "try", 0)
- if you would want to define operator path by string instead of input number, you have to use op: syntax otherwise it'd think it's the file path on disk, so it would look like this:
point("op:../attribwrangle2", 0, "try", 0)
but I'd recommend using opfullpath() wrapper which would keep the dependency so that it would update the path even if you rename your attribwrangle2
point("op:" + opfullpath("../attribwrangle2"), 0, "try", 0)
- you cannot use attribute in the parameter of Transform SOP to control values per point, so there is no other function you can replace point index with to make it work that way, nor any local wariable
to do that you can use Point Wrangle or Point Expression SOP
Edited by tamte - 2021年10月15日 21:44:39
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
80 posts
Joined: 4月 2020
Online
Thanks, Tomas, so very much for your detailed and helpful explanation. This clarifies a lot for me.

Best wishes,
Mary
User Avatar
Member
58 posts
Joined: 11月 2014
Offline
tamte
several things:
- if you would want to define operator path by string instead of input number, you have to use op: syntax otherwise it'd think it's the file path on disk, so it would look like this:
point("op:../attribwrangle2", 0, "try", 0)
but I'd recommend using opfullpath() wrapper which would keep the dependency so that it would update the path even if you rename your attribwrangle2
Hi Thomas,
I kind always use direct string relative path references
please help on opfullpath(), if there are more uses for it other than i/o operations channels, and disavantages of using string path directly, in hscript functions other than i/o operations.
thank you,
Houdini Fx Artist (Build)
User Avatar
Member
58 posts
Joined: 11月 2014
Offline
Naga Pavan
tamte
several things:
- if you would want to define operator path by string instead of input number, you have to use op: syntax otherwise it'd think it's the file path on disk, so it would look like this:
point("op:../attribwrangle2", 0, "try", 0)
but I'd recommend using opfullpath() wrapper which would keep the dependency so that it would update the path even if you rename your attribwrangle2
Hi Thomas,
I kind always use direct string relative path references
please help on opfullpath(), if there are more uses for it other than i/o operations channels, and disavantages of using string path directly, in hscript functions other than i/o operations.
thank you,
Hi Thomas,
I see it now opfullpath() is changing relative to absolute path reference.
Houdini Fx Artist (Build)
User Avatar
Member
8838 posts
Joined: 7月 2007
Offline
Naga Pavan
I kind always use direct string relative path references
please help on opfullpath(), if there are more uses for it other than i/o operations channels, and disavantages of using string path directly, in hscript functions other than i/o operations.
usually you don't have to worry about the direct string references absolute or relative like
ch("../path/to/parm")
is absolutely fine and Houdini will track the dependency so you can rename the node holding the referenced parm and it will update your string in the expression
however using op: prefix before the path (as in mentioned function) to refer to the geometry of a SOP operator will not track that dependency) so if you rename referenced node, the op: prefixed path will not update and the expression will become invalid
so the opfullpath() is there just to track that dependency
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
58 posts
Joined: 11月 2014
Offline
tamte
hi do you have suggestions to work out the dependency or node name change inside the vex opfullpath() /attribute wrangle, it is not even updating the node name change
where as name changes in channel references in vex/aw are updating.

thank you
Edited by Houdini Obsession - 2021年10月17日 05:44:40
Houdini Fx Artist (Build)
User Avatar
Member
8838 posts
Joined: 7月 2007
Offline
Naga Pavan
hi do you have suggestions to work out the dependency or node name change inside the vex opfullpath() /attribute wrangle, it is not even updating the node name change
where as name changes in channel references in vex/aw are updating.
For VEX always refer to geo using spare inputs
And to parameters of other nodes using parameters on Wrangle referencing external ones using expressions
Since none of VEX functions will track dependencies, all previous posts were describing Hscript expressions
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links