From bb9ed201650b1303c825750794335750464fd0ff Mon Sep 17 00:00:00 2001 From: bruce nesbit Date: Wed, 29 Apr 2015 06:45:47 -0400 Subject: [PATCH] Removed code that was forcing feature packs have a focus asset. (Focus asses aret not mandatory) [CL 2529987 by bruce nesbit in Main branch] --- .../FeaturePack/FeaturePackContentSource.cpp | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/Engine/Source/Editor/AddContentDialog/Private/ContentSourceProviders/FeaturePack/FeaturePackContentSource.cpp b/Engine/Source/Editor/AddContentDialog/Private/ContentSourceProviders/FeaturePack/FeaturePackContentSource.cpp index 96ad22b964f6..e019fbe34c93 100644 --- a/Engine/Source/Editor/AddContentDialog/Private/ContentSourceProviders/FeaturePack/FeaturePackContentSource.cpp +++ b/Engine/Source/Editor/AddContentDialog/Private/ContentSourceProviders/FeaturePack/FeaturePackContentSource.cpp @@ -105,13 +105,7 @@ bool TryValidateManifestObject(TSharedPtr ManifestObject, TSharedPt ErrorMessage = MakeShareable(new FString("Manifest object missing 'Category' field")); return false; } - - if (ManifestObject->HasTypedField("FocusAsset") == false) - { - ErrorMessage = MakeShareable(new FString("Manifest object missing 'FocusAsset' field")); - return false; - } - + if (ManifestObject->HasTypedField("Thumbnail") == false) { ErrorMessage = MakeShareable(new FString("Manifest object missing 'Thumbnail' field")); @@ -206,8 +200,12 @@ FFeaturePackContentSource::FFeaturePackContentSource(FString InFeaturePackPath) // Parse class types field ClassTypes = ManifestObject->GetStringField("ClassTypes"); - // Parse initial focus asset - FocusAssetIdent = ManifestObject->GetStringField("FocusAsset"); + + // Parse initial focus asset if we have one - this is not required + if (ManifestObject->HasTypedField("FocusAsset") == false) + { + FocusAssetIdent = ManifestObject->GetStringField("FocusAsset"); + } // Use the path as the sort key - it will be alphabetical that way SortKey = FeaturePackPath; @@ -392,18 +390,14 @@ void FFeaturePackContentSource::HandleActOnSearchText(TSharedPtr S void FFeaturePackContentSource::TryAddFeaturePackCategory(FString CategoryTitle, TArray< TSharedPtr >& OutSuggestions) { - for (int32 iEntry = 0; iEntry < OutSuggestions.Num() ; iEntry++) + if (OutSuggestions.ContainsByPredicate([&CategoryTitle](TSharedPtr& InElement) + { return ((InElement->Title == CategoryTitle) && (InElement->bCategory == true)); }) == false) { - if((OutSuggestions[iEntry]->Title == CategoryTitle ) && (OutSuggestions[iEntry]->bCategory == true )) - { - return; - } + TSharedPtr FeaturePackCat = MakeShareable(new FSearchEntry()); + FeaturePackCat->bCategory = true; + FeaturePackCat->Title = CategoryTitle; + OutSuggestions.Add(FeaturePackCat); } - - TSharedPtr FeaturePackCat = MakeShareable(new FSearchEntry()); - FeaturePackCat->bCategory = true; - FeaturePackCat->Title = CategoryTitle; - OutSuggestions.Add(FeaturePackCat); } void FFeaturePackContentSource::HandleSuperSearchTextChanged(const FString& InText, TArray< TSharedPtr >& OutSuggestions)