mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Drag drop Texture
This commit is contained in:
@@ -299,7 +299,28 @@ namespace GlitchyEditor.EditWindows
|
|||||||
|
|
||||||
for (let texture in effect.Textures)
|
for (let texture in effect.Textures)
|
||||||
{
|
{
|
||||||
ImGui.Text(texture.key);
|
//ImGui.Text(texture.key);
|
||||||
|
ImGui.Button(texture.key);
|
||||||
|
|
||||||
|
if (ImGui.BeginDragDropTarget())
|
||||||
|
{
|
||||||
|
ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM");
|
||||||
|
|
||||||
|
if (payload != null)
|
||||||
|
{
|
||||||
|
Log.EngineLogger.Warning("");
|
||||||
|
|
||||||
|
StringView path = .((char8*)payload.Data, (int)payload.DataSize);
|
||||||
|
|
||||||
|
using (Texture2D newTexture = new Texture2D(path, true))
|
||||||
|
{
|
||||||
|
newTexture.SamplerState = SamplerStateManager.AnisotropicWrap;
|
||||||
|
material.SetTexture(texture.key, newTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndDragDropTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let (name, arguments) in effect.[Friend]_variableDescriptions)
|
for (let (name, arguments) in effect.[Friend]_variableDescriptions)
|
||||||
|
|||||||
@@ -243,6 +243,10 @@ namespace GlitchyEditor.EditWindows
|
|||||||
{
|
{
|
||||||
String fullpath = scope $"{_currentDirectory}{Path.DirectorySeparatorChar}{entry.Name}";
|
String fullpath = scope $"{_currentDirectory}{Path.DirectorySeparatorChar}{entry.Name}";
|
||||||
|
|
||||||
|
// TODO: this is dirty
|
||||||
|
if (fullpath.StartsWith(ContentDirectory, .OrdinalIgnoreCase))
|
||||||
|
fullpath.Remove(0, ContentDirectory.Length);
|
||||||
|
|
||||||
ImGui.SetDragDropPayload("CONTENT_BROWSER_ITEM", fullpath.CStr(), (.)fullpath.Length, .Once);
|
ImGui.SetDragDropPayload("CONTENT_BROWSER_ITEM", fullpath.CStr(), (.)fullpath.Length, .Once);
|
||||||
|
|
||||||
ImGui.EndDragDropSource();
|
ImGui.EndDragDropSource();
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ namespace GlitchyEngine.Content
|
|||||||
String fullpath = scope .(_contentRoot.Length + 1 + filename.Length);
|
String fullpath = scope .(_contentRoot.Length + 1 + filename.Length);
|
||||||
GetFilePath(fullpath, filename);
|
GetFilePath(fullpath, filename);
|
||||||
|
|
||||||
|
Log.EngineLogger.AssertDebug(File.Exists(fullpath), "File doesn't exist!");
|
||||||
|
|
||||||
FileStream stream = new FileStream();
|
FileStream stream = new FileStream();
|
||||||
var result = stream.Open(fullpath, .Read, .Read);
|
var result = stream.Open(fullpath, .Read, .Read);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user