Get reference to original actor in Actor::PostDuplicate

Maybe I’m just missing something obvious, but is there a way to get a reference to the actor the current one was duplicated from?

I’m actually trying to create something similar to the SplineActor from UE3, where when you ALT-dragged in the editor the new actor was automatically linked to the original one. I tried to hook up into different Actor functions (PostEditMove, PostDuplicate, PostEditImport), but without success.

I took a look into the edactDuplicateSelected Editor function too, and it seems that on duplication the old Actor is actually copy-pasted, and no direct link exists between the old and new Actor. Is this correct? Unfortuntely a search in the documentation and community websites didn’t help out.

Thanks!

I have the same need.

The only way I found is to create my own custom editor mode witch define the function ActorsDuplicatedNotify.
For that you have to override le UnrealEdEditor with your own to register your FEdMode.

It’s a bit obvious but with that you can do what you want.

The thread that help me was:

My FEdMode is activated with
FEditorModeRegistry::Get().RegisterMode(FName("MyMode"));
GLevelEditorModeTools().ActivateMode(FName("MyMode"));

Don’t forget to override IsCompatibleWith to return true.

This is a very elegant solution, thanks!

I guess my error was to look for a way to implement it on the actor itself rather than extending the editor in some way. Still, it would be nice to have a simple callback on the actor (like PostEditMove, etc.) for simple use cases.