Download

Getting the material that owns a property being changed

Hiya

I have a delegate that I’m using to catch a material being edited in the editor:


DelegateHandles.Add(
        FCoreUObjectDelegates::OnObjectPropertyChanged.AddRaw(
            this,
            &FMyPluginModule::OtherComponentPropertyChanged
        )
);

This works, I can trap the event. This is what the event provides:


UObject               *ObjectBeingModified,
FPropertyChangedEvent &PropertyChangedEvent

In this case ObjectBeingModified is a UObject whose name is "DEditorVectorParameterValuebut I can’t figure out from this which UMaterialInstance is being edited. Tracing up the Owner chain almost immediately gives me LevelEd, no useful objects along the way. Same deal for the UProperty in PropertyChangedEvent - there’s little info to go on in the data structure.

Any advice?

Fun bonus! Here’s the watchlist for this event:

I’m gotten as far as figuring this out:


UDEditorVectorParameterValue * VectorParam = Cast<UDEditorVectorParameterValue>(Object);
			if (VectorParam) {
				UPackage * Package = VectorParam->GetTypedOuter<UPackage>();
				if (LL::General) UE_LOG(LogTemp, Warning, TEXT("Trying to find material..."));
			}

So VectorParam and Package are both valid objects, cool! But the package owner is “/Engine/Transient”.