Jump to content
Sign in to follow this  
sanostol

onCopy event in hda

Recommended Posts

how can I trigger a event, when a node gets copied?

thanks

martin

Share this post


Link to post
Share on other sites

There is no copy/paste event, which is lame, I RFE that a while ago, but you can workaround this with OnNameChanged event. Print the kwargs args and see the difference between duplicating a node and just renaming, it's a little bit tricky though. I don't have a code with me now.

Share this post


Link to post
Share on other sites

ah, there is a difference, I will try, thanks a lot.

PS: a bunch of more events would be really cool

Share this post


Link to post
Share on other sites

HI, I know this is an old thread,

could anyone shed some light on this?

I need to have my custom function track if the HDA has been duplicated?

What is the best practice.

 

Cheers

 

Daniel

Share this post


Link to post
Share on other sites
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

 

Use this in an OnNameChanged event handler

Share this post


Link to post
Share on other sites

Thank you so much for this Alex.

 

been banging my head against the wall in a code hole. does not help when I am no Python wizard.

 

Cheers again

 

Daniel

  • Like 1

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
Sign in to follow this  

×