学荣 陈
Xr_Blood
About Me
Connect
LOCATION
London,
Not Specified
WEBSITE
Houdini Skills
Availability
Not Specified
Recent Forum Posts
Supercharged H20 extension (TouchDesigner Style) Nov. 20, 2024, 10:29 p.m.
animatrix_Xr_Bloodanimatrix_Xr_Bloodtpetrick 特佩特里克
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.
I saw a post on the forum where SideFX staff member tpetrick wrote.
Ok using that script, I get the drag and drop but it only seems to work on the 3d viewport. You manage to get it working using the regular network editor? I think this might require more to get it working for any network editor.
Yes, the Network Editor in the main panel supports this by default. You can modify it to drag and drop files into the Network Editor and print the file paths.
Now I have to press a shortcut to switch to the Network Editor in the main panel to drag and drop files, then switch back to the Supercharged Network Editor to work.
Oh ok I see where the confusion is. I was testing using another floating network editor. So it's not that it doesn't work on the overlay network editor, but that it doesn't work on floating panels, which the overlay network editor also is. So this has to be added by SideFX to work. That would be a good RFE.
Okay, I understand the issue. Thank you for your explanation. Hopefully, SideFX will update support soon.
Supercharged H20 extension (TouchDesigner Style) Nov. 20, 2024, 9:36 a.m.
animatrix_Xr_Bloodtpetrick 特佩特里克
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.
I saw a post on the forum where SideFX staff member tpetrick wrote.
Ok using that script, I get the drag and drop but it only seems to work on the 3d viewport. You manage to get it working using the regular network editor? I think this might require more to get it working for any network editor.
Yes, the Network Editor in the main panel supports this by default. You can modify it to drag and drop files into the Network Editor and print the file paths.
Now I have to press a shortcut to switch to the Network Editor in the main panel to drag and drop files, then switch back to the Supercharged Network Editor to work.
Supercharged H20 extension (TouchDesigner Style) Nov. 20, 2024, 6:59 a.m.
tpetrick 特佩特里克
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.
I saw a post on the forum where SideFX staff member tpetrick wrote.