mirror of
https://github.com/4sval/FModel.git
synced 2026-06-21 15:30:05 -05:00
MaterialColorToggle
This commit is contained in:
parent
212d8a12f8
commit
1b9bd2c56a
|
|
@ -1 +1 @@
|
|||
Subproject commit ce78d9257da0adaf6c4c151c6fc42b045c170466
|
||||
Subproject commit 20b76090cb5309be5623082eaef801791ef8ae18
|
||||
|
|
@ -142,10 +142,10 @@ namespace FModel.Creator.Bases.FN
|
|||
if (property.TryGetValue(out FStructFallback curve, "Curve") &&
|
||||
curve.TryGetValue(out FName rowName, "RowName") &&
|
||||
curve.TryGetValue(out UCurveTable curveTable, "CurveTable") &&
|
||||
curveTable.TryGetCurveTableRow(rowName.Text, StringComparison.OrdinalIgnoreCase, out var rowValue) &&
|
||||
rowValue.TryGetValue(out FSimpleCurveKey[] keys, "Keys") && keys.Length > 0)
|
||||
curveTable.TryFindCurve(rowName, out var rowValue) &&
|
||||
rowValue is FSimpleCurve s && s.Keys.Length > 0)
|
||||
{
|
||||
statValue = keys[0].Value;
|
||||
statValue = s.Keys[0].Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -259,33 +259,6 @@ namespace FModel.Settings
|
|||
set => SetProperty(ref _overridedGame, value);
|
||||
}
|
||||
|
||||
private IDictionary<FGame, UE4Version> _overridedUEVersion = new Dictionary<FGame, UE4Version>
|
||||
{
|
||||
{FGame.Unknown, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.FortniteGame, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.ShooterGame, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.DeadByDaylight, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.OakGame, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.Dungeons, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.WorldExplorers, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.g3, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.StateOfDecay2, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.Prospect, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.Indiana, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.RogueCompany, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.SwGame, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.Platform, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.BendGame, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.TslGame, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.PortalWars, UE4Version.VER_UE4_DETERMINE_BY_GAME},
|
||||
{FGame.Gameface, UE4Version.VER_UE4_DETERMINE_BY_GAME}
|
||||
};
|
||||
public IDictionary<FGame, UE4Version> OverridedUEVersion
|
||||
{
|
||||
get => _overridedUEVersion;
|
||||
set => SetProperty(ref _overridedUEVersion, value);
|
||||
}
|
||||
|
||||
private IDictionary<FGame, List<FCustomVersion>> _overridedCustomVersions = new Dictionary<FGame, List<FCustomVersion>>
|
||||
{
|
||||
{FGame.Unknown, null},
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ namespace FModel.ViewModels
|
|||
private set => SetProperty(ref _mountPoint, value);
|
||||
}
|
||||
|
||||
private UE4Version _version;
|
||||
public UE4Version Version
|
||||
private int _version;
|
||||
public int Version
|
||||
{
|
||||
get => _version;
|
||||
private set => SetProperty(ref _version, value);
|
||||
|
|
@ -61,7 +61,7 @@ namespace FModel.ViewModels
|
|||
public RangeObservableCollection<TreeItem> Folders { get; }
|
||||
public ICollectionView FoldersView { get; }
|
||||
|
||||
public TreeItem(string header, string package, string mountPoint, UE4Version version, string pathHere)
|
||||
public TreeItem(string header, string package, string mountPoint, int version, string pathHere)
|
||||
{
|
||||
Header = header;
|
||||
Package = package;
|
||||
|
|
@ -129,7 +129,7 @@ namespace FModel.ViewModels
|
|||
if (lastNode == null)
|
||||
{
|
||||
var nodePath = builder.ToString();
|
||||
lastNode = new TreeItem(folder, item.Package, entry.Vfs.MountPoint, entry.Vfs.Ver, nodePath[..^1]);
|
||||
lastNode = new TreeItem(folder, item.Package, entry.Vfs.MountPoint, entry.Vfs.Ver.Value, nodePath[..^1]);
|
||||
lastNode.Folders.SetSuppressionState(true);
|
||||
lastNode.AssetsList.Assets.SetSuppressionState(true);
|
||||
parentNode.Add(lastNode);
|
||||
|
|
@ -168,4 +168,4 @@ namespace FModel.ViewModels
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,9 +85,8 @@ namespace FModel.ViewModels
|
|||
Provider = new StreamedFileProvider("FortniteLive", true,
|
||||
new VersionContainer(
|
||||
UserSettings.Default.OverridedGame[Game],
|
||||
UserSettings.Default.OverridedUEVersion[Game],
|
||||
UserSettings.Default.OverridedCustomVersions[Game],
|
||||
UserSettings.Default.OverridedOptions[Game]));
|
||||
customVersions: UserSettings.Default.OverridedCustomVersions[Game],
|
||||
optionOverrides: UserSettings.Default.OverridedOptions[Game]));
|
||||
break;
|
||||
}
|
||||
case Constants._VAL_LIVE_TRIGGER:
|
||||
|
|
@ -96,17 +95,16 @@ namespace FModel.ViewModels
|
|||
Provider = new StreamedFileProvider("ValorantLive", true,
|
||||
new VersionContainer(
|
||||
UserSettings.Default.OverridedGame[Game],
|
||||
UserSettings.Default.OverridedUEVersion[Game],
|
||||
UserSettings.Default.OverridedCustomVersions[Game],
|
||||
UserSettings.Default.OverridedOptions[Game]));
|
||||
customVersions: UserSettings.Default.OverridedCustomVersions[Game],
|
||||
optionOverrides: UserSettings.Default.OverridedOptions[Game]));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Game = gameDirectory.SubstringBeforeLast("\\Content").SubstringAfterLast("\\").ToEnum(FGame.Unknown);
|
||||
var versions = new VersionContainer(
|
||||
UserSettings.Default.OverridedGame[Game], UserSettings.Default.OverridedUEVersion[Game],
|
||||
UserSettings.Default.OverridedCustomVersions[Game], UserSettings.Default.OverridedOptions[Game]);
|
||||
var versions = new VersionContainer(UserSettings.Default.OverridedGame[Game],
|
||||
customVersions: UserSettings.Default.OverridedCustomVersions[Game],
|
||||
optionOverrides: UserSettings.Default.OverridedOptions[Game]);
|
||||
|
||||
if (Game == FGame.StateOfDecay2)
|
||||
Provider = new DefaultFileProvider(new DirectoryInfo(gameDirectory), new List<DirectoryInfo>
|
||||
|
|
@ -395,7 +393,7 @@ namespace FModel.ViewModels
|
|||
if (VirtualPathCount > 0) return;
|
||||
await _threadWorkerView.Begin(cancellationToken =>
|
||||
{
|
||||
VirtualPathCount = Provider.LoadVirtualPaths(UserSettings.Default.OverridedUEVersion[Game], cancellationToken);
|
||||
VirtualPathCount = Provider.LoadVirtualPaths(UserSettings.Default.OverridedGame[Game].GetVersion(), cancellationToken);
|
||||
if (VirtualPathCount > 0)
|
||||
{
|
||||
FLogger.AppendInformation();
|
||||
|
|
|
|||
|
|
@ -51,43 +51,11 @@ namespace FModel.ViewModels
|
|||
set => SetProperty(ref _cam, value);
|
||||
}
|
||||
|
||||
private Geometry3D _xAxis;
|
||||
public Geometry3D XAxis
|
||||
{
|
||||
get => _xAxis;
|
||||
set => SetProperty(ref _xAxis, value);
|
||||
}
|
||||
|
||||
private Geometry3D _yAxis;
|
||||
public Geometry3D YAxis
|
||||
{
|
||||
get => _yAxis;
|
||||
set => SetProperty(ref _yAxis, value);
|
||||
}
|
||||
|
||||
private Geometry3D _zAxis;
|
||||
public Geometry3D ZAxis
|
||||
{
|
||||
get => _zAxis;
|
||||
set => SetProperty(ref _zAxis, value);
|
||||
}
|
||||
|
||||
private ModelAndCam _selectedModel; // selected mesh
|
||||
public ModelAndCam SelectedModel
|
||||
{
|
||||
get => _selectedModel;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectedModel, value);
|
||||
if (_selectedModel == null) return;
|
||||
|
||||
XAxis = _selectedModel.XAxis;
|
||||
YAxis = _selectedModel.YAxis;
|
||||
ZAxis = _selectedModel.ZAxis;
|
||||
Cam.UpDirection = new Vector3D(0, 1, 0);
|
||||
Cam.Position = _selectedModel.Position;
|
||||
Cam.LookDirection = _selectedModel.LookDirection;
|
||||
}
|
||||
set => SetProperty(ref _selectedModel, value);
|
||||
}
|
||||
|
||||
private readonly ObservableCollection<ModelAndCam> _loadedModels; // mesh list
|
||||
|
|
@ -107,6 +75,8 @@ namespace FModel.ViewModels
|
|||
|
||||
private readonly FGame _game;
|
||||
private readonly int[] _facesIndex = { 1, 0, 2 };
|
||||
private readonly float[] _table = { 255 * 0.9f, 25 * 3.0f, 255 * 0.6f, 255 * 0.0f };
|
||||
private readonly int[] _table2 = { 0, 1, 2, 4, 7, 3, 5, 6 };
|
||||
|
||||
public ModelViewerViewModel(FGame game)
|
||||
{
|
||||
|
|
@ -155,7 +125,11 @@ namespace FModel.ViewModels
|
|||
};
|
||||
});
|
||||
if (!valid) return;
|
||||
|
||||
SelectedModel = p;
|
||||
Cam.UpDirection = new Vector3D(0, 1, 0);
|
||||
Cam.Position = p.Position;
|
||||
Cam.LookDirection = p.LookDirection;
|
||||
}
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
|
@ -183,6 +157,12 @@ namespace FModel.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public void MaterialColorToggle()
|
||||
{
|
||||
if (SelectedModel == null) return;
|
||||
SelectedModel.ShowMaterialColor = !SelectedModel.ShowMaterialColor;
|
||||
}
|
||||
|
||||
public void DiffuseOnlyToggle()
|
||||
{
|
||||
if (SelectedModel == null) return;
|
||||
|
|
@ -317,10 +297,12 @@ namespace FModel.ViewModels
|
|||
|
||||
private void PushLod(CMeshSection[] sections, CMeshVertex[] verts, FRawStaticIndexBuffer indices, ModelAndCam cam)
|
||||
{
|
||||
foreach (var section in sections) // each section is a mesh part with its own material
|
||||
for (int i = 0; i < sections.Length; i++) // each section is a mesh part with its own material
|
||||
{
|
||||
var section = sections[i];
|
||||
var builder = new MeshBuilder();
|
||||
cam.TriangleCount += section.NumFaces; // NumFaces * 3 (triangle) = next section FirstIndex
|
||||
|
||||
for (var j = 0; j < section.NumFaces; j++) // draw a triangle for each face
|
||||
{
|
||||
foreach (var t in _facesIndex) // triangle face 1 then 0 then 2
|
||||
|
|
@ -339,18 +321,26 @@ namespace FModel.ViewModels
|
|||
if (section.Material == null || !section.Material.TryLoad<UMaterialInterface>(out var unrealMaterial))
|
||||
continue;
|
||||
|
||||
var index = (i & 0xFFF8) | _table2[i & 7] ^ 7;
|
||||
var (m, isRendering, isTransparent) = LoadMaterial(unrealMaterial);
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
cam.Group3d.Add(new MeshGeometryModel3D
|
||||
{
|
||||
Name = FixName(unrealMaterial.Name), Geometry = builder.ToMeshGeometry3D(),
|
||||
Material = m, IsTransparent = isTransparent, IsRendering = isRendering
|
||||
Material = m, IsTransparent = isTransparent, IsRendering = isRendering,
|
||||
Tag = new PBRMaterial
|
||||
{
|
||||
AlbedoColor = new Color4(_table[C(index)] / 255, _table[C(index >> 1)] / 255, _table[C(index >> 2)] / 255, 1)
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private int C(int x) => (x & 1) | ((x >> 2) & 2);
|
||||
|
||||
private (PBRMaterial material, bool isRendering, bool isTransparent) LoadMaterial(UMaterialInterface unrealMaterial)
|
||||
{
|
||||
var m = new PBRMaterial { RenderShadowMap = true, EnableAutoTangent = true, RenderEnvironmentMap = true };
|
||||
|
|
@ -539,6 +529,23 @@ namespace FModel.ViewModels
|
|||
set => SetProperty(ref _isVisible, value);
|
||||
}
|
||||
|
||||
private bool _showMaterialColor;
|
||||
public bool ShowMaterialColor
|
||||
{
|
||||
get => _showMaterialColor;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _showMaterialColor, value);
|
||||
foreach (var g in Group3d)
|
||||
{
|
||||
if (g is not MeshGeometryModel3D geometryModel)
|
||||
continue;
|
||||
|
||||
(geometryModel.Material, geometryModel.Tag) = ((PBRMaterial)geometryModel.Tag, geometryModel.Material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MeshGeometryModel3D _selectedGeometry; // selected material
|
||||
public MeshGeometryModel3D SelectedGeometry
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,13 +47,6 @@ namespace FModel.ViewModels
|
|||
set => SetProperty(ref _selectedUeGame, value);
|
||||
}
|
||||
|
||||
private UE4Version _selectedUeVersion;
|
||||
public UE4Version SelectedUeVersion
|
||||
{
|
||||
get => _selectedUeVersion;
|
||||
set => SetProperty(ref _selectedUeVersion, value);
|
||||
}
|
||||
|
||||
private List<FCustomVersion> _selectedCustomVersions;
|
||||
public List<FCustomVersion> SelectedCustomVersions
|
||||
{
|
||||
|
|
@ -127,7 +120,6 @@ namespace FModel.ViewModels
|
|||
public ReadOnlyObservableCollection<EUpdateMode> UpdateModes { get; private set; }
|
||||
public ObservableCollection<string> Presets { get; private set; }
|
||||
public ReadOnlyObservableCollection<EGame> UeGames { get; private set; }
|
||||
public ReadOnlyObservableCollection<UE4Version> UeVersions { get; private set; }
|
||||
public ReadOnlyObservableCollection<ELanguage> AssetLanguages { get; private set; }
|
||||
public ReadOnlyObservableCollection<EAesReload> AesReloads { get; private set; }
|
||||
public ReadOnlyObservableCollection<EDiscordRpc> DiscordRpcs { get; private set; }
|
||||
|
|
@ -146,7 +138,6 @@ namespace FModel.ViewModels
|
|||
private EUpdateMode _updateModeSnapshot;
|
||||
private string _presetSnapshot;
|
||||
private EGame _ueGameSnapshot;
|
||||
private UE4Version _ueVersionSnapshot;
|
||||
private List<FCustomVersion> _customVersionsSnapshot;
|
||||
private Dictionary<string, bool> _optionsSnapshot;
|
||||
private ELanguage _assetLanguageSnapshot;
|
||||
|
|
@ -168,7 +159,6 @@ namespace FModel.ViewModels
|
|||
_updateModeSnapshot = UserSettings.Default.UpdateMode;
|
||||
_presetSnapshot = UserSettings.Default.Presets[_game];
|
||||
_ueGameSnapshot = UserSettings.Default.OverridedGame[_game];
|
||||
_ueVersionSnapshot = UserSettings.Default.OverridedUEVersion[_game];
|
||||
_customVersionsSnapshot = UserSettings.Default.OverridedCustomVersions[_game];
|
||||
_optionsSnapshot = UserSettings.Default.OverridedOptions[_game];
|
||||
_assetLanguageSnapshot = UserSettings.Default.AssetLanguage;
|
||||
|
|
@ -181,7 +171,6 @@ namespace FModel.ViewModels
|
|||
SelectedUpdateMode = _updateModeSnapshot;
|
||||
SelectedPreset = _presetSnapshot;
|
||||
SelectedUeGame = _ueGameSnapshot;
|
||||
SelectedUeVersion = _ueVersionSnapshot;
|
||||
SelectedCustomVersions = _customVersionsSnapshot;
|
||||
SelectedOptions = _optionsSnapshot;
|
||||
SelectedAssetLanguage = _assetLanguageSnapshot;
|
||||
|
|
@ -196,7 +185,6 @@ namespace FModel.ViewModels
|
|||
UpdateModes = new ReadOnlyObservableCollection<EUpdateMode>(new ObservableCollection<EUpdateMode>(EnumerateUpdateModes()));
|
||||
Presets = new ObservableCollection<string>(EnumeratePresets());
|
||||
UeGames = new ReadOnlyObservableCollection<EGame>(new ObservableCollection<EGame>(EnumerateUeGames()));
|
||||
UeVersions = new ReadOnlyObservableCollection<UE4Version>(new ObservableCollection<UE4Version>(EnumerateUeVersions()));
|
||||
AssetLanguages = new ReadOnlyObservableCollection<ELanguage>(new ObservableCollection<ELanguage>(EnumerateAssetLanguages()));
|
||||
AesReloads = new ReadOnlyObservableCollection<EAesReload>(new ObservableCollection<EAesReload>(EnumerateAesReloads()));
|
||||
DiscordRpcs = new ReadOnlyObservableCollection<EDiscordRpc>(new ObservableCollection<EDiscordRpc>(EnumerateDiscordRpcs()));
|
||||
|
|
@ -226,7 +214,6 @@ namespace FModel.ViewModels
|
|||
{
|
||||
if (_gamePreset?.Versions == null || !_gamePreset.Versions.TryGetValue(key, out var version)) return;
|
||||
SelectedUeGame = version.GameEnum.ToEnum(EGame.GAME_UE4_LATEST);
|
||||
SelectedUeVersion = (UE4Version)version.UeVer;
|
||||
|
||||
SelectedCustomVersions = new List<FCustomVersion>();
|
||||
foreach (var (guid, v) in version.CustomVersions)
|
||||
|
|
@ -244,7 +231,6 @@ namespace FModel.ViewModels
|
|||
public void ResetPreset()
|
||||
{
|
||||
SelectedUeGame = _ueGameSnapshot;
|
||||
SelectedUeVersion = _ueVersionSnapshot;
|
||||
SelectedCustomVersions = _customVersionsSnapshot;
|
||||
SelectedOptions = _optionsSnapshot;
|
||||
}
|
||||
|
|
@ -253,7 +239,7 @@ namespace FModel.ViewModels
|
|||
{
|
||||
var ret = SettingsOut.Nothing;
|
||||
|
||||
if (_ueGameSnapshot != SelectedUeGame || _ueVersionSnapshot != SelectedUeVersion || // comboboxes
|
||||
if (_ueGameSnapshot != SelectedUeGame || // combobox
|
||||
_customVersionsSnapshot != SelectedCustomVersions || _optionsSnapshot != SelectedOptions ||
|
||||
_outputSnapshot != UserSettings.Default.OutputDirectory || // textbox
|
||||
_gameSnapshot != UserSettings.Default.GameDirectory) // textbox
|
||||
|
|
@ -265,7 +251,6 @@ namespace FModel.ViewModels
|
|||
UserSettings.Default.UpdateMode = SelectedUpdateMode;
|
||||
UserSettings.Default.Presets[_game] = SelectedPreset;
|
||||
UserSettings.Default.OverridedGame[_game] = SelectedUeGame;
|
||||
UserSettings.Default.OverridedUEVersion[_game] = SelectedUeVersion;
|
||||
UserSettings.Default.OverridedCustomVersions[_game] = SelectedCustomVersions;
|
||||
UserSettings.Default.OverridedOptions[_game] = SelectedOptions;
|
||||
UserSettings.Default.AssetLanguage = SelectedAssetLanguage;
|
||||
|
|
@ -289,7 +274,6 @@ namespace FModel.ViewModels
|
|||
yield return Constants._NO_PRESET_TRIGGER;
|
||||
}
|
||||
private IEnumerable<EGame> EnumerateUeGames() => Enum.GetValues(SelectedUeGame.GetType()).Cast<EGame>();
|
||||
private IEnumerable<UE4Version> EnumerateUeVersions() => Enum.GetValues(SelectedUeVersion.GetType()).Cast<UE4Version>();
|
||||
private IEnumerable<ELanguage> EnumerateAssetLanguages() => Enum.GetValues(SelectedAssetLanguage.GetType()).Cast<ELanguage>();
|
||||
private IEnumerable<EAesReload> EnumerateAesReloads() => Enum.GetValues(SelectedAesReload.GetType()).Cast<EAesReload>();
|
||||
private IEnumerable<EDiscordRpc> EnumerateDiscordRpcs() => Enum.GetValues(SelectedDiscordRpc.GetType()).Cast<EDiscordRpc>();
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@
|
|||
<helix:LineGeometryModel3D Geometry="{Binding ModelViewer.SelectedModel.YAxis}" Color="#85CB22" />
|
||||
<helix:LineGeometryModel3D Geometry="{Binding ModelViewer.SelectedModel.ZAxis}" Color="#388EED" />
|
||||
|
||||
<helix:GroupModel3D x:Name="MyAntiCrashGroup" ItemsSource="{Binding ModelViewer.SelectedModel.Group3d}" />
|
||||
<helix:GroupModel3D x:Name="MyAntiCrashGroup" ItemsSource="{Binding ModelViewer.SelectedModel.Group3d}" Mouse3DDown="OnMouse3DDown" />
|
||||
</helix:Viewport3DX>
|
||||
</Grid>
|
||||
</adonisControls:AdonisWindow>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using CUE4Parse.UE4.Assets.Exports;
|
|||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using FModel.Services;
|
||||
using FModel.ViewModels;
|
||||
using HelixToolkit.Wpf.SharpDX;
|
||||
using MessageBox = AdonisUI.Controls.MessageBox;
|
||||
using MessageBoxImage = AdonisUI.Controls.MessageBoxImage;
|
||||
|
||||
|
|
@ -64,12 +65,21 @@ namespace FModel.Views
|
|||
// case Key.D:
|
||||
// _applicationView.ModelViewer.DiffuseOnlyToggle();
|
||||
// break;
|
||||
case Key.M:
|
||||
_applicationView.ModelViewer.MaterialColorToggle();
|
||||
break;
|
||||
case Key.Decimal:
|
||||
_applicationView.ModelViewer.FocusOnSelectedMesh();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouse3DDown(object sender, MouseDown3DEventArgs e)
|
||||
{
|
||||
if (!Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) || e.HitTestResult.ModelHit is not MeshGeometryModel3D m) return;
|
||||
_applicationView.ModelViewer.SelectedModel.SelectedGeometry = m;
|
||||
}
|
||||
|
||||
private void OnFocusClick(object sender, RoutedEventArgs e)
|
||||
=> _applicationView.ModelViewer.FocusOnSelectedMesh();
|
||||
|
||||
|
|
|
|||
28
FModel/Views/Resources/Converters/TagToColorConverter.cs
Normal file
28
FModel/Views/Resources/Converters/TagToColorConverter.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using HelixToolkit.Wpf.SharpDX;
|
||||
|
||||
namespace FModel.Views.Resources.Converters
|
||||
{
|
||||
public class TagToColorConverter : IValueConverter
|
||||
{
|
||||
public static readonly TagToColorConverter Instance = new();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is not PBRMaterial material)
|
||||
return new SolidColorBrush(Colors.Red);
|
||||
|
||||
return new SolidColorBrush(Color.FromScRgb(
|
||||
material.AlbedoColor.Alpha, material.AlbedoColor.Red,
|
||||
material.AlbedoColor.Green, material.AlbedoColor.Blue));
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -653,6 +653,7 @@
|
|||
<ColumnDefinition Width="25" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Image Grid.Column="0" Source="/FModel;component/Resources/materialicon.png" Width="16" Height="16" Margin="5 0" HorizontalAlignment="Center" />
|
||||
|
|
@ -671,6 +672,10 @@
|
|||
</Canvas>
|
||||
</Viewbox>
|
||||
</ToggleButton>
|
||||
<Rectangle Grid.Column="5" Width="19" Height="22" Fill="{Binding Tag, Mode=OneTime, Converter={x:Static converters:TagToColorConverter.Instance}}"
|
||||
Visibility="{Binding DataContext.ModelViewer.SelectedModel.ShowMaterialColor,
|
||||
RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:Views.ModelViewer}},
|
||||
Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding IsRendering}" Value="True">
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
|
@ -92,7 +91,7 @@
|
|||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" SelectionChanged="OnSelectionChanged" Margin="0 0 0 5">
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Grid.Row="7" Grid.Column="0" Text="UE4 Versions *" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Override the UE4 version to use when parsing assets" />
|
||||
<TextBlock Grid.Row="7" Grid.Column="0" Text="UE Versions *" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Override the UE version to use when parsing assets" />
|
||||
<ComboBox Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.UeGames}" SelectedItem="{Binding SettingsView.SelectedUeGame, Mode=TwoWay}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" IsEnabled="{Binding SettingsView.EnableElements}"
|
||||
Margin="0 0 0 5">
|
||||
|
|
@ -103,19 +102,8 @@
|
|||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" Text="UE4 Object Versions *" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Override the UE4 object version to use when parsing assets" />
|
||||
<ComboBox Grid.Row="8" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.UeVersions}" SelectedItem="{Binding SettingsView.SelectedUeVersion, Mode=TwoWay}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" IsEnabled="{Binding SettingsView.EnableElements}"
|
||||
Margin="0 0 0 5">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={x:Static converters:EnumToStringConverter.Instance}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" Text="Versioning Configuration *" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<Grid Grid.Row="9" Grid.Column="2" Grid.ColumnSpan="3" Margin="0 0 0 5">
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" Text="Versioning Configuration *" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<Grid Grid.Row="8" Grid.Column="2" Grid.ColumnSpan="3" Margin="0 0 0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="5" />
|
||||
|
|
@ -126,13 +114,13 @@
|
|||
<Button Grid.Column="2" Content="Options" Click="OpenOptions" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="10" Grid.Column="0" Text="Keep Directory Structure" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Auto Export & Save assets inside their game directory" />
|
||||
<CheckBox Grid.Row="10" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" Text="Keep Directory Structure" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Auto Export & Save assets inside their game directory" />
|
||||
<CheckBox Grid.Row="9" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
|
||||
IsChecked="{Binding KeepDirectoryStructure, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
|
||||
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 10"/>
|
||||
|
||||
<TextBlock Grid.Row="11" Grid.Column="0" Text="Compressed Audio" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="What to do when encountering a compressed audio file" />
|
||||
<ComboBox Grid.Row="11" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.CompressedAudios}" SelectedItem="{Binding SettingsView.SelectedCompressedAudio, Mode=TwoWay}"
|
||||
<TextBlock Grid.Row="10" Grid.Column="0" Text="Compressed Audio" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="What to do when encountering a compressed audio file" />
|
||||
<ComboBox Grid.Row="10" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.CompressedAudios}" SelectedItem="{Binding SettingsView.SelectedCompressedAudio, Mode=TwoWay}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
|
@ -141,7 +129,7 @@
|
|||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Grid.Row="12" Grid.Column="0" Text="AES Reload at Launch" VerticalAlignment="Center" Margin="0 0 0 5"
|
||||
<TextBlock Grid.Row="11" Grid.Column="0" Text="AES Reload at Launch" VerticalAlignment="Center" Margin="0 0 0 5"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
|
|
@ -154,7 +142,7 @@
|
|||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<ComboBox Grid.Row="12" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.AesReloads}" SelectedItem="{Binding SettingsView.SelectedAesReload, Mode=TwoWay}"
|
||||
<ComboBox Grid.Row="11" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.AesReloads}" SelectedItem="{Binding SettingsView.SelectedAesReload, Mode=TwoWay}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
|
||||
<ComboBox.Style>
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user