Jump to content


Custom TAB submenu and selector to not reuse selection

hdk mantragora c++ houdini submenu tab selector

  • Please log in to reply
12 replies to this topic

#1 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 651 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 13 May 2013 - 02:32 AM

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, 13 May 2013 - 05:10 AM.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#2 edward

edward

    Grand Master

  • Members
  • PipPipPipPipPip
  • 3,758 posts
  • Joined: 10-September 02
  • Name:e.d.w.a.r.d. .

Posted 14 May 2013 - 01:54 AM

2) See OP3D_InputSelectorBase::allowFinishWithExistingSelection()
don't panic!

#3 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 651 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 14 May 2013 - 03:39 AM

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


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

Edited by mantragora, 14 May 2013 - 02:13 PM.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#4 lisux

lisux

    Houdini Master

  • Members
  • PipPipPipPip
  • 656 posts
  • Joined: 11-February 04
  • Location:London
  • Name:Pablo Gimenez

Posted 19 June 2013 - 03:54 PM

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
Best Regards
Pablo Gimenez

#5 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 651 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 19 June 2013 - 06:51 PM

Haha, thanks for info. Good to know about RFE.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#6 graham

graham

    Houdini Master

  • Moderator
  • 784 posts
  • Joined: 13-September 06
  • Location:Santa Monica, CA
  • Name:Graham Thompson

Posted 19 June 2013 - 09:50 PM

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.
I write python and break things.

#7 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 651 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 20 June 2013 - 02:24 AM

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, 20 June 2013 - 03:56 AM.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#8 graham

graham

    Houdini Master

  • Moderator
  • 784 posts
  • Joined: 13-September 06
  • Location:Santa Monica, CA
  • Name:Graham Thompson

Posted 20 June 2013 - 06:25 AM

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/c...pcentroid.shelf
I write python and break things.

#9 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 651 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 20 June 2013 - 11:53 AM

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

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#10 graham

graham

    Houdini Master

  • Moderator
  • 784 posts
  • Joined: 13-September 06
  • Location:Santa Monica, CA
  • Name:Graham Thompson

Posted 20 June 2013 - 06:18 PM

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.
I write python and break things.

#11 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 651 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 21 June 2013 - 12:37 PM

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:
<?xml version="1.0" encoding="UTF-8"?>
<shelfDocument>
<tool name="sop_createpolygon" label="CreatePolygon" icon="SOP_CreatePolygon">

<helpURL>operator:Sop/hdk_createpolygon</helpURL>

<toolMenuContext name="viewer">
<contextNetType>SOP</contextNetType>
</toolMenuContext>
<toolMenuContext name="network">
<contextOpType>Sop/hdk_createpolygon</contextOpType>
</toolMenuContext>

<toolSubmenu>MANTRAGORA/HDK</toolSubmenu>

<script scriptType="python"><![CDATA[import soptoolutils

soptoolutils.genericTool(kwargs, 'hdk_createpolygon', allow_obj_sel=False)]]></script>
</tool>
</shelfDocument>

Now, as I understand, all attributes in this line
<tool name="foo" label="Foo" icon="FooIcon">
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, 21 June 2013 - 02:56 PM.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#12 graham

graham

    Houdini Master

  • Moderator
  • 784 posts
  • Joined: 13-September 06
  • Location:Santa Monica, CA
  • Name:Graham Thompson

Posted 21 June 2013 - 12:49 PM

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

So In your case you should name your tool: "sop_hdk_createpolygon".
I write python and break things.





Also tagged with one or more of these keywords: hdk, mantragora, c++, houdini, submenu, tab, selector

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users