4.7.1 - PostEditChangeProperty - MakeEditWidget - FVector - PropertyChangedEvent.Property Null

Hi,

In PostEditChangeProperty function, when I update my FVector propery (with metadata MakeEditWidget) the PropertyChangedEvent.Property is Null.
The function is called properly, but the Property is always null.

Could you please fix this ?

As a workaround I’m doing the stuff I need when “any” of the property are called but this is not efficient at all.

thanks,

Hey -

Could you post a screenshot of how you’re making the call to PostEditChangeProperty? Do you have the same null return on 4.7.2 as well? Any additional information that would help me reproduce this on my end would also be helpful.

Cheers

Hi,

I tested in 4.7.2 and I have the same issue.
I’m changing the FVector value by moving the EditWidget.

Thanks

I may have to test the PostEditChangeChainProperty to get the proper event, but the PropertyChangedEvent should not be fired with Null in my opinion

I am having the same issue. I am running 4.7.2.

edit: I was able to get around this by just checking when Property is invalid and manually checking if my properties have been changed. It’s hacky, but works.

FYI PostEditChangeChainProperty is not fired when moving the EditWidget so it’s not a solution;

@Saucy,
I also have a hack like this, but this should be fixed in the engine :smiley:

@ I don’t know about PostEditChangeChainProperty but it seems PostEditChangeProperty does.

Yes it does but the property is null. That s the issue here :smiley:

Any update on this? have you been able to reproduce the issue?

Thanks,

Hey -

Could you post a screenshot of how you’re making the call to PostEditChangeProperty? Any additional information on the setup you’re using or how you’re using the result from the call or that would help me reproduce this on my end would also be helpful.

ok here are some information to reproduce the bug:

Create a Actor Class
Add a property like :

UPROPERTY(EditAnywhere, Category = Test, BlueprintReadWrite, meta = (MakeEditWidget = ""))
FVector Test1;

add :

virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;

in cpp

void AZB4Teleport::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
	if ( PropertyChangedEvent.Property != NULL &&
		( PropertyChangedEvent.Property->GetFName() == FName(TEXT("Test1"))
		) )
	{
             //SUCESS
	}

	Super::PostEditChangeProperty(PropertyChangedEvent);
}

Build
Go in the editor, drop your actor in the map.
you will see the diamond to change the value. Drag and Drop it. The postEditChangeProperty will be called and the property name will be null.

Once you reproduce it, you may also look at:

UPROPERTY(EditAnywhere, Category = Test, BlueprintReadWrite, meta = (MakeEditWidget = ""))
FTransform Test2;

as this may fail also.

If you didn’t suceed, I will try to post you source file, but it may take some times…

Thanks,

Hey -

I was able to reproduce the NULL property and have entered a bug report (UE-12015) for further investigation. For the time being I would encourage continuing to use the current workaround you mentioned in your original post.

Cheers

Hey -

Rather than using PostEditChangeProperty() you should be able to use PostEditMove() instead. Let me know if that helps at all.

According to the PostEditMove() signature, which is declared in AActor class

virtual void PostEditMove
(
    bool bFinished
)

it’s not supposed to notify which property was changed (or which widget was moved) and I think the problem of is that he wants to fire a time consuming procedure when the special property has changed.

By the way, I’m experiencing the same problem with NULL pointer. I have UE4.7.2 built from sources.

Hi and duburlan,

I took another look at this issue, and there does appear to be something unusual happening. When I dragged the Test1 widget around in the viewport, the PropertyChangedEvent.Property was NULL, but if I entered new X, Y, or Z values for Test1 directly into the Details panel, then PropertyChangedEvent.Property appeared to have a valid value. This was also only occurring when I was simulating in the viewport. I have updated the report that submitted with the new information I observed that should help with the investigation.

Also, just to provide some additional clarification, PostEditMove won’t work in this case because that is only called when the entire object is moved in the scene. PostEditChangeProperty is called when only the values for Test1 are changed. I am guessing that when the suggestion to try PostEditMove was given to , it was based on a misunderstanding of what was being moved.

I ran into this myself today! (On UE 4.11)
The editor is running FEdMode::InputDelta and in there it calls the post edit change commands with null as the property:

BestSelectedItem->PreEditChange(NULL);
    
if (bEditedPropertyIsTransform)
{
    SetPropertyValueByName<FTransform>(BestSelectedItem, EditedPropertyName, EditedPropertyIndex, LocalTM);
}
else
{
    SetPropertyValueByName<FVector>(BestSelectedItem, EditedPropertyName, EditedPropertyIndex, LocalTM.GetLocation());
}
    
BestSelectedItem->PostEditChange();

The actual property windows code uses things like the following:

UProperty* RelativeRotationProperty = FindField<UProperty>( USceneComponent::StaticClass(), "RelativeRotation" );
FPropertyChangedEvent PropertyChangedEvent( RelativeRotationProperty );

Object->PostEditChangeProperty( PropertyChangedEvent );

So it seems the only way to handle this is to look for null and then check against a manually cached variable.

Is there a reason why we couldn’t do a similar thing to the property window code here?

EDIT: This is fixed in 4.12 as of preview 4.
The epic code change is similar to the below but requires a few other changes. To get you through until then you can try the below.

<---------------------------------------------------------------->

If you have full source code, you can make a change to make this work.

The first caveat I will add is I have no idea what side effects this might have, but hopefully someone from Epic can chime in to see what they think and if all is fine apply the fix as well.

Go to FEdMode::InputDelta in EdMode.cpp

And Replace the old code

BestSelectedItem->PreEditChange(NULL);

if (bEditedPropertyIsTransform)
{
	SetPropertyValueByName<FTransform>(BestSelectedItem, EditedPropertyName, EditedPropertyIndex, LocalTM);
}
else
{
	SetPropertyValueByName<FVector>(BestSelectedItem, EditedPropertyName, EditedPropertyIndex, LocalTM.GetLocation());
}

BestSelectedItem->PostEditChange();

with

UProperty* WidgetProperty = FindField<UProperty>(BestSelectedItem->GetClass(), *EditedPropertyName);
BestSelectedItem->PreEditChange(WidgetProperty);

if (bEditedPropertyIsTransform)
{
	SetPropertyValueByName<FTransform>(BestSelectedItem, EditedPropertyName, EditedPropertyIndex, LocalTM);
}
else
{
	SetPropertyValueByName<FVector>(BestSelectedItem, EditedPropertyName, EditedPropertyIndex, LocalTM.GetLocation());
}

FPropertyChangedEvent PropertyChangedEvent(WidgetProperty);
BestSelectedItem->PostEditChangeProperty(PropertyChangedEvent);

Note the if (bEditedPropertyIsTransform) in the middle has not changed. What Ive done is before the if get the Property and then called the PreEditChange like before but with the property and after the if passed the property to the PostEditChange.

Hi ,

Do you still see this occurring in 4.12 Preview 4 (released earlier today)? I just tested our test case there and it appears to be working correctly. I also checked 4.11.2, and it was not working in that version. It looks like 4.12 should have this corrected for you.

Not yet working with 4.12, but checked out the code in question on git and the code has a very similar change to my answer below, so would be fixed.

Thanks for that.