Custom editor for assets with a blueprint editor.

Hey all,

I’m trying to create some custom assets for my plugin. Fundamentally, I’d like to add another tab to the blueprint editor that displays a custom editor in order to simplify the interface, primarily to separate my custom C++ properties of that actor from all the properties of the base class, to make finding & editing them easier.

When building a custom asset based on UObject, adding a custom editor is fairly simple, just override OpenAssetEditor() in the relevant ...Actions.h file. However, doing so with anything deriving from AActor doesn’t result in any changes, and opening the asset launches a standard blueprint editor. The only difference I can see between creating an Object vs a Blueprint is the FactoryCreateNew() function in the relevant ...Factory.h file. When creating a Blueprint, I use FKismetEditorUtilities::CreateBlueprint whereas with objects I use NewObject<>.

I’m in the process of reading through Kismet2.cpp where CreateBlueprint() is located, but I was wondering if there’s an easy way to add tabs to the blueprint editor, or override it completely and build a new one from scratch.

Thank youuu! ^^

1 Like

Hi who-is_Ellie,

One way is to hook the HandleAssetOpenedInEditor and make any additions there:


#if ENGINE_MAJOR_VERSION<5 && ENGINE_MINOR_VERSION<24
	FDelegateHandle OnOpenAssetHandle=FAssetEditorManager::Get().OnAssetOpenedInEditor().AddRaw(this,&FrdBPTools::HandleAssetOpenedInEditor);
#else
	UAssetEditorSubsystem* assEdSubsystem=GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
	if(assEdSubsystem) {
		assEdSubsystem->OnAssetOpenedInEditor().AddRaw(this,&FrdBPTools::HandleAssetOpenedInEditor);
	}
#endif

void FrdBPTools::HandleAssetOpenedInEditor(UObject* Asset,IAssetEditorInstance* Editor) {

	auto blueprint=Cast<UBlueprint>(Asset);
	if(Editor->GetEditorName()!="BlueprintEditor" || !blueprint) {
		bpAsset=nullptr;
		return;
	}

    ...
}
1 Like