Dear Experts,
I am very confused about the following. I’m attempting to use a node’s attribute in one of its parameters, and I’m getting some behavior I don’t understand. It’s probably something embarrassingly simple, but here goes:
I’ve attached a sample hip file and also a video showing what I’m trying to do. The SideFX documentation seems to suggest that you can right click on a parameter, and use the Reference > Local Attribute > Global Attributes to select and use a global (detail) attribute. In one case, where I use an attribute to translate a sphere, the end result seems to be okay, but the value of the parameter shows as 0 when it should show as 5.0. In the other case, when I try to use an attribute to set a number of copies, it just gives me an error saying the attribute doesn’t exist, even when it shows up in the geometry spreadsheet. So, I’m confused.
Thank you for any suggestions you can provide,
Mary
Confused by behavior of global attribute in a parameter
2715 4 1-
- mgbaker
- Member
- 89 posts
- Joined: April 2020
- Offline
-
- jsmack
- Member
- 8231 posts
- Joined: Sept. 2011
- Offline
I may be wrong, but I think most nodes don't allow referencing attributes that way, even if they are 'global'. They aren't global in the sense of global to the Houdini session, as they are still local to the geometry stream evaluation. Many modern nodes don't evaluate the geometry at all before evaluating the parameters because it's more efficient to split it up into separate parts that don't depend on each other. These nodes can still make use of incoming detail attributes, but must do so explicitly using an expression such as detail().
For example on the copy sop, useto reference the geometry on the first input's attribute called 'myIntNumber'. The last zero refers to the component for vectors but is still needed when referencing a scalar value.
For example on the copy sop, use
detail(0, 'myIntNumber', 0)
-
- mgbaker
- Member
- 89 posts
- Joined: April 2020
- Offline
Thanks very much, jsmack. That would certainly explain the odd behavior.
In wrangles I do exactly what you suggest, grabbing detail, primitive, or point attributes as desired. My problem is with the parameters to SOPS that are not wrangles -- whether there is any way to reference attributes in their parameters. I often have calculations that are made in one wrangle, and I want the output of that calculation to influence the input parameters of a later node. If that later node is another wrangle, that's no problem, I just access the attributes in the VEX code. But if the later node is something like a transform or a copy SOP or such, it seems like I must rewrite the functionality of that SOP as a wrangle, and I'm hoping not to have to do that, since some of the SOPS have so much work behind them!
This seems like something people would frequently want to do, so I'm worried that I must be overlooking something quite big. Either a way to do it or a reason why I should never need to do it!
Thanks again,
Mary
In wrangles I do exactly what you suggest, grabbing detail, primitive, or point attributes as desired. My problem is with the parameters to SOPS that are not wrangles -- whether there is any way to reference attributes in their parameters. I often have calculations that are made in one wrangle, and I want the output of that calculation to influence the input parameters of a later node. If that later node is another wrangle, that's no problem, I just access the attributes in the VEX code. But if the later node is something like a transform or a copy SOP or such, it seems like I must rewrite the functionality of that SOP as a wrangle, and I'm hoping not to have to do that, since some of the SOPS have so much work behind them!
This seems like something people would frequently want to do, so I'm worried that I must be overlooking something quite big. Either a way to do it or a reason why I should never need to do it!
Thanks again,
Mary
-
- tamte
- Member
- 9560 posts
- Joined: July 2007
- Offline
mgbakerthat's what jsmack is referring to
But if the later node is something like a transform or a copy SOP or such, it seems like I must rewrite the functionality of that SOP as a wrangle, and I'm hoping not to have to do that, since some of the SOPS have so much work behind them!
the detail() [www.sidefx.com] function goes to your parameter to grab the value of detail attribute from your SOP that computed it
similarly you can use point() [www.sidefx.com], prim() [www.sidefx.com] and vertex() [www.sidefx.com] hscript expression functions, just note that they have different syntax from their VEX equivalents
also there are special versions of the functions for grabbing string values and also since they are most likely used in string fields you may want to use them within ticks, `details()`, `points()`, `prims()`, ...
Edited by tamte - June 3, 2021 17:36:43
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- mgbaker
- Member
- 89 posts
- Joined: April 2020
- Offline
In case it is helpful to anyone else, here is how we solved this problem. It seems you can indeed, in a parameter to a node, refer to the global detail attributes created in a previous wrangle. You can use the reference menu option, but I was getting at it the wrong way. You still right click on the parameter and use Reference, but you use Reference->SceneData instead of the local variable options. At least, this works well for the places I needed it!
Thanks,
Mary
Thanks,
Mary
-
- Quick Links

