Jump to content

Make Difference in Alt Drag, Copy and Paste or Rename Node in Event Callbacks


Recommended Posts


Can it be possible to make difference in event callbacks with copy, alt drag and rename a node.

The problem is when Houdini make a node copy ( duplicate, or copy paste ) makes a renaming too.

So in scripting I could not figure out how to determine which event occurs.

So I want to know when rename or copy paste or alt drag happened.




Link to comment
Share on other sites

Thanks for your answer !

Have a nice day !

I extended the code like this:

def is_copy_paste_event(kwargs):
    if not kwargs['node'].name().startswith('original') and not kwargs['old_name'].startswith('original'):
        original_node = kwargs['node'].parent().node('original0_of_%s' % kwargs['old_name'])
        return True if original_node else False
def checkAltDown():
    from hutil.Qt import QtWidgets
    from hutil.Qt import QtCore
    m = QtWidgets.QApplication.keyboardModifiers()
    return m == QtCore.Qt.AltModifier
if is_copy_paste_event( kwargs) and checkAltDown():
    print 'alt_dup', kwargs['node']
    hou.session._node_copy_mode_ = 'alt_duplication'
elif is_copy_paste_event( kwargs):
    print 'copied', kwargs['node']
    hou.session._node_copy_mode_ = 'copy_of_node'
elif not 'original' in kwargs['node'].name():
    if hasattr( hou.session, '_node_copy_mode_'):
        if hou.session._node_copy_mode_ == 'alt_duplication':
            print 'alt_renamed', kwargs['node']
        elif hou.session._node_copy_mode_ == 'copy_of_node':
            print 'copy_renamed', kwargs['node']
        del( hou.session._node_copy_mode_)
        print 'simple_renamed', kwargs['node']


Edited by gemini
  • Like 1
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.

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...