Jump to content

two fast questions


Guest Swann

Recommended Posts

Guest Swann

Hi,

I want my asset to update some parameters when it's created with a help of OnCreated script menu. Problem is that hou.pwd() returns global node in this case. So how to acces parameters on freshly created instance ?

And is there possibility to acces function stored in PythonModule from OnCreated script ?

Big Thanks for any tips

Link to comment
Share on other sites

Guest Swann

The case is, I want apply the same functionality like omsbind (but hou.selectorBindings is not implemented )and plug data into group slot but I can't acces this instance of asset when it's not fully created yet, so how to achieve this ?

def userInput():
    import toolutils

    sViewer = toolutils.sceneViewer()
    list = []     

    pointA = sViewer.selectGeometry('Select point A', use_existing_selection=False, geometry_types=(hou.geometryType.Points,))
    list.append(str(pointA))

    pointB = sViewer.selectGeometry('Select point B', use_existing_selection=False, geometry_types=(hou.geometryType.Points,))
    list.append(str(pointB))

This gives me my points but how to pack them into group slots ? I know how to set parameter but I can't acces it without knowing how to call instance of this asset on creation.

Edited by SWANN
Link to comment
Share on other sites

All the Python event handler scripts/sections, OnCreated, OnInputChanged, OnNameChanged, etc have relevant information available in the kwargs dictionary. In the case of OnCreated it gives you the hou.Node of the instance, as well as an instance of the hou.NodeType for the node. You can then just call the PythonModule directly from that.

node = kwargs['node']
node.hdaModule().foo(node)

Edited by graham
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...