Accessing upstream Result Data without dynamic cooking

   1884   2   0
User Avatar
Member
201 posts
Joined: July 2015
Offline
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.

Attachments:
pdg_access_upstream_resultdata.hip (112.2 KB)

Manuel Köster - Senior Technical Artist @Remedy Entertainment

https://www.remedygames.com/ [www.remedygames.com]
http://shadesoforange.de/ [shadesoforange.de]
https://twitter.com/ShadesOfOrange_ [twitter.com]
User Avatar
Staff
585 posts
Joined: May 2014
Offline
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.
User Avatar
Member
201 posts
Joined: July 2015
Offline
Great news, thanks Taylor!
I will revive this thread when the next version ships and I get back to it.
Manuel Köster - Senior Technical Artist @Remedy Entertainment

https://www.remedygames.com/ [www.remedygames.com]
http://shadesoforange.de/ [shadesoforange.de]
https://twitter.com/ShadesOfOrange_ [twitter.com]
  • Quick Links