please see the attached hip file
the last node is to create a new attribute (primitive level, a string attribute) whose value is the name of the group to which a primitive belongs.
What's the python script or hscript to do this for the string value section of the “attribcreate” node?
I'm not sure if it has to do with the “hou.pwd().inputs()” script to get the input node of the current node and then get the name of the group from that input node…
anyway, i don't know the script that can do this. pls help!
thanks!
how to create an attribute whose value is the group name?
11227 6 0-
- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
-
- graham
- Member
- 1926 posts
- Joined: Nov. 2006
- Offline
There isn't a real easy way to do it using just an expression (hscript or python) since dealing with group membership is troublesome. The most straightforward method I think would be to use a ForEach SOP. This allows you to not have to worry about the groups since it just processes each group at a time. You then just need to use a stamps() expression to get the name of the current group for the attribute value.
Graham Thompson, Technical Artist @ Rockstar Games
-
- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
Thank you very much, graham!
following the “foreach” SOP, i want to operate only on those polygons with a specific group name.
I tried to use the Delet SOP to perform this kind of selection, but I don't know if i should use the “delet by pattern” or “delet by expression” option. and what's the pattern string or expression script for these options…
or should i use other SOP to achieve this objective?
Can you guide me on this?
thanks!
following the “foreach” SOP, i want to operate only on those polygons with a specific group name.
I tried to use the Delet SOP to perform this kind of selection, but I don't know if i should use the “delet by pattern” or “delet by expression” option. and what's the pattern string or expression script for these options…
or should i use other SOP to achieve this objective?
Can you guide me on this?
thanks!
-
- graham
- Member
- 1926 posts
- Joined: Nov. 2006
- Offline
-
- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
hi, graham,
is the Hscript for the “Filter Expression” of the “delet by expression” option something like this, if i want to delet polygons whose “group_name” value is “group1”?
strmatch(hou.pwd().geometry().primAttibs(), “group1”)
or
strmatch(group_name, “group1”)
I can't seem to be able to make it work…
pls guide me again.
Thanks!
is the Hscript for the “Filter Expression” of the “delet by expression” option something like this, if i want to delet polygons whose “group_name” value is “group1”?
strmatch(hou.pwd().geometry().primAttibs(), “group1”)
or
strmatch(group_name, “group1”)
I can't seem to be able to make it work…
pls guide me again.
Thanks!
-
- tamte
- Member
- 9384 posts
- Joined: July 2007
- Offline
what is your main goal of all this?
do you really need group name as an attribute?
be aware that one primitive can be in many groups
you can delete directly by group
just type group1 in Group field in Delete SOP or Blast SOP
you may be doing all this for some higher purpose so
if you do not have groups anymore, only the primitive attribute called group_name
then type @group_name=“group1” in the Group field of Blast SOP or Delete SOP to delete only the primitives whose group_name attribute value equals “group1”
do you really need group name as an attribute?
be aware that one primitive can be in many groups
you can delete directly by group
just type group1 in Group field in Delete SOP or Blast SOP
you may be doing all this for some higher purpose so
if you do not have groups anymore, only the primitive attribute called group_name
then type @group_name=“group1” in the Group field of Blast SOP or Delete SOP to delete only the primitives whose group_name attribute value equals “group1”
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
-
- Quick Links

