Moving Components in Editor Instances Has No Callback

Hi there,

We are running Unreal 4.11 and I have run into a bug where if you move a scene component that is not the root component of an actor that none of the expected callbacks are called.

In the blueprint editor, moving a non root scene component (You obviously cannot move the root component), causes the component to have PostEditComponentMove called on it. You can see this in FSCSEditorViewportClient::InputWidgetDelta.

However this function is only called in other place, on the root component when the actor itself moves. So doing the same action (moving a sub component) in the actual editor viewport does not trigger this code.

When you edit the actual transform values in the property window (via the numbers), both the blueprint editor and the main editor scene both call FComponentTransformDetails::OnSetLocation which in turn call PostEditChangeProperty on the component.

When you drag the sub component in the level editor window on an instance the equivalent InputWidgetDelta function is FLevelEditorViewportClient::InputWidgetDelta. To do its work, it then calls ApplyDeltaToActors which hits an if part way to do, which splits its functionality between if you have components selected or actors selected :

if ( !Actor->bLockLocation )
{
	if (GEditor->GetSelectedComponentCount() > 0)
	{
		//code applies delta to components
		Eventually Calls FLevelEditorViewportClient::ApplyDeltaToComponent
	}
	else
	{
		//code applies delta to actors
		Eventually Calls FLevelEditorViewportClient::ApplyDeltaToActor
	}
}

In the ApplyDeltaToActor case it calls the GEditor->ApplyDeltaToActor function which in turn calls PostEditMove on that actor at the end.

In ApplyDeltaToComponent is calls GEditor->ApplyDeltaToComponent. This function does not call PostEditComponentMove (and this function is also used as part of FSCSEditorViewportClient::InputWidgetDelta).

I am not sure if the fix is to simply add a PostEditComponentMove callback to FLevelEditorViewportClient::ApplyDeltaToComponent or a bigger change. But it would be nice to have consistent behaviour or at least a way to catch changes to the transform of a sub component.

Note: From what I can tell only UPhysicsConstraintComponent uses the PostEditComponentMove to do anything, but as it stands the code it has there to update the constraint frames wont be called if you move it using this method (Moving the instanced component in the level viewport).

Also not sure if its relevant or bad, but if you move the whole actor it might be worth calling PostEditComponentMove on all components, because again in this case of UPhysicsConstraintComponent , it won’t update its constraint frames.

Hey Ben-

For clarity, you’re saying that moving a component (independent of the actor’s root) calls PostEditComponentMove() if done from the blueprint viewport but does not call that function if done from the main editor viewport? If this is not the bug you’re reporting, can you explain what behavior you’re seeing?

That is correct :slight_smile:
Sorry for the information overload, just wanted to try and show all the code paths that I was following to help track it down.

But yes if you move a non root component in the blueprint editor, PostEditComponentMove is called. In the level viewport it is not called.

Editing the location/rotation/scale values in the property window (editing the numbers), in both cases will make PostEditChangeProperty happen (but not PostEditComponentMove). I am not sure if that is a problem and for my needs I can just catch the change in there anyway.

The main issue I am running into is that there is no hook at all, no PostEditChange and no PostEditComponentMove. For consistency it seems it should be a PostEditComponentMove but I am happy for any solution.

Thank you for the clarification. I was able to reproduce the issue and have submitted the bug report UE-30945 for investigation.

Cheers

Hi, I’m using engine 4.15 and this problem still seems to be happening. I checked the tracker and it says it’s fixed, but the changes still don’t show in the editor viewport on PostEditComponentMove.

Hey Savants-

What exactly are you seeing on your end? After testing the provided repro steps available in the public issue (Unreal Engine Issues and Bug Tracker (UE-30945)) , the sample code was updated as expected in the viewport. If you are having issues with PostEditComponentMove not being called, please provide the setup steps used to help me test the behavior on my end.

void UMyComponent::PostEditComponentMove(bool bFinished)
{
//if(bFinished)
SetRelativeTransform(FTransform());

	Super::PostEditComponentMove(bFinished);
}

This is all I’m trying todo on a custom component. When I move it in the blueprint editor viewport, I am expecting it to go back to 0,0. If I do this in PostEditChangeProperty it works fine. This is a non-root component.

When I add the code you provided to a scene component class the component resets to the actor’s center whenever the component is moved specifically. If you are moving the actor itself, this function isn’t getting called.

Has this been resolved? I’m still experiencing the same issue where MyCustomComponent::PostEditComponentMove is not firing when manipulating it in editor viewport.

The owning Actor’s PostEditMove is being called, but unfortunately that doesn’t provide me with the information I’m looking for ie. which component has just been moved.

Hi, been having this issue in 4.27 and still couldn’t find much info on how to solve. Have managed to find a way to get a non-root component to update / call construct on the actor by using GEngine->OnComponentTransformChanged() when the component is moved or updated in the editor viewport.

I had to set in the C++ constructor (not sure if best way), and had to make sure the bound function is a UFunction and takes a USceneComponent* Comp and TeleportType Type to get the multicastdelegate to bind. Anyway pics will probably explain better.

I used in conjunction with PostEditChangeProperty() and PostEditMove() for completion to ensure any changes updated the BP Actor

Ok after a bit of extra work I have found this to work better than previous post. So for completion:

I have scrapped the SetEngineOnMove() and replaced it by binding a function to the actual OnObjectChanged Delegate. See Images below.

Note: these need to be tagged #if WITH_EDITOR so they run only in the editor and not game. I call the BindUpdateEvent() in the CPP constructor. I then call whatever function I need to in the bound function. I still cal both the PostEditMove and ChangeProperty functions, but these may not be needed.

CPP:


Header: