Hi Alick,
About the engine modifications presented in the Unreal Fest talk, unfortunately most of them don’t seem to be publicly available. The studio that gave the talk does have a public GitHub, but the only related repository that can be found there includes just an actor for testing collision queries and some debug draw helper functions.
Going back to your original need, I don’t think I can help with exposing Collision Profile Names to the Reference Viewer, but I thought of some other approaches you can try. Let me go over them starting with some simple, but limited built-in features:
Property Matrix for Actors in a level
- Select all desired actors in the level editor
- Right-click, select “Bulk Editing -- Edit Components in the Property Matrix -- <ComponentName>”
- In the “Pinned Columns” tab, expand category “Collision” and pin property “Body Instance -- Collision Profile Name”
- In the main property matrix tab, sort components by the “Collision Profile Name” column
Note: Bulk-editing the collision profile name in the property matrix might not work as expected (UE-224076).
Property Matrix for Static Mesh Assets
- Select all desired StaticMesh assets in the content browser
- Right-click, select “Asset Actions -- Advanced -- Edit Selection in Property Matrix”
- In the “Pinned Columns” tab, expand category “StaticMesh” and pin property “Body Setup -- Default Instance -- Collision Profile Name”
- In the main property matrix tab, sort components by the “Collision Profile Name” column
Note: Bulk-editing the collision profile name in the property matrix might not work as expected (UE-224076).
Content Browser Filters for Static Mesh Assets
- Enter the desired root folder
- In the Search Bar, type “DefaultCollision:BlockAll” (without the quotes, with any collision profile name)
- The content browser should only show StaticMesh assets that pass this filter
---
Now, lets move on to some more powerful approaches that require some implementation.
Analyzing blueprint assets using the Subobject Data Subsystem
One idea is to implement an Asset Action Utility that lets you select some blueprint assets and, with a context-menu action, print the Collision Presets used by their primitive components (or, alternatively, print the names of the assets that use a given Collision Preset). This is illustrated here and in the image below:
[Image Removed]
Adding Collision Presets as Asset Registry Tags on Blueprint Assets
This is a very interesting approach, because once all blueprint assets have been re-saved, you will be able to filter them directly in the Content Browser by typing “CollisionPreset_BlockAllDynamic:Yes” or something similar in the search bar. For that, you need to implement the following method override on AActor itself (if you can edit the Engine source code) or on a subclass that all your blueprints derive from:
#if WITH_EDITOR
virtual void GetAssetRegistryTags(FAssetRegistryTagsContext Context) const override;
#endif
The implementation would be something similar to this:
#include "UObject/AssetRegistryTagsContext.h"
#include "Engine/SimpleConstructionScript.h"
#include "Engine/SCS_Node.h"
#if WITH_EDITOR
void MyActorBase::GetAssetRegistryTags (FAssetRegistryTagsContext Context) const
{
Super::GetAssetRegistryTags(Context);
// Process Components added in C++
TInlineComponentArray<TObjectPtr<UPrimitiveComponent>> PrimitiveComponents;
GetComponents<UPrimitiveComponent>(PrimitiveComponents);
for (const auto& PrimitiveComponent : PrimitiveComponents)
{
FName CollisionProfileName = PrimitiveComponent->GetCollisionProfileName();
Context.AddTag(FAssetRegistryTag(
FName(*FString::Printf(TEXT("CollisionPreset_%s"), *CollisionProfileName.ToString())),
TEXT("Yes"),
FAssetRegistryTag::TT_Alphabetical
));
}
// Process Components added in BP
if (const UBlueprintGeneratedClass* BGClass = Cast<UBlueprintGeneratedClass>(GetClass()))
{
if (const USimpleConstructionScript* SCS = BGClass->SimpleConstructionScript)
{
for (const USCS_Node* Node : SCS->GetAllNodes())
{
if (Node && Node->ComponentClass && Node->ComponentClass->IsChildOf(UPrimitiveComponent::StaticClass()))
{
UPrimitiveComponent* PrimitiveComponent = Cast<UPrimitiveComponent>(Node->ComponentTemplate);
FName CollisionProfileName = PrimitiveComponent->GetCollisionProfileName();
Context.AddTag(FAssetRegistryTag(
FName(*FString::Printf(TEXT("CollisionPreset_%s"), *CollisionProfileName.ToString())),
TEXT("Yes"),
FAssetRegistryTag::TT_Alphabetical
));
}
}
}
}
}
#endif
Alternatively, you can also get this Content Browser filtering capability by using Asset Metadata. I tested this by changing the Asset Action Utility above to call function EditorAssetLibrary.SetMetadataTag() on the selected blueprint assets. To enable Content Browser filtering, you must also go to Project Settings, on page “Game -- Asset Manager”, and add your metadata tags to “Asset Registry -- Metadata Tags For Asset Registry”.
Some notes:
- the approaches above assume you are concerned with Blueprint assets only. If you need to analyze actor classes defined in C++, you’ll probably need to use TObjectIterator<UClass> in C++ to iterate over all existing classes and work with their CDO (ClassDefaultObject).
- If you need to list all profile names in your project for a utility, you need to use C++, but you can expose a small helper function to BP:
void MyBPFunctionLibrary::GetCollisionProfileNames (TArray<FName>& OutProfileNames)
{
UCollisionProfile* CollisionProfile = UCollisionProfile::Get();
if (!CollisionProfile)
return;
TArray<TSharedPtr<FName>> ProfileNames;
CollisionProfile->GetProfileNames(ProfileNames);
for (const TSharedPtr<FName>& NamePtr : ProfileNames)
OutProfileNames.Add(*NamePtr);
}
I hope this is helpful. Please let me know if one of the solutions above works for you, and feel free to ask if you have any further questions. Also, if you prefer to try the Reference Viewer approach, I can try to escalate this ticket to the engine devs to see if they can offer some more insight.
Best regards,
Vitor
[Attachment Removed]