Shotgun find Output

   387   7   2
User Avatar
Member
5 posts
Joined: Feb. 2015
Offline
Hello,

Can you help me to get the result of the shotgun find output. I can see anything in work_item.data.allDataMap or parent_item.data.allDataMap.

Thank you

Attachments:
find.JPG (70.0 KB)

User Avatar
Member
16 posts
Joined: March 2011
Offline
Hi Clément, how did you setup SG to work with TOPs? I can´t find a way to make it work. Thanks and sorry to use your post to ask a different question.
User Avatar
Member
5 posts
Joined: Feb. 2015
Offline
Hi,

You have to set the environment variables PDG_SHOTGUN_LOGIN to your Shotgun username, PDG_SHOTGUN_PASSWORD to your Shotgun password and PYTHONPATH to the shotgun api path. Normaly after that your shotgun session node should work.

Clement
User Avatar
Member
16 posts
Joined: March 2011
Offline
Yeah, I´ve added them, but I´m still getting errors (houdini doesn´t find the path to the API). In my “PYTHONPATH” variable (on the system), I added the path to “\\python-api\\shotgun_api3”. Is that correct?
User Avatar
Member
5 posts
Joined: Feb. 2015
Offline
Can you “import sgtk” in python shell?
User Avatar
Member
16 posts
Joined: March 2011
Offline
Yes, inside houdini´s python shell I can. I´ve shotgun running and SG python tab open inside houdini. But I still get error´s saying that Houdini can´t find SG API. As I posted, I pointed out the “PYTHONPATH” environment to the “shotgun_api3” folder. Is that correct? Do I need to add extra folders to the environment?

Got it. Was a problem with the pythonpath. Thanks for the help, and I hope someone can help you too!
Edited by guilhermecasagrandi - March 26, 2019 11:02:24
User Avatar
Staff
295 posts
Joined: Aug. 2017
Offline
Clément HECTOR
Hello,

Can you help me to get the result of the shotgun find output. I can see anything in work_item.data.allDataMap or parent_item.data.allDataMap.

Thank you

The reason that you can't find the output in the data map is that the Shotgun node is attaching the output as result data, which is a separate entity from the attribute data.

If you want to extract the information in the Python Script node and attach the information as attributes, you could do something like this:

entity_types = pdg.resultData(parent_item, "shotgun/find_entity_type", as_list=True)
entity_dicts = pdg.resultData(parent_item, "shotgun/find_entity_dict", as_list=True)
entity_ids = pdg.resultData(parent_item, "shotgun/find_entity_id", as_list=True)

for x in xrange(0, len(entity_ids)):
work_item.data.setInt("entity_ids", int(entity_ids[x]), x)
work_item.data.setString("entity_types", entity_types[x], x)
work_item.data.setString("entity_dicts", entity_dicts[x], x)

This will grab 3 distinct lists of result data from the upstream work item, where each list corresponds to a tag. It then iterates over the number of returned entities, and adds the information as attributes.
User Avatar
Member
5 posts
Joined: Feb. 2015
Offline
Thanks a lot! That's exactly what I wanted. I just have to put the results in different index, thanks again.
  • Quick Links