Search - User list
Full Version: Accessing upstream Result Data without dynamic cooking
Root » PDG/TOPs » Accessing upstream Result Data without dynamic cooking
shadesoforange
Hey,

everytime I've been creating PDG tools I struggled with accessing upstream result data when cooking a whole graph at once.

Example Python Processor:
for upstream_item in upstream_items:
    print upstream_item.resultData[0]

This will error out with
Traceback (most recent call last):
File "pythonprocessor.generate", line 2, in <module>
IndexError: list index out of range

To prevent this error when cooking the whole graph at once you can instead access expected result data.
for upstream_item in upstream_items:
    print upstream_item.expectedResultData[0]

But this won't work if you cook the graph node by node (same errorlog).

Any pointers?

I've attached a hipfile showing the issue.
tpetrick
One option is to use the lower-level function instead of the property, which allows you to query output files by tag and optionally include both actual files and expected outputs:

upstream_item.resultDataForTag(tag=“file”, include_expected=True)

The tag is just a prefix – “file” will match files tagged with “file/geo”, “file/image”, etc.

The reason for the issue is that when a work item cooks it replaces any expected outputs that correspond to real file paths created while cooking. This means that the behavior of a downstream Python Processor depends on whether or not the input items are cooked or not, which isn't ideal. That issue has been addressed in the next release of Houdini. The attributes and files on work items will always appear the same to a downstream static node, regardless of whether the work item is cooked or not.
shadesoforange
Great news, thanks Taylor!
I will revive this thread when the next version ships and I get back to it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.