Reading cooked blueprints in editor

Hi,

I am looking to read cooked content from my game to add support for a public editor. I only need the user to be able to make references to the cooked assets, with the ability to duplicate a few and edit such as Data Assets and being able to open a map and add additional tiles.

So far I have had some success in that I have got reading of most cooked assets and opening of cooked maps working. However I am struggling to get blueprints working I only need them to be place able on the map and don’t want to be able to edit the cooked blueprints.

Initially no blueprints were appearing in the content browser but most cooked blueprints used on a cooked map are loading into the level. This is when I discovered the cooked blueprints don’t contain an export for ‘UBlueprint’ but the ‘UBlueprintGeneratedClass’. From what I understand the ‘UBlueprint’ is normally used as the asset and as no exports in a cooked blueprints package are assets they do not show up in the content browser.

At the moment my solution is to treat the ‘BlueprintGeneratedClass’ export in a cooked blueprints as the asset, this somewhat works as all blueprints appear in the content browser and can be dragged onto the map which is the main goal. However, the editor seems to generate quite a few errors from this and some blueprints such as spines don’t work at all. All blueprint assets also appear as native C++ classes in the content browser which I would ideally like to change to a thumbnail of the asset.

I have been trying to solve this by creating a new ‘UBlueprint’ object and adding it to the package when loading cooked blueprints. However, doing this seems to be generating a blank blueprint. I am not sure what I need to do to the newly created blueprint asset to make it work with the generated class.

My current code for creating a ‘UBlueprint’ looks like this:

auto BlueprintFactory = NewObject<UBlueprintFactory>();
UObject* BlueprintObject = BlueprintFactory->FactoryCreateNew(
            UBlueprint::StaticClass(),
            Package,
            *Path[Path.Num() - 1],
            RF_Standalone | RF_Public,
            NULL,
            GWarn
            );

	UBlueprint* Blueprint = Cast<UBlueprint>(BlueprintObject);
	Blueprint->GeneratedClass = BlueprintGeneratedObject;
	Blueprint->Status = BS_UpToDate;
	Blueprint->bIsNewlyCreated = 0;
	Blueprint->bRecompileOnLoad = 0;
	Blueprint->SimpleConstructionScript = 
       NewObject<USimpleConstructionScript>(BlueprintGeneratedObject->SimpleConstructionScript);
	Blueprint->ComponentTemplates = 
       BlueprintGeneratedObject->ComponentTemplates;
	Blueprint->InheritableComponentHandler =        
        NewObject<UInheritableComponentHandler>(BlueprintGeneratedObject->InheritableComponentHandler);
	Blueprint->Timelines = BlueprintGeneratedObject->Timelines;

After running that, a blank blueprint with the correct filename is shown in the content browser, I’m not too familiar with blueprints so am wondering if it’s regenerating the ‘GeneratedClass’ when I drag it into the map causing it to create a blank ‘GeneratedClass’.

I’m not too sure what else to try so am wondering if anyone has any knowledge on making cooked blueprints work in the editor and what the best solution would be to make this work or also any information on how generated blueprints work with the ‘UBlueprint’ class.

I understand the editor isn’t designed to read cooked content at all so I’m not sure if it’ll even be possible to get it working in a better way.

Thank in advanced for any help and sorry this post is so long.

Will

All cooked assets are stripped from editor data in them, they contain only data needed in runtime, this includes blueprint source code (aka graph).

Considering in 99% cases if somebody tries to to open cooked assets that they don’t have source assets involves breaking EULA of original software, you most likely wont get much help here.

There is a plugin for supporting user generated content (UGC), they explain in this video:


It is aimed at making it possible for your game to be modded, but I wonder if maybe additional Levels work with this too.