# Content Browser

> ## Credits:
>
> * Thanks to mklabs for his [GAS Companion](https://www.fab.com/listings/72e2bc50-658e-43cd-bd40-535f46d2f113) plugin, his content browser extension code is the original reason I pursued this system. Although no GAS Companion code is used in this plugin.
> * Some of the code is borrowed from the open-source [VoxelCore](https://github.com/VoxelPlugin/VoxelCore) plugin.

`OmniToolbox` allows any C++ class to be easily added to the content browser's context menu by simply adding the `I_AssetDetails` interface and returning true for `AppearsInContextMenu`.

<figure><img src="https://3180859593-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHaVAFyKjs3d16ljfQ2o0%2Fuploads%2FjvRVYer2oNevkLNu5RYm%2Fimage.png?alt=media&#x26;token=46e23a2f-5dc0-4567-92e9-f052808f733a" alt=""><figcaption></figcaption></figure>

Your asset will now automatically get a `UOmniAssetDefinition` and `UOmniFactory` to handle displaying it in the context menu and to create the asset.

{% hint style="info" %}
This only supports basic assets (data assets and normal blueprint types)
{% endhint %}

The interface provides some utilities, such as enabling a class picker

<figure><img src="https://3180859593-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHaVAFyKjs3d16ljfQ2o0%2Fuploads%2FzwlCXbqt97chKDhP4m3J%2Fimage.png?alt=media&#x26;token=4992c7d9-98f2-462b-9b44-e5f33cad6825" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3180859593-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHaVAFyKjs3d16ljfQ2o0%2Fuploads%2FXGHShrX6kz3DyC64avGm%2Fimage.png?alt=media&#x26;token=8963ccca-4311-48ee-b868-2d67184f0e4d" alt=""><figcaption></figcaption></figure>

When overriding `AppearsInContextMenu`, I recommend doing it like this:

```cpp
virtual bool AppearsInContextMenu_Implementation() const override
{
    return GetClass() == UEntityAbility::StaticClass();
}
```

Handling it like this will prevent child classes from also attempting to appear in the context menu.

## Blueprint support

{% hint style="danger" %}
I do NOT recommend using this system for blueprints. It's not good practice to have your base abstract classes be blueprints and there are many potential issues that can occur when loading blueprints like this.
{% endhint %}

To allow blueprints to appear in the content browsers context menu, a little bit more work is required:

1. Go to your editor settings and find `OmniToolbox` and add your blueprint to `Context Menu Entries`
   1. &#x20;The blueprint must implement `I_AssetDetails` to appear
2. Restart the editor.
   1. The code that handles this system is only executed once and that is when the plugin is started.
