本文整理汇总了C++中UClass::FindFunctionByName方法的典型用法代码示例。如果您正苦于以下问题:C++ UClass::FindFunctionByName方法的具体用法?C++ UClass::FindFunctionByName怎么用?C++ UClass::FindFunctionByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UClass
的用法示例。
在下文中一共展示了UClass::FindFunctionByName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
UFunction* UK2Node_MakeArray::GetArrayAddFunction() const
{
UClass* ArrayLibClass = UKismetArrayLibrary::StaticClass();
UFunction* ReturnFunction = ArrayLibClass->FindFunctionByName(FName(TEXT("Array_Add")));
check(ReturnFunction);
return ReturnFunction;
}
示例2: FindPropertySetter
bool FSequencerObjectChangeListener::FindPropertySetter( const UClass& ObjectClass, const FName PropertyTypeName, const FString& PropertyVarName ) const
{
bool bFound = ClassToPropertyChangedMap.Contains( PropertyTypeName );
if( bFound )
{
static const FString Set(TEXT("Set"));
const FString FunctionString = Set + PropertyVarName;
FName FunctionName = FName(*FunctionString);
bFound = ObjectClass.FindFunctionByName(FunctionName) != nullptr;
}
return bFound;
}
示例3: HandleGameplayCue
void IGameplayCueInterface::HandleGameplayCue(AActor *Self, FGameplayTag GameplayCueTag, EGameplayCueEvent::Type EventType, FGameplayCueParameters Parameters)
{
SCOPE_CYCLE_COUNTER(STAT_GameplayCueInterface_HandleGameplayCue);
// Look up a custom function for this gameplay tag.
UClass* Class = Self->GetClass();
IGameplayTagsModule& GameplayTagsModule = IGameplayTagsModule::Get();
FGameplayTagContainer TagAndParentsContainer = GameplayTagsModule.GetGameplayTagsManager().RequestGameplayTagParents(GameplayCueTag);
Parameters.OriginalTag = GameplayCueTag;
//Find entry for the class
FGameplayCueTagFunctionList& GameplayTagFunctionList = PerClassGameplayTagToFunctionMap.FindOrAdd(Class);
TArray<FCueNameAndUFunction>* FunctionList = GameplayTagFunctionList.Find(GameplayCueTag);
if (FunctionList == NULL)
{
//generate new function list
FunctionList = &GameplayTagFunctionList.Add(GameplayCueTag);
for (auto InnerTagIt = TagAndParentsContainer.CreateConstIterator(); InnerTagIt; ++InnerTagIt)
{
UFunction* Func = NULL;
FName CueName = InnerTagIt->GetTagName();
Func = Class->FindFunctionByName(CueName, EIncludeSuperFlag::IncludeSuper);
// If the handler calls ForwardGameplayCueToParent, keep calling functions until one consumes the cue and doesn't forward it
while (Func)
{
FCueNameAndUFunction NewCueFunctionPair;
NewCueFunctionPair.Tag = *InnerTagIt;
NewCueFunctionPair.Func = Func;
FunctionList->Add(NewCueFunctionPair);
Func = Func->GetSuperFunction();
}
// Native functions cant be named with ".", so look for them with _.
FName NativeCueFuncName = *CueName.ToString().Replace(TEXT("."), TEXT("_"));
Func = Class->FindFunctionByName(NativeCueFuncName, EIncludeSuperFlag::IncludeSuper);
while (Func)
{
FCueNameAndUFunction NewCueFunctionPair;
NewCueFunctionPair.Tag = *InnerTagIt;
NewCueFunctionPair.Func = Func;
FunctionList->Add(NewCueFunctionPair);
Func = Func->GetSuperFunction();
}
}
}
//Iterate through all functions in the list until we should no longer continue
check(FunctionList);
bool bShouldContinue = true;
for (int32 FunctionIndex = 0; bShouldContinue && (FunctionIndex < FunctionList->Num()); ++FunctionIndex)
{
FCueNameAndUFunction& CueFunctionPair = FunctionList->GetData()[FunctionIndex];
UFunction* Func = CueFunctionPair.Func;
Parameters.MatchedTagName = CueFunctionPair.Tag;
// Reset the forward parameter now, so we can check it after function
bForwardToParent = false;
IGameplayCueInterface::DispatchBlueprintCustomHandler(Self, Func, EventType, Parameters);
bShouldContinue = bForwardToParent;
}
if (bShouldContinue)
{
TArray<UGameplayCueSet*> Sets;
GetGameplayCueSets(Sets);
for (UGameplayCueSet* Set : Sets)
{
bShouldContinue = Set->HandleGameplayCue(Self, GameplayCueTag, EventType, Parameters);
if (!bShouldContinue)
{
break;
}
}
}
if (bShouldContinue)
{
Parameters.MatchedTagName = GameplayCueTag;
GameplayCueDefaultHandler(EventType, Parameters);
}
}
示例4: Compile
virtual void Compile(FKismetFunctionContext& Context, UEdGraphNode* Node) override
{
UEdGraphPin* InputPin = NULL;
for (int32 PinIndex = 0; PinIndex < Node->Pins.Num(); ++PinIndex)
{
UEdGraphPin* Pin = Node->Pins[PinIndex];
if (Pin && (EGPD_Input == Pin->Direction))
{
InputPin = Pin;
break;
}
}
UEdGraphPin *InNet = FEdGraphUtilities::GetNetFromPin(InputPin);
UClass *Class = Cast<UClass>(StaticLoadObject(UClass::StaticClass(), NULL, TEXT("class'VaRestPlugin.VaRestJsonObject'")));
FBPTerminal **SourceTerm = Context.NetMap.Find(InNet);
if (SourceTerm == nullptr)
{
return;
}
for (int32 PinIndex = 0; PinIndex < Node->Pins.Num(); ++PinIndex)
{
UEdGraphPin* Pin = Node->Pins[PinIndex];
if (Pin && (EGPD_Output == Pin->Direction))
{
if (Pin->LinkedTo.Num() < 1)
{
continue;
}
FBPTerminal **Target = Context.NetMap.Find(Pin);
const FString &FieldName = Pin->PinName;
const FString &FieldType = Pin->PinType.PinCategory;
FBPTerminal* FieldNameTerm = Context.CreateLocalTerminal(ETerminalSpecification::TS_Literal);
FieldNameTerm->Type.PinCategory = CompilerContext.GetSchema()->PC_String;
FieldNameTerm->Source = Pin;
FieldNameTerm->Name = FieldName;
FieldNameTerm->TextLiteral = FText::FromString(FieldName);
FBlueprintCompiledStatement& Statement = Context.AppendStatementForNode(Node);
FName FunctionName;
bool bIsArray = Pin->PinType.bIsArray;
if (FieldType == CompilerContext.GetSchema()->PC_Boolean)
{
FunctionName = bIsArray ? TEXT("GetBoolArrayField") : TEXT("GetBoolField");
}
else if (FieldType == CompilerContext.GetSchema()->PC_Float)
{
FunctionName = bIsArray ? TEXT("GetNumberArrayField") : TEXT("GetNumberField");
}
else if (FieldType == CompilerContext.GetSchema()->PC_String)
{
FunctionName = bIsArray ? TEXT("GetStringArrayField") : TEXT("GetStringField");
}
else if (FieldType == CompilerContext.GetSchema()->PC_Object)
{
FunctionName = bIsArray ? TEXT("GetObjectArrayField") : TEXT("GetObjectField");
}
else
{
continue;
}
UFunction *FunctionPtr = Class->FindFunctionByName(FunctionName);
Statement.Type = KCST_CallFunction;
Statement.FunctionToCall = FunctionPtr;
Statement.FunctionContext = *SourceTerm;
Statement.bIsParentContext = false;
Statement.LHS = *Target;
Statement.RHS.Add(FieldNameTerm);
}
}
}