mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Mouse picking
This commit is contained in:
@@ -23,8 +23,9 @@ namespace GlitchyEditor.EditWindows
|
||||
|
||||
public List<Entity> SelectedEntities => _selectedEntities;
|
||||
|
||||
public this(Scene scene)
|
||||
public this(Editor editor, Scene scene)
|
||||
{
|
||||
_editor = editor;
|
||||
SetContext(scene);
|
||||
}
|
||||
|
||||
@@ -61,6 +62,23 @@ namespace GlitchyEditor.EditWindows
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
if (_editor.SceneViewportWindow.SelectionChanged)
|
||||
{
|
||||
if (Input.IsKeyReleased(.Control))
|
||||
{
|
||||
_selectedEntities.Clear();
|
||||
}
|
||||
|
||||
var handle = _scene.[Friend]_ecsWorld.GetCurrentVersion(EcsEntity.[Friend]CreateEntityID(_editor.SceneViewportWindow.SelectedEntityId, 0));
|
||||
|
||||
if (handle case .Ok(let h))
|
||||
{
|
||||
Entity e = .(h, _scene);
|
||||
|
||||
_selectedEntities.Add(e);
|
||||
}
|
||||
}
|
||||
|
||||
ShowEntityHierarchy();
|
||||
|
||||
if ((ImGui.IsMouseDown(.Left) || ImGui.IsMouseDown(.Right)) && !ImGui.IsAnyItemHovered() && !ImGui.GetIO().KeyCtrl && ImGui.IsWindowHovered(.AllowWhenBlockedByPopup))
|
||||
@@ -113,6 +131,8 @@ namespace GlitchyEditor.EditWindows
|
||||
{
|
||||
_scene.DestroyEntity(entity, true);
|
||||
}
|
||||
|
||||
_selectedEntities.Clear();
|
||||
}
|
||||
|
||||
private void ShowEntityHierarchyMenuBar()
|
||||
|
||||
Reference in New Issue
Block a user