本文整理汇总了C++中FCompilerResultsLog类的典型用法代码示例。如果您正苦于以下问题:C++ FCompilerResultsLog类的具体用法?C++ FCompilerResultsLog怎么用?C++ FCompilerResultsLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FCompilerResultsLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareObjects
/**
* Compares the properties of two UObject instances
* @param OriginalObj The first UObject to compare
* @param CompareObj The second UObject to compare
* @param Results The results log to record errors or warnings
*
* @return True of the blueprints are the same, false otherwise (see the Results log for more details)
*/
static bool CompareObjects(UObject* OriginalObj, UObject* CompareObj, FCompilerResultsLog& Results)
{
bool bMatch = false;
// ensure we have something sensible to compare
if (OriginalObj == NULL)
{
Results.Error( TEXT("Original object is null") );
return false;
}
else if (CompareObj == NULL)
{
Results.Error( TEXT("Compare object is null") );
return false;
}
else if (OriginalObj == CompareObj)
{
Results.Error( TEXT("Objects to compare are the same") );
return false;
}
TMap<FString, FString> ObjProperties;
GetObjProperties(OriginalObj, ObjProperties);
TMap<FString, FString> CmpProperties;
GetObjProperties(CompareObj, CmpProperties);
return ComparePropertyMaps(OriginalObj->GetFName(), ObjProperties, CompareObj->GetFName(), CmpProperties, Results);
}
示例2: ValidateAnimNodeDuringCompilation
void UAnimGraphNode_BoneDrivenController::ValidateAnimNodeDuringCompilation(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog)
{
if (ForSkeleton->GetReferenceSkeleton().FindBoneIndex(Node.SourceBone.BoneName) == INDEX_NONE)
{
MessageLog.Warning(*LOCTEXT("NoSourceBone", "@@ - You must pick a source bone as the Driver joint").ToString(), this);
}
if (Node.SourceComponent == EComponentType::None)
{
MessageLog.Warning(*LOCTEXT("NoSourceComponent", "@@ - You must pick a source component on the Driver joint").ToString(), this);
}
if (ForSkeleton->GetReferenceSkeleton().FindBoneIndex(Node.TargetBone.BoneName) == INDEX_NONE)
{
MessageLog.Warning(*LOCTEXT("NoTargetBone", "@@ - You must pick a target bone as the Driven joint").ToString(), this);
}
const bool bAffectsTranslation = Node.bAffectTargetTranslationX || Node.bAffectTargetTranslationY || Node.bAffectTargetTranslationZ;
const bool bAffectsRotation = Node.bAffectTargetRotationX || Node.bAffectTargetRotationY || Node.bAffectTargetRotationZ;
const bool bAffectsScale = Node.bAffectTargetScaleX || Node.bAffectTargetScaleY || Node.bAffectTargetScaleZ;
if (!bAffectsTranslation && !bAffectsRotation && !bAffectsScale)
{
MessageLog.Warning(*LOCTEXT("NoTargetComponent", "@@ - You must pick one or more target components on the Driven joint").ToString(), this);
}
Super::ValidateAnimNodeDuringCompilation(ForSkeleton, MessageLog);
}
示例3: ValidateAnimNodeDuringCompilation
void UAnimGraphNode_PoseHandler::ValidateAnimNodeDuringCompilation(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog)
{
UPoseAsset* PoseAssetToCheck = GetPoseHandlerNode()->PoseAsset;
UEdGraphPin* PoseAssetPin = FindPin(GET_MEMBER_NAME_STRING_CHECKED(FAnimNode_PoseHandler, PoseAsset));
if (PoseAssetPin != nullptr && PoseAssetToCheck == nullptr)
{
PoseAssetToCheck = Cast<UPoseAsset>(PoseAssetPin->DefaultObject);
}
if (PoseAssetToCheck == nullptr)
{
if (PoseAssetPin == nullptr || PoseAssetPin->LinkedTo.Num() == 0)
{
MessageLog.Error(TEXT("@@ references an unknown poseasset"), this);
}
}
else
{
USkeleton* SeqSkeleton = PoseAssetToCheck->GetSkeleton();
if (SeqSkeleton && // if PoseAsset doesn't have skeleton, it might be due to PoseAsset not loaded yet, @todo: wait with anim blueprint compilation until all assets are loaded?
!SeqSkeleton->IsCompatible(ForSkeleton))
{
MessageLog.Error(TEXT("@@ references poseasset that uses different skeleton @@"), this, SeqSkeleton);
}
}
Super::ValidateAnimNodeDuringCompilation(ForSkeleton, MessageLog);
}
示例4: ValidateNodeVariableNames
void USimpleConstructionScript::ValidateNodeVariableNames(FCompilerResultsLog& MessageLog)
{
UBlueprint* Blueprint = GetBlueprint();
check(Blueprint);
TSharedPtr<FKismetNameValidator> ParentBPNameValidator;
if( Blueprint->ParentClass != NULL )
{
UBlueprint* ParentBP = Cast<UBlueprint>(Blueprint->ParentClass->ClassGeneratedBy);
if( ParentBP != NULL )
{
ParentBPNameValidator = MakeShareable(new FKismetNameValidator(ParentBP));
}
}
TSharedPtr<FKismetNameValidator> CurrentBPNameValidator = MakeShareable(new FKismetNameValidator(Blueprint));
TArray<USCS_Node*> Nodes = GetAllNodes();
int32 Counter=0;
for (int32 NodeIndex=0; NodeIndex < Nodes.Num(); ++NodeIndex)
{
USCS_Node* Node = Nodes[NodeIndex];
if( Node && Node->ComponentTemplate && Node != DefaultSceneRootNode )
{
// Replace missing or invalid component variable names
if( Node->VariableName == NAME_None
|| Node->bVariableNameAutoGenerated_DEPRECATED
|| !FComponentEditorUtils::IsValidVariableNameString(Node->ComponentTemplate, Node->VariableName.ToString()) )
{
FName OldName = Node->VariableName;
// Generate a new default variable name for the component.
Node->VariableName = GenerateNewComponentName(Node->ComponentTemplate->GetClass());
Node->bVariableNameAutoGenerated_DEPRECATED = false;
if( OldName != NAME_None )
{
FBlueprintEditorUtils::ReplaceVariableReferences(Blueprint, OldName, Node->VariableName);
MessageLog.Warning(*FString::Printf(TEXT("Found a component variable with an invalid name (%s) - changed to %s."), *OldName.ToString(), *Node->VariableName.ToString()));
}
}
else if( ParentBPNameValidator.IsValid() && ParentBPNameValidator->IsValid(Node->VariableName) != EValidatorResult::Ok )
{
FName OldName = Node->VariableName;
FName NewVariableName = FBlueprintEditorUtils::FindUniqueKismetName(Blueprint, OldName.ToString());
FBlueprintEditorUtils::RenameMemberVariable(Blueprint, OldName, NewVariableName );
MessageLog.Warning(*FString::Printf(TEXT("Found a component variable with a conflicting name (%s) - changed to %s."), *OldName.ToString(), *Node->VariableName.ToString()));
}
}
}
}
示例5: if
void UK2Node_AddComponent::ValidateNodeDuringCompilation(FCompilerResultsLog& MessageLog) const
{
Super::ValidateNodeDuringCompilation(MessageLog);
UActorComponent* Template = GetTemplateFromNode();
if (Template)
{
UClass* TemplateClass = Template->GetClass();
if (!TemplateClass->IsChildOf(UActorComponent::StaticClass()) || TemplateClass->HasAnyClassFlags(CLASS_Abstract) || !TemplateClass->HasMetaData(FBlueprintMetadata::MD_BlueprintSpawnableComponent) )
{
FFormatNamedArguments Args;
Args.Add(TEXT("TemplateClass"), FText::FromString(TemplateClass->GetName()));
Args.Add(TEXT("NodeTitle"), GetNodeTitle(ENodeTitleType::FullTitle));
MessageLog.Error(*FText::Format(NSLOCTEXT("KismetCompiler", "InvalidComponentTemplate_Error", "Invalid class '{TemplateClass}' used as template by '{NodeTitle}' for @@"), Args).ToString(), this);
}
if (UChildActorComponent const* ChildActorComponent = Cast<UChildActorComponent const>(Template))
{
UBlueprint const* Blueprint = GetBlueprint();
UClass const* ChildActorClass = ChildActorComponent->GetChildActorClass();
if (ChildActorClass == Blueprint->GeneratedClass)
{
UEdGraph const* ParentGraph = GetGraph();
UEdGraphSchema_K2 const* K2Schema = GetDefault<UEdGraphSchema_K2>();
if (K2Schema->IsConstructionScript(ParentGraph))
{
FFormatNamedArguments Args;
Args.Add(TEXT("ChildActorClass"), FText::FromString(ChildActorClass->GetName()));
MessageLog.Error(*FText::Format(NSLOCTEXT("KismetCompiler", "AddSelfComponent_Error", "@@ cannot add a '{ChildActorClass}' component in the construction script (could cause infinite recursion)."), Args).ToString(), this);
}
}
else if (ChildActorClass != nullptr)
{
AActor const* ChildActor = Cast<AActor>(ChildActorClass->ClassDefaultObject);
check(ChildActor != nullptr);
USceneComponent* RootComponent = ChildActor->GetRootComponent();
if ((RootComponent != nullptr) && (RootComponent->Mobility == EComponentMobility::Static) && (ChildActorComponent->Mobility != EComponentMobility::Static))
{
FFormatNamedArguments Args;
Args.Add(TEXT("ChildActorClass"), FText::FromString(ChildActorClass->GetName()));
MessageLog.Error(*FText::Format(NSLOCTEXT("KismetCompiler", "AddStaticChildActorComponent_Error", "@@ cannot add a '{ChildActorClass}' component as it has static mobility, and the ChildActorComponent does not."), Args).ToString(), this);
}
}
}
}
else
{
FFormatNamedArguments Args;
Args.Add(TEXT("NodeTitle"), GetNodeTitle(ENodeTitleType::FullTitle));
MessageLog.Error(*FText::Format(NSLOCTEXT("KismetCompiler", "MissingComponentTemplate_Error", "Unknown template referenced by '{NodeTitle}' for @@"), Args).ToString(), this);
}
}
示例6: ValidateAnimNodeDuringCompilation
void UAnimGraphNode_ModifyBone::ValidateAnimNodeDuringCompilation(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog)
{
if (ForSkeleton->GetReferenceSkeleton().FindBoneIndex(Node.BoneToModify.BoneName) == INDEX_NONE)
{
MessageLog.Warning(*LOCTEXT("NoBoneToModify", "@@ - You must pick a bone to modify").ToString(), this);
}
if ((Node.TranslationMode == BMM_Ignore) && (Node.RotationMode == BMM_Ignore) && (Node.ScaleMode == BMM_Ignore))
{
MessageLog.Warning(*LOCTEXT("NothingToModify", "@@ - No components to modify selected. Either Rotation, Translation, or Scale should be set to something other than Ignore").ToString(), this);
}
Super::ValidateAnimNodeDuringCompilation(ForSkeleton, MessageLog);
}
示例7: CreateVariables
static void CreateVariables(UBlueprintGeneratedStruct* Struct, TArray<FBPVariableDescription>& Fields, const class UEdGraphSchema_K2* Schema, FCompilerResultsLog& MessageLog)
{
check(Struct && Schema);
//FKismetCompilerUtilities::LinkAddedProperty push property to begin, so we revert the order
for(int32 VarDescIdx = Fields.Num() - 1; VarDescIdx >= 0; --VarDescIdx)
{
FBPVariableDescription& VarDesc = Fields[VarDescIdx];
VarDesc.bInvalidMember = true;
FString ErrorMsg;
if(!FStructureEditorUtils::CanHaveAMemberVariableOfType(Struct, VarDesc.VarType, &ErrorMsg))
{
MessageLog.Error(*FString::Printf(*LOCTEXT("StructureGeneric_Error", "Structure: %s Error: %s").ToString(), *Struct->GetPathName(), *ErrorMsg));
continue;
}
UProperty* NewProperty = FKismetCompilerUtilities::CreatePropertyOnScope(Struct, VarDesc.VarName, VarDesc.VarType, NULL, 0, Schema, MessageLog);
if (NewProperty != NULL)
{
FKismetCompilerUtilities::LinkAddedProperty(Struct, NewProperty);
}
else
{
MessageLog.Error(*FString::Printf(*LOCTEXT("VariableInvalidType_Error", "The variable %s declared in %s has an invalid type %s").ToString(),
*VarDesc.VarName.ToString(), *Struct->GetName(), *UEdGraphSchema_K2::TypeToString(VarDesc.VarType)));
continue;
}
NewProperty->SetPropertyFlags(VarDesc.PropertyFlags);
NewProperty->SetMetaData(TEXT("FriendlyName"), *VarDesc.FriendlyName);
NewProperty->SetMetaData(TEXT("DisplayName"), *VarDesc.FriendlyName);
NewProperty->SetMetaData(TEXT("Category"), *VarDesc.Category.ToString());
NewProperty->RepNotifyFunc = VarDesc.RepNotifyFunc;
if (!VarDesc.DefaultValue.IsEmpty())
{
NewProperty->SetMetaData(TEXT("MakeStructureDefaultValue"), *VarDesc.DefaultValue);
}
// Set metadata on property
for (const FBPVariableMetaDataEntry& Entry : VarDesc.MetaDataArray)
{
NewProperty->SetMetaData(Entry.DataKey, *Entry.DataValue);
}
VarDesc.bInvalidMember = false;
}
}
示例8:
void UK2Node_ForEachElementInEnum::ValidateNodeDuringCompilation(FCompilerResultsLog& MessageLog) const
{
if (!Enum)
{
MessageLog.Error(*NSLOCTEXT("K2Node", "ForEachElementInEnum_NoEnumError", "No Enum in @@").ToString(), this);
}
}
示例9: ValidateEnumProperties
void FKismetCompilerUtilities::ValidateEnumProperties(UObject* DefaultObject, FCompilerResultsLog& MessageLog)
{
check(DefaultObject);
for (TFieldIterator<UProperty> It(DefaultObject->GetClass()); It; ++It)
{
const UByteProperty* ByteProperty = Cast<UByteProperty>(*It);
if(ByteProperty && !ByteProperty->HasAnyPropertyFlags(CPF_Transient))
{
const UEnum* Enum = ByteProperty->GetIntPropertyEnum();
if(Enum)
{
const uint8 EnumIndex = ByteProperty->GetPropertyValue_InContainer(DefaultObject);
const int32 EnumAcceptableMax = Enum->NumEnums() - 1;
if(EnumIndex >= EnumAcceptableMax)
{
MessageLog.Warning(
*FString::Printf(
*LOCTEXT("InvalidEnumDefaultValue_Error", "Default Enum value '%s' for class '%s' is invalid in object '%s' ").ToString(),
*ByteProperty->GetName(),
*DefaultObject->GetClass()->GetName(),
*DefaultObject->GetName()
)
);
}
}
}
}
}
示例10: LogError
static void LogError(UUserDefinedStruct* Struct, FCompilerResultsLog& MessageLog, const FString& ErrorMsg)
{
MessageLog.Error(*ErrorMsg);
if (Struct && Struct->ErrorMessage.IsEmpty())
{
Struct->ErrorMessage = ErrorMsg;
}
}
示例11: ValidateAnimNodeDuringCompilation
void UAnimGraphNode_TwistCorrectiveNode::ValidateAnimNodeDuringCompilation(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog)
{
if (Node.Curve.Name == NAME_None)
{
MessageLog.Warning(TEXT("@@ has missing Curve Name."), this);
}
Super::ValidateAnimNodeDuringCompilation(ForSkeleton, MessageLog);
}
示例12: ComparePropertyMaps
/**
* Compare two object property maps
* @param OrigName The name of the original object being compared against
* @param OrigMap The property map for the object
* @param CmpName The name of the object to compare
* @param CmpMap The property map for the object to compare
*/
static bool ComparePropertyMaps(FName OrigName, TMap<FString, FString>& OrigMap, FName CmpName, FPropertiesMap& CmpMap, FCompilerResultsLog& Results)
{
if (OrigMap.Num() != CmpMap.Num())
{
Results.Error( *FString::Printf(TEXT("Objects have a different number of properties (%d vs %d)"), OrigMap.Num(), CmpMap.Num()) );
return false;
}
bool bMatch = true;
for (auto PropIt = OrigMap.CreateIterator(); PropIt; ++PropIt)
{
FString Key = PropIt.Key();
FString Val = PropIt.Value();
const FString* CmpValue = CmpMap.Find(Key);
// Value is missing
if (CmpValue == NULL)
{
bMatch = false;
Results.Error( *FString::Printf(TEXT("Property is missing in object being compared: (%s %s)"), *Key, *Val) );
break;
}
else if (Val != *CmpValue)
{
// string out object names and retest
FString TmpCmp(*CmpValue);
TmpCmp.ReplaceInline(*CmpName.ToString(), TEXT(""));
FString TmpVal(Val);
TmpVal.ReplaceInline(*OrigName.ToString(), TEXT(""));
if (TmpCmp != TmpVal)
{
bMatch = false;
Results.Error( *FString::Printf(TEXT("Object properties do not match: %s (%s vs %s)"), *Key, *Val, *(*CmpValue)) );
break;
}
}
}
return bMatch;
}
示例13:
void UK2Node_Variable::CheckForErrors(const UEdGraphSchema_K2* Schema, FCompilerResultsLog& MessageLog)
{
if(!VariableReference.IsSelfContext() && VariableReference.GetMemberParentClass(GetBlueprintClassFromNode()) != NULL)
{
// Check to see if we're not a self context, if we have a valid context. It may have been purged because of a dead execution chain
UEdGraphPin* ContextPin = Schema->FindSelfPin(*this, EGPD_Input);
if((ContextPin != NULL) && (ContextPin->LinkedTo.Num() == 0) && (ContextPin->DefaultObject == NULL))
{
MessageLog.Error(*LOCTEXT("VarNodeError_InvalidVarTarget", "Variable node @@ uses an invalid target. It may depend on a node that is not connected to the execution chain, and got purged.").ToString(), this);
}
}
}
示例14: CheckOutputsParametersInDelegateSignature
static void CheckOutputsParametersInDelegateSignature(const UFunction* SignatureFunc, const UK2Node * DelegateNode, FCompilerResultsLog& MessageLog)
{
for (TFieldIterator<UProperty> PropIt(SignatureFunc); PropIt && (PropIt->PropertyFlags & CPF_Parm); ++PropIt)
{
UProperty* FuncParam = *PropIt;
if (FuncParam->HasAllPropertyFlags(CPF_OutParm) && !FuncParam->HasAllPropertyFlags(CPF_ConstParm))
{
const bool bIsArray = FuncParam->IsA<UArrayProperty>(); // array is always passed by reference, see FKismetCompilerContext::CreatePropertiesFromList
const FString MessageStr = FString::Printf(
*LOCTEXT("DelegatesDontSupportRef", "Event Dispatcher: No value will be return by reference. Parameter '%s'. Node '@@'").ToString(),
*FuncParam->GetName());
if (bIsArray)
{
MessageLog.Note(*MessageStr,DelegateNode);
}
else
{
MessageLog.Warning(*MessageStr, DelegateNode);
}
}
}
}
示例15: LOCTEXT
void UK2Node_SetFieldsInStruct::ValidateNodeDuringCompilation(FCompilerResultsLog& MessageLog) const
{
Super::ValidateNodeDuringCompilation(MessageLog);
if (UEdGraphPin* FoundPin = FindPinChecked(SetFieldsInStructHelper::StructRefPinName()))
{
if (FoundPin->LinkedTo.Num() <= 0)
{
FText ErrorMessage = LOCTEXT("SetStructFields_NoStructRefError", "The @@ pin must be connected to the struct that you wish to set.");
MessageLog.Error(*ErrorMessage.ToString(), FoundPin);
}
}
}