From 1f11b79222aa37d394826c6ad0c7e4a3c6f63538 Mon Sep 17 00:00:00 2001 From: "j.foucher" Date: Tue, 14 Apr 2026 19:50:20 +0200 Subject: [PATCH] Auto-call OnRep on server after editor property change + ForceNetUpdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - After ImportText, automatically call the property's RepNotifyFunc via reflection - ForceNetUpdate ensures replication to clients (OnRep fires on both server and client) - No BP changes needed — fully transparent for replicated properties Co-Authored-By: Claude Opus 4.6 (1M context) --- .../UI/Widgets/PS_Editor_MainWidget.cpp | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Unreal/Plugins/PS_Editor/Source/PS_Editor/UI/Widgets/PS_Editor_MainWidget.cpp b/Unreal/Plugins/PS_Editor/Source/PS_Editor/UI/Widgets/PS_Editor_MainWidget.cpp index 884b4b9..db9b8ba 100644 --- a/Unreal/Plugins/PS_Editor/Source/PS_Editor/UI/Widgets/PS_Editor_MainWidget.cpp +++ b/Unreal/Plugins/PS_Editor/Source/PS_Editor/UI/Widgets/PS_Editor_MainWidget.cpp @@ -2121,10 +2121,28 @@ void UPS_Editor_MainWidget::ApplyPropertyFromUI(int32 RowIndex) UE_LOG(LogTemp, Warning, TEXT("PS_Editor: ApplyProperty '%s' = '%s' -> Import %s"), *Row.Key, *NewValueText, ImportResult ? TEXT("OK") : TEXT("FAILED")); - // Refresh rendering + // Refresh rendering + force network replication (triggers OnRep on clients) if (UActorComponent* Comp = Cast(Target)) { Comp->MarkRenderStateDirty(); + if (AActor* OwnerActor = Comp->GetOwner()) + { + OwnerActor->ForceNetUpdate(); + } + } + else + { + Actor->ForceNetUpdate(); + } + + // Auto-call OnRep on the server (ImportText bypasses replication notify) + if (!Row.CachedProperty->RepNotifyFunc.IsNone()) + { + if (UFunction* RepFunc = Target->FindFunction(Row.CachedProperty->RepNotifyFunc)) + { + Target->ProcessEvent(RepFunc, nullptr); + UE_LOG(LogTemp, Log, TEXT("PS_Editor: Called %s on %s"), *Row.CachedProperty->RepNotifyFunc.ToString(), *Target->GetName()); + } } // Export new value after import (normalized form for undo)