How to delete an attribute in a python script?

   2774   2   0
User Avatar
Member
71 posts
Joined: June 2008
Offline
Hello all,

I want to delete some attributes in a python script, but “destroy” method is not implemented in the hou.Attrib.
How to delete attributes in script language, without using SOP Attribute?
Alexey Mazurenko
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
Since the method isn't implemented there is currently no other way to delete attributes in Python to my knowledge. The best I could suggest is to have an Attribute sop connected to your output and during the cooking process you can set the parameter to delete your attributes.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
71 posts
Joined: June 2008
Offline
Hi, Graham!
Thank you for answer.
My case is quite simple. I have a digital asset, that can create some results and for each result asset will create some attributes, which will be used for internal calculations. It will be nice if this attributes will be removed after calculations are finished. I know a common list of attributes to remove, but I don't know the list of attributes for every particular generated result. Thus I have to create a list of attributes to be removed for particular result with existance verification and then specify it for Attributes SOP.
I would like to make a nice and simple network. I see two ways: either I will create custom Python SOP, which will delete in loop every attribute from common list after existance verification (“destroy” method in the hou.Attrib) or I will specify common list for Attribute SOP, but this case Attribute SOP gives a warning if the specified attribute(s) does not exist. Warning is good for checking, but the network looks dirty (I don't like warnings which are not necessary ). It will be nice, if “Attribute SOP” will have “skip warning” mode: if attribute(s) does not exist the warning will not be generated.
Alexey Mazurenko
  • Quick Links