mirror of
https://github.com/4sval/FModel.git
synced 2026-12-04 23:02:22 -06:00
persistent actors + select on load + bump snooper
This commit is contained in:
Submodule CUE4Parse updated: cb72c6e181...e4ea4ba8ec
@@ -1,3 +1,4 @@
|
||||
using System.IO;
|
||||
using CUE4Parse_Conversion.Options;
|
||||
using FModel.Settings;
|
||||
using Snooper.Hosting;
|
||||
@@ -8,6 +9,7 @@ public sealed class FModelBridgeHost : IBridgeHost
|
||||
{
|
||||
public string Name => "FModel";
|
||||
public string ExportDirectory => UserSettings.Default.ModelDirectory;
|
||||
public string ImGuiIniPath => Path.Combine(UserSettings.Default.OutputDirectory, ".data", "snooper.ini");
|
||||
|
||||
public bool OwnsLoadOptions => true;
|
||||
public bool CanBrowseAssets => true;
|
||||
|
||||
@@ -122,7 +122,7 @@ public partial class MainWindow
|
||||
_applicationView.CUE4Parse.InitMappings(),
|
||||
ApplicationViewModel.InitDetex(),
|
||||
ApplicationViewModel.InitVgmStream(),
|
||||
// ApplicationViewModel.InitImGuiSettings(newOrUpdated),
|
||||
ApplicationViewModel.InitImGuiSettings(newOrUpdated),
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (UserSettings.Default.DiscordRpc == EDiscordRpc.Always)
|
||||
|
||||
@@ -285,7 +285,7 @@ public class ApplicationViewModel : ViewModel
|
||||
|
||||
public static async Task InitImGuiSettings(bool forceDownload)
|
||||
{
|
||||
const string imgui = "imgui.ini";
|
||||
const string imgui = "snooper.ini";
|
||||
var imguiPath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", imgui);
|
||||
|
||||
if (File.Exists(imgui)) File.Move(imgui, imguiPath, true);
|
||||
|
||||
@@ -1231,7 +1231,7 @@ public class CUE4ParseViewModel : ViewModel
|
||||
|
||||
TabControl.AddTab($"{verseDigest.Name}.verse");
|
||||
TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("verse");
|
||||
TabControl.SelectedTab.SetDocumentText(verseDigest.ReadableCode, false, false);
|
||||
TabControl.SelectedTab.SetDocumentText(Encoding.UTF8.GetString(verseDigest.ReadableCode), false, false);
|
||||
return true;
|
||||
}
|
||||
case UTexture when (isNone || saveTextures) && pointer.Object.Value is UTexture texture:
|
||||
|
||||
@@ -10,13 +10,13 @@ using CUE4Parse.UE4.Assets.Exports.GeometryCollection;
|
||||
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
||||
using CUE4Parse.UE4.Objects.Engine;
|
||||
using Editor;
|
||||
using Editor.Managers;
|
||||
using FModel.Framework;
|
||||
using FModel.Services;
|
||||
using FModel.Settings;
|
||||
using Snooper.Hosting;
|
||||
using Snooper.Rendering.Actors;
|
||||
using Snooper.Rendering.Components;
|
||||
using Snooper.Rendering.Components.Light;
|
||||
using Snooper.Rendering.Components.Mesh;
|
||||
using Snooper.Rendering.Components.Primitive;
|
||||
using Snooper.Rendering.Components.Transforms;
|
||||
@@ -28,6 +28,8 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
public static SnooperViewModel Instance { get; } = new();
|
||||
|
||||
private readonly SnooperHost _host;
|
||||
private readonly SunActor _sun;
|
||||
private readonly EnvironmentActor _environment;
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors <see cref="Bridge.PendingRequest"/> for bindings.
|
||||
@@ -49,6 +51,8 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
Bridge.PendingRequestChanged += request => PendingRequest = request;
|
||||
|
||||
_host = new SnooperHost(() => new EditorWindow(htz, width, height, ApplicationService.ApplicationView.CUE4Parse.Provider, false, true));
|
||||
_sun = new SunActor();
|
||||
_environment = new EnvironmentActor();
|
||||
}
|
||||
|
||||
public void Load(UObject? obj)
|
||||
@@ -76,7 +80,12 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
editor.Invoke(() =>
|
||||
{
|
||||
if (editor.Manager.RootActor == null)
|
||||
{
|
||||
// FIFO load the scene
|
||||
editor.Manager.LoadScene(CreateScene(actor is not MeshActor));
|
||||
editor.Manager.LoadScene(_sun);
|
||||
editor.Manager.LoadScene(_environment);
|
||||
}
|
||||
|
||||
if (actor != null)
|
||||
editor.Manager.LoadScene(actor);
|
||||
@@ -88,6 +97,9 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
if (mesh.SnapToGround())
|
||||
mesh.UpdateWorldMatrix(); // just so teleport works properly
|
||||
mesh.TeleportTo();
|
||||
|
||||
if (editor.Manager is InterfaceManager ui)
|
||||
ui.SelectComponent(mesh);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -114,11 +126,6 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
camera.CameraComponent.SetLocalTransform(new Transform(new Vector3(0, 1.14f, 3.5f), new Vector3(180, 18, 0)));
|
||||
scene.Children.Add(camera);
|
||||
|
||||
const float distance = 500;
|
||||
var sun = new Actor("Sun Light");
|
||||
sun.Components.Add(new DirectionalLightComponent(MathF.PI, new Vector3(1.00f, 0.96f, 0.90f), new Transform(new Vector3(-distance, distance, distance), new Vector3(140, 37, 0)), "Directional Light"));
|
||||
scene.Children.Add(sun);
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
||||
|
||||
2
Snooper
2
Snooper
Submodule Snooper updated: 27c40c5a78...254231ea47
Reference in New Issue
Block a user