ChatGPT - Handle alignment script

   1327   4   0
User Avatar
Member
678 posts
Joined: 2月 2017
Offline
Hey everybody,

I want a radial menu that contains all the handle alignment states. I tried to create it with ChatGPT but it isn't working. Can somebody correct it?

Cheers
CYTE

import hou

def radial_menu():
    # Get the current handle alignment state
    handle_align = hou.handleAlignment()

    # Create the radial menu
    menu = hou.ui.createRadialMenu()
    menu.setTitle("Handle Alignment")

    # Add the global option to the menu
    global_item = menu.addItem("Global")
    global_item.setCheckable(True)
    if handle_align == hou.handleAlignment.Global:
        global_item.setChecked(True)

    # Add the object option to the menu
    object_item = menu.addItem("Object")
    object_item.setCheckable(True)
    if handle_align == hou.handleAlignment.Object:
        object_item.setChecked(True)

    # Add the parent option to the menu
    parent_item = menu.addItem("Parent")
    parent_item.setCheckable(True)
    if handle_align == hou.handleAlignment.Parent:
        parent_item.setChecked(True)

    # Show the menu and retrieve the selected option
    selected_item = menu.exec_()

    # Set the handle alignment based on the selected option
    if selected_item == global_item:
        hou.setHandleAlignment(hou.handleAlignment.Global)
    elif selected_item == object_item:
        hou.setHandleAlignment(hou.handleAlignment.Object)
    elif selected_item == parent_item:
        hou.setHandleAlignment(hou.handleAlignment.Parent)
User Avatar
Member
64 posts
Joined: 4月 2022
Offline
There are no Python functions in Houdini to align handles. And this is very sad. As for ChatGPT, it invents a non-existent functionality. When there is no function in Houdini, it simply invents its own. Moreover, it does not even know how to correctly create nodes and links between them. I want to note that its knowledge of scripting in Maya is much better.
alexeyvanzhula.gumroad.com
User Avatar
Member
678 posts
Joined: 2月 2017
Offline
Thanks, Alexey,

thats a bummer. I wish it was easier to create stuff like that in Houdini. It was so simple in XSI

Cheers
Philipp
User Avatar
Member
7737 posts
Joined: 9月 2011
Offline
why? there's hot keys for them and they are in the right click menu.
User Avatar
Member
678 posts
Joined: 2月 2017
Offline
@jsmack
yea, it's not a big thing I just would like to have them in a radial menu as I really like to work that way. The right-click menu is quite cumbersome. having a radial menu reduces the number of hotkeys for all handle alignments to one. and I like that. everybody works a bit differently, and I think it's a simple thing that should be possible. why not?

Cheers
CYTE
  • Quick Links