How to achieve different names and colors for custom asset types?

Hello there,
this question seems pretty specific to me (I haven’t found any answer yet), but I downloaded this useful plugin GitHub - jinyuliao/GenericGraph: Generic graph data structure plugin for ue4 and coded a dialogue system into it, which is perfectly working, BUT now I want to differentiate between the Generic Graph and my Dialogue Graph as you can see they appear quite similar (This can lead to confusion if they aren’t named correctly).

294721-screenshot-169.png

294720-screenshot-170.png

I am obviously quite new to plugin programming, but I haven’t found any good tutorial or wiki entry to begin with (They are either on how to start a plugin, but without functionality or they are outdated). I can’t of course tell you to download the plugin and help me out with it, so I’ll provide any bits of code which I think might be the reason for that I can’t change the color and name over all.

So: The “Generic Graph” is the super class of “Dialogue Session” and there is a “FAssetTypeActions_GenericGraph” which inherits from “FAssetTypeActions_Base”. In this class a “GetName()” function can be found which names the Objects Thumbnail, in this case “Graph332”. The Color is specified in the same class.

FText FAssetTypeActions_GenericGraph::GetName() const
{
	
	return LOCTEXT("FGenericGraphAssetTypeActionsName", "Graph332");
}

So obviously changing the value will change the appearence of both objects, but how can I change the color of only one? **I thought maybe I need to get the class of the object ** within the “GetName()” function (Whether it’s a “Dialogue Session” or “Generic Graph”) and just check it and return a different name and color, but I can’t find any way to check the class of the object I want to create. Then I thought, that I may need to create a “FAssetTypeActions_DialogueGraph” class (Do I need to create a new AssetTypeActions class for each new Factory?), I have tried this, but this was a bit buggy, the “FAssetTypeActions_GenericGraph” class gets registered in the “GenericGraphEditor” file in the “StartupModule()” method.

void FGenericGraphEditor::StartupModule()
{
	FGenericGraphEditorStyle::Initialize();

	GraphPanelNodeFactory_GenericGraph = MakeShareable(new FGraphPanelNodeFactory_GenericGraph());
	FEdGraphUtilities::RegisterVisualNodeFactory(GraphPanelNodeFactory_GenericGraph);

	IAssetTools& AssetTools = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools").Get();

	GenericGraphAssetCategoryBit = AssetTools.RegisterAdvancedAssetCategory(FName(TEXT("Graphs")), LOCTEXT("GenericGraphAssetCategory", "Graphs"));

	RegisterAssetTypeAction(AssetTools, MakeShareable(new FAssetTypeActions_GenericGraph(GenericGraphAssetCategoryBit)));
}

So I created a “FAssetTypeActions_DialogueGraph” class and registered it in there as well, but the color stayed the same for both objects (depending of what class was registered at the end).

I really don’t know if there is anyone reading this, who is familiar with creating custom assets and can help me out here, so I’ll try to contact the author of this plugin. (But I doubt that I’ll get a response, because he is probably too busy).
If there is anything unclear, please ask me about it (I know this seems quite overwhelming) and thanks for your effort reading this.

Yes, you need to register FAssetTypeActions for each asset class

I really don’t know why you registring just category, you should register action individually

in header file:

TSharedPtr<class FAssetTypeActions_GenericGraph> GenericGraphActions;
TSharedPtr<class FAssetTypeActions_DialogueGraph> DialogueGraphActions;

then in cpp on startup

	GenericGraphActions = MakeShareable(new FAssetTypeActions_GenericGraph);
	AssetTools.RegisterAssetTypeActions(GenericGraphActions.ToSharedRef());
	DialogueGraphActions = MakeShareable(new FAssetTypeActions_DialogueGraph);
	AssetTools.RegisterAssetTypeActions(DialogueGraphActions.ToSharedRef());

Remeber to unregister on ShutdownModule

AssetTools.UnregisterAssetTypeActions(GenericGraphActions.ToSharedRef());
AssetTools.UnregisterAssetTypeActions(DialogueGraphActions.ToSharedRef());

There can not deduce more from your code as you posted part that does not register the asset actions if you do that somewhere, also put header and cpp files of action classes

Also this is not just “plugin progrmaing” this code would run on project code too, all moduels are equile regardless if they are in enigne code, project or plugin, you can do same things anywhere, only diffrence is when you load that code.

Thank you very much for your detailed documentation is so great. I’ll try that out instantly. Do you know any good place to get started with plugin programming in UE4?

294732-screenshot-174.png

As you can see, this unfortunatly does not solve my problem. But I will add the code down below.
I can only provide the .cpp files themselves, because I don’t have enough characters left for a quote.

https://drive.google.com/open?id=1u3uyIXkNltATwr7IUctHfTDFX91Uv2l1

You assigning both asset actions to same asset class and UDialogueGraph being child class of UGenericGraph adapts latest updated settings of parent:

UClass* FAssetTypeActions_DialogueGraph::GetSupportedClass() const
{
	return UGenericGraph::StaticClass();
}

UClass* FAssetTypeActions_GenericGraph::GetSupportedClass() const
{
	return UGenericGraph::StaticClass();
}

Assing UDialogueGraph to FAssetTypeActions_DialogueGraph

Thank you so much! I can’t believe I have not seen this. You really saved my day!