Search - User list
Full Version: Delete attribute on a work item via python
Root » PDG/TOPs » Delete attribute on a work item via python
mzigaib
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
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.
mzigaib
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.
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.
mzigaib
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!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB