we are currently writing a custom editor mode that spawns actors from code and we would like do restrict editing those actors. In particular we want to…
prevent an actor from being transformed
prevent an actor from getting deleted manually by the user
prevent an actor from being listed in the editor’s World Outliner
I found the UObject::CanEditChange(const UProperty* InProperty) function which seemed to be promising for the first restriction, but actually I don’t get transformation changes there. And for the second and third points I didn’t find anything either.
Is there a way to achieve these things?
EDIT: I now also tried to replace the RootComponent with a custom class where I overwrite the property change functions, but the same as before: no transformation changes are recognized there. The only idea I have for the transformation part is to store the actor location and restore it in PostEditMove() to the value that was stored. But that is not the ideal.
There bListedInSceneOutliner it’s protected varbale so you can only change it inside actor related class, in other words you can change it outside the object.
As for prevent destroying, i dont think there a way to change that other then modifying editor tools, there EditorDestroyActor but thats part of UWorld (same as SpawnActor) I can point you to where is editor delete code, you might try to investigate it
Strange, I looked through the actor members last week and saw bHiddenEd, bEditable and several bHiddenEd* members but managed to miss the bListedInSceneOutliner that is defined right in the middle of them.
Works like a charm. Thanks again.
I just saw that there is also a public bLockLocation member that locks the actor’s entire transformation (translation, scale & rotation) which might come in handy if you can’t override the EditorApply* functions.