cval

cval

About Me

Expertise
Not Specified
Location
Not Specified
Website

Connect

Recent Forum Posts

scriptMenuStripRadio default value Oct. 19, 2022, 10:28 a.m.

Hello everybody,

I am building a menu with radio buttons and in the documentation [www.sidefx.com], I see that scriptMenuStripRadio seems a good way. The problem that I have is that I do not understand how to set the default value for the scriptMenuStripRadio. When I launch houdini and open my menu, all radio buttons are "unchecked". I would like to define the initial value for the strip in my menu definition. Is there a way to do this?

Also, when looking at examples from houdini menus, I see that menuStripRadio is used instead of scriptMenuStripRadio. However, I do not find any documentation about menuStripRadio. If I try using menuStripRadio, then I find that there is an initial radio button that is "checked" when I open my menu. However, I do not know how to read that value in python since there is not global variable associated with it.

Any hints would be very much appreciated.

Thank you

Setting default hotkeys for a tool distributed in a package Oct. 18, 2022, 11:31 p.m.

Hello everybody

I am developing a tool that is being distributed through a package. The tool is adding functionnalities to the animation graph and those new functionnalities are available to the user through a custom menu added to the animation graph (by including a custom AnimationEditorGraphMenu.xml in my package). I would like to add hotkeys to those menu entries, but I am not sure what would be the correct way. By looking in the houdini installation folder, I discovered that hotkeys are set by the Hotkeys file found in houdini\config\Hotkeys folder. I tried to replicate this pattern in my package, but this resulted in a lot of errors when launching houdini (hotkey symbols not being found). So I guess that this way is destructive and not legit...

My second attempt was to use a keymap override instead of a config\Hotkeys folder. So I created a Houdini.keymap.overrides file that I saved at the root of my package. This seems to work, but I wonder if this will only work for the Houdini keymap? What if the user made a custom keymap?

In the documentation, I see that there is a hou.hotkeys python module : https://www.sidefx.com/docs/houdini/hom/hou/hotkeys.html [www.sidefx.com]

Should I use this instead? Is there a way to execute a python file when the package is loaded that would create the needed contexts and hotkey assignments? (like a startup script I suppose...)

To summarize, my question is: what would be the most legit way of distributing a package with hotkeys assignations?

Thanks in advance for any help

Programmatically accessing selected keyframes from AnimGraph April 19, 2022, 3:43 p.m.

Big thanks to Guillaume from SideFX who could indicate me the problem with my code and how to fix it! I am posting the solution here in case it can help other persons.

The problem was accessing the correct channel_editor (animation_editor). Here is an example that returns selected keyframes from the pane under the cursor:

def get_selected_keyframes():
    pane_tab = hou.ui.paneTabUnderCursor()
    anim_editor = pane_tab.graph()
    return anim_editor.selectedKeyframes()

Just make sure that your mouse is over an animation editor while executing this code