Supercharged H20 extension (TouchDesigner Style)

   Views 46223   Replies 133   Subscribers 8
User Avatar
Member
4861 posts
Joined: Feb. 2012
Offline
Xr_Blood
animatrix_
Xr_Blood
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.

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.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
14 posts
Joined: Oct. 2020
Offline
animatrix_
Xr_Blood
animatrix_
Xr_Blood
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.

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.
User Avatar
Member
4861 posts
Joined: Feb. 2012
Offline
In the upcoming version, you'll be able to undo and redo network editor view changes independently for each network editor. This new history is completely separate from the scene change undo/redo history, ensuring it won't interfere with or bloat your regular undo/redo actions:

Attachments:
undoredo3.gif (4.9 MB)

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
33 posts
Joined: Feb. 2024
Offline
Nevermind, after a few hours I managed to make it work, just pasted the hotkeys into the Hotkeys file and resolved a couple conflicts, I like it
User Avatar
Member
33 posts
Joined: Feb. 2024
Offline
Hi, I am trying to use Append to Parameter Editor and get this error, maybe I am using it wrong? I guess it has something to do with the fact that I have another addon which has it's own 123.py file, and it seems it is found first, and disregards any subsequent one. Can I merge your 123.py into the one that is being loaded?
Edited by bskochii - Feb. 3, 2025 03:43:23

Attachments:
parameterpin.png (55.2 KB)
parameterAppend.png (115.0 KB)

User Avatar
Member
4861 posts
Joined: Feb. 2012
Offline
bskochii
Hi, I am trying to use Append to Parameter Editor and get this error, maybe I am using it wrong? I guess it has something to do with the fact that I have another addon which has it's own 123.py file, and it seems it is found first, and disregards any subsequent one. Can I merge your 123.py into the one that is being loaded?
Image Not Found

Hi,

I checked there was a bug there in the shelf code, so you can update it to this until I push a new update:

from utility_ui import appendToParameterEditor
appendToParameterEditor()

Just right click on the tool and choose Edit Tool.

As for multiple 123 files, if you are sure one of them is not being called at startup, you can definitely merge them. This issue above is not related to that though.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
33 posts
Joined: Feb. 2024
Offline
animatrix_
Just right click on the tool and choose Edit Tool.

Cheers!

Gonna work with 123.py now, thanks!
User Avatar
Member
768 posts
Joined: Feb. 2017
Offline
Hey @animatrix, I hope you are fine!

I have a question. I often use the little button to flip two sides of a splitted pane.
Do you think it would be possible to create a script action for that?

Cheers
CYTE

Attachments:
Screenshot 2025-02-04 102647.jpg (14.5 KB)

User Avatar
Member
4861 posts
Joined: Feb. 2012
Offline
CYTE
Hey @animatrix, I hope you are fine!

I have a question. I often use the little button to flip two sides of a splitted pane.
Do you think it would be possible to create a script action for that?

Cheers
CYTE

Hi,

Yes there is a splitSwap method on hou.Pane that you can use for this:
https://www.sidefx.com/docs/houdini/hom/hou/Pane.html [www.sidefx.com]
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
768 posts
Joined: Feb. 2017
Offline
Thanks @animatrix,
I put this here in case anybody wants the same command as a hotkey. create a shelf tool with this python script:
import hou

# Get the current Houdini desktop
desktop = hou.ui.curDesktop()

# Get the currently selected pane
pane = desktop.paneUnderCursor()

# Check if the pane supports the splitSwap() function
if pane and hasattr(pane, 'splitSwap'):
    pane.splitSwap()
else:
    hou.ui.displayMessage("This pane does not support splitSwap(). Try hovering over a different pane.")

Cheers
CYTE
Edited by CYTE - Feb. 7, 2025 15:44:10
User Avatar
Member
33 posts
Joined: Feb. 2024
Offline
Hi @animatrix,

Wanted to try out the theme with circle nodes, but I don't seem to understand where to paste the files, can you give me a hint
It tried on a clean Houdini as well. Pasted files I got from the Gumroad. Everything works, but not the theme, I even tried to paste files from naiad folder directly into houdini20.5, but still no effect
Edited by bskochii - March 31, 2025 19:13:08
User Avatar
Member
4861 posts
Joined: Feb. 2012
Offline
bskochii
Hi @animatrix,

Wanted to try out the theme with circle nodes, but I don't seem to understand where to paste the files, can you give me a hint
It tried on a clean Houdini as well. Pasted files I got from the Gumroad. Everything works, but not the theme, I even tried to paste files from naiad folder directly into houdini20.5, but still no effect

Hi,

Did you put the OPcustomize file and nodethemes.json directly under the houdini20.5 folder? With the supercharged extension, it's using packages to install each module separately so the files are not placed under under the houdini20.5 folder but it's the same idea.

Do you have the custom shapes option off in Houdini? Because the extension is basically overriding the default node shape visually but doesn't alter any node shapes when others look at the same scene files so it's completely non-destructive.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
33 posts
Joined: Feb. 2024
Offline
So you're saying that I don't need to do anything for it to work,just copy the contents of Supercharged extension from the archive, and make sure custom node shapes are on? Correct? If so it doesn't seem to work, but hey, I can live without it, so don't bother, it's just my OCD, I want to make sure everything's working even though I don't actually need it haha, all good man
User Avatar
Member
4861 posts
Joined: Feb. 2012
Offline
Yes if the packages are installed as is in $HOUDINI_USER_DIR, and you have other functionality available, then the node shapes should also work.

It's better to have this option off. If you have it on, then the explicit custom node shapes will override the circle shapes.

Attachments:
option.png (581.5 KB)

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
  • Quick Links