How to create a slate widget for a UProperty of a UClass without the object instance

I have the need to make a slate widget for a graph that allows me to see the UProperties of a UClass and to place a value for said UProperty.

I can’t use the PropertyEditor since it seems to need the instance of the object, and I don’t have that. I only have an UClass (Specifically a sub class, using TSubclassOf) and I can’t make instances of it for various reasons.

I think I found in the blueprint structure editor an example of what I need (the default values table) but I couldn’t understand how to replicate that.

1 Like

You are aware that you need to hold those variables somewhere in memory? And easiest way to do so is by making UObject of that class? There no way around it, either use UObject or reconstruct it’s structure with UProperty data you have by different means (like array?). Blueprint editor probably editing Class Default Object (CDO) which holds default varables of class

But i would double check it in engine source code since just editing CDO might not only thing you need to do

1 Like

The thing is that I plan to create instances on the assets. Let me explain.
I have an EdGraph for a custom asset, which is also a graph, and each EdNode represent a node in my asset graph.

If I create my asset nodes when I create the EdNodes I have the problem that when I copy/cut/paste/duplicate I don’t know how to track the pairs (asset node, EdNode) and their informations to keep my asset graph consistent with the EdGraph.

So I thought to create my asset graph only when I save the EdGraph in my custom editor. So I didn’t need to keep track of every single change between savings.
I thought about destroying the asset and creating a new one for every single change made in the EdGraph, but that sounds stupid and I want to avoid that.

Your comment made me realize that I still don’t know if the slate widgets will save the value internally our if they just take it from the objects. In the latter case I guess that I will just have to create and keep track of the asset node at all time…

Looking into the code I found out that you are supposed to use class FEdGraphUtilities to export the nodes into a text format and FPlatformApplicationMisc to save it into the clipboard.

That made way easier to copy and paste the EdNodes with an instance of the asset.