本文整理汇总了C++中UClass::GetDisplayNameText方法的典型用法代码示例。如果您正苦于以下问题:C++ UClass::GetDisplayNameText方法的具体用法?C++ UClass::GetDisplayNameText怎么用?C++ UClass::GetDisplayNameText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UClass
的用法示例。
在下文中一共展示了UClass::GetDisplayNameText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Format
FText UK2Node_CallFunctionOnMember::GetFunctionContextString() const
{
UClass* MemberVarClass = MemberVariableToCallOn.GetMemberParentClass(GetBlueprintClassFromNode());
FText CallFunctionClassName = (MemberVarClass != NULL) ? MemberVarClass->GetDisplayNameText() : FText::GetEmpty();
FFormatNamedArguments Args;
Args.Add(TEXT("TargetName"), CallFunctionClassName);
Args.Add(TEXT("MemberVariableName"), FText::FromName(MemberVariableToCallOn.GetMemberName()));
return FText::Format(LOCTEXT("CallFunctionOnMemberDifferentContext", "Target is {TargetName} ({MemberVariableName})"), Args);
}
示例2: if
bool UK2Node_DynamicCast::IsConnectionDisallowed(const UEdGraphPin* MyPin, const UEdGraphPin* OtherPin, FString& OutReason) const
{
bool bIsDisallowed = Super::IsConnectionDisallowed(MyPin, OtherPin, OutReason);
if (MyPin == GetCastSourcePin())
{
const FEdGraphPinType& OtherPinType = OtherPin->PinType;
const FText OtherPinName = OtherPin->PinFriendlyName.IsEmpty() ? FText::FromString(OtherPin->PinName) : OtherPin->PinFriendlyName;
if (OtherPinType.bIsArray)
{
bIsDisallowed = true;
OutReason = LOCTEXT("CannotArrayCast", "You cannot cast arrays of objects.").ToString();
}
else if (TargetType == nullptr)
{
bIsDisallowed = true;
OutReason = LOCTEXT("BadCastNode", "This cast has an invalid target type (was the class deleted without a redirect?).").ToString();
}
else if ((OtherPinType.PinCategory == UEdGraphSchema_K2::PC_Interface) || TargetType->HasAnyClassFlags(CLASS_Interface))
{
// allow all interface casts
}
else if (OtherPinType.PinCategory == UEdGraphSchema_K2::PC_Object)
{
UClass* ObjectClass = Cast<UClass>(OtherPinType.PinSubCategoryObject.Get());
if ((ObjectClass == nullptr) && (OtherPinType.PinSubCategory == UEdGraphSchema_K2::PSC_Self))
{
if (UK2Node* K2Node = Cast<UK2Node>(OtherPin->GetOwningNode()))
{
ObjectClass = K2Node->GetBlueprint()->GeneratedClass;
}
}
// if the ObjectClass is still null, assume it is a UObject, which
// will work with everything (so don't disallow it)
if (ObjectClass != nullptr)
{
if (ObjectClass == TargetType)
{
bIsDisallowed = true;
OutReason = FText::Format(LOCTEXT("EqualObjectCast", "'{0}' is already a '{1}', you don't need the cast."),
OtherPinName, TargetType->GetDisplayNameText()).ToString();
}
else if (ObjectClass->IsChildOf(TargetType))
{
bIsDisallowed = true;
OutReason = FText::Format(LOCTEXT("UnneededObjectCast", "'{0}' is already a '{1}' (which inherits from '{2}'), so you don't need the cast."),
OtherPinName, ObjectClass->GetDisplayNameText(), TargetType->GetDisplayNameText()).ToString();
}
else if (!TargetType->IsChildOf(ObjectClass))
{
bIsDisallowed = true;
OutReason = FText::Format(LOCTEXT("DisallowedObjectCast", "'{0}' does not inherit from '{1}' (the cast would always fail)."),
TargetType->GetDisplayNameText(), ObjectClass->GetDisplayNameText()).ToString();
}
}
}
else
{
bIsDisallowed = true;
OutReason = LOCTEXT("NonObjectCast", "You can only cast objects/interfaces.").ToString();
}
}
return bIsDisallowed;
}
示例3: if
void UK2Node_DynamicCast::ValidateNodeDuringCompilation(FCompilerResultsLog& MessageLog) const
{
Super::ValidateNodeDuringCompilation(MessageLog);
UEdGraphPin* SourcePin = GetCastSourcePin();
if (SourcePin->LinkedTo.Num() > 0)
{
const UClass* SourceType = *TargetType;
if (SourceType == nullptr)
{
return;
}
for (UEdGraphPin* CastInput : SourcePin->LinkedTo)
{
const FEdGraphPinType& SourcePinType = CastInput->PinType;
if (SourcePinType.PinCategory != UEdGraphSchema_K2::PC_Object)
{
// all other types should have been rejected by IsConnectionDisallowed()
continue;
}
UClass* SourceClass = Cast<UClass>(SourcePinType.PinSubCategoryObject.Get());
if ((SourceClass == nullptr) && (SourcePinType.PinSubCategory == UEdGraphSchema_K2::PSC_Self))
{
if (UK2Node* K2Node = Cast<UK2Node>(CastInput->GetOwningNode()))
{
SourceClass = K2Node->GetBlueprint()->GeneratedClass;
}
}
if (SourceClass == nullptr)
{
const FString SourcePinName = CastInput->PinFriendlyName.IsEmpty() ? CastInput->PinName : CastInput->PinFriendlyName.ToString();
FText const ErrorFormat = LOCTEXT("BadCastInput", "'%s' does not have a clear object type (invalid input into @@).");
MessageLog.Error( *FString::Printf(*ErrorFormat.ToString(), *SourcePinName), this );
continue;
}
if (SourceClass == SourceType)
{
const FString SourcePinName = CastInput->PinFriendlyName.IsEmpty() ? CastInput->PinName : CastInput->PinFriendlyName.ToString();
FText const WarningFormat = LOCTEXT("EqualObjectCast", "'%s' is already a '%s', you don't need @@.");
MessageLog.Warning( *FString::Printf(*WarningFormat.ToString(), *SourcePinName, *TargetType->GetDisplayNameText().ToString()), this );
}
else if (SourceClass->IsChildOf(SourceType))
{
const FString SourcePinName = CastInput->PinFriendlyName.IsEmpty() ? CastInput->PinName : CastInput->PinFriendlyName.ToString();
FText const WarningFormat = LOCTEXT("UnneededObjectCast", "'%s' is already a '%s' (which inherits from '%s'), so you don't need @@.");
MessageLog.Warning( *FString::Printf(*WarningFormat.ToString(), *SourcePinName, *SourceClass->GetDisplayNameText().ToString(), *TargetType->GetDisplayNameText().ToString()), this );
}
else if (!SourceType->IsChildOf(SourceClass) && !FKismetEditorUtilities::IsClassABlueprintInterface(SourceType))
{
FText const WarningFormat = LOCTEXT("DisallowedObjectCast", "'%s' does not inherit from '%s' (@@ would always fail).");
MessageLog.Warning( *FString::Printf(*WarningFormat.ToString(), *TargetType->GetDisplayNameText().ToString(), *SourceClass->GetDisplayNameText().ToString()), this );
}
}
}
}