void FEnvQueryTestDetails::BuildScoreClampingTypeValues(bool bBuildMinValues, TArray<FTextIntPair>& ClampTypeValues) const { UEnum* ScoringNormalizationEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EEnvQueryTestClamping")); check(ScoringNormalizationEnum); ClampTypeValues.Reset(); ClampTypeValues.Add(FTextIntPair(ScoringNormalizationEnum->GetEnumText(EEnvQueryTestClamping::None), EEnvQueryTestClamping::None)); ClampTypeValues.Add(FTextIntPair(ScoringNormalizationEnum->GetEnumText(EEnvQueryTestClamping::SpecifiedValue), EEnvQueryTestClamping::SpecifiedValue)); if (IsFiltering()) { bool bSupportFilterThreshold = false; if (bBuildMinValues) { if (UsesFilterMin()) { bSupportFilterThreshold = true; } } else if (UsesFilterMax()) { bSupportFilterThreshold = true; } if (bSupportFilterThreshold) { ClampTypeValues.Add(FTextIntPair(ScoringNormalizationEnum->GetEnumText(EEnvQueryTestClamping::FilterThreshold), EEnvQueryTestClamping::FilterThreshold)); } } }
void FIntroTutorials::AddSummonBlueprintTutorialsMenuExtension(FMenuBuilder& MenuBuilder, UObject* PrimaryObject) { MenuBuilder.BeginSection("Tutorials", LOCTEXT("TutorialsLabel", "Tutorials")); MenuBuilder.AddMenuEntry( LOCTEXT("BlueprintMenuEntryTitle", "Blueprint Overview"), LOCTEXT("BlueprintMenuEntryToolTip", "Opens up an introductory overview of Blueprints."), FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tutorials"), FUIAction(FExecuteAction::CreateRaw(this, &FIntroTutorials::SummonBlueprintTutorialHome, PrimaryObject, true))); if(PrimaryObject != nullptr) { UBlueprint* BP = Cast<UBlueprint>(PrimaryObject); if(BP != nullptr) { UEnum* Enum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EBlueprintType"), true); check(Enum); MenuBuilder.AddMenuEntry( FText::Format(LOCTEXT("BlueprintTutorialsMenuEntryTitle", "{0} Tutorial"), Enum->GetEnumText(BP->BlueprintType)), LOCTEXT("BlueprintTutorialsMenuEntryToolTip", "Opens up an introductory tutorial covering this particular part of the Blueprint editor."), FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tutorials"), FUIAction(FExecuteAction::CreateRaw(this, &FIntroTutorials::SummonBlueprintTutorialHome, PrimaryObject, false))); } } MenuBuilder.EndSection(); }
FText UEnvQueryTest_Trace::GetDescriptionTitle() const { UEnum* ChannelEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("ETraceTypeQuery"), true); FString ChannelDesc = ChannelEnum->GetEnumText(TraceData.TraceChannel).ToString(); FString DirectionDesc = TraceFromContext.IsDynamic() ? FString::Printf(TEXT("%s, direction: %s"), *UEnvQueryTypes::DescribeContext(Context).ToString(), *TraceFromContext.ToString()) : FString::Printf(TEXT("%s %s"), TraceFromContext.DefaultValue ? TEXT("from") : TEXT("to"), *UEnvQueryTypes::DescribeContext(Context).ToString()); return FText::FromString(FString::Printf(TEXT("%s: %s on %s"), *Super::GetDescriptionTitle().ToString(), *DirectionDesc, *ChannelDesc)); }
void FEnvQueryTestDetails::BuildScoreEquationValues() { UEnum* TestScoreEquationEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EEnvTestScoreEquation")); check(TestScoreEquationEnum); ScoreEquationValues.Reset(); // Const scoring is always valid. But other equations are only valid if the score values can be other than boolean values. ScoreEquationValues.Add(FTextIntPair(TestScoreEquationEnum->GetEnumText(EEnvTestScoreEquation::Constant), EEnvTestScoreEquation::Constant)); const UEnvQueryTest* EditedTest = Cast<const UEnvQueryTest>(MyTest.Get()); if (EditedTest) { if (EditedTest->GetWorkOnFloatValues()) { ScoreEquationValues.Add(FTextIntPair(TestScoreEquationEnum->GetEnumText(EEnvTestScoreEquation::Linear), EEnvTestScoreEquation::Linear)); ScoreEquationValues.Add(FTextIntPair(TestScoreEquationEnum->GetEnumText(EEnvTestScoreEquation::Square), EEnvTestScoreEquation::Square)); ScoreEquationValues.Add(FTextIntPair(TestScoreEquationEnum->GetEnumText(EEnvTestScoreEquation::InverseLinear), EEnvTestScoreEquation::InverseLinear)); } } }
END_SLATE_FUNCTION_BUILD_OPTIMIZATION void FEnvQueryTestDetails::BuildFilterTestValues() { UEnum* TestConditionEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EEnvTestFilterType")); check(TestConditionEnum); FilterTestValues.Reset(); const UEnvQueryTest* EditedTest = Cast<const UEnvQueryTest>(MyTest.Get()); if (EditedTest) { if (EditedTest->GetWorkOnFloatValues()) { FilterTestValues.Add(FTextIntPair(TestConditionEnum->GetEnumText(EEnvTestFilterType::Minimum), EEnvTestFilterType::Minimum)); FilterTestValues.Add(FTextIntPair(TestConditionEnum->GetEnumText(EEnvTestFilterType::Maximum), EEnvTestFilterType::Maximum)); FilterTestValues.Add(FTextIntPair(TestConditionEnum->GetEnumText(EEnvTestFilterType::Range), EEnvTestFilterType::Range)); } else { FilterTestValues.Add(FTextIntPair(TestConditionEnum->GetEnumText(EEnvTestFilterType::Match), EEnvTestFilterType::Match)); } } }
const FSoundGroup& USoundGroups::GetSoundGroup(const ESoundGroup SoundGroup) const { // Initialize the settings if this gets called early enough to require it if (SoundGroupMap.Num() == 0) { Initialize(); } const FSoundGroup* SG = SoundGroupMap.Find(SoundGroup); if (SG == NULL) { UEnum* SoundGroupEnum = FindObjectChecked<UEnum>(NULL, TEXT("/Script/Engine.ESoundGroup")); UE_LOG(LogAudio, Warning, TEXT("Requested SoundGroup %s does not have defined profile. Using SOUNDGROUP_Default."), *SoundGroupEnum->GetEnumText(SoundGroup).ToString()); return SoundGroupMap.FindChecked(SOUNDGROUP_Default); } return *SG; }
void USoundGroups::Initialize() const { for (int32 ProfileIndex = 0; ProfileIndex < SoundGroupProfiles.Num(); ++ProfileIndex) { SoundGroupMap.Add(SoundGroupProfiles[ProfileIndex].SoundGroup, SoundGroupProfiles[ProfileIndex]); } if (!SoundGroupMap.Find(SOUNDGROUP_Default)) { UE_LOG(LogAudio, Warning, TEXT("Missing default SoundGroup profile. Creating default with no decompression.")); SoundGroupMap.Add(SOUNDGROUP_Default, FSoundGroup()); } #if WITH_EDITOR UEnum* SoundGroupEnum = FindObjectChecked<UEnum>(NULL, TEXT("/Script/Engine.ESoundGroup")); for (const auto& It : SoundGroupMap) { if (It.Value.DisplayName.Len() > 0) { SoundGroupEnum->SetMetaData(TEXT("DisplayName"), *It.Value.DisplayName, It.Key); SoundGroupEnum->RemoveMetaData(TEXT("Hidden"), It.Key); } else { if (SoundGroupEnum->HasMetaData(TEXT("Hidden"), It.Key)) { UE_LOG(LogAudio, Warning, TEXT("Custom Game SoundGroup profile for %s defined but no display name supplied."), *SoundGroupEnum->GetEnumText(It.Key).ToString()); } SoundGroupEnum->RemoveMetaData(TEXT("Hidden"), It.Key); } } #endif }