Download LyraStarterGame/Source/LyraEditor/Validation/EditorValidator_Blueprints.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 4.05 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraEditor/Validation/EditorValidator_Blueprints.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraEditor/Validation/EditorValidator_Blueprints.cpp
-
curl -L -o EditorValidator_Blueprints.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraEditor/Validation/EditorValidator_Blueprints.cpp
4.05 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| UEditorValidator_Blueprints::UEditorValidator_Blueprints() | |
| : Super() | |
| { | |
| } | |
| bool UEditorValidator_Blueprints::CanValidateAsset_Implementation(const FAssetData& InAssetData, UObject* InAsset, FDataValidationContext& InContext) const | |
| { | |
| return Super::CanValidateAsset_Implementation(InAsset) && (InAsset ? InAsset->IsA(UBlueprint::StaticClass()) : false); | |
| } | |
| EDataValidationResult UEditorValidator_Blueprints::ValidateLoadedAsset_Implementation(const FAssetData& InAssetData, UObject* InAsset, FDataValidationContext& Context) | |
| { | |
| UBlueprint* Blueprint = Cast<UBlueprint>(InAsset); | |
| check(Blueprint); | |
| if (UEditorValidator::ShouldAllowFullValidation()) | |
| { | |
| // For non-dataonly blueprints, also load and check all directly referencing non-data-only blueprints, as changes may have caused them to fail to compile | |
| if (!FBlueprintEditorUtils::IsDataOnlyBlueprint(Blueprint)) | |
| { | |
| FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry")); | |
| IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); | |
| TSet<FName> AllHardReferencers; | |
| TArray<FName> PackagesToProcess; | |
| PackagesToProcess.Add(Blueprint->GetOutermost()->GetFName()); | |
| do | |
| { | |
| TArray<FName> NextPackagesToProcess; | |
| for (FName PackageToProcess : PackagesToProcess) | |
| { | |
| TArray<FName> HardReferencers; | |
| AssetRegistry.GetReferencers(PackageToProcess, HardReferencers, UE::AssetRegistry::EDependencyCategory::Package, UE::AssetRegistry::EDependencyQuery::Hard); | |
| for (FName HardReferencer : HardReferencers) | |
| { | |
| if (!AllHardReferencers.Contains(HardReferencer)) | |
| { | |
| AllHardReferencers.Add(HardReferencer); | |
| TArray<FAssetData> RefAssets; | |
| AssetRegistry.GetAssetsByPackageName(HardReferencer, RefAssets, true); | |
| for (const FAssetData& RefData : RefAssets) | |
| { | |
| if (RefData.IsRedirector()) | |
| { | |
| NextPackagesToProcess.Add(RefData.PackageName); | |
| break; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| PackagesToProcess = MoveTemp(NextPackagesToProcess); | |
| } while (PackagesToProcess.Num() > 0); | |
| for (FName HardReferencer : AllHardReferencers) | |
| { | |
| FString HardReferencerStr = HardReferencer.ToString(); | |
| if (!IsInUncookedFolder(HardReferencerStr)) | |
| { | |
| TArray<FAssetData> ReferencerAssets; | |
| AssetRegistry.GetAssetsByPackageName(HardReferencer, ReferencerAssets, true); | |
| for (const FAssetData& ReferencerAssetData : ReferencerAssets) | |
| { | |
| // Skip levelscript BPs... for now | |
| if ((ReferencerAssetData.PackageFlags & PKG_ContainsMap) == 0) | |
| { | |
| bool bIsDataOnlyBP = false; | |
| if (ReferencerAssetData.GetTagValue<bool>(FBlueprintTags::IsDataOnly, bIsDataOnlyBP)) | |
| { | |
| if (!bIsDataOnlyBP) | |
| { | |
| UE_LOG(LogLyraEditor, Display, TEXT(" Loading referencing non-dataonly blueprint %s"), *HardReferencerStr); | |
| TArray<FString> WarningsAndErrors; | |
| if (UEditorValidator_Load::GetLoadWarningsAndErrorsForPackage(HardReferencerStr, WarningsAndErrors)) | |
| { | |
| for (const FString& WarningOrError : WarningsAndErrors) | |
| { | |
| AssetFails(InAsset, FText::FromString(WarningOrError)); | |
| } | |
| } | |
| break; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if (GetValidationResult() != EDataValidationResult::Invalid) | |
| { | |
| AssetPasses(InAsset); | |
| } | |
| return GetValidationResult(); | |
| } | |