Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Guest mantragora

Custom TAB submenu and selector to not reuse selection

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

Share this post


Link to post
Share on other sites

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

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

Edited by mantragora

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thank you, it works. The only problem is that now I got operator available in both, Custom and MANTRAGORA submenu.

Share this post


Link to post
Share on other sites

My guess would be your custom tool isn't quite named correctly to cause Houdini to recognize it as being for your operator and not building a default tool.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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îè

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now