sanostol Posted June 22, 2017 Share Posted June 22, 2017 how can I trigger a event, when a node gets copied? thanks martin Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted June 26, 2017 Share Posted June 26, 2017 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. Quote Link to comment Share on other sites More sharing options...
sanostol Posted June 26, 2017 Author Share Posted June 26, 2017 ah, there is a difference, I will try, thanks a lot. PS: a bunch of more events would be really cool Quote Link to comment Share on other sites More sharing options...
danielsweeney Posted March 9, 2020 Share Posted March 9, 2020 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 Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted March 9, 2020 Share Posted March 9, 2020 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 Quote Link to comment Share on other sites More sharing options...
danielsweeney Posted March 9, 2020 Share Posted March 9, 2020 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 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.