mirror of
https://github.com/4sval/FModel.git
synced 2026-10-02 05:59:55 -05:00
swap before vacation
This commit is contained in:
@@ -763,7 +763,8 @@ public class CUE4ParseViewModel : ViewModel
|
||||
}
|
||||
case UMaterialInstance m when ModelIsOverwritingMaterial:
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
SnooperViewer.SwapMaterial(m);
|
||||
return true;
|
||||
}
|
||||
case UStaticMesh when UserSettings.Default.SaveStaticMeshes:
|
||||
case USkeletalMesh when UserSettings.Default.SaveSkeletalMeshes:
|
||||
|
||||
@@ -11,6 +11,9 @@ public class Options
|
||||
public int SelectedSection { get; private set; }
|
||||
public int SelectedMorph { get; private set; }
|
||||
|
||||
public bool Append { get; set; }
|
||||
public bool Close { get; set; }
|
||||
|
||||
public Options()
|
||||
{
|
||||
Reset();
|
||||
@@ -22,6 +25,8 @@ public class Options
|
||||
SelectedModelInstance = 0;
|
||||
SelectedSection = 0;
|
||||
SelectedMorph = 0;
|
||||
Append = false;
|
||||
Close = false;
|
||||
}
|
||||
|
||||
public void SelectModel(FGuid guid)
|
||||
@@ -49,4 +54,9 @@ public class Options
|
||||
section = model.Sections[SelectedSection]; else section = null;
|
||||
return section != null;
|
||||
}
|
||||
|
||||
public void SwapMaterial(bool value)
|
||||
{
|
||||
Services.ApplicationService.ApplicationView.CUE4Parse.ModelIsOverwritingMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,9 +293,7 @@ public class SnimGui : IDisposable
|
||||
{
|
||||
options.SelectSection(i);
|
||||
if (ImGui.Selectable("Swap"))
|
||||
{
|
||||
|
||||
}
|
||||
options.SwapMaterial(true);
|
||||
if (ImGui.Selectable("Copy Name to Clipboard"))
|
||||
Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
|
||||
@@ -49,7 +49,6 @@ public class Snooper
|
||||
|
||||
private Vector2D<int> _size;
|
||||
private float _previousSpeed;
|
||||
private bool _append;
|
||||
|
||||
public Snooper()
|
||||
{
|
||||
@@ -206,9 +205,19 @@ public class Snooper
|
||||
DoLoop();
|
||||
}
|
||||
|
||||
public void SwapMaterial(UMaterialInstance mi)
|
||||
{
|
||||
if (!_models.TryGetValue(_options.SelectedModel, out var model) ||
|
||||
!_options.TryGetSection(model, out var section)) return;
|
||||
|
||||
section.SwapMaterial(mi);
|
||||
_options.SwapMaterial(false);
|
||||
DoLoop();
|
||||
}
|
||||
|
||||
private void DoLoop()
|
||||
{
|
||||
if (_append) _append = false;
|
||||
if (_options.Append) _options.Append = false;
|
||||
_window.Run();
|
||||
// if (_window.IsInitialized)
|
||||
// {
|
||||
@@ -376,7 +385,7 @@ public class Snooper
|
||||
// we can't use GLContext back on next load and so, for now, we basically have to reset the window
|
||||
// if we can't use GLContext, we can't generate handles, can't interact with IsVisible, State, etc
|
||||
// tldr we dispose everything but don't clear models, so the more you append, the longer it takes to load
|
||||
_append = true;
|
||||
_options.Append = true;
|
||||
_window.Close();
|
||||
// _window.IsVisible = false;
|
||||
}
|
||||
@@ -395,7 +404,7 @@ public class Snooper
|
||||
{
|
||||
model.Dispose();
|
||||
}
|
||||
if (!_append)
|
||||
if (!_options.Append)
|
||||
{
|
||||
_models.Clear();
|
||||
_options.Reset();
|
||||
|
||||
Reference in New Issue
Block a user