本文整理汇总了C++中UFunction类的典型用法代码示例。如果您正苦于以下问题:C++ UFunction类的具体用法?C++ UFunction怎么用?C++ UFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UFunction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetBlueprint
void UK2Node_CustomEvent::ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const
{
Super::ValidateNodeDuringCompilation(MessageLog);
UBlueprint* Blueprint = GetBlueprint();
check(Blueprint != NULL);
UFunction* ParentFunction = FindField<UFunction>(Blueprint->ParentClass, CustomFunctionName);
// if this custom-event is overriding a function belonging to the blueprint's parent
if (ParentFunction != NULL)
{
UObject const* const FuncOwner = ParentFunction->GetOuter();
check(FuncOwner != NULL);
// if this custom-event is attempting to override a native function, we can't allow that
if (!FuncOwner->IsA(UBlueprintGeneratedClass::StaticClass()))
{
MessageLog.Error(*FString::Printf(*LOCTEXT("NativeFunctionConflict", "@@ name conflicts with a native '%s' function").ToString(), *FuncOwner->GetName()), this);
}
else
{
UK2Node_CustomEvent const* OverriddenEvent = FindCustomEventNodeFromFunction(ParentFunction);
// if the function that this is attempting to override is NOT another
// custom-event, then we want to error (a custom-event shouldn't override something different)
if (OverriddenEvent == NULL)
{
MessageLog.Error(*FString::Printf(*LOCTEXT("NonCustomEventOverride", "@@ name conflicts with a '%s' function").ToString(), *FuncOwner->GetName()), this);
}
// else, we assume the user was attempting to override the parent's custom-event
// the signatures could still be off, but FKismetCompilerContext::PrecompileFunction() should catch that
}
}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:33,代码来源:K2Node_CustomEvent.cpp
示例2: GetTargetFunction
void UK2Node_CallArrayFunction::GetArrayPins(TArray< FArrayPropertyPinCombo >& OutArrayPinInfo ) const
{
OutArrayPinInfo.Empty();
UFunction* TargetFunction = GetTargetFunction();
check(TargetFunction);
FString ArrayPointerMetaData = TargetFunction->GetMetaData(FBlueprintMetadata::MD_ArrayParam);
TArray<FString> ArrayPinComboNames;
ArrayPointerMetaData.ParseIntoArray(ArrayPinComboNames, TEXT(","), true);
for(auto Iter = ArrayPinComboNames.CreateConstIterator(); Iter; ++Iter)
{
TArray<FString> ArrayPinNames;
Iter->ParseIntoArray(ArrayPinNames, TEXT("|"), true);
FArrayPropertyPinCombo ArrayInfo;
ArrayInfo.ArrayPin = FindPin(ArrayPinNames[0]);
if(ArrayPinNames.Num() > 1)
{
ArrayInfo.ArrayPropPin = FindPin(ArrayPinNames[1]);
}
if(ArrayInfo.ArrayPin)
{
OutArrayPinInfo.Add(ArrayInfo);
}
}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:28,代码来源:K2Node_CallArrayFunction.cpp
示例3: Disasm
// Disassemble all functions in any classes that have matching names.
void FKismetBytecodeDisassembler::DisassembleAllFunctionsInClasses(FOutputDevice& Ar, const FString& ClassnameSubstring)
{
FKismetBytecodeDisassembler Disasm(Ar);
for (TObjectIterator<UClass> ClassIter; ClassIter; ++ClassIter)
{
UClass* Class = *ClassIter;
FString ClassName = Class->GetName();
if (FCString::Strfind(*ClassName, *ClassnameSubstring))
{
Ar.Logf(TEXT("Processing class %s"), *ClassName);
for (TFieldIterator<UFunction> FunctionIter(Class, EFieldIteratorFlags::ExcludeSuper); FunctionIter; ++FunctionIter)
{
UFunction* Function = *FunctionIter;
FString FunctionName = Function->GetName();
Ar.Logf(TEXT(" Processing function %s (%d bytes)"), *FunctionName, Function->Script.Num());
Disasm.DisassembleStructure(Function);
Ar.Logf(TEXT(""));
}
Ar.Logf(TEXT(""));
Ar.Logf(TEXT("-----------"));
Ar.Logf(TEXT(""));
}
}
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:32,代码来源:ScriptDisassembler.cpp
示例4: while
/** Finds a property by name, starting in the specified scope; Validates property type and returns NULL along with emitting an error if there is a mismatch. */
UProperty* FKismetCompilerUtilities::FindPropertyInScope(UStruct* Scope, UEdGraphPin* Pin, FCompilerResultsLog& MessageLog, const UEdGraphSchema_K2* Schema, UClass* SelfClass)
{
while (Scope != NULL)
{
for (TFieldIterator<UProperty> It(Scope, EFieldIteratorFlags::IncludeSuper); It; ++It)
{
UProperty* Property = *It;
if (Property->GetName() == Pin->PinName)
{
if (FKismetCompilerUtilities::IsTypeCompatibleWithProperty(Pin, Property, MessageLog, Schema, SelfClass))
{
return Property;
}
else
{
// Exit now, we found one with the right name but the type mismatched (and there was a type mismatch error)
return NULL;
}
}
}
// Functions don't automatically check their class when using a field iterator
UFunction* Function = Cast<UFunction>(Scope);
Scope = (Function != NULL) ? Cast<UStruct>(Function->GetOuter()) : NULL;
}
// Couldn't find the name
MessageLog.Error(*LOCTEXT("PropertyNotFound_Error", "The property associated with @@ could not be found").ToString(), Pin);
return NULL;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:32,代码来源:KismetCompilerMisc.cpp
示例5: new
void FBlueprintStatsModule::DumpBlueprintStats()
{
TArray<FBlueprintStatRecord> Records;
for (TObjectIterator<UBlueprint> BlueprintIt; BlueprintIt; ++BlueprintIt)
{
UBlueprint* Blueprint = *BlueprintIt;
new (Records) FBlueprintStatRecord(Blueprint);
}
// Now merge them
FBlueprintStatRecord Aggregate(NULL);
for (const FBlueprintStatRecord& SourceRecord : Records)
{
Aggregate.MergeAnotherRecordIn(SourceRecord);
}
// Sort the lists
Aggregate.NodeCount.ValueSort(TGreater<int32>());
Aggregate.FunctionCount.ValueSort(TGreater<int32>());
Aggregate.FunctionOwnerCount.ValueSort(TGreater<int32>());
Aggregate.RemoteMacroCount.ValueSort(TGreater<int32>());
// Print out the merged record
UE_LOG(LogBlueprintStats, Log, TEXT("Blueprint stats for %d blueprints in %s"), Records.Num(), GGameName);
UE_LOG(LogBlueprintStats, Log, TEXT("%s"), *Aggregate.ToString(true));
UE_LOG(LogBlueprintStats, Log, TEXT("%s"), *Aggregate.ToString(false));
UE_LOG(LogBlueprintStats, Log, TEXT("\n"));
// Print out the node list
UE_LOG(LogBlueprintStats, Log, TEXT("NodeClass,NumInstances"));
for (const auto& NodePair : Aggregate.NodeCount)
{
UE_LOG(LogBlueprintStats, Log, TEXT("%s,%d"), *(NodePair.Key->GetName()), NodePair.Value);
}
UE_LOG(LogBlueprintStats, Log, TEXT("\n"));
// Print out the function list
UE_LOG(LogBlueprintStats, Log, TEXT("FunctionPath,ClassName,FunctionName,NumInstances"));
for (const auto& FunctionPair : Aggregate.FunctionCount)
{
UFunction* Function = FunctionPair.Key;
UE_LOG(LogBlueprintStats, Log, TEXT("%s,%s,%s,%d"), *(Function->GetPathName()), *(Function->GetOuterUClass()->GetName()), *(Function->GetName()), FunctionPair.Value);
}
UE_LOG(LogBlueprintStats, Log, TEXT("\n"));
// Print out the macro list
UE_LOG(LogBlueprintStats, Log, TEXT("MacroPath,MacroName,NumInstances"));
for (const auto& MacroPair : Aggregate.RemoteMacroCount)
{
UEdGraph* MacroGraph = MacroPair.Key;
UE_LOG(LogBlueprintStats, Log, TEXT("%s,%s,%d"), *(MacroGraph->GetPathName()), *(MacroGraph->GetName()), MacroPair.Value);
}
UE_LOG(LogBlueprintStats, Log, TEXT("\n"));
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:56,代码来源:BlueprintStatsModule.cpp
示例6: SetNodeFunc
static void SetNodeFunc(UEdGraphNode* NewNode, bool /*bIsTemplateNode*/, TWeakObjectPtr<UFunction> FunctionPtr)
{
UK2Node_LatentGameplayTaskCall* AsyncTaskNode = CastChecked<UK2Node_LatentGameplayTaskCall>(NewNode);
if (FunctionPtr.IsValid())
{
UFunction* Func = FunctionPtr.Get();
UObjectProperty* ReturnProp = CastChecked<UObjectProperty>(Func->GetReturnProperty());
AsyncTaskNode->ProxyFactoryFunctionName = Func->GetFName();
AsyncTaskNode->ProxyFactoryClass = Func->GetOuterUClass();
AsyncTaskNode->ProxyClass = ReturnProp->PropertyClass;
}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:13,代码来源:K2Node_LatentGameplayTaskCall.cpp
示例7: FindEventFunctionForClass
/**
* Finds the event version of a UFunction for a given Blueprint
*
* @param InBlueprint The Blueprint to find the function within
* @param InFunction The Function to find an event version of
*
* @return Event Function used by the given Blueprint for the given Function
*/
UFunction* FindEventFunctionForClass(const UBlueprint* InBlueprint, const UFunction* InFunction)
{
// Look at all of the Blueprint parent's functions for an event
for (TFieldIterator<UFunction> FunctionIt(InBlueprint->ParentClass, EFieldIteratorFlags::IncludeSuper); FunctionIt; ++FunctionIt)
{
UFunction* Function = *FunctionIt;
if(Function->GetName() == InFunction->GetName())
{
return Function;
}
}
return NULL;
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:22,代码来源:BlueprintEditorCommands.cpp
示例8: ExecuteOnServer
void ANUTActor::ExecuteOnServer(UObject* InTargetObj, FString InTargetFunc)
{
if (InTargetObj != NULL && InTargetFunc.Len() > 0)
{
// Only static functions can be used, so verify this is referencing a static function
FName TargetFuncName = *InTargetFunc;
UFunction* TargetFuncObj = InTargetObj->FindFunction(TargetFuncName);
if (FString(TargetFuncName.ToString()).StartsWith(TEXT("UnitTestServer_"), ESearchCase::CaseSensitive))
{
if (TargetFuncObj != NULL)
{
if (TargetFuncObj->HasAnyFunctionFlags(FUNC_Static))
{
UObject* TargetObjCDO = (InTargetObj->HasAnyFlags(EObjectFlags::RF_ClassDefaultObject) ?
InTargetObj :
InTargetObj->GetClass()->GetDefaultObject());
// Now that we've verified it's a static function, change the delegate object to the class default object
// (as that is where static function must be executed, as there is no serverside unit test instance),
// and then send it to the server
TempDelegate.BindUFunction(TargetObjCDO, TargetFuncName);
UDelegateProperty* DelProp = FindField<UDelegateProperty>(GetClass(), TEXT("TempDelegate"));
FString DelString;
DelProp->ExportTextItem(DelString, DelProp->ContainerPtrToValuePtr<uint8>(this), NULL, this, 0, NULL);
ServerExecute(DelString);
}
else
{
UE_LOG(LogUnitTest, Log, TEXT("ExecuteOnServer: Only static functions can be passed to the server."));
}
}
else
{
UE_LOG(LogUnitTest, Log, TEXT("ExecuteOnServer: Could not locate InTarget function."));
}
}
else
{
UE_LOG(LogUnitTest, Log, TEXT("ExecuteOnServer: Target functions must be prefixed 'UnitTestServer_FuncName'"));
}
}
else
{
UE_LOG(LogUnitTest, Log, TEXT("ExecuteOnServer: Target not specified"));
}
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:50,代码来源:NUTActor.cpp
示例9: MakeShareable
void SGraphNodeK2CreateDelegate::CreateBelowWidgetControls(TSharedPtr<SVerticalBox> MainBox)
{
if(UK2Node_CreateDelegate* Node = Cast<UK2Node_CreateDelegate>(GraphNode))
{
UFunction* FunctionSignature = Node->GetDelegateSignature();
UClass* ScopeClass = Node->GetScopeClass();
if(FunctionSignature && ScopeClass)
{
FunctionDataItems.Empty();
for(TFieldIterator<UFunction> It(ScopeClass); It; ++It)
{
UFunction* Func = *It;
if (Func && FunctionSignature->IsSignatureCompatibleWith(Func) &&
UEdGraphSchema_K2::FunctionCanBeUsedInDelegate(Func))
{
TSharedPtr<FFunctionItemData> ItemData = MakeShareable(new FFunctionItemData());
ItemData->Name = Func->GetFName();
ItemData->Description = FunctionDescription(Func);
FunctionDataItems.Add(ItemData);
}
}
TSharedRef<SComboButton> SelectFunctionWidgetRef = SNew(SComboButton)
.Method(EPopupMethod::UseCurrentWindow)
.ButtonContent()
[
SNew(STextBlock)
.Text(this, &SGraphNodeK2CreateDelegate::GetCurrentFunctionDescription)
]
.MenuContent()
[
SNew(SListView<TSharedPtr<FFunctionItemData> >)
.ListItemsSource( &FunctionDataItems )
.OnGenerateRow(this, &SGraphNodeK2CreateDelegate::HandleGenerateRowFunction)
.OnSelectionChanged(this, &SGraphNodeK2CreateDelegate::OnFunctionSelected)
];
MainBox->AddSlot()
.AutoHeight()
.VAlign(VAlign_Fill)
[
SelectFunctionWidgetRef
];
SelectFunctionWidget = SelectFunctionWidgetRef;
}
}
}
开发者ID:PopCap,项目名称:GameIdea,代码行数:49,代码来源:SGraphNodeK2CreateDelegate.cpp
示例10:
UFunction* UK2Node_Event::FindEventSignatureFunction()
{
UFunction* Function = FindField<UFunction>(EventSignatureClass, EventSignatureName);
// First try remap table
if ((Function == NULL) && (EventSignatureClass != NULL))
{
Function = Cast<UFunction>(FindRemappedField(EventSignatureClass, EventSignatureName));
if( Function )
{
// Found a remapped property, update the node
EventSignatureName = Function->GetFName();
EventSignatureClass = Cast<UClass>(Function->GetOuter());
}
}
return Function;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:18,代码来源:K2Node_Event.cpp
示例11: GetTargetFunction
void UK2Node_Message::AllocateDefaultPins()
{
UFunction* MessageNodeFunction = GetTargetFunction();
// since we have branching logic in ExpandNode(), this has to be an impure
// node with exec pins
//
// @TODO: make it so we can have impure message nodes using a custom
// FNodeHandlingFunctor, instead of ExpandNode()
if (MessageNodeFunction && MessageNodeFunction->HasAnyFunctionFlags(FUNC_BlueprintPure))
{
// Input - Execution Pin
CreatePin(EGPD_Input, UEdGraphSchema_K2::PC_Exec, TEXT(""), NULL, false, false, UEdGraphSchema_K2::PN_Execute);
// Output - Execution Pin
CreatePin(EGPD_Output, UEdGraphSchema_K2::PC_Exec, TEXT(""), NULL, false, false, UEdGraphSchema_K2::PN_Then);
}
Super::AllocateDefaultPins();
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:18,代码来源:K2Node_Message.cpp
示例12: RetainBinding
CefRefPtr<CefDictionaryValue> FWebJSScripting::ConvertObject(UObject* Object)
{
CefRefPtr<CefDictionaryValue> Result = CefDictionaryValue::Create();
RetainBinding(Object);
UClass* Class = Object->GetClass();
CefRefPtr<CefListValue> MethodNames = CefListValue::Create();
int32 MethodIndex = 0;
for (TFieldIterator<UFunction> FunctionIt(Class, EFieldIteratorFlags::IncludeSuper); FunctionIt; ++FunctionIt)
{
UFunction* Function = *FunctionIt;
MethodNames->SetString(MethodIndex++, *Function->GetName());
}
Result->SetString("$type", "uobject");
Result->SetString("$id", *PtrToGuid(Object).ToString(EGuidFormats::Digits));
Result->SetList("$methods", MethodNames);
return Result;
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:19,代码来源:WebJSScripting.cpp
示例13: InitGame
void ASGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
{
// HACK: workaround to inject CheckRelevance() into the BeginPlay sequence
UFunction* Func = AActor::GetClass()->FindFunctionByName(FName(TEXT("ReceiveBeginPlay")));
Func->FunctionFlags |= FUNC_Native;
Func->SetNativeFunc((Native)&ASGameMode::BeginPlayMutatorHack);
/* Spawn all mutators. */
for (int32 i = 0; i < MutatorClasses.Num(); i++)
{
AddMutator(MutatorClasses[i]);
}
if (BaseMutator)
{
BaseMutator->InitGame(MapName, Options, ErrorMessage);
}
Super::InitGame(MapName, Options, ErrorMessage);
}
开发者ID:kardmode,项目名称:EpicSurvivalGameSeries,代码行数:20,代码来源:SGameMode.cpp
示例14: TEXT
void UK2Node_MatineeController::ExpandNode(FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph)
{
if (SourceGraph != CompilerContext.ConsolidatedEventGraph)
{
CompilerContext.MessageLog.Error(*FString::Printf(*NSLOCTEXT("KismetCompiler", "InvalidNodeOutsideUbergraph_Error", "Unexpected node @@ found outside ubergraph.").ToString()), this);
return;
}
Super::ExpandNode(CompilerContext, SourceGraph);
if (MatineeActor != NULL)
{
UFunction* MatineeEventSig = FindObject<UFunction>(AMatineeActor::StaticClass(), TEXT("OnMatineeEvent__DelegateSignature"));
check(MatineeEventSig != NULL);
const UEdGraphSchema_K2* Schema = CompilerContext.GetSchema();
// Create event for each exec output pin
for(int32 PinIdx=0; PinIdx<Pins.Num(); PinIdx++)
{
UEdGraphPin* MatineePin = Pins[PinIdx];
if(MatineePin->Direction == EGPD_Output && MatineePin->PinType.PinCategory == Schema->PC_Exec)
{
FName EventFuncName = MatineeActor->GetFunctionNameForEvent( FName(*(MatineePin->PinName)) );
UK2Node_Event* MatineeEventNode = CompilerContext.SpawnIntermediateNode<UK2Node_Event>(this, SourceGraph);
MatineeEventNode->EventSignatureName = MatineeEventSig->GetFName();
MatineeEventNode->EventSignatureClass = AMatineeActor::StaticClass();
MatineeEventNode->CustomFunctionName = EventFuncName;
MatineeEventNode->bInternalEvent = true;
MatineeEventNode->AllocateDefaultPins();
// Move connection from matinee output to event node output
UEdGraphPin* EventOutputPin = Schema->FindExecutionPin(*MatineeEventNode, EGPD_Output);
check(EventOutputPin != NULL);
CompilerContext.CheckConnectionResponse(Schema->MovePinLinks(*MatineePin, *EventOutputPin), this);
}
}
}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:41,代码来源:K2Node_MatineeController.cpp
示例15: Super
UGameplayAbility::UGameplayAbility(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
CostGameplayEffect = NULL;
CooldownGameplayEffect = NULL;
{
static FName FuncName = FName(TEXT("K2_ShouldAbilityRespondToEvent"));
UFunction* ShouldRespondFunction = GetClass()->FindFunctionByName(FuncName);
HasBlueprintShouldAbilityRespondToEvent = ShouldRespondFunction && ShouldRespondFunction->GetOuter()->IsA(UBlueprintGeneratedClass::StaticClass());
}
{
static FName FuncName = FName(TEXT("K2_CanActivateAbility"));
UFunction* CanActivateFunction = GetClass()->FindFunctionByName(FuncName);
HasBlueprintCanUse = CanActivateFunction && CanActivateFunction->GetOuter()->IsA(UBlueprintGeneratedClass::StaticClass());
}
{
static FName FuncName = FName(TEXT("K2_ActivateAbility"));
UFunction* ActivateFunction = GetClass()->FindFunctionByName(FuncName);
HasBlueprintActivate = ActivateFunction && ActivateFunction->GetOuter()->IsA(UBlueprintGeneratedClass::StaticClass());
}
#if WITH_EDITOR
/** Autoregister abilities with the blueprint debugger in the editor.*/
if (!HasAnyFlags(RF_ClassDefaultObject))
{
UBlueprint* BP = Cast<UBlueprint>(GetClass()->ClassGeneratedBy);
if (BP && (BP->GetWorldBeingDebugged() == nullptr || BP->GetWorldBeingDebugged() == GetWorld()))
{
BP->SetObjectBeingDebugged(this);
}
}
#endif
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:34,代码来源:GameplayAbility.cpp
示例16: IsFunctionAvailableAsEvent
/**
* Checks if the passed in function is available as an event for the Blueprint
*
* @param InBlueprint The Blueprint to check for validity with
* @param InFunction The Function to check for being available as an event
*
* @return Returns true if the function is available as an event in the Blueprint
*/
bool IsFunctionAvailableAsEvent(const UBlueprint* InBlueprint, const UFunction* InFunction)
{
// Build a list of all interface classes either implemented by this blueprint or through inheritance
TArray<UClass*> InterfaceClasses;
FBlueprintEditorUtils::FindImplementedInterfaces(InBlueprint, true, InterfaceClasses);
InterfaceClasses.Add(InBlueprint->ParentClass);
// Grab the list of events to be excluded from the override list
const FString ExclusionListKeyName = TEXT("KismetHideOverrides");
TArray<FString> ExcludedEventNames;
if( InBlueprint->ParentClass->HasMetaData(*ExclusionListKeyName) )
{
const FString ExcludedEventNameString = InBlueprint->ParentClass->GetMetaData(*ExclusionListKeyName);
ExcludedEventNameString.ParseIntoArray(ExcludedEventNames, TEXT(","), true);
}
const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
if (K2Schema->FunctionCanBePlacedAsEvent(InFunction) && !ExcludedEventNames.Contains(InFunction->GetName()))
{
// Check all potential interface events using the class list we build above
for(auto It = InterfaceClasses.CreateConstIterator(); It; It++)
{
const UClass* Interface = (*It);
for (TFieldIterator<UFunction> FunctionIt(Interface, EFieldIteratorFlags::IncludeSuper); FunctionIt; ++FunctionIt)
{
UFunction* Function = *FunctionIt;
if(Function->GetName() == InFunction->GetName())
{
return true;
}
}
}
}
return false;
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:45,代码来源:BlueprintEditorCommands.cpp
示例17: ParseDefaultValueData
void SGameplayTagGraphPin::ParseDefaultValueData()
{
FString TagString = GraphPinObj->GetDefaultAsString();
UK2Node_CallFunction* CallFuncNode = Cast<UK2Node_CallFunction>(GraphPinObj->GetOuter());
FilterString.Empty();
if (CallFuncNode)
{
UFunction* ThisFunction = CallFuncNode->GetTargetFunction();
if (ThisFunction)
{
if (ThisFunction->HasMetaData(TEXT("GameplayTagFilter")))
{
FilterString = ThisFunction->GetMetaData(TEXT("GameplayTagFilter"));
}
}
}
if (TagString.StartsWith(TEXT("(")) && TagString.EndsWith(TEXT(")")))
{
TagString = TagString.LeftChop(1);
TagString = TagString.RightChop(1);
TagString.Split("=", NULL, &TagString);
if (TagString.StartsWith(TEXT("\"")) && TagString.EndsWith(TEXT("\"")))
{
TagString = TagString.LeftChop(1);
TagString = TagString.RightChop(1);
}
}
if (!TagString.IsEmpty())
{
FGameplayTag Tag = IGameplayTagsModule::Get().GetGameplayTagsManager().RequestGameplayTag(FName(*TagString));
TagContainer->AddTag(Tag);
}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:37,代码来源:SGameplayTagGraphPin.cpp
示例18: if
FText UK2Node_Event::GetTooltipText() const
{
UFunction* Function = FindField<UFunction>(EventSignatureClass, EventSignatureName);
if (CachedTooltip.IsOutOfDate() && (Function != nullptr))
{
CachedTooltip = FText::FromString(UK2Node_CallFunction::GetDefaultTooltipForFunction(Function));
if (bOverrideFunction || (CustomFunctionName == NAME_None))
{
FFormatNamedArguments Args;
Args.Add(TEXT("FunctionTooltip"), (FText&)CachedTooltip);
//@TODO: KISMETREPLICATION: Should do this for events with a custom function name, if it's a newly introduced replicating thingy
if (Function->HasAllFunctionFlags(FUNC_BlueprintCosmetic) || IsCosmeticTickEvent())
{
Args.Add(
TEXT("ClientString"),
NSLOCTEXT("K2Node", "ClientEvent", "\n\nCosmetic. This event is only for cosmetic, non-gameplay actions.")
);
// FText::Format() is slow, so we cache this to save on performance
CachedTooltip = FText::Format(LOCTEXT("Event_SubtitledTooltip", "{FunctionTooltip}\n\n{ClientString}"), Args);
}
else if(Function->HasAllFunctionFlags(FUNC_BlueprintAuthorityOnly))
{
Args.Add(
TEXT("ClientString"),
NSLOCTEXT("K2Node", "ServerEvent", "\n\nAuthority Only. This event only fires on the server.")
);
// FText::Format() is slow, so we cache this to save on performance
CachedTooltip = FText::Format(LOCTEXT("Event_SubtitledTooltip", "{FunctionTooltip}\n\n{ClientString}"), Args);
}
}
}
return CachedTooltip;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:36,代码来源:K2Node_Event.cpp
示例19: CreatePin
void UK2Node_Switch::CreateFunctionPin()
{
// Set properties on the function pin
const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
UEdGraphPin* FunctionPin = CreatePin(EGPD_Input, K2Schema->PC_Object, TEXT(""), FunctionClass, false, false, FunctionName.ToString());
FunctionPin->bDefaultValueIsReadOnly = true;
FunctionPin->bNotConnectable = true;
FunctionPin->bHidden = true;
UFunction* Function = FindField<UFunction>(FunctionClass, FunctionName);
const bool bIsStaticFunc = Function->HasAllFunctionFlags(FUNC_Static);
if (bIsStaticFunc)
{
// Wire up the self to the CDO of the class if it's not us
if (UBlueprint* BP = GetBlueprint())
{
UClass* FunctionOwnerClass = Function->GetOuterUClass();
if (!BP->SkeletonGeneratedClass->IsChildOf(FunctionOwnerClass))
{
FunctionPin->DefaultObject = FunctionOwnerClass->GetDefaultObject();
}
}
}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:24,代码来源:K2Node_Switch.cpp
示例20: check
void UK2Node_LatentAbilityCall::GetMenuActions(FBlueprintActionDatabaseRegistrar& ActionRegistrar) const
{
// these nested loops are combing over the same classes/functions the
// FBlueprintActionDatabase does; ideally we save on perf and fold this in
// with FBlueprintActionDatabase, but we want to keep the modules separate
for (TObjectIterator<UClass> ClassIt; ClassIt; ++ClassIt)
{
UClass* Class = *ClassIt;
if (!Class->IsChildOf<UAbilityTask>() || Class->HasAnyClassFlags(CLASS_Abstract))
{
continue;
}
for (TFieldIterator<UFunction> FuncIt(Class, EFieldIteratorFlags::ExcludeSuper); FuncIt; ++FuncIt)
{
UFunction* Function = *FuncIt;
if (!Function->HasAnyFunctionFlags(FUNC_Static))
{
continue;
}
// to keep from needlessly instantiating a UBlueprintNodeSpawner, first
// check to make sure that the registrar is looking for actions of this type
// (could be regenerating actions for a specific asset, and therefore the
// registrar would only accept actions corresponding to that asset)
if (!ActionRegistrar.IsOpenForRegistration(Function))
{
continue;
}
UObjectProperty* ReturnProperty = Cast<UObjectProperty>(Function->GetReturnProperty());
// see if the function is a static factory method for online proxies
bool const bIsProxyFactoryMethod = (ReturnProperty != nullptr) && ReturnProperty->PropertyClass->IsChildOf<UAbilityTask>();
if (bIsProxyFactoryMethod)
{
UBlueprintNodeSpawner* NodeSpawner = UBlueprintFunctionNodeSpawner::Create(Function);
check(NodeSpawner != nullptr);
NodeSpawner->NodeClass = GetClass();
auto CustomizeAcyncNodeLambda = [](UEdGraphNode* NewNode, bool bIsTemplateNode, TWeakObjectPtr<UFunction> FunctionPtr)
{
UK2Node_LatentAbilityCall* AsyncTaskNode = CastChecked<UK2Node_LatentAbilityCall>(NewNode);
if (FunctionPtr.IsValid())
{
UFunction* Func = FunctionPtr.Get();
UObjectProperty* ReturnProp = CastChecked<UObjectProperty>(Func->GetReturnProperty());
AsyncTaskNode->ProxyFactoryFunctionName = Func->GetFName();
AsyncTaskNode->ProxyFactoryClass = Func->GetOuterUClass();
AsyncTaskNode->ProxyClass = ReturnProp->PropertyClass;
}
};
TWeakObjectPtr<UFunction> FunctionPtr = Function;
NodeSpawner->CustomizeNodeDelegate = UBlueprintNodeSpawner::FCustomizeNodeDelegate::CreateStatic(CustomizeAcyncNodeLambda, FunctionPtr);
// @TODO: since this can't be folded into FBlueprintActionDatabase, we
// need a way to associate these spawners with a certain class
ActionRegistrar.AddBlueprintAction(Function, NodeSpawner);
}
}
}
}
开发者ID:johndpope,项目名称:UE4,代码行数:64,代码来源:K2Node_LatentAbilityCall.cpp
注:本文中的UFunction类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论