Jump to content

Query parameter under the right-click menu


afx

Recommended Posts

Is there a way to query the parameter you right clicked, essentially what I want to do is right-click on said parameter - query it - and then create a copy right underneath it. I have a PARMmenu.xml file going, I am just not clear in how to get the query. Noob to python, but long time houdini user.

Link to comment
Share on other sites

  • 2 weeks later...

I am not sure of what you want to achieve, but here is a hint of how to print the clicked parameter name

<?xml version="1.0" encoding="UTF-8"?>
<menuDocument>
    <menu>
        <subMenu id="parmmenu.print_parm">
            <insertBefore />
            <label>Print Parm</label>
            <scriptCode><![CDATA[
parms = kwargs["parms"]

for parm in parms:
	print(parm.name())
    ]]>
            </scriptCode>
        </subMenu>

        <separatorItem>
            <insertAfter>parmmenu.print_parm</insertAfter>
        </separatorItem>
    </menu>
</menuDocument>

The "parms" keyword argument is a tuple containing the clicked parameters that triggered the menu (it is a tuple because in some cases there are multiple parameters for the same parameter on the interface, a translate has tx, ty and tz for exemple). If I understant what you mean by creating a copy of the parameter, you can copy its parm template and add it to the node which the clicked parm belongs to.

 

Cheers,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...