Hey all,
Was hoping someone might be able to point me in the right direction. I am trying to implement a drag and drop functionality from Shotgun in the browser into houdini. Currently have a setup for Nuke but Houdini is proving to be more difficult. Any help would be greatly appreciated!
thanks!
Event Trigger for python callback on drag and drop
10585 9 4- caden
- Member
- 8 posts
- Joined: 10月 2013
- Offline
- tpetrick
- スタッフ
- 600 posts
- Joined: 5月 2014
- Offline
Houdini has a script hook for external drag/drop, but currently only file path data is supported.
To use the script hook add a Python script named externaldragdrop.py to the Houdini script path, for example ~/houdini16.5/scripts/externaldragdrop.py. The script should define a function called dropAccept which takes a single parameter. Every time a drop event occurs on the main Houdini application it will call the dropAccept function with a list of file path(s) that were dropped onto Houdini. The function can return True to block the drop event from continuing on to Houdini, or False to indicate that Houdini should handle the drop event itself.
An example drop handler script that ignores .hip file drops and creates Font SOPs with the contents of the incoming files:
If the data in the drag/drop event contains arbitary text or binary data instead of file paths the script hook won't be invoked. This is something that would need to be fixed on our end - I can look into fixing that if necessary.
To use the script hook add a Python script named externaldragdrop.py to the Houdini script path, for example ~/houdini16.5/scripts/externaldragdrop.py. The script should define a function called dropAccept which takes a single parameter. Every time a drop event occurs on the main Houdini application it will call the dropAccept function with a list of file path(s) that were dropped onto Houdini. The function can return True to block the drop event from continuing on to Houdini, or False to indicate that Houdini should handle the drop event itself.
An example drop handler script that ignores .hip file drops and creates Font SOPs with the contents of the incoming files:
import hou import os def dropAccept(file_list): if len(file_list) == 1 and os.path.splitext(file_list[0])[1] == ".hip": return False for filename in file_list: with open(filename) as f: contents = f.read() obj = hou.node("/obj") geo = obj.createNode("geo", "geo1", False, False) font = geo.createNode("font") font.parm("text").set(contents[:20]) return True
If the data in the drag/drop event contains arbitary text or binary data instead of file paths the script hook won't be invoked. This is something that would need to be fixed on our end - I can look into fixing that if necessary.
- NFX
- Member
- 183 posts
- Joined: 12月 2011
- Offline
The ability to drag in arbitrary text or even binary data and handle it would be amazing. Just to verify, would this work with python panels? So far I haven't been able to figure out a good way drag and drop data from a custom panel into a parameter field. Seems like an important feature to have to support common studio tasks like wanting to drag an asset from a python asset manager into the viewport or network view. Perhaps there is already a way to do this that I have missed?
- caden
- Member
- 8 posts
- Joined: 10月 2013
- Offline
Thank you tpetrick! I apologize for the delayed response but such are the riggers of production.
I haven't had the chance to try and implement this but I agree with NFX. This all came about because we would like to more tightly integrate the shotgun web ui into our artist pipeline. To really provide a robust solution I definitely believe we will need to be able to accept arbitrary text/data i.e json data stored in shotgun.
Please let me know what you think and would love to be kept in the loop if this issue progresses.
I haven't had the chance to try and implement this but I agree with NFX. This all came about because we would like to more tightly integrate the shotgun web ui into our artist pipeline. To really provide a robust solution I definitely believe we will need to be able to accept arbitrary text/data i.e json data stored in shotgun.
Please let me know what you think and would love to be kept in the loop if this issue progresses.
- Doudini
- Member
- 333 posts
- Joined: 10月 2012
- Offline
- lightreacher
- Member
- 7 posts
- Joined: 10月 2013
- Offline
- mattebb
- Member
- 263 posts
- Joined: 10月 2010
- Offline
- danielsweeney
- Member
- 11 posts
- Joined: 7月 2016
- Offline
- ivantitov_zd
- Member
- 27 posts
- Joined: 2月 2017
- Offline
tpetrick
Houdini has a script hook for external drag/drop, but currently only file path data is supported.
If the data in the drag/drop event contains arbitary text or binary data instead of file paths the script hook won't be invoked. This is something that would need to be fixed on our end - I can look into fixing that if necessary.
Is there any news?
English is not my native language, sorry in advance for any misunderstanding
- ababak
- Member
- 7 posts
- Joined: 11月 2019
- Offline
-
- Quick Links