Accessing PDG inputs in Python expression

   1851   3   1
User Avatar
Member
39 posts
Joined: Feb. 2017
Offline
This feels like something that has been answered elsewhere, but I seem to be missing something because I can't access upstream data in my Python expressions.

Quick example of what I'm trying to do: render with a ROPfetch, perform some comp operations in a ROPCompositeOutput node, change the output name via Python string manipulation in the copoutput channel, write to disk.

Here's some sample code running in that channel expression that I thought should get me the input file name or at least the upstream workItem, but no luck yet:

#looking for input from upstream item
inputList = pdg.input()
inputTag = pdg.input(tag="file/image")

#just trying to find the upstream item at all
parent = pdg.workItem().parent
batchParent = pdg.workItem().batchParent

print(inputList, inputTag, parent, batchParent)

The results are all empty though:
([], [], None, None)

Clearly I'm misunderstanding how to approach the problem because neither that example nor anything else I can think of from the Python reference gets me any data other than "None" or an empty array.

Thanks for any help.
User Avatar
Member
146 posts
Joined: June 2016
Offline
Any ideas on how to do it. im facing the same roadblock right now. searching for solutions.
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
User Avatar
Member
146 posts
Joined: June 2016
Offline
This helped me to access the output files of the upstream network. hope that might help someone.

results = parent_item.outputFiles
for i in results:
    print(i)
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
User Avatar
Member
146 posts
Joined: June 2016
Offline
And to get other attribute this is working well for me

result = work_item.attribValues()

for key, value in result.items():
    print(key, ' : ', value)
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
  • Quick Links