検索 - User list
Full Version: How to access current cook value of an attribute in Python?
Root » PDG/TOPs » How to access current cook value of an attribute in Python?
alexmajewski
I would like to check current cook value of a wedge attribute in a Python expression.

The same way that we use `@pdg_index` in string parameters etc. but this time we'd like to grab that value in a script. How can I do that?
Soothsayer
There's got to be an easier way but you can always make a parm and read it from there.
tpetrick
You can access the active work item using pdg.WorkItem() in a Python Expression, and use that to look up the index, attribute values, etc. There's an example in the documentation for the PDG Python module: https://www.sidefx.com/docs/houdini/tops/pdg/index.html#functions [www.sidefx.com]

The next release also has a top-level pdg.attrib(..) function that mirrors the HScript equivalent.
alexmajewski
@tpetrick Amazing! Thank you! Just a small correction: the actual function is pdg.workItem() (lowercase 'w'), I got stuck for a while before I realized. Thanks for linking the docs.

For every solution with a spare parameter there's always another secret one that's much cleaner.
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