Creating Global Attribute through Python

   Views 551   Replies 1   Subscribers 0
User Avatar
Member
21 posts
Joined: March 2021
Offline
Hello:
I know how to create a global attribute through the AttributeCreate node but I was wondering how I would create one in a PythonProcessor or PythonScript node? I saw the docs mention using pdg.Graph but I'm not sure I'm using it correctly as I don't seem to see any attributes created ( https://www.sidefx.com/docs/houdini/tops/attributes.html#global-vs-work-item-attributes [www.sidefx.com] ) Thank you!
User Avatar
Staff
615 posts
Joined: May 2014
Offline
pdg.Graph has all of the same methods as pdg.WorkItem for adding/setting attributes. For example, in a Python Script. you can use the following to create a global string attribute named "example" that appears in the MMB menu on the TOP Network itself:

graph.setStringAttrib("example", "value")
  • Quick Links