Editor camera and Editor/Runtime scene update separation

This commit is contained in:
Simon Lübeß
2022-05-17 19:06:28 +02:00
parent ccea61fb79
commit 5d8a4ad3a7
10 changed files with 486 additions and 126 deletions
+1 -13
View File
@@ -11,7 +11,6 @@ namespace GlitchyEditor
class Editor
{
private Scene _scene;
private Entity _currentCamera;
private EntityHierarchyWindow _entityHierarchyWindow ~ delete _;
private ComponentEditWindow _componentEditWindow ~ delete _;
@@ -31,7 +30,7 @@ namespace GlitchyEditor
}
}
public Entity CurrentCamera => _currentCamera;
public EditorCamera* CurrentCamera { get; set; }
/// Creates a new editor for the given world
public this(Scene scene)
@@ -44,17 +43,6 @@ namespace GlitchyEditor
public void Update()
{
_currentCamera = _scene.ActiveCamera;
if (_currentCamera.IsValid)
{
var scriptComponent = _currentCamera.GetComponent<NativeScriptComponent>();
if (var camController = scriptComponent?.Instance as EditorCameraController)
{
camController.IsEnabled = (SceneViewportWindow.HasFocus && Input.IsMouseButtonPressed(.RightButton));
}
}
_entityHierarchyWindow.Show();
_componentEditWindow.Show();
_sceneViewportWindow.Show();