UFunction* UK2Node_MakeArray::GetArrayAddFunction() const { UClass* ArrayLibClass = UKismetArrayLibrary::StaticClass(); UFunction* ReturnFunction = ArrayLibClass->FindFunctionByName(FName(TEXT("Array_Add"))); check(ReturnFunction); return ReturnFunction; }
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; }
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); } }
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); } } }