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:
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.