当前位置: 首页>>代码示例>>C++>>正文


C++ UClass::GetDisplayNameText方法代码示例

本文整理汇总了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);
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:9,代码来源:K2Node_CallFunctionOnMember.cpp

示例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;
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:67,代码来源:K2Node_DynamicCast.cpp

示例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 );
			}
		}
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:63,代码来源:K2Node_DynamicCast.cpp


注:本文中的UClass::GetDisplayNameText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。