alexmajewski
April 25, 2024 04:14:09
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
April 26, 2024 11:00:52
There's got to be an easier way but you can always make a parm and read it from there.
tpetrick
April 26, 2024 11:06:18
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
April 27, 2024 05:04:29
@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.