Allow dragging and dropping of Entities in editor

+ New Dictionary Helpers
+ Made ImGui Payloads safer
+ Start of Component drag'n'drop
This commit is contained in:
Simon Lübeß
2023-07-24 23:17:00 +02:00
parent b53ed2d8f2
commit 37197cbdf1
19 changed files with 500 additions and 183 deletions
@@ -25,36 +25,36 @@ namespace Sandbox
class MyTestEntity : Entity
{
//[ShowInEditor]
[ShowInEditor]
RigidBody2D _rigidBody;
public bool Bo;
//public bool Bo;
public byte By;
public ushort Us;
public uint Ui;
public ulong Ul;
//public byte By;
//public ushort Us;
//public uint Ui;
//public ulong Ul;
public sbyte Sb;
public short Sh;
public int In;
public long Lo;
//public sbyte Sb;
//public short Sh;
//public int In;
//public long Lo;
public float Fl;
public double Do;
public float2 V2;
public float3 V3;
public float4 V4;
//public float Fl;
//public double Do;
//public float2 V2;
//public float3 V3;
//public float4 V4;
public Entity TheEntity;
public float JumpForce = 2000;
[ShowInEditor] float MoveForce = 1000;
[ShowInEditor] private int MyNumber = 1337;
[ShowInEditor] public double MyDouble = 1000.0f;
public MyStruct AStruct;
//[ShowInEditor] public double MyDouble = 1000.0f;
//public MyStruct AStruct;
public Camera Camera;
/// <summary>
@@ -67,12 +67,16 @@ namespace Sandbox
Log.Info($"Jump Force: {JumpForce}");
_rigidBody ??= GetComponent<RigidBody2D>() ?? AddComponent<RigidBody2D>();
Camera = FindEntityWithName("Camera").As<Camera>();
if (Camera == null)
{
Log.Error("Camera not found.");
Log.Warning("Camera wasn't set in editor. Searching...");
Camera = FindEntityWithName("Camera").As<Camera>();
if (Camera == null)
{
Log.Error("Camera not found.");
}
}
}
@@ -99,7 +103,7 @@ namespace Sandbox
if (Input.IsKeyPressed(Key.E))
Camera.DistanceFromPlayer += deltaTime;
if (Input.IsKeyPressing(Key.Space))
{
force.Y += JumpForce;
+22 -47
View File
@@ -71,8 +71,8 @@
SpriteRendererComponent = {
Color = {
R = 1,
G = 0.941886961,
B = 0.401484549,
G = 0.941887021,
B = 0.401484519,
A = 1
},
Sprite = "",
@@ -162,7 +162,7 @@
OrthographicHeight = 10,
OrthographicNearPlane = 0,
OrthographicFarPlane = 10,
AspectRatio = 0.884925187,
AspectRatio = 1.17151165,
FixedAspectRatio = false
},
ScriptComponent = {
@@ -195,8 +195,8 @@
},
TransformComponent = {
Position = {
X = -0.121203184,
Y = 0.660160959,
X = -0.121203199,
Y = 0.660161018,
Z = 0
},
Rotation = {
@@ -234,37 +234,12 @@
ScriptComponent = {
ScriptClass = "Sandbox.MyTestEntity",
Fields = [
Bo = (Bool)false,
By = (Byte)0,
Us = (UShort)57,
Ui = (UInt)54,
Ul = (ULong)53,
Sb = (SByte)-128,
Sh = (Short)95,
In = (Int)-149,
Lo = (Long)82,
Fl = (Float)-98.122963,
Do = (Double)118,
V2 = (float2){
X = 11,
Y = 12
},
V3 = (float3){
X = 13,
Y = 14,
Z = 15
},
V4 = (float4){
X = 14,
Y = 17,
Z = 18,
W = 19
},
_rigidBody = (Component)0,
TheEntity = (Entity)0,
JumpForce = (Float)200,
MoveForce = (Float)148,
MyNumber = (Int)22,
MyDouble = (Double)23
Camera = (Entity)1491484622542812645
] }
},
{
@@ -301,7 +276,7 @@
Color = {
R = 0.985467017,
G = 1,
B = 0.569978058
B = 0.569977999
}
}
},
@@ -348,8 +323,8 @@
SpriteRendererComponent = {
Color = {
R = 0.425658971,
G = 0.855207562,
B = 0.0558161102,
G = 0.855207503,
B = 0.0558161139,
A = 1
},
Sprite = "",
@@ -363,14 +338,14 @@
TransformComponent = {
Position = {
X = 6.74610233,
Y = -2.03225899,
Y = -2.03225923,
Z = 0
},
Rotation = {
X = 0,
Y = 0,
Z = -0.331792623,
W = 0.943352342
W = 0.943352461
},
Scale = {
X = 5.29557419,
@@ -409,7 +384,7 @@
},
SpriteRendererComponent = {
Color = {
R = 0.666116953,
R = 0.666117013,
G = 0.0600316115,
B = 1,
A = 1
@@ -424,8 +399,8 @@
},
TransformComponent = {
Position = {
X = 15.2321301,
Y = -1.98709249,
X = 15.2321291,
Y = -1.98709261,
Z = 0
},
Rotation = {
@@ -435,7 +410,7 @@
W = 0.990847468
},
Scale = {
X = 13.9764566,
X = 13.9764547,
Y = 1,
Z = 1
},
@@ -471,7 +446,7 @@
},
SpriteRendererComponent = {
Color = {
R = 0.176544324,
R = 0.176544309,
G = 0.666713238,
B = 0.687030852,
A = 1
@@ -487,24 +462,24 @@
TransformComponent = {
Position = {
X = -6.27842855,
Y = 2.62550211,
Y = 2.62550187,
Z = 0
},
Rotation = {
X = 0,
Y = 0,
Z = 0.187087834,
Z = 0.187087849,
W = 0.982343197
},
Scale = {
X = 0.999999523,
X = 0.999999464,
Y = 6.49634314,
Z = 1
},
EditorEulerRotation = {
X = 0,
Y = 0,
Z = 0.376393586
Z = 0.376393616
}
},
Rigidbody2D = {
@@ -522,7 +497,7 @@
},
Density = 1,
Friction = 0.5,
Restitution = 0.899999976,
Restitution = 0.899999917,
RestitutionThreshold = 0.5
}
}
@@ -9,12 +9,21 @@
".NETStandard,Version=v2.0/": {
"ScriptCore/1.0.0": {
"dependencies": {
"Half": "1.0.0",
"NETStandard.Library": "2.0.3"
},
"runtime": {
"ScriptCore.dll": {}
}
},
"Half/1.0.0": {
"runtime": {
"lib/netstandard2.0/System.Half.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
"NETStandard.Library/2.0.3": {
"dependencies": {
@@ -29,6 +38,13 @@
"serviceable": false,
"sha512": ""
},
"Half/1.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-EPLLPQA1UjF9QM3ymNhWLhgcnBNc8e1po4qWRWTD3Hd9xiohYlkCob0QjDIbJs6Nvfd4eAbsjxIwRyh7httyXA==",
"path": "half/1.0.0",
"hashPath": "half.1.0.0.nupkg.sha512"
},
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
@@ -33,7 +33,7 @@ class MaterialAssetPropertiesEditor : AssetPropertiesEditor
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.ContentBrowserItem);
if (payload != null)
{
@@ -78,7 +78,7 @@ class MaterialAssetPropertiesEditor : AssetPropertiesEditor
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.ContentBrowserItem);
if (payload != null)
{
@@ -7,6 +7,8 @@ using GlitchyEngine.Renderer;
using GlitchyEngine;
using GlitchyEngine.Content;
using GlitchyEngine.Scripting;
using GlitchyEngine.Core;
using Mono;
namespace GlitchyEditor.EditWindows
{
@@ -278,7 +280,7 @@ namespace GlitchyEditor.EditWindows
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.ContentBrowserItem);
if (payload != null)
{
@@ -306,7 +308,7 @@ namespace GlitchyEditor.EditWindows
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.ContentBrowserItem);
if (payload != null)
{
@@ -338,7 +340,7 @@ namespace GlitchyEditor.EditWindows
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.ContentBrowserItem);
if (payload != null)
{
@@ -601,94 +603,94 @@ namespace GlitchyEditor.EditWindows
{
let scriptFields = ScriptEngine.GetScriptFieldMap(entity);
for (var (name, field) in ref scriptFields)
for (var (fieldName, field) in ref scriptFields)
{
switch (field.Type)
{
case .Bool:
var value = field.GetData<bool>();
if (ImGui.Checkbox(name.CStr(), &value))
if (ImGui.Checkbox(fieldName.CStr(), &value))
field.SetData(value);
case .SByte:
var value = field.GetData<int8>();
if (ImGui.DragScalar(name.CStr(), .S8, &value))
if (ImGui.DragScalar(fieldName.CStr(), .S8, &value))
field.SetData(value);
case .Short:
var value = field.GetData<int16>();
if (ImGui.DragScalar(fieldName.CStr(), .S16, &value))
field.SetData(value);
case .Short:
var value = field.GetData<int16>();
if (ImGui.DragScalar(name.CStr(), .S16, &value))
field.SetData(value);
case .Int:
var value = field.GetData<int32>();
if (ImGui.DragScalar(name.CStr(), .S32, &value))
field.SetData(value);
var value = field.GetData<int32>();
if (ImGui.DragScalar(fieldName.CStr(), .S32, &value))
field.SetData(value);
case .Int2:
var value = field.GetData<int2>();
if (ImGui.DragScalarN(name.CStr(), .S32, &value, 2))
field.SetData(value);
var value = field.GetData<int2>();
if (ImGui.DragScalarN(fieldName.CStr(), .S32, &value, 2))
field.SetData(value);
case .Int3:
var value = field.GetData<int3>();
if (ImGui.DragScalarN(name.CStr(), .S32, &value, 3))
field.SetData(value);
var value = field.GetData<int3>();
if (ImGui.DragScalarN(fieldName.CStr(), .S32, &value, 3))
field.SetData(value);
case .Int4:
var value = field.GetData<int4>();
if (ImGui.DragScalarN(name.CStr(), .S32, &value, 4))
field.SetData(value);
var value = field.GetData<int4>();
if (ImGui.DragScalarN(fieldName.CStr(), .S32, &value, 4))
field.SetData(value);
case .Long:
var value = field.GetData<int64>();
if (ImGui.DragScalar(name.CStr(), .S64, &value))
field.SetData(value);
var value = field.GetData<int64>();
if (ImGui.DragScalar(fieldName.CStr(), .S64, &value))
field.SetData(value);
case .Byte:
var value = field.GetData<uint8>();
if (ImGui.DragScalar(name.CStr(), .U8, &value))
field.SetData(value);
var value = field.GetData<uint8>();
if (ImGui.DragScalar(fieldName.CStr(), .U8, &value))
field.SetData(value);
case .UShort:
var value = field.GetData<uint16>();
if (ImGui.DragScalar(name.CStr(), .U16, &value))
field.SetData(value);
var value = field.GetData<uint16>();
if (ImGui.DragScalar(fieldName.CStr(), .U16, &value))
field.SetData(value);
case .UInt:
var value = field.GetData<uint32>();
if (ImGui.DragScalar(name.CStr(), .U32, &value))
field.SetData(value);
var value = field.GetData<uint32>();
if (ImGui.DragScalar(fieldName.CStr(), .U32, &value))
field.SetData(value);
case .ULong:
var value = field.GetData<uint64>();
if (ImGui.DragScalar(name.CStr(), .U64, &value))
field.SetData(value);
var value = field.GetData<uint64>();
if (ImGui.DragScalar(fieldName.CStr(), .U64, &value))
field.SetData(value);
case .Float:
var value = field.GetData<float>();
if (ImGui.DragScalar(name.CStr(), .Float, &value))
field.SetData(value);
var value = field.GetData<float>();
if (ImGui.DragScalar(fieldName.CStr(), .Float, &value))
field.SetData(value);
case .float2:
var value = field.GetData<float2>();
if (ImGui.Editfloat2(name, ref value))
field.SetData(value);
var value = field.GetData<float2>();
if (ImGui.Editfloat2(fieldName, ref value))
field.SetData(value);
case .float3:
var value = field.GetData<float3>();
if (ImGui.Editfloat3(name, ref value))
field.SetData(value);
var value = field.GetData<float3>();
if (ImGui.Editfloat3(fieldName, ref value))
field.SetData(value);
case .float4:
var value = field.GetData<float4>();
if (ImGui.Editfloat4(name, ref value))
field.SetData(value);
var value = field.GetData<float4>();
if (ImGui.Editfloat4(fieldName, ref value))
field.SetData(value);
case .Double:
var value = field.GetData<double>();
if (ImGui.DragScalar(name.CStr(), .Double, &value))
field.SetData(value);
var value = field.GetData<double>();
if (ImGui.DragScalar(fieldName.CStr(), .Double, &value))
field.SetData(value);
case .Double2:
var value = field.GetData<double2>();
if (ImGui.DragScalarN(name.CStr(), .Double, &value, 2))
field.SetData(value);
var value = field.GetData<double2>();
if (ImGui.DragScalarN(fieldName.CStr(), .Double, &value, 2))
field.SetData(value);
case .Double3:
var value = field.GetData<double3>();
if (ImGui.DragScalarN(name.CStr(), .Double, &value, 3))
field.SetData(value);
var value = field.GetData<double3>();
if (ImGui.DragScalarN(fieldName.CStr(), .Double, &value, 3))
field.SetData(value);
case .Double4:
var value = field.GetData<double4>();
if (ImGui.DragScalarN(name.CStr(), .Double, &value, 4))
field.SetData(value);
var value = field.GetData<double4>();
if (ImGui.DragScalarN(fieldName.CStr(), .Double, &value, 4))
field.SetData(value);
case .Enum:
// TODO!
@@ -697,11 +699,16 @@ namespace GlitchyEditor.EditWindows
// TODO!
case .Entity:
// TODO!
ShowEntityReceiver(field, fieldName, scriptClass);
case .Component:
ShowComponentReceiver(field, fieldName, scriptClass);
case .Struct:
// TODO!
case .Class:
// We don't support editing classes
default:
Log.EngineLogger.Error($"Unhandled field type {field.Type}");
}
@@ -709,6 +716,133 @@ namespace GlitchyEditor.EditWindows
}
}
private static void ShowEntityReceiver(ScriptFieldInstance* field, StringView fieldName, ScriptClass scriptClass)
{
var entityId = field.GetData<UUID>();
Result<Entity> fieldEntity = Editor.Instance.CurrentScene.GetEntityByID(entityId);
String entityName = scope .(32);
if (fieldEntity case .Ok(Entity e))
entityName.Set(e.Name);
else
entityName..Clear().AppendF($"Missing entity ({entityId})");
ImGui.Text($"{fieldName}: ");
ImGui.SameLine();
if (ImGui.Button(entityName))
{
// TODO: Show a selector or something
}
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* peekPayload = ImGui.AcceptDragDropPayload(.Entity, .AcceptPeekOnly);
bool allowDrop = false;
if (peekPayload != null)
{
Entity draggedEntity = *(Entity*)peekPayload.Data;
ScriptClass draggedScriptClass = ScriptEngine.[Friend]s_EntityRoot;
if (draggedEntity.TryGetComponent<ScriptComponent>(let draggedScript))
{
var draggedClassName = draggedScript.ScriptClassName;
draggedScriptClass = ScriptEngine.GetScriptClass(draggedClassName);
}
// TODO: I don't like the fact, that we are using mono directly
ScriptField scriptField = scriptClass.Fields[fieldName];
var fieldMonoClass = Mono.mono_type_get_class(scriptField.GetMonoType());
allowDrop = draggedScriptClass.[Friend]IsSubclass(fieldMonoClass);
}
if (allowDrop)
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.Entity);
if (payload != null)
{
Log.EngineLogger.AssertDebug(payload.DataSize == sizeof(Entity));
Entity droppedEntity = *(Entity*)payload.Data;
if (droppedEntity.IsValid)
field.SetData<UUID>(droppedEntity.UUID);
}
}
ImGui.EndDragDropTarget();
}
}
private static void ShowComponentReceiver(ScriptFieldInstance* field, StringView fieldName, ScriptClass scriptClass)
{
var entityId = field.GetData<UUID>();
Result<Entity> fieldEntity = Editor.Instance.CurrentScene.GetEntityByID(entityId);
String entityName = scope .(32);
if (fieldEntity case .Ok(Entity e))
entityName.Set(e.Name);
else
entityName..Clear().AppendF($"Missing reference ({entityId})");
ImGui.Text($"{fieldName}: ");
ImGui.SameLine();
if (ImGui.Button(entityName))
{
// TODO: Show a selector or something
}
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* peekPayload = ImGui.AcceptDragDropPayload(.Entity, .AcceptPeekOnly);
bool allowDrop = false;
if (peekPayload != null)
{
Entity draggedEntity = *(Entity*)peekPayload.Data;
// TODO: I don't like the fact, that we are using mono directly
ScriptField scriptField = scriptClass.Fields[fieldName];
MonoReflectionType* reflectionType = Mono.mono_type_get_object(ScriptEngine.[Friend]s_AppDomain, scriptField.GetMonoType());
// TODO: We shouldn't abuse the script glue like that...
// ScriptGlue should only be called by C#, not by Beef...
allowDrop = ScriptGlue.[Friend]Entity_HasComponent(draggedEntity.UUID, reflectionType);
}
if (allowDrop)
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.Entity);
if (payload != null)
{
Log.EngineLogger.AssertDebug(payload.DataSize == sizeof(Entity));
Entity droppedEntity = *(Entity*)payload.Data;
if (droppedEntity.IsValid)
field.SetData<UUID>(droppedEntity.UUID);
}
}
ImGui.EndDragDropTarget();
}
}
private static void LabelColumn(StringView label)
{
ImGui.TextUnformatted(label);
@@ -773,7 +907,7 @@ namespace GlitchyEditor.EditWindows
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.ContentBrowserItem);
if (payload != null)
{
@@ -324,7 +324,7 @@ namespace GlitchyEditor.EditWindows
Path.Fixup(fullpath);
ImGui.SetDragDropPayload("CONTENT_BROWSER_ITEM", fullpath.CStr(), (.)fullpath.Length, .Once);
ImGui.SetDragDropPayload(.ContentBrowserItem, fullpath.CStr(), (.)fullpath.Length, .Once);
ImGui.EndDragDropSource();
}
@@ -370,7 +370,7 @@ namespace GlitchyEditor.EditWindows
String fullpath = scope String(entry->Path);
fullpath.AppendF($"#{subAsset.Name}");
ImGui.SetDragDropPayload("CONTENT_BROWSER_ITEM", fullpath.CStr(), (.)fullpath.Length, .Once);
ImGui.SetDragDropPayload(.ContentBrowserItem, fullpath.CStr(), (.)fullpath.Length, .Once);
ImGui.EndDragDropSource();
}
@@ -137,7 +137,7 @@ namespace GlitchyEditor.EditWindows
{
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.ContentBrowserItem);
if (payload != null)
{
@@ -341,9 +341,13 @@ namespace GlitchyEditor.EditWindows
if (deleted)
return;
bool isDragged = false;
if(ImGui.BeginDragDropSource())
{
ImGui.SetDragDropPayload("DND_Entity", &tree.Value, sizeof(Entity));
isDragged = true;
ImGui.SetDragDropPayload(.Entity, &tree.Value, sizeof(Entity));
ImGui.Text(name);
@@ -352,7 +356,7 @@ namespace GlitchyEditor.EditWindows
if(ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("DND_Entity");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.Entity);
if(payload != null)
{
@@ -395,7 +399,7 @@ namespace GlitchyEditor.EditWindows
bool clicked = ImGui.IsItemClicked(.Left);
bool clickedRight = ImGui.IsItemClicked(.Right);
if(isOpen)
{
for(var child in tree.Children)
@@ -407,6 +411,12 @@ namespace GlitchyEditor.EditWindows
}
if (clicked || clickedRight)
{
lastClickedEntity = tree.Value;
}
//if (!isDragged && (clicked || clickedRight))
if (!isDragged && (!ImGui.IsMouseDown(.Left) && !ImGui.IsMouseDown(.Right) && ImGui.IsItemHovered()) && tree.Value == lastClickedEntity)
{
if (inSelectedList && !clickedRight)
{
@@ -418,9 +428,13 @@ namespace GlitchyEditor.EditWindows
SelectEntity(tree.Value, !ImGui.GetIO().KeyCtrl && !clickedRight);
inSelectedList = true;
}
lastClickedEntity = .();
}
}
private static Entity lastClickedEntity;
private void ShowEntityHierarchy()
{
StringView searchString = StringView(&_entitySearchChars);
@@ -464,7 +478,7 @@ namespace GlitchyEditor.EditWindows
{
if(ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("DND_Entity");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.Entity);
if(payload != null)
{
@@ -527,6 +541,10 @@ namespace GlitchyEditor.EditWindows
ImGuiPrintEntityTree(scope .(entity));
}
}
// If the mouse was released and no entity took the chance to become selected we probably hovered the background while releasing -> select no entity
if (!ImGui.IsMouseDown(.Left) && !ImGui.IsMouseDown(.Right))
lastClickedEntity = .();
}
}
}
@@ -91,7 +91,7 @@ namespace GlitchyEditor.EditWindows
{
if (ImGui.BeginDragDropTarget())
{
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM");
ImGui.Payload* payload = ImGui.AcceptDragDropPayload(.ContentBrowserItem);
if (payload != null)
{
+7
View File
@@ -53,9 +53,16 @@ namespace GlitchyEditor
public SceneRenderer GameSceneRenderer {get; set;}
public SceneRenderer EditorSceneRenderer {get; set;}
private static Editor s_Instance;
public static Editor Instance => s_Instance;
/// Creates a new editor for the given world
public this(Scene scene, EditorContentManager contentManager)
{
Log.EngineLogger.AssertDebug(s_Instance == null, "Cannot create a second instance of a singleton.");
s_Instance = this;
_scene = scene;
_contentManager = contentManager;
+33
View File
@@ -0,0 +1,33 @@
using System;
namespace ImGui;
enum DragDropPayloadType
{
case ContentBrowserItem;
case Entity;
public String GetName()
{
switch (this)
{
case .ContentBrowserItem:
return "CONTENT_BROWSER_ITEM";
case .Entity:
return "ENTITY";
}
}
}
extension ImGui
{
public static Payload* AcceptDragDropPayload(DragDropPayloadType type, DragDropFlags flags = .None)
{
return AcceptDragDropPayload(type.GetName(), flags);
}
public static bool SetDragDropPayload(DragDropPayloadType type, void* data, size sz, Cond cond = .None)
{
return SetDragDropPayload(type.GetName(), data, sz, cond);
}
}