Download

PostEditChangeProperty - On mouse edit

Hi all!

I’m a fresh beginner at Unreal and still struggling on some basics (but in general loving what I’ve seen so far) so please bear with me.
Also if this post is not in the right place please let me know!

I’m currently using PostEditChangeProperty to get the bounds of a static mesh when modified in the editor ( to later do something with those bounds). But PostEditChangeProperty only seems to be called when editing values in the details section, not when using the mouse controls to scale the static mesh.

My general pattern:



#if WITH_EDITOR
void AGridFloor::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
{	
	RecalculateFloorSize();
	Super::PostEditChangeProperty(PropertyChangedEvent);
}
#endif


So this works fine when editing here:
d76ac5caa376f1e60b7ee00a2b4e9e7f398747f0.png

But is never called when editing here
2.PNG

Any suggestions on how to “capture” the mouse edit event?

Thank you for your time.

PostEditChangeProperty() quite literally only gets called on a property/variable update.

I believe you want OnConstruction(const FTransform& Transform)

I know it updates when moving the object, never tried scaling (but I imagine it does)

Thanks for the reply, but it seems OnConstruction only gets called when editing from the details panel as well :frowning:
I’ve just put a print on it and it only gets printed at the same time as PostEditChangeProperty.

Any thoughts?
Thanks!

Also tried overloading:

bool SetActorTransform(const FTransform& NewTransform, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr);
bool K2_SetActorTransform(const FTransform& NewTransform, bool bSweep, FHitResult& SweepHitResult);
void SetActorRelativeScale3D(FVector NewRelativeScale);

In the hopes I could catch the transform/scale being set to the actor. But no luck,

Never mind, found it! The overloads I was looking for are:



void AGridFloor::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
{	
	UE_LOG(LogTemp, Warning, TEXT("PostEditChangeProperty"));
	RecalculateFloorSize();
	Super::PostEditChangeProperty(PropertyChangedEvent);
}

void AGridFloor::EditorApplyScale(const FVector& DeltaScale, const FVector* PivotLocation, bool bAltDown, bool bShiftDown, bool bCtrlDown)
{
	UE_LOG(LogTemp, Warning, TEXT("EditorApplyScale"));
	RecalculateFloorSize();
	Super::EditorApplyScale(DeltaScale, PivotLocation, bAltDown, bShiftDown, bCtrlDown);	
}


For catching both details edit and editor mouse edits :slight_smile: Hope it helps someone.