Skip to content

Commit

Permalink
open material in viewer choice
Browse files Browse the repository at this point in the history
  • Loading branch information
4sval committed Nov 22, 2021
1 parent 2dc8ae9 commit 2b41943
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions FModel/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
<MenuItem Header="Open Sounds" IsCheckable="True" StaysOpenOnClick="True"
InputGestureText="{Binding AutoOpenSounds, Source={x:Static local:Settings.UserSettings.Default}}"
IsChecked="{Binding IsAutoOpenSounds, Source={x:Static local:Settings.UserSettings.Default}}" />
<MenuItem Header="Open Meshes &amp; Materials" IsCheckable="True" StaysOpenOnClick="True"
<MenuItem Header="Open Meshes" IsCheckable="True" StaysOpenOnClick="True"
InputGestureText="{Binding AutoOpenMeshes, Source={x:Static local:Settings.UserSettings.Default}}"
IsChecked="{Binding IsAutoOpenMeshes, Source={x:Static local:Settings.UserSettings.Default}}" />
</MenuItem>
Expand Down Expand Up @@ -867,7 +867,7 @@
<TextBlock HorizontalAlignment="Center" FontWeight="SemiBold" Text="SND" />
</StatusBarItem>

<StatusBarItem Width="35" HorizontalContentAlignment="Stretch" ToolTip="Auto Open Meshes &amp; Materials Enabled">
<StatusBarItem Width="35" HorizontalContentAlignment="Stretch" ToolTip="Auto Open Meshes Enabled">
<StatusBarItem.Style>
<Style TargetType="StatusBarItem">
<Style.Triggers>
Expand Down
7 changes: 7 additions & 0 deletions FModel/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,13 @@ public ELodFormat LodExportFormat
set => SetProperty(ref _lodExportFormat, value);
}

private bool _openMaterialsInModelViewer = true;
public bool OpenMaterialsInModelViewer
{
get => _openMaterialsInModelViewer;
set => SetProperty(ref _openMaterialsInModelViewer, value);
}

private bool _saveSkeletonAsMesh;
public bool SaveSkeletonAsMesh
{
Expand Down
2 changes: 1 addition & 1 deletion FModel/ViewModels/CUE4ParseViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public void ExtractAndScroll(string fullPath, string objectName)
}
case UStaticMesh when UserSettings.Default.IsAutoOpenMeshes:
case USkeletalMesh when UserSettings.Default.IsAutoOpenMeshes:
case UMaterialInstance when UserSettings.Default.IsAutoOpenMeshes && !ModelIsSwappingMaterial &&
case UMaterialInstance when UserSettings.Default.OpenMaterialsInModelViewer && !ModelIsSwappingMaterial &&
!(Game == FGame.FortniteGame && export.Owner != null && (export.Owner.Name.EndsWith($"/MI_OfferImages/{export.Name}", StringComparison.OrdinalIgnoreCase) ||
export.Owner.Name.EndsWith($"/RenderSwitch_Materials/{export.Name}", StringComparison.OrdinalIgnoreCase) ||
export.Owner.Name.EndsWith($"/MI_BPTile/{export.Name}", StringComparison.OrdinalIgnoreCase))):
Expand Down
6 changes: 0 additions & 6 deletions FModel/ViewModels/TabControlViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@
using FModel.Settings;
using FModel.ViewModels.Commands;
using FModel.Views.Resources.Controls;

using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Highlighting;

using Microsoft.Win32;

using Serilog;

using SkiaSharp;

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace FModel.ViewModels
Expand Down
3 changes: 2 additions & 1 deletion FModel/Views/Resources/Controls/AvalonEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ private void OnCloseClick(object sender, RoutedEventArgs e)

private void OnTabClose(object sender, EventArgs eventArgs)
{
if (sender is not TabControlViewModel tab|| eventArgs is not TabControlViewModel.TabEventArgs e)
if (eventArgs is not TabControlViewModel.TabEventArgs e || e.TabToRemove.Document == null)
return;

var fileName = e.TabToRemove.Document.FileName;
if (_savedCarets.ContainsKey(fileName))
_savedCarets.Remove(fileName);
Expand Down
20 changes: 10 additions & 10 deletions FModel/Views/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
Expand Down Expand Up @@ -280,15 +275,20 @@
</ComboBox.ItemTemplate>
</ComboBox>

<TextBlock Grid.Row="2" Grid.Column="0" Text="Save Skeletons as Empty Meshes" VerticalAlignment="Center" Margin="0 0 0 5" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="Open Materials in Model Viewer" VerticalAlignment="Center" Margin="0 2.5 0 5" />
<CheckBox Grid.Row="2" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding OpenMaterialsInModelViewer, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 5"/>

<TextBlock Grid.Row="3" Grid.Column="0" Text="Save Skeletons as Empty Meshes" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="3" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding SaveSkeletonAsMesh, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 10"/>

<Separator Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" Style="{StaticResource CustomSeparator}" />
<Separator Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" Style="{StaticResource CustomSeparator}" />

<TextBlock Grid.Row="4" Grid.Column="0" Text="Texture Format" VerticalAlignment="Center" Margin="0 0 0 5" />
<ComboBox Grid.Row="4" Grid.Column="2" ItemsSource="{Binding SettingsView.TextureExportFormats}" SelectedItem="{Binding SettingsView.SelectedTextureExportFormat, Mode=TwoWay}"
<TextBlock Grid.Row="5" Grid.Column="0" Text="Texture Format" VerticalAlignment="Center" Margin="0 0 0 5" />
<ComboBox Grid.Row="5" Grid.Column="2" ItemsSource="{Binding SettingsView.TextureExportFormats}" SelectedItem="{Binding SettingsView.SelectedTextureExportFormat, Mode=TwoWay}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
<ComboBox.ItemTemplate>
<DataTemplate>
Expand Down Expand Up @@ -366,7 +366,7 @@
<TextBlock Grid.Row="12" Grid.Column="0" Text="Auto Open Sounds *" VerticalAlignment="Center" Margin="0 0 0 5" />
<controls:HotkeyTextBox Grid.Row="12" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
HotKey="{Binding AutoOpenSounds, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />
<TextBlock Grid.Row="13" Grid.Column="0" Text="Auto Open Meshes &amp; Materials *" VerticalAlignment="Center" />
<TextBlock Grid.Row="13" Grid.Column="0" Text="Auto Open Meshes *" VerticalAlignment="Center" />
<controls:HotkeyTextBox Grid.Row="13" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}"
HotKey="{Binding AutoOpenMeshes, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />

Expand Down

0 comments on commit 2b41943

Please sign in to comment.