Delete attribute on a work item via python

   2426   4   0
User Avatar
Member
948 posts
Joined: April 2008
Offline
I am trying to delete an attribute using python processor but it gives me an error saying that is read only, how can I do that?

Thats the line I am using:

upstream_item.eraseAttrib("my_attrib")

Thanks
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Staff
585 posts
Joined: May 2014
Offline
You cannot modify an upstream work item in a Python Processor or Python Script. A node can only add or remove attributes from the work items in the node itself -- it can't edit attributes on work items in other nodes. If you have two nodes that are both wired into the same input, and those nodes were allowed to edit the input node's work items, then the behavior of the entire graph would be random depending on the cook order of the two nodes. One node might delete attributes on the upstream items and cause the second node to behave differently, for example.
User Avatar
Member
948 posts
Joined: April 2008
Offline
tpetrick
You cannot modify an upstream work item in a Python Processor or Python Script. A node can only add or remove attributes from the work items in the node itself -- it can't edit attributes on work items in other nodes. If you have two nodes that are both wired into the same input, and those nodes were allowed to edit the input node's work items, then the behavior of the entire graph would be random depending on the cook order of the two nodes. One node might delete attributes on the upstream items and cause the second node to behave differently, for example.

Thanks for the info dude!
If you may I have another question regarding attributes on TOPs, I am trying to add a TOP attribute to a geometry primitive through the geometry_import TOP node using the "add attributes" in the edit geometry tab but it doesn't seem to add anything, am I missing something?

Thanks.
Edited by mzigaib - Jan. 24, 2021 15:36:18
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Staff
585 posts
Joined: May 2014
Offline
Are you able to attach an example file that demonstrates the issue? The Add Attributes parameter is used to copy an attribute that already exists on the work item onto the imported geometry. It won't affect the source geometry (the SOP or the original .bgeo.sc file) -- it will only update the geometry stored on the work item.
User Avatar
Member
948 posts
Joined: April 2008
Offline
tpetrick
Are you able to attach an example file that demonstrates the issue? The Add Attributes parameter is used to copy an attribute that already exists on the work item onto the imported geometry. It won't affect the source geometry (the SOP or the original .bgeo.sc file) -- it will only update the geometry stored on the work item.

Oh Thanks for the info!

What I was trying to do is add and TOP attribute to the primitive geometry without having pass through sops.

Thanks again!
https://vimeo.com/user2163076 [vimeo.com]
  • Quick Links