本文整理汇总了C++中FColor::InitFromString方法的典型用法代码示例。如果您正苦于以下问题:C++ FColor::InitFromString方法的具体用法?C++ FColor::InitFromString怎么用?C++ FColor::InitFromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FColor
的用法示例。
在下文中一共展示了FColor::InitFromString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseTag
bool ParseTag(FColor& OutColor)
{
FString TagString;
EStringParserToken Token = ReadToken();
for (; Token != EStringParserToken::EndOfString && Token != EStringParserToken::CloseTag; Token = ReadToken())
{
if (Token == EStringParserToken::RegularChar)
{
TagString.AppendChar(DataString[DataIndex]);
}
DataIndex++;
}
bool bResult = false;
if (Token == EStringParserToken::CloseTag)
{
const FString TagColorLower = TagString.ToLower();
const bool bIsColorName = GColorList.IsValidColorName(*TagColorLower);
if (bIsColorName)
{
OutColor = GColorList.GetFColorByName(*TagColorLower);
bResult = true;
}
else
{
bResult = OutColor.InitFromString(TagString);
}
}
return bResult;
}
示例2: ParseTag
uint32 ParseTag( FString& OutData )
{
FString TagString;
int32 OryginalIndex = Index;
uint8 token = ReadToken();
while (token != EndOfString && token != CloseTag)
{
if (token == RegularChar)
{
TagString.AppendChar(DataString[Index++]);
}
token = ReadToken();
}
int OutTag = ErrorTag;
if (token != CloseTag)
{
Index = OryginalIndex;
OutData = FString::Printf( TEXT("{%s"), *TagString);
OutData.AppendChar(DataString[Index-1]);
return OutTag;
}
if (GColorList.IsValidColorName(*TagString.ToLower()))
{
OutTag = DefinedColor;
OutData = TagString;
}
else
{
FColor Color;
if (Color.InitFromString(TagString))
{
OutTag = OtherColor;
OutData = TagString;
}
else
{
OutTag = ErrorTag;
OutData = FString::Printf( TEXT("{%s"), *TagString);
OutData.AppendChar(DataString[Index-1]);
}
}
//Index++;
return OutTag;
}
示例3: CreateColorPicker
void FColorStructCustomization::CreateColorPicker( bool bUseAlpha, bool bOnlyRefreshOnOk )
{
int32 NumObjects = StructPropertyHandle->GetNumOuterObjects();
SavedPreColorPickerColors.Empty();
TArray<FString> PerObjectValues;
StructPropertyHandle->GetPerObjectValues( PerObjectValues );
for( int32 ObjectIndex = 0; ObjectIndex < NumObjects; ++ObjectIndex )
{
if( bIsLinearColor )
{
FLinearColor Color;
Color.InitFromString( PerObjectValues[ObjectIndex] );
SavedPreColorPickerColors.Add( Color );
}
else
{
FColor Color;
Color.InitFromString( PerObjectValues[ObjectIndex] );
SavedPreColorPickerColors.Add( Color.ReinterpretAsLinear() );
}
}
FLinearColor InitialColor;
GetColorAsLinear(InitialColor);
// This needs to be meta data. Other colors could benefit from this
const bool bRefreshOnlyOnOk = StructPropertyHandle->GetProperty()->GetOwnerClass()->IsChildOf(UMaterialExpressionConstant3Vector::StaticClass());
FColorPickerArgs PickerArgs;
PickerArgs.bUseAlpha = !bIgnoreAlpha;
PickerArgs.bOnlyRefreshOnMouseUp = false;
PickerArgs.bOnlyRefreshOnOk = bRefreshOnlyOnOk;
PickerArgs.DisplayGamma = TAttribute<float>::Create( TAttribute<float>::FGetter::CreateUObject(GEngine, &UEngine::GetDisplayGamma) );
PickerArgs.OnColorCommitted = FOnLinearColorValueChanged::CreateSP( this, &FColorStructCustomization::OnSetColorFromColorPicker );
PickerArgs.OnColorPickerCancelled = FOnColorPickerCancelled::CreateSP( this, &FColorStructCustomization::OnColorPickerCancelled );
PickerArgs.OnInteractivePickBegin = FSimpleDelegate::CreateSP( this, &FColorStructCustomization::OnColorPickerInteractiveBegin );
PickerArgs.OnInteractivePickEnd = FSimpleDelegate::CreateSP( this, &FColorStructCustomization::OnColorPickerInteractiveEnd );
PickerArgs.InitialColorOverride = InitialColor;
PickerArgs.ParentWidget = ColorPickerParentWidget;
OpenColorPicker(PickerArgs);
}
示例4: SNew
TSharedRef<SColorPicker> FColorStructCustomization::CreateInlineColorPicker()
{
int32 NumObjects = StructPropertyHandle->GetNumOuterObjects();
SavedPreColorPickerColors.Empty();
TArray<FString> PerObjectValues;
StructPropertyHandle->GetPerObjectValues( PerObjectValues );
for( int32 ObjectIndex = 0; ObjectIndex < NumObjects; ++ObjectIndex )
{
if( bIsLinearColor )
{
FLinearColor Color;
Color.InitFromString( PerObjectValues[ObjectIndex] );
SavedPreColorPickerColors.Add( Color );
}
else
{
FColor Color;
Color.InitFromString( PerObjectValues[ObjectIndex] );
SavedPreColorPickerColors.Add( Color.ReinterpretAsLinear() );
}
}
FLinearColor InitialColor;
GetColorAsLinear(InitialColor);
// This needs to be meta data. Other colors could benefit from this
const bool bRefreshOnlyOnOk = StructPropertyHandle->GetProperty()->GetOwnerClass()->IsChildOf(UMaterialExpressionConstant3Vector::StaticClass());
return SNew(SColorPicker)
.Visibility(this, &FColorStructCustomization::GetInlineColorPickerVisibility)
.DisplayInlineVersion(true)
.OnlyRefreshOnMouseUp(false)
.OnlyRefreshOnOk(bRefreshOnlyOnOk)
.DisplayGamma(TAttribute<float>::Create( TAttribute<float>::FGetter::CreateUObject(GEngine, &UEngine::GetDisplayGamma) ))
.OnColorCommitted(FOnLinearColorValueChanged::CreateSP( this, &FColorStructCustomization::OnSetColorFromColorPicker ))
.OnColorPickerCancelled(FOnColorPickerCancelled::CreateSP( this, &FColorStructCustomization::OnColorPickerCancelled ))
.OnInteractivePickBegin(FSimpleDelegate::CreateSP( this, &FColorStructCustomization::OnColorPickerInteractiveBegin ))
.OnInteractivePickEnd(FSimpleDelegate::CreateSP( this, &FColorStructCustomization::OnColorPickerInteractiveEnd ))
.TargetColorAttribute(InitialColor);
}
示例5: ParseString
void ParseString(const FString& StringToParse)
{
Index = 0;
DataString = StringToParse;
Strings.Add(StringNode());
if (Index >= DataString.Len())
return;
uint8 Token = ReadToken();
while (Token != EndOfString)
{
switch (Token)
{
case RegularChar:
Strings[Strings.Num()-1].String.AppendChar( DataString[Index++] );
break;
case NewLine:
Strings.Add(StringNode());
Strings[Strings.Num()-1].bNewLine = true;
Strings[Strings.Num()-1].Color = Strings[Strings.Num()-2].Color;
break;
case EndOfString:
break;
case Tab:
{
const FString TabString(TEXT(" "));
Strings[Strings.Num()-1].String.Append(TabString);
static bool sbTest = false;
if (sbTest)
{
Index++;
}
break;
}
case OpenTag:
{
FString OutData;
switch (ParseTag(OutData))
{
case DefinedColor:
{
int32 i = Strings.Add(StringNode());
Strings[i].Color = GColorList.GetFColorByName(*OutData.ToLower());
}
break;
case OtherColor:
{
FColor NewColor;
if (NewColor.InitFromString( OutData ))
{
int32 i = Strings.Add(StringNode());
Strings[i].Color = NewColor;
break;
}
}
default:
Strings[Strings.Num()-1].String += OutData;
break;
}
}
break;
}
Token = ReadToken();
}
}