[Sidefx-houdini-list] Intercepting menu buttons on Type Properties.

Agent Xray xray at agentxray.com
Wed Oct 12 15:05:58 EDT 2016


Yes, you should be able to modify the right-click context menu for HDAs 
in an OPmenu.xml file to add controls to check in/out/abandon digital 
assets.
Somthing like this:

|<menuDocument>||
||    <!-- menuDocument can only contain 1 menu element, whose id is ||
||        implicitly "root_menu"||
||      -->||
||    <menu>||
||    <!-- HDA submenu. -->||
||    <separatorItem/>||
||    <subMenu id="opmenu.hda_menu">||
||        <label>HDA</label>||
||            <scriptItem id="opmenu.hda_checkout">||
||                <label>Checkout HDA</label>||
||                <context>||
||<expression>kwargs["node"].type().definition() is not None and 
kwargs["node"].type().definition().libraryFilePath().find('Volumes/Software/SideFx/houdini/hfs') 
!= 1</expression>||
||                </context>||
||                <scriptCode>||
||                <![CDATA[||
||import myMenuModule ||
||reload(myMenuModule)||
||myMenuModule.checkoutHDA(kwargs)
]]></scriptCode>
             </scriptItem>
             <scriptItem id="opmenu.hda_checkin">
                 <label>Checkin HDA</label>
                 <context>
  <expression>kwargs["node"].type().definition() is not None and 
kwargs["node"].type().definition().libraryFilePath().find('Volumes/Software/SideFx/houdini/hfs') 
!= 1</expression>
                 </context>
                 <scriptCode>
                 <![CDATA[
import |||myMenuModule |
reload(|||myMenuModule|)
|||myMenuModule|.checkinHDA(kwargs)
]]></scriptCode>

|

On 10/11/2016 4:59 PM, Antoine Durr wrote:
> We’ve always done this kind of thing by having check-out and check-in RMB entries.  If you are intending to modify a show-wide or shop-wide tool, you check it out which makes a local copy that you can edit, you do your work, then check it back in and the local copy is removed.
>
> — Antoine
>
>> On Oct 11, 2016, at 9:43 AM, Andy Nicholas <andy at andynicholas.com> wrote:
>>
>> Thanks Andy,
>>
>> Will look into this - we are needing however to do stuff BEFORE the HDA
>> gets saved.
>>
>> S.
>>
>> On Tue, Oct 11, 2016 at 4:21 PM, Andy Nicholas <andy at andynicholas.com>
>> wrote:
>>
>>> I can partly solve your problem, but then, unfortunately, give you another
>>> one to figure out :)
>>>
>>> If you can override the “Type Properties…" menu, then you can replace it
>>> with your own that calls this function:
>>>
>>>     hou.ui.openTypePropertiesDialog(node_or_node_type,
>>> promote_spare_parms=False, immediately_save=False)
>>>
>>> which will open the HDA Type Properties dialog for you.
>>>
>>> The only problem is that it’s not modal and will return straight away.
>>> However, there maybe a (platform dependent) way of using Python to get a
>>> handle for the Type Properties window so you can figure out when it’s
>>> closed. In theory, it’s all PyQt now, so it’s possible that it might be
>>> relatively easy to do.
>>>
>>> Once you know it’s closed, you can check to see if the HDA file on disk
>>> has been modified.
>>>
>>>
>>>
>>>
>>>> On 11 Oct 2016, at 15:56, Sandy Sutherland <sandy.maillists at gmail.com>
>>> wrote:
>>>> Hi All,
>>>>
>>>> Given that you can modify the menu xml filesto intercept and change any
>>>> menu item in Houdini, is it possible to intercept the buttons like the
>>>> Accept Button on the bottom of the Type Properties GUI?
>>>>
>>>> We are looking into this, to add methods for our version publishing
>>> system,
>>>> when saving and creating HDAs.
>>>>
>>>> Thanks
>>>>
>>>> Sandy
>>>> _______________________________________________
>>>> Sidefx-houdini-list mailing list
>>>> Sidefx-houdini-list at sidefx.com
>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>> _______________________________________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list




More information about the Sidefx-houdini-list mailing list