void UKismetMathLibrary::RGBToHSV_Vector(const FLinearColor RGB, FLinearColor& HSV) { HSV = RGB.LinearRGBToHSV(); }
void SColorGradientEditor::OnCancelSelectedStopColorChange( FLinearColor PreviousColor ) { SelectedStop.SetColor( PreviousColor.HSVToLinearRGB(), *CurveOwner ); CurveOwner->ModifyOwner(); }
void UKismetMathLibrary::HSVToRGB_Vector(const FLinearColor HSV, FLinearColor& RGB) { RGB = HSV.HSVToLinearRGB(); }
bool CollectionViewUtils::HasCustomColors( TArray< FLinearColor >* OutColors ) { if(!FPaths::FileExists(GEditorPerProjectIni)) { return false; } // Read individual entries from a config file. TArray<FString> Section; GConfig->GetSection(TEXT("CollectionColor"), Section, GEditorPerProjectIni); bool bHasCustom = false; const FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule(); const ICollectionManager& CollectionManager = CollectionManagerModule.Get(); for(FString& EntryStr : Section) { EntryStr.Trim(); FString ColorKeyStr; FString ColorStr; if(!EntryStr.Split("=", &ColorKeyStr, &ColorStr)) { continue; } // Ignore any that have invalid or default colors FLinearColor CurrentColor; if(!CurrentColor.InitFromString(ColorStr) || CurrentColor.Equals(CollectionViewUtils::GetDefaultColor())) { continue; } // Ignore any that reference old collections FString CollectionName; ECollectionShareType::Type CollectionType; if(!FromConfigKey(ColorKeyStr, CollectionName, CollectionType) || !CollectionManager.CollectionExists(*CollectionName, CollectionType)) { continue; } bHasCustom = true; if(OutColors) { // Only add if not already present (ignores near matches too) bool bAdded = false; for(const FLinearColor& Color : *OutColors) { if(CurrentColor.Equals(Color)) { bAdded = true; break; } } if(!bAdded) { OutColors->Add(CurrentColor); } } else { break; } } return bHasCustom; }
void FSequencerFolderNode::OnColorPickerPicked(FLinearColor NewFolderColor) { MovieSceneFolder.SetFolderColor(NewFolderColor.ToFColor(false)); }
void ULog::K2_PrintStringOverTime(const FString& InString, float Duration, FLinearColor TextColor) { GEngine->AddOnScreenDebugMessage(-1, Duration, TextColor.ToFColor(true), InString); return; }
bool FProfilerManager::TrackStat( const uint32 StatID ) { bool bAdded = false; // Check if all profiler instances have this stat ready. int32 NumReadyStats = 0; for( auto It = GetProfilerInstancesIterator(); It; ++It ) { const FProfilerSessionRef ProfilerSession = It.Value(); NumReadyStats += ProfilerSession->GetAggregatedStat(StatID) != nullptr ? 1 : 0; } const bool bStatIsReady = NumReadyStats == GetProfilerInstancesNum(); if( StatID != 0 && bStatIsReady ) { FTrackedStat* TrackedStat = TrackedStats.Find( StatID ); if( TrackedStat == nullptr ) { // R = H, G = S, B = V const FLinearColor& ColorAverage = GetColorForStatID( StatID ); const FLinearColor ColorAverageHSV = ColorAverage.LinearRGBToHSV(); FLinearColor ColorBackgroundHSV = ColorAverageHSV; ColorBackgroundHSV.G = FMath::Max( 0.0f, ColorBackgroundHSV.G-0.25f ); FLinearColor ColorExtremesHSV = ColorAverageHSV; ColorExtremesHSV.G = FMath::Min( 1.0f, ColorExtremesHSV.G+0.25f ); ColorExtremesHSV.B = FMath::Min( 1.0f, ColorExtremesHSV.B+0.25f ); const FLinearColor ColorBackground = ColorBackgroundHSV.HSVToLinearRGB(); const FLinearColor ColorExtremes = ColorExtremesHSV.HSVToLinearRGB(); TrackedStat = &TrackedStats.Add( StatID, FTrackedStat(CreateCombinedGraphDataSource( StatID ),ColorAverage,ColorExtremes,ColorBackground,StatID) ); bAdded = true; // @TODO: Convert a reference parameter to copy parameter/sharedptr/ref/weak, to avoid problems when a reference is no longer valid. TrackedStatChangedEvent.Broadcast( *TrackedStat, true ); } if( TrackedStat != nullptr ) { uint32 NumAddedInstances = 0; bool bMetadataInitialized = false; for( auto It = GetProfilerInstancesIterator(); It; ++It ) { const FGuid& SessionInstanceID = It.Key();// ProfilerSessionInstanceID, ProfilerInstanceID, InstanceID const FProfilerSessionRef ProfilerSession = It.Value(); const bool bInstanceAdded = TrackStatForSessionInstance( StatID, SessionInstanceID ); NumAddedInstances += bInstanceAdded ? 1 : 0; // Initialize metadata for combine graph data source. // TODO: This should be checked against the remaining elements to detect inconsistent data. // The first instance should be the main. if( !bMetadataInitialized ) { const bool bIsStatReady = ProfilerSession->GetMetaData()->IsStatInitialized( StatID ); if( bIsStatReady ) { const FProfilerStatMetaDataRef MetaData = ProfilerSession->GetMetaData(); const FProfilerStat& Stat = MetaData->GetStatByID( StatID ); const FProfilerGroup& Group = Stat.OwningGroup(); TrackedStat->CombinedGraphDataSource->Initialize( Stat.Name().GetPlainNameString(), Group.ID(), Group.Name().GetPlainNameString(), Stat.Type(), ProfilerSession->GetCreationTime() ); bMetadataInitialized = true; } } } } } return bAdded; }
void UVisualLoggerKismetLibrary::LogBox(UObject* WorldContextObject, FBox Box, FString Text, FLinearColor ObjectColor, FName CategoryName) { #if ENABLE_VISUAL_LOG const ELogVerbosity::Type DefaultVerbosity = ELogVerbosity::Log; FVisualLogger::GeometryShapeLogf(WorldContextObject, FLogCategoryBase(*CategoryName.ToString(), DefaultVerbosity, DefaultVerbosity), DefaultVerbosity, INDEX_NONE, Box, FMatrix::Identity, ObjectColor.ToFColor(true), *Text); #endif }
void UVisualLoggerKismetLibrary::LogLocation(UObject* WorldContextObject, FVector Location, FString Text, FLinearColor Color, float Radius, FName CategoryName) { #if ENABLE_VISUAL_LOG const ELogVerbosity::Type DefaultVerbosity = ELogVerbosity::Log; FVisualLogger::GeometryShapeLogf(WorldContextObject, FLogCategoryBase(*CategoryName.ToString(), DefaultVerbosity, DefaultVerbosity), DefaultVerbosity, INDEX_NONE, Location, Radius, Color.ToFColor(true), *Text); #endif }
FString UKismetStringLibrary::Conv_ColorToString(FLinearColor C) { return C.ToString(); }
/** * Construct this widget. Called by the SNew() Slate macro. * * @param InArgs Declaration used by the SNew() macro to construct this widget * @param Factory The factory this menu entry represents */ void Construct( const FArguments& InArgs, UFactory* Factory ) { const FName ClassThumbnailBrushOverride = Factory->GetNewAssetThumbnailOverride(); const FSlateBrush* ClassThumbnail = nullptr; if (ClassThumbnailBrushOverride.IsNone()) { ClassThumbnail = FClassIconFinder::FindThumbnailForClass(Factory->GetSupportedClass()); } else { // Instead of getting the override thumbnail directly from the editor style here get it from the // ClassIconFinder since it may have additional styles registered which can be searched by passing // it as a default with no class to search for. ClassThumbnail = FClassIconFinder::FindThumbnailForClass(nullptr, ClassThumbnailBrushOverride); } FAssetToolsModule& AssetToolsModule = FAssetToolsModule::GetModule(); TWeakPtr<IAssetTypeActions> AssetTypeActions = AssetToolsModule.Get().GetAssetTypeActionsForClass(Factory->GetSupportedClass()); FLinearColor AssetColor = FLinearColor::White; if ( AssetTypeActions.IsValid() ) { AssetColor = AssetTypeActions.Pin()->GetTypeColor(); } ChildSlot [ SNew( SHorizontalBox ) +SHorizontalBox::Slot() .Padding( 4, 0, 0, 0 ) .VAlign(VAlign_Center) .AutoWidth() [ SNew( SOverlay ) +SOverlay::Slot() [ SNew( SBox ) .WidthOverride( InArgs._Width + 4 ) .HeightOverride( InArgs._Height + 4 ) [ SNew( SBorder ) .BorderImage( FEditorStyle::GetBrush("AssetThumbnail.AssetBackground") ) .BorderBackgroundColor(AssetColor.CopyWithNewOpacity(0.3f)) .Padding( 2.0f ) .VAlign( VAlign_Center ) .HAlign( HAlign_Center ) [ SNew( SImage ) .Image( ClassThumbnail ) ] ] ] +SOverlay::Slot() .HAlign(HAlign_Fill) .VAlign(VAlign_Bottom) [ SNew( SBorder ) .BorderImage( FEditorStyle::GetBrush("WhiteBrush") ) .BorderBackgroundColor( AssetColor ) .Padding( FMargin(0, FMath::Max(FMath::CeilToFloat(InArgs._Width*0.025f), 3.0f), 0, 0) ) ] ] +SHorizontalBox::Slot() .VAlign(VAlign_Center) .Padding(4, 0, 4, 0) [ SNew( SVerticalBox ) +SVerticalBox::Slot() .Padding(0, 0, 0, 1) .AutoHeight() [ SNew(STextBlock) .Font( FEditorStyle::GetFontStyle("LevelViewportContextMenu.AssetLabel.Text.Font") ) .Text( Factory->GetDisplayName() ) ] ] ]; SetToolTip(IDocumentation::Get()->CreateToolTip(Factory->GetToolTip(), nullptr, Factory->GetToolTipDocumentationPage(), Factory->GetToolTipDocumentationExcerpt())); }
inline FString convert(FLinearColor x) { return x.ToString(); }