Find Blueprint Info Direct From Visual Studio With This One Neat Extension!
October 20, 2021
Intro
When editing Unreal source code that is exposed to Blueprint, it is not immediately apparent to a developer if this code is ever actually used by the Blueprint system. If, for example, our developer wishes to remove a function declaration they can relatively easily find if it is being used in source code. However, if the function is a UFunction, and tagged up as BlueprintCallable or similar this is not the case. In order to check if this function is still referenced inside a Blueprint it is necessary to open the editor, open a Blueprint, open the search function and then search for the value we are interested in. Repeating these steps every time can become time consuming and does not make for a smooth workflow. Our BlueprintSearchVS extension and commandlet allow access to the Blueprint search function directly from Visual Studio, removing the need to launch the Editor.
Installing the Tool
We have made this tooling freely available (MIT Licence) on our GitHub. The package consists of an Unreal plugin containing a commandlet and a Visual Studio extension. The plugin needs to be integrated into the Engine/Plugins folder of the project you wish to use this tool with, and the extension is a normal Visual Studio installer. Full details are contained in the project ReadMe.
UI
Once installed, BlueprintSearchVS can be opened using either the button inside the Extensions drop-down menu, or the keyboard shortcut Alt + Shift + Control + G.
This button will open a new window inside Visual Studio comprising two main sections: A search bar, and a blank box in which the Search results will be displayed. The search function uses the same logic as the Blueprint search facility in the Unreal editor and supports all the same search syntax.
The search query results will be displayed using a tree view, similar to the one used by the inbuilt Unreal editor Blueprint search function. The root of the tree will always be the name of the Blueprints that contain the elements matching the search term, the content of leaves depend on which search terms were submitted to the query. All the branch or leaf elements are composed of at least two strings divided by a colon. The first string is the type of the element (Blueprints, Graphs, Functions, Pins), the second one is the full name of the element. The Pin elements will have an extra string inserted which will display the type of the Pin. If the Pin type is a user defined data type, the name of that type will appear between quotation marks.
Blueprint Filters
The Unreal Blueprint search syntax allows the use of filters in order to search for specific subsets of data inside a Blueprint. A full list of filters can be found in the relevant Unreal Engine documentation.
Filters can be called using the name of the filter and encapsulating the list of tags (Name, Description, Comment, ObjectClass) associated with that filter between round brackets. Tags can be used by associating the name of the tag with a tag value.
To search Tags that matches the value associated an assignment operator (=) or a “Equal to” (==) operator must be used.
Nodes(Name=Input) returns all the nodes containing “Input” in their name or comment.
To narrow down the results of a search query multiple Tags can be chained together using a logical AND (&&) operator. The element returned will contain each Tags declared inside the filters.
Blueprint( Name=VH_Buggy && Name=Wheel ) returns all the blueprints that contains both “VH_Buggy” and “Wheel” in their name.
Increase the scope of a search query multiple Tags can be chained together using a logical OR (||) operator. The element returned will contain at least one of the Tags declared inside the filters.
Blueprint( Name=VH_Buggy || Name=Wheel ) returns all the blueprints that contains either “VH_Buggy” or “Wheel” in their name.
When called, a Subfilter is always applied to a Blueprint root filter, even if not explicitly declared. This causes queries with multiple subfilters chained with an AND operator to return results only if they are on the same blueprint.
Nodes( Name=EventTick ) && Nodes( Name=BeginPlay ) return nodes called “EventTick” or “BeginPlay” only if both of them are present in the same blueprint. This query is implicitly called as Blueprint( Nodes( Name=EventTick ) && Nodes( Name=BeginPlay )).
To submit a query that returns all the elements that satisfy the subfilters without them having to be all in the same blueprints is necessary to use the OR operator.
Nodes( Name=EventTick ) || Nodes( Name=BeginPlay ) returns all the nodes which name contains either "EventTick” or “BeginPlay”.
Despite being grouped inside Pins, Variables/Properties and Categories, the tag IsSCSComponent will fail to produce any results when used with the Pins filter, regardless of its value. On a similar note, the tag DefaultValue will fail to produce any results when used with Components.
Boolean tags (IsArray, IsReference, IsSCSComponent), need a boolean literal value associated to them. IsReference differs from the other boolean tags by using both an integer value and literal value, which returns different results from each other.
Blueprint( Name=VH_Buggy && Pins( IsReference=1 )|| Pins( IsReference=true )) returns all the reference pins inside the blueprints that contain “VH_Buggy” in their name.
Known Issues
During development of this plugin we discovered an issue when testing with the Vehicle Game sample available via the Epic launcher. This sample project has been around since the early days of UE4 (the earliest supported version is UE4.2), and it turned out that some of the oldest assets in the sample game were being missed by the Blueprint search if they hadn't been fully loaded by the editor before a search was kicked off. As our extension doesn't ever fully load assets this issue was made more apparent. The problem is due to an engine bug that fails to correctly handle assets saved prior to the introduction of the FEditorObjectVersion custom version. The majority of projects are unlikley to suffer from this issue, but we have submitted a fix for it to Epic (Pull Request #8422).
Summary
We have developed a lightweight utility that allows developers to more easily access information on Blueprint use direct from the IDE rather than having to load the full editor. If you find it useful, we'd love to hear about it!
Development: Davide Contini (Coconut Lizard)
Support: Will Hinds (Coconut Lizard), Ori Lazar (Coconut Lizard), Josef Gluyas (Coconut Lizard)
Header Image: Steve Dietz (Coconut Lizard)