mirror of
https://github.com/4sval/FModel.git
synced 2026-12-04 23:02:22 -06:00
Direct texture inspector / Fixed unresolved image preview / OpenGL compatibility detection
This commit is contained in:
Submodule CUE4Parse updated: badffcd042...18d2b8bce7
@@ -17,7 +17,7 @@ namespace FModel.Framework;
|
||||
/// dying: GLFW and the GL driver keep per-thread state there. So the thread Snooper is created on never dies until
|
||||
/// FModel itself closes, it just loops back to waiting for the next window to build.
|
||||
/// </summary>
|
||||
public sealed class SnooperHost(Func<EditorWindow> build) : IDisposable
|
||||
public sealed class SnooperHost(Func<EditorWindow> build, Action<Exception> onStartupFailure) : IDisposable
|
||||
{
|
||||
private readonly Lock _lock = new();
|
||||
private readonly SemaphoreSlim _wanted = new(0);
|
||||
@@ -27,22 +27,25 @@ public sealed class SnooperHost(Func<EditorWindow> build) : IDisposable
|
||||
private Exception? _failure;
|
||||
private Thread? _thread;
|
||||
|
||||
public EditorWindow Window
|
||||
public EditorWindow? GetWindow()
|
||||
{
|
||||
get
|
||||
Exception? failure;
|
||||
lock (_lock)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (_window is { } current) return current;
|
||||
if (_window is { } current) return current;
|
||||
|
||||
_thread ??= StartThread();
|
||||
_ready.Reset();
|
||||
_wanted.Release();
|
||||
_ready.Wait();
|
||||
_thread ??= StartThread();
|
||||
_ready.Reset();
|
||||
_wanted.Release();
|
||||
_ready.Wait();
|
||||
|
||||
return _window ?? throw new InvalidOperationException("Snooper failed to start", _failure);
|
||||
}
|
||||
if (_window is { } window) return window;
|
||||
|
||||
failure = _failure;
|
||||
}
|
||||
|
||||
onStartupFailure(new InvalidOperationException("Snooper failed to start", failure));
|
||||
return null;
|
||||
}
|
||||
|
||||
private Thread StartThread()
|
||||
|
||||
@@ -149,7 +149,8 @@
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Views">
|
||||
<MenuItem Header="3D Viewer" Command="{Binding MenuCommand}" CommandParameter="Views_3dViewer">
|
||||
<MenuItem Header="3D Viewer" Command="{Binding MenuCommand}" CommandParameter="Views_3dViewer"
|
||||
IsEnabled="{Binding CanOpenSnooper, Source={x:Static viewModels:SnooperViewModel.Instance}}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ImageCommand(TabItem contextViewModel) : ViewModelCommand<TabItem>(
|
||||
{
|
||||
public override void Execute(TabItem tabViewModel, object parameter)
|
||||
{
|
||||
if (parameter == null || !tabViewModel.HasImage)
|
||||
if (parameter == null || tabViewModel?.SelectedImage is not { } image)
|
||||
return;
|
||||
|
||||
switch (parameter)
|
||||
@@ -37,6 +37,15 @@ public class ImageCommand(TabItem contextViewModel) : ViewModelCommand<TabItem>(
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "InspectTexture" when image.InspectorTexture is { } texture:
|
||||
SnooperViewModel.Instance.InspectTexture(texture, image.Name, image.RenderNearestNeighbor);
|
||||
break;
|
||||
case "PreviousImage":
|
||||
tabViewModel.GoPreviousImage();
|
||||
break;
|
||||
case "NextImage":
|
||||
tabViewModel.GoNextImage();
|
||||
break;
|
||||
case "Copy":
|
||||
case BitmapSource:
|
||||
ClipboardExtensions.SetImage(parameter as BitmapSource ?? tabViewModel.SelectedImage.Image, Path.ChangeExtension(tabViewModel.SelectedImage.ExportName, "png"));
|
||||
|
||||
@@ -419,7 +419,6 @@ public class GameFileViewModel(GameFile asset) : ViewModel
|
||||
|
||||
private Task ResolveByExtensionAsync(EResolveCompute resolve)
|
||||
{
|
||||
Resolved |= EResolveCompute.Preview;
|
||||
var lowercaseExtension = Asset.Extension.ToLowerInvariant();
|
||||
|
||||
AssetFamily = lowercaseExtension switch
|
||||
@@ -504,11 +503,10 @@ public class GameFileViewModel(GameFile asset) : ViewModel
|
||||
case "bmp":
|
||||
case "svg":
|
||||
{
|
||||
Resolved |= ~EResolveCompute.Preview;
|
||||
AssetCategory = EAssetCategory.Texture;
|
||||
AssetActions = EBulkType.Textures;
|
||||
if (!resolve.HasFlag(EResolveCompute.Preview))
|
||||
break;
|
||||
return Task.CompletedTask;
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
@@ -568,6 +566,7 @@ public class GameFileViewModel(GameFile asset) : ViewModel
|
||||
break;
|
||||
}
|
||||
|
||||
Resolved |= EResolveCompute.Preview;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,11 +16,14 @@ using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
||||
using CUE4Parse.UE4.Objects.Engine;
|
||||
using CUE4Parse.UE4.Versions;
|
||||
using CUE4Parse_Conversion.Options;
|
||||
using CUE4Parse_Conversion.Textures;
|
||||
using Editor;
|
||||
using Editor.Managers;
|
||||
using FModel.Framework;
|
||||
using FModel.Services;
|
||||
using FModel.Settings;
|
||||
using FModel.Views.Resources.Controls;
|
||||
using OpenTK.Windowing.GraphicsLibraryFramework;
|
||||
using Snooper.Hosting;
|
||||
using Snooper.Rendering.Actors;
|
||||
using Snooper.Rendering.Components.Camera;
|
||||
@@ -29,6 +32,8 @@ using Snooper.Rendering.Components.Primitive;
|
||||
using Snooper.Rendering.Components.Transforms;
|
||||
using Snooper.Rendering.Systems;
|
||||
using Snooper.Rendering.Actors.Custom;
|
||||
using Snooper.UI;
|
||||
using GlfwErrorCode = OpenTK.Windowing.GraphicsLibraryFramework.ErrorCode;
|
||||
|
||||
namespace FModel.ViewModels;
|
||||
|
||||
@@ -40,6 +45,12 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
private readonly SunActor _sun;
|
||||
private readonly EnvironmentActor _environment;
|
||||
|
||||
public bool CanOpenSnooper
|
||||
{
|
||||
get;
|
||||
private set => SetProperty(ref field, value);
|
||||
} = true;
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors <see cref="Bridge.PendingRequest"/> for bindings.
|
||||
/// </summary>
|
||||
@@ -59,13 +70,16 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
Bridge.Host = new FModelBridgeHost();
|
||||
Bridge.PendingRequestChanged += request => PendingRequest = request;
|
||||
|
||||
_host = new SnooperHost(() => new EditorWindow(htz, width, height, ApplicationService.ApplicationView.CUE4Parse.Provider, false, true));
|
||||
_host = new SnooperHost(() => new EditorWindow(htz, width, height, ApplicationService.ApplicationView.CUE4Parse.Provider, startVisible: false, closeHides: true), OnStartupFailure);
|
||||
_sun = new SunActor();
|
||||
_environment = new EnvironmentActor();
|
||||
}
|
||||
|
||||
public void Load(UObject obj, CancellationToken ct = default)
|
||||
{
|
||||
if (!CanOpenSnooper)
|
||||
return;
|
||||
|
||||
SetOptions(obj);
|
||||
|
||||
Actor actor = obj switch
|
||||
@@ -89,7 +103,9 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
var editor = _host.Window;
|
||||
if (_host.GetWindow() is not { } editor)
|
||||
return;
|
||||
|
||||
editor.Invoke(() =>
|
||||
{
|
||||
if (editor.Manager.RootActor == null)
|
||||
@@ -109,6 +125,7 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
}));
|
||||
}
|
||||
|
||||
WindowRequests.Request(Snooper.Settings.ViewportWindow);
|
||||
if (actor != null)
|
||||
editor.Manager.LoadScene(actor);
|
||||
|
||||
@@ -145,13 +162,29 @@ public class SnooperViewModel : ViewModel, IDisposable
|
||||
|
||||
public bool TryDeliver(UObject obj)
|
||||
{
|
||||
if (!Bridge.TryDeliver(obj)) return false;
|
||||
if (!CanOpenSnooper || !Bridge.TryDeliver(obj) || _host.GetWindow() is not { } editor)
|
||||
return false;
|
||||
|
||||
var editor = _host.Window;
|
||||
editor.Invoke(editor.Show);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void InspectTexture(CTexture texture, string name, bool nearestNeighbor)
|
||||
{
|
||||
if (CanOpenSnooper)
|
||||
{
|
||||
_host.GetWindow()?.InspectTexture(texture, name, nearestNeighbor);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStartupFailure(Exception e)
|
||||
{
|
||||
if (e.InnerException is GLFWException { ErrorCode: GlfwErrorCode.ApiUnavailable or GlfwErrorCode.VersionUnavailable })
|
||||
CanOpenSnooper = false;
|
||||
|
||||
FLogger.Append(e);
|
||||
}
|
||||
|
||||
private void SetOptions(UObject obj)
|
||||
{
|
||||
var settings = UserSettings.Default;
|
||||
|
||||
@@ -30,6 +30,7 @@ public class TabImage : ViewModel
|
||||
private readonly string _name;
|
||||
private readonly object _source;
|
||||
|
||||
public string Name => _name;
|
||||
public string ExportName { get; set; }
|
||||
|
||||
public byte[] ImageBuffer { get; set; }
|
||||
@@ -37,6 +38,11 @@ public class TabImage : ViewModel
|
||||
public ImageAnimation.Frame[] AnimationFrames { get; }
|
||||
public bool CanDisableAlpha => AnimationFrames == null;
|
||||
|
||||
public EPixelFormat? TextureFormat { get; }
|
||||
public int? MipCount { get; }
|
||||
public CTexture InspectorTexture => TextureFormat.HasValue ? _source as CTexture : null;
|
||||
public bool HasTexture => InspectorTexture != null;
|
||||
|
||||
public TabImage(string name, CFlipbook flipbook)
|
||||
{
|
||||
_name = name;
|
||||
@@ -56,10 +62,22 @@ public class TabImage : ViewModel
|
||||
Encode(UserSettings.GetExportOptions());
|
||||
}
|
||||
|
||||
public TabImage(string name, bool rnn, CTexture img)
|
||||
public TabImage(string name, bool rnn, CTexture img, UTexture sourceTexture = null)
|
||||
{
|
||||
_name = name;
|
||||
_source = img;
|
||||
if (img != null && sourceTexture != null)
|
||||
{
|
||||
TextureFormat = sourceTexture.Format == EPixelFormat.PF_Unknown ? img.PixelFormat : sourceTexture.Format;
|
||||
|
||||
var platformData = sourceTexture.PlatformData;
|
||||
var mipCount = platformData.Mips.Length;
|
||||
if (platformData is { FirstMipToSerialize: >= 0, VTData: { } virtualTexture } && virtualTexture.IsInitialized())
|
||||
mipCount = (int) virtualTexture.NumMips;
|
||||
|
||||
if (mipCount > 1)
|
||||
MipCount = mipCount;
|
||||
}
|
||||
RenderNearestNeighbor = rnn;
|
||||
SetImage(img?.ToSkBitmap());
|
||||
Encode(UserSettings.GetExportOptions());
|
||||
@@ -369,7 +387,7 @@ public class TabItem : ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
AddImage(texture.Name, texture.RenderNearestNeighbor, img, save, updateUi, appendLayerNumber);
|
||||
AddImage(texture.Name, texture.RenderNearestNeighbor, img, save, updateUi, appendLayerNumber, texture);
|
||||
}
|
||||
|
||||
public void AddImage(string name, bool rnn, SKBitmap[] img, bool save, bool updateUi, bool appendLayerNumber = false)
|
||||
@@ -380,11 +398,12 @@ public class TabItem : ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public void AddImage(string name, bool rnn, CTexture[] img, bool save, bool updateUi, bool appendLayerNumber = false)
|
||||
public void AddImage(string name, bool rnn, CTexture[] img, bool save, bool updateUi, bool appendLayerNumber = false, UTexture sourceTexture = null)
|
||||
{
|
||||
for (var i = 0; i < img.Length; i++)
|
||||
{
|
||||
AddImage($"{name}{(appendLayerNumber ? $"_{i}" : "")}", rnn, img[i], save, updateUi);
|
||||
var layerName = appendLayerNumber ? $"{name}_{i}" : name;
|
||||
AddImage(new TabImage(layerName, rnn, img[i], sourceTexture), save, updateUi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -7,6 +7,7 @@
|
||||
xmlns:audioControls="clr-namespace:FModel.Views.Resources.Controls.Aup"
|
||||
xmlns:converters="clr-namespace:FModel.Views.Resources.Converters"
|
||||
xmlns:settings="clr-namespace:FModel.Settings"
|
||||
xmlns:viewModels="clr-namespace:FModel.ViewModels"
|
||||
xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
|
||||
xmlns:folding="clr-namespace:ICSharpCode.AvalonEdit.Folding;assembly=ICSharpCode.AvalonEdit"
|
||||
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
|
||||
@@ -521,11 +522,217 @@
|
||||
<ColumnDefinition Width="{Binding AvalonImageSize, Source={x:Static settings:UserSettings.Default}, Mode=TwoWay}" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<controls:AvalonEditor x:Name="DynamicArea" Grid.Column="0" DataContext="{Binding SelectedItem, ElementName=TabControlName}" />
|
||||
<GridSplitter Grid.Column="1" Width="4" VerticalAlignment="Stretch" ResizeDirection="Columns" KeyboardIncrement="0"
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<controls:AvalonEditor x:Name="DynamicArea" Grid.Column="0" Grid.RowSpan="2" DataContext="{Binding SelectedItem, ElementName=TabControlName}" />
|
||||
<GridSplitter Grid.Column="1" Grid.RowSpan="2" Width="4" VerticalAlignment="Stretch" ResizeDirection="Columns" KeyboardIncrement="0"
|
||||
Visibility="{Binding SelectedItem.HasImage, ElementName=TabControlName, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}" />
|
||||
<Border Grid.Column="2" BorderBrush="#3b3d4a" BorderThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
<Border Grid.Column="2"
|
||||
Padding="10 6 8 8"
|
||||
BorderThickness="0 0 0 1"
|
||||
DataContext="{Binding SelectedItem, ElementName=TabControlName}"
|
||||
BorderBrush="{DynamicResource {x:Static adonisUi:Brushes.Layer1BorderBrush}}"
|
||||
TextElement.Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"
|
||||
Visibility="{Binding HasImage, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Margin="0 0 4 0"
|
||||
Text="{Binding SelectedImage.Name}"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="{Binding Text, RelativeSource={RelativeSource Self}}"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<Button Grid.Column="1"
|
||||
Margin="0 2"
|
||||
Cursor="Hand"
|
||||
VerticalAlignment="Center"
|
||||
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer1BackgroundBrush}}"
|
||||
ToolTip="Open in Texture Inspector"
|
||||
Command="{Binding ImageCommand}"
|
||||
CommandParameter="InspectTexture"
|
||||
IsEnabled="{Binding CanOpenSnooper, Source={x:Static viewModels:SnooperViewModel.Instance}}"
|
||||
Visibility="{Binding SelectedImage.HasTexture, Converter={StaticResource BoolToVisibilityConverter}, FallbackValue=Collapsed}">
|
||||
<Button.Style>
|
||||
<Style TargetType="Button"
|
||||
BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Width"
|
||||
Value="24" />
|
||||
<Setter Property="Height"
|
||||
Value="24" />
|
||||
<Setter Property="Padding"
|
||||
Value="5" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasMultipleImages}"
|
||||
Value="True">
|
||||
<Setter Property="Width"
|
||||
Value="18" />
|
||||
<Setter Property="Height"
|
||||
Value="18" />
|
||||
<Setter Property="Padding"
|
||||
Value="4" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
CornerRadius="3">
|
||||
<Path x:Name="InspectorIcon"
|
||||
Stretch="Uniform"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Data="{StaticResource TextureInspectorIcon}">
|
||||
<Path.Effect>
|
||||
<DropShadowEffect Color="Black"
|
||||
BlurRadius="2"
|
||||
ShadowDepth="1"
|
||||
Opacity="0.35" />
|
||||
</Path.Effect>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter TargetName="InspectorIcon"
|
||||
Property="Fill"
|
||||
Value="#B79AF4" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled"
|
||||
Value="False">
|
||||
<Setter TargetName="InspectorIcon"
|
||||
Property="Fill"
|
||||
Value="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
<DockPanel Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0 1 0 0"
|
||||
TextElement.Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}">
|
||||
<StackPanel DockPanel.Dock="Right"
|
||||
Orientation="Horizontal"
|
||||
Margin="6 0 0 0"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding HasMultipleImages, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="RepeatButton">
|
||||
<Setter Property="Width"
|
||||
Value="18" />
|
||||
<Setter Property="Height"
|
||||
Value="18" />
|
||||
<Setter Property="Cursor"
|
||||
Value="Hand" />
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource {x:Static adonisUi:Brushes.Layer2BackgroundBrush}}" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RepeatButton">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="3">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource {x:Static adonisUi:Brushes.Layer2HighlightBrush}}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<RepeatButton ToolTip="Previous image"
|
||||
Command="{Binding ImageCommand}"
|
||||
CommandParameter="PreviousImage">
|
||||
<Path Data="M4,0 L0,4 4,8"
|
||||
Width="6"
|
||||
Height="9"
|
||||
Stretch="Uniform"
|
||||
StrokeThickness="1.3"
|
||||
Stroke="{Binding Foreground, RelativeSource={RelativeSource AncestorType=RepeatButton}}" />
|
||||
</RepeatButton>
|
||||
<Border Height="18"
|
||||
Margin="1 0"
|
||||
Padding="5 0"
|
||||
CornerRadius="3"
|
||||
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer1BackgroundBrush}}">
|
||||
<TextBlock FontSize="11"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Page}"
|
||||
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
|
||||
</Border>
|
||||
<RepeatButton ToolTip="Next image"
|
||||
Command="{Binding ImageCommand}"
|
||||
CommandParameter="NextImage">
|
||||
<Path Data="M0,0 L4,4 0,8"
|
||||
Width="6"
|
||||
Height="9"
|
||||
Stretch="Uniform"
|
||||
StrokeThickness="1.3"
|
||||
Stroke="{Binding Foreground, RelativeSource={RelativeSource AncestorType=RepeatButton}}" />
|
||||
</RepeatButton>
|
||||
</StackPanel>
|
||||
<TextBlock DockPanel.Dock="Left"
|
||||
FontSize="11"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding SelectedImage.HasTexture, Converter={StaticResource BoolToVisibilityConverter}, FallbackValue=Collapsed}">
|
||||
<Run Text="{Binding SelectedImage.TextureFormat, Mode=OneWay}"
|
||||
Foreground="{DynamicResource {x:Static adonisUi:Brushes.AlertBrush}}" />
|
||||
<Run Text=" / "
|
||||
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
|
||||
<Run Text="{Binding SelectedImage.InspectorTexture.Data.Length, Mode=OneWay, Converter={x:Static converters:SizeToStringConverter.Instance}}" />
|
||||
<Run Text=" / "
|
||||
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
|
||||
</TextBlock>
|
||||
<TextBlock FontSize="11"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis">
|
||||
<Run>
|
||||
<Run.Text>
|
||||
<MultiBinding Mode="OneWay"
|
||||
StringFormat="{}{0} × {1}px"
|
||||
FallbackValue="">
|
||||
<Binding Path="SelectedImage.Image.PixelWidth" />
|
||||
<Binding Path="SelectedImage.Image.PixelHeight" />
|
||||
</MultiBinding>
|
||||
</Run.Text>
|
||||
</Run>
|
||||
<Run>
|
||||
<Run.Text>
|
||||
<Binding Path="SelectedImage.MipCount"
|
||||
Mode="OneWay"
|
||||
StringFormat="{} / {0} mips"
|
||||
TargetNullValue=""
|
||||
FallbackValue="" />
|
||||
</Run.Text>
|
||||
</Run>
|
||||
</TextBlock>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Grid.Column="2" Grid.Row="1" Margin="8" BorderThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
BorderBrush="{DynamicResource {x:Static adonisUi:Brushes.Layer2BorderBrush}}"
|
||||
Visibility="{Binding SelectedItem.HasImage, ElementName=TabControlName, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<Image VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Uniform"
|
||||
controls:ImageAnimation.Frames="{Binding SelectedItem.SelectedImage.AnimationFrames, ElementName=TabControlName}"
|
||||
@@ -536,6 +743,19 @@
|
||||
</Image.InputBindings>
|
||||
<Image.ContextMenu>
|
||||
<ContextMenu DataContext="{Binding PlacementTarget, RelativeSource={RelativeSource Self}}">
|
||||
<MenuItem Header="Open in Texture Inspector"
|
||||
Command="{Binding DataContext.ImageCommand}"
|
||||
CommandParameter="InspectTexture"
|
||||
IsEnabled="{Binding CanOpenSnooper, Source={x:Static viewModels:SnooperViewModel.Instance}}"
|
||||
Visibility="{Binding DataContext.SelectedImage.HasTexture, Converter={StaticResource BoolToVisibilityConverter}, FallbackValue=Collapsed}">
|
||||
<MenuItem.Icon>
|
||||
<Path Width="12"
|
||||
Height="12"
|
||||
Stretch="Uniform"
|
||||
Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"
|
||||
Data="{StaticResource TextureInspectorIcon}" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Open in New Window" Command="{Binding DataContext.ImageCommand}" CommandParameter="Open">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
@@ -572,15 +792,6 @@
|
||||
</Image.ContextMenu>
|
||||
</Image>
|
||||
</Border>
|
||||
<StackPanel Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center">
|
||||
<TextBlock HorizontalAlignment="Center"
|
||||
Text="{Binding SelectedItem.SelectedImage.ExportName, Converter={x:Static converters:FileNameWithoutExtensionConverter.Instance}, ElementName=TabControlName}"
|
||||
FontSize="10" FontWeight="SemiBold"
|
||||
Visibility="{Binding SelectedItem.HasImage, ElementName=TabControlName, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<TextBlock HorizontalAlignment="Center"
|
||||
Visibility="{Binding SelectedItem.HasMultipleImages, ElementName=TabControlName, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
Text="{Binding SelectedItem.Page, ElementName=TabControlName}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding SelectedItem.HasImage, ElementName=TabControlName}" Value="False">
|
||||
|
||||
2
Snooper
2
Snooper
Submodule Snooper updated: 6d867026f7...721892bcdb
Reference in New Issue
Block a user