In a DetailCustomization, i have a TMap
I would like to programmatically propagate change of a property of the struct of the edited CDO to every instances (the one in viewport in particular).
So far i tried PostEditChangeChainProperty and NotifyPostChange (on the TMap property handle) but without any success.
I présume i should get a IPropertyHandle of the struct property and use Setvalue. But the property is a FGuid, and i can’t use setvalue.
Could anyone show me the direction ?
Find a solution: propagate to all archetype instances. Need to press compile to see the result in viewport and level. It works, but i have a doubt as to its correctness.
TRACESTATIC("Remove weapon for %s", *HPName.ToString());
Ship->FixedHardPointsFromLibrary[HPName].WeaponId = FGuid(); // remplace par un guid invalide (0)
Ship->MarkPackageDirty();
TRACESTATIC("istemplate %i", (int32)Ship->IsTemplate());
if (Ship->IsTemplate())
{
TArray<UObject*> ArchetypeInstances;
Ship->GetArchetypeInstances(ArchetypeInstances);
for (int32 InstanceIndex = 0; InstanceIndex < ArchetypeInstances.Num(); ++InstanceIndex)
{
ABaseShip* Instance = Cast<ABaseShip>(ArchetypeInstances[InstanceIndex]);
if (!Instance)
{
TRACEWSTATIC("Instance not valid !!");
}
Instance->FixedHardPointsFromLibrary[HPName].WeaponId = FGuid();
Instance->MarkPackageDirty();
}
}