You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-196209
Improves "Find References" in blueprints: now supports function search by [class, function] call-sites and definitions rather than a generic search for function name. Replaces the "Find References" context menu action with a sub-menu for variables and functions in BlueprintEditor, WidgetBlueprintEditor, SubobjectEditor and SubobjectEditor. That context sub-menu has 'By Name' and 'By Class Member' search options and local+global versions of both. Made changes to Find-in-Blueprints metadata that is generated per blueprint asset to be able to do "specific function of a specific class" type queries; some search types were unsupported with previous metadata. Incremented the EFiBVersion so that the Find-in-Blueprints search window will ask to re-index all blueprints and resave. Added an opt-out editor setting "Allow Index All Blueprints" (default: true) to disable the button, which can be decided per project. Added an action in the Find-in-Blueprints modal when outdated metadata is detected to export the list of affected assets. #rb Phillip.Kavan [CL 30316851 by zhikang shao in ue5-main branch]
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "EngineLogs.h"
|
||||
#include "EventEntryHandler.h"
|
||||
#include "FindInBlueprints.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "GraphEditorSettings.h"
|
||||
#include "HAL/PlatformCrt.h"
|
||||
@@ -898,24 +899,27 @@ FSlateIcon UK2Node_Event::GetIconAndTint(FLinearColor& OutColor) const
|
||||
return Icon;
|
||||
}
|
||||
|
||||
FString UK2Node_Event::GetFindReferenceSearchString() const
|
||||
FString UK2Node_Event::GetFindReferenceSearchString_Impl(EGetFindReferenceSearchStringFlags InFlags) const
|
||||
{
|
||||
// Behavior modeled after UK2Node_Event::GetNodeTitle but without "Event" prepended
|
||||
if (bOverrideFunction || (CustomFunctionName == NAME_None))
|
||||
// Resolve the function
|
||||
if (const UFunction* Function = FFunctionFromNodeHelper::FunctionFromNode(this))
|
||||
{
|
||||
FString FunctionName = EventReference.GetMemberName().ToString(); // If we fail to find the function, still want to search for its expected name.
|
||||
|
||||
if (const UFunction* Function = EventReference.ResolveMember<UFunction>(GetBlueprintClassFromNode()))
|
||||
// Attempt to construct an advanced search syntax query from the function
|
||||
FString SearchTerm;
|
||||
if (EnumHasAnyFlags(InFlags, EGetFindReferenceSearchStringFlags::UseSearchSyntax) && FindInBlueprintsHelpers::ConstructSearchTermFromFunction(Function, SearchTerm))
|
||||
{
|
||||
FunctionName = UEdGraphSchema_K2::GetFriendlySignatureName(Function).ToString();
|
||||
return SearchTerm;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback behavior: function was found but failed to construct a search term from it
|
||||
// Just search for the function's friendly name
|
||||
return UEdGraphSchema_K2::GetFriendlySignatureName(Function).ToString();
|
||||
}
|
||||
|
||||
return FunctionName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CustomFunctionName.ToString();
|
||||
}
|
||||
|
||||
// If we fail to find the function, still want to search for its expected name.
|
||||
return EventReference.GetMemberName().ToString();
|
||||
}
|
||||
|
||||
void UK2Node_Event::FindDiffs(UEdGraphNode* OtherNode, struct FDiffResults& Results)
|
||||
@@ -961,6 +965,25 @@ bool UK2Node_Event::HasExternalDependencies(TArray<class UStruct*>* OptionalOutp
|
||||
return bSuperResult || bResult;
|
||||
}
|
||||
|
||||
void UK2Node_Event::AddSearchMetaDataInfo(TArray<FSearchTagDataPair>& OutTaggedMetaData) const
|
||||
{
|
||||
Super::AddSearchMetaDataInfo(OutTaggedMetaData);
|
||||
|
||||
if (const UFunction* Function = FFunctionFromNodeHelper::FunctionFromNode(this))
|
||||
{
|
||||
// Index the native name of the function, this will be used in search queries rather than node title
|
||||
const FString FunctionNativeName = Function->GetName();
|
||||
OutTaggedMetaData.Add(FSearchTagDataPair(FFindInBlueprintSearchTags::FiB_NativeName, FText::FromString(FunctionNativeName)));
|
||||
|
||||
// Index the (ancestor) class or interface from which the function originates, can be self
|
||||
if (const UClass* FuncOriginClass = FindInBlueprintsHelpers::GetFunctionOriginClass(Function))
|
||||
{
|
||||
const FString FuncOriginClassName = FuncOriginClass->GetPathName();
|
||||
OutTaggedMetaData.Add(FSearchTagDataPair(FFindInBlueprintSearchTags::FiB_FuncOriginClass, FText::FromString(FuncOriginClassName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TSharedPtr<FEdGraphSchemaAction> UK2Node_Event::GetEventNodeAction(const FText& ActionCategory)
|
||||
{
|
||||
TSharedPtr<FEdGraphSchemaAction_K2Event> EventNodeAction = MakeShareable(new FEdGraphSchemaAction_K2Event(ActionCategory, GetNodeTitle(ENodeTitleType::EditableTitle), GetTooltipText(), 0));
|
||||
|
||||
Reference in New Issue
Block a user