Jump to content

Custom TAB submenu and selector to not reuse selection


Guest mantragora

Recommended Posts

Guest mantragora

Hi.

I got two HOWTO questions:

1) In DA you just specify TAB submenu path and you are ready to go, but I can't find anything similar in HDK when I'm adding operator. I suppose it is somewhere in OP_OperatorTable, but which function does that ? I don't see Tab submenu path function there :).

2) In python you can pass

use_existing_selection=False

to the selector and it will not reuse already selected geometry. I can't find the same functionality in HDK selector.

There are probably simple solutions for those two questions.

Thanks in advance.

Edited by mantragora
Link to comment
Share on other sites

Guest mantragora

You came, You saw, You solved ;) . Thank you.

Only one to go. Anyone knows how to solve first question?

Edited by mantragora
Link to comment
Share on other sites

  • 1 month later...

Only one to go. Anyone knows how to solve first question?

Yep, you can't :)

I submitted a RFE more than a year ago to add this feature to OP_OperatorTable.

Still waiting, last time I checked with support they told they are working on it.

You have the same problem if you code a VEX node from scratch and compile it using vcc, noway to put your node inside a submenu.(AFAIK)

Cheers

Link to comment
Share on other sites

All Houdini nodes and tools have their tool information (including Tab menu settings) defined in tool definitions. This includes all HDK compiled nodes (both custom and SESI built). To have anything other than your compiled operator showing up in the 'Custom' tab menu you will have to build your own tool definition and shove it in a toolbar/ folder in the Houdini path.

For digital assets, when you edit the menu location on in the Type Properties you are modifying the definition in the Tools.shelf section of the definition. When Houdini starts up, tools from otls are loaded so the nodes become available to you. When Houdini starts up and sees something like an HDK operator and can not find any pre-defined tools it will generate a very basic default tool to allow the node to be instantiated.

Link to comment
Share on other sites

Guest mantragora

I suppose this is not the same toolbar definition like *.shelf file? Or is it and you just use different XML attributes there? Is there example somwhere of such a file somewhere?

Is there full specification of all attributes that are available in *.shelf format somewhere?

Edited by mantragora
Link to comment
Share on other sites

I don't think there is any real documentation about writing them. Your best bet is to either look through $HFS/houdini/toolbar to see all Houdini's default tools, or to just create a new tool on the shelf, add a bunch of settings to it then look at the corresponding generated .shelf file. You can pick and choose elements from the files and basically create your own.

Here's an example of a simple .shelf file containing a tool for a compiled operator.

https://github.com/captainhammy/Houdini-Toolbox/blob/master/SOP/SOP_PrimGroupCentroid/sop_primgroupcentroid.shelf

Link to comment
Share on other sites

Guest mantragora

So I've trying to figure out how the attributes should be used.

Let's say we got tool with:

- internal name => "hdk_createpolygon" <= this is the same name you will see if you MMB on your operator under "Operator type".

- external name => "HDK CreatePolygon" <= this is the name we see on the interface

Now let's fill the data:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;shelfDocument&gt;
&lt;tool name="sop_createpolygon" label="CreatePolygon" icon="SOP_CreatePolygon"&gt;

&lt;helpURL&gt;operator:Sop/hdk_createpolygon&lt;/helpURL&gt;

&lt;toolMenuContext name="viewer"&gt;
&lt;contextNetType&gt;SOP&lt;/contextNetType&gt;
&lt;/toolMenuContext&gt;
&lt;toolMenuContext name="network"&gt;
&lt;contextOpType&gt;Sop/hdk_createpolygon&lt;/contextOpType&gt;
&lt;/toolMenuContext&gt;

&lt;toolSubmenu&gt;MANTRAGORA/HDK&lt;/toolSubmenu&gt;

&lt;script scriptType="python"&gt;&lt;![CDATA[import soptoolutils

soptoolutils.genericTool(kwargs, 'hdk_createpolygon', allow_obj_sel=False)]]&gt;&lt;/script&gt;
&lt;/tool&gt;
&lt;/shelfDocument&gt;

Now, as I understand, all attributes in this line

&lt;tool name="foo" label="Foo" icon="FooIcon"&gt;

can be filled with different data than our internal/external name and icon we specified in the C++ code, we use this to specify how our tool will be named when moved to MANTRAGORA/HDK submenu. I suppose we can also use the same names as we specified in C++. In both cases I still get tool in both, Custom and MANTRAGORA/HDK submenus. Is there anything else that can be wrong?

Edited by mantragora
Link to comment
Share on other sites

Guest mantragora

The tool name is of this form: {context}_{internal_name}

So In your case you should name your tool: "sop_hdk_createpolygon".

F*ck yeah! Works. Thank you!

Link to comment
Share on other sites

  • 2 years later...

Hi there,

 

I know the topic is quite old, but I've decided to ask here anyway, since things might have changed with newer versions of houdini.

Basically my problem is that I'm trying to implement a vop network where only custom vop nodes are allowed and only those should show up in the tab menu. Most of the vops inherit from a custom base class and are generated automatically. So what I've ended up with is - in the tab menu there is single submenu "Custom" where all allowed vops can be found. Is there  any other way I could customise the tab menu without generating a tool definition for every vop that I have and place it under houdini/toolbar folder? What would be the best approach here?

 

Thanks.

Link to comment
Share on other sites

Guest mantragora

No.

 

Every node have generated tool definition. Even when you modify Digital Asset and you modify TAB Submenu Path, under the hood there is a Tool.shelf file modified that is included inside of HDA.

 

EDIT: 

To expand a little on this, I've been thinking about XML config file for my tools, instead of header file where I #define all parameter names, tooltips etc. So once Houdini launches, it reads file and sets the names. It would allow easy name changing if there is existing tool in some pipeline with specified name, without the need for recompilation.

This XML file could be also used to easily generate tool definition files with some additional script (added to compilation stack at the end for automation). Maybe you could go this way.

Edited by fântastîque Mântragorîè
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...