Skip to content

Commit

Permalink
Merge pull request #336 from mklierman/dev
Browse files Browse the repository at this point in the history
Add EditAnywhere Access Transformer option
  • Loading branch information
budak7273 authored Jan 31, 2025
2 parents 495c67a + 08ca1a4 commit d71eecf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ bool UAccessTransformersSubsystem::GetAccessTransformersForPlugin(IPlugin& Plugi
OutPluginAccessTransformers.BlueprintCallable.Add(FFunctionReference::FromConfigString(ConfigValue.GetValue()));
}

TArray<FConfigValue> EditAnywhere;
AccessTransformersSection->MultiFind(TEXT("EditAnywhere"), EditAnywhere);
for (const FConfigValue& ConfigValue : EditAnywhere) {
OutPluginAccessTransformers.EditAnywhere.Add(FPropertyReference::FromConfigString(ConfigValue.GetValue()));
}

return true;
}

Expand Down Expand Up @@ -265,6 +271,29 @@ void UAccessTransformersSubsystem::ApplyTransformers() {
Function->FunctionFlags |= FUNC_BlueprintCallable;
}
}
for (const auto& PluginTransformers : AccessTransformers) {
for (const FPropertyReference& EDOPropertyReference : PluginTransformers.Value.EditAnywhere) {
FString Error, Warning;
FProperty* Property = EDOPropertyReference.Resolve(Error, Warning);
if (!Warning.IsEmpty()) {
UE_LOG(LogAccessTransformers, Warning, TEXT("Resolving EditAnywhere %s requested by %s: %s"), *ToString(EDOPropertyReference), *PluginTransformers.Key, *Warning);
}
if (!Property) {
UE_LOG(LogAccessTransformers, Error, TEXT("Could not resolve property for EditAnywhere %s requested by %s: %s"), *ToString(EDOPropertyReference), *PluginTransformers.Key, *Error);
continue;
}

if (!OriginalPropertyFlags.Contains(Property)) {
// Only store the original flags if we haven't already
// so we don't override this with modified flags
OriginalPropertyFlags.Add(Property, Property->PropertyFlags);
}

Property->SetPropertyFlags(CPF_Edit);
Property->ClearPropertyFlags(CPF_EditConst);
Property->ClearPropertyFlags(CPF_DisableEditOnInstance);
}
}
}

void UAccessTransformersSubsystem::Reset() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ struct ACCESSTRANSFORMERS_API FPluginAccessTransformers {

UPROPERTY()
TArray<FFunctionReference> BlueprintCallable;

UPROPERTY()
TArray<FPropertyReference> EditAnywhere;
};

UCLASS()
Expand Down

0 comments on commit d71eecf

Please sign in to comment.