How can I control the "Lock Actor Movement" in the scene outliner via C++?

I’m trying to make a tool in the editor which requires locking some actors’ transforms, however doing this one by one is tedious so I would like to be able to do so via a script.

(talking about this)

Hi @Kotaru_1 !

That contextual menu option internally calls GEditor->ToggleSelectedActorMovementLock(); in C++. I’m reading the source code and it actually iterates over all of the selected actors, so if you first select all of the actors that you want to lock it should apply the lock to the whole selection. If you want to automate this via C++ then the process would be to first select the actors and then call that function in GEditor.

I hope this helps!

This function didn’t exactly do what I wanted it to, but you were able to lead me in the right direction so that I could find the right function in the source files.
I was able to find and read this function and implement the function I really wanted which was:

MyActor->SetLockLocation(bool InLockLocation)

Which is really confusing naming since it locks rotation too, but oh well.

Anyway, thanks a lot! This was a massive help

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.