NrxDebugVisualizer shows objects.
TODO: Update SceneTreeView after adding new objects
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using NrxDebugVisualizer.ViewModels;
|
||||
using Num.Roto.Visualization.Types;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
namespace NrxDebugVisualizer.Views;
|
||||
|
||||
@@ -6,6 +12,29 @@ public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
InitializeComponent();
|
||||
|
||||
Closing += OnClosing;
|
||||
|
||||
}
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(e);
|
||||
if (DataContext is not MainWindowViewModel viewModel) throw new DataException("wrong viewModel type!");
|
||||
if (App.Settings?.CameraFrame is not { } cameraFrame) return;
|
||||
var scene = viewModel.ProportionalDockControlViewModel.Scene;
|
||||
var camera = scene?.SelectedCamera;
|
||||
camera?.Frame = cameraFrame;
|
||||
viewModel.ViewPosition = CameraView.Position.User;
|
||||
}
|
||||
private async void OnClosing(object? sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (DataContext is not MainWindowViewModel viewModel) throw new DataException("wrong viewModel type!");
|
||||
var scene = viewModel.ProportionalDockControlViewModel.Scene;
|
||||
var camera = scene?.SelectedCamera;
|
||||
App.Settings?.MainWindow = this;
|
||||
App.Settings?.CameraFrame = camera?.Frame;
|
||||
App.Settings?.Save();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user