Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
249b930602 | ||
|
|
6472f378b7 | ||
|
|
8672f0571c | ||
|
|
e7a990c1bd | ||
|
|
6727fa8e8f | ||
|
|
66d8c489b5 | ||
|
|
1931c4713a | ||
|
|
f19f172e7c | ||
|
|
092fa76124 |
@@ -1,5 +1,14 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## v0.16.6
|
||||||
|
|
||||||
|
- 修复控件尺寸为0时导致的画面缩放错误
|
||||||
|
|
||||||
|
## v0.16.5
|
||||||
|
|
||||||
|
- 修复对于无 size 行的旧 atlas 格式读取错误
|
||||||
|
- 修复托盘化之后无法联动显示窗口的问题
|
||||||
|
|
||||||
## v0.16.4
|
## v0.16.4
|
||||||
|
|
||||||
- 增加 apng 导出格式
|
- 增加 apng 导出格式
|
||||||
|
|||||||
@@ -240,8 +240,8 @@ namespace SFMLRenderer
|
|||||||
if (RenderWindow is null) return;
|
if (RenderWindow is null) return;
|
||||||
float parentW = (float)sizeInfo.NewSize.Width;
|
float parentW = (float)sizeInfo.NewSize.Width;
|
||||||
float parentH = (float)sizeInfo.NewSize.Height;
|
float parentH = (float)sizeInfo.NewSize.Height;
|
||||||
float renderW = (float)_hwndHost.ActualWidth;
|
float renderW = _resolution.X;
|
||||||
float renderH = (float)_hwndHost.ActualHeight;
|
float renderH = _resolution.Y;
|
||||||
float scale = Math.Min(parentW / renderW, parentH / renderH); // 两方向取较小值, 保证 parent 覆盖 render
|
float scale = Math.Min(parentW / renderW, parentH / renderH); // 两方向取较小值, 保证 parent 覆盖 render
|
||||||
renderW *= scale;
|
renderW *= scale;
|
||||||
renderH *= scale;
|
renderH *= scale;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
||||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||||
<Version>0.16.0</Version>
|
<Version>0.16.6</Version>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,14 @@ namespace Spine.Implementations
|
|||||||
if (ForceMipmap) texture.GenerateMipmap();
|
if (ForceMipmap) texture.GenerateMipmap();
|
||||||
|
|
||||||
page.rendererObject = texture;
|
page.rendererObject = texture;
|
||||||
|
|
||||||
|
// 有些旧的 atlas 会省略 size 行, 这时需要在读取纹理时赋值
|
||||||
|
if (page.width <= 0 || page.height <= 0)
|
||||||
|
{
|
||||||
|
var texSize = texture.Size;
|
||||||
|
page.width = (int)texSize.X;
|
||||||
|
page.height = (int)texSize.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Load(SpineRuntime34.AtlasPage page, string path)
|
public virtual void Load(SpineRuntime34.AtlasPage page, string path)
|
||||||
@@ -147,6 +155,14 @@ namespace Spine.Implementations
|
|||||||
if (ForceMipmap) texture.GenerateMipmap();
|
if (ForceMipmap) texture.GenerateMipmap();
|
||||||
|
|
||||||
page.rendererObject = texture;
|
page.rendererObject = texture;
|
||||||
|
|
||||||
|
// 有些旧的 atlas 会省略 size 行, 这时需要在读取纹理时赋值
|
||||||
|
if (page.width <= 0 || page.height <= 0)
|
||||||
|
{
|
||||||
|
var texSize = texture.Size;
|
||||||
|
page.width = (int)texSize.X;
|
||||||
|
page.height = (int)texSize.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Load(SpineRuntime35.AtlasPage page, string path)
|
public virtual void Load(SpineRuntime35.AtlasPage page, string path)
|
||||||
@@ -182,6 +198,14 @@ namespace Spine.Implementations
|
|||||||
if (ForceMipmap) texture.GenerateMipmap();
|
if (ForceMipmap) texture.GenerateMipmap();
|
||||||
|
|
||||||
page.rendererObject = texture;
|
page.rendererObject = texture;
|
||||||
|
|
||||||
|
// 有些旧的 atlas 会省略 size 行, 这时需要在读取纹理时赋值
|
||||||
|
if (page.width <= 0 || page.height <= 0)
|
||||||
|
{
|
||||||
|
var texSize = texture.Size;
|
||||||
|
page.width = (int)texSize.X;
|
||||||
|
page.height = (int)texSize.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Load(SpineRuntime36.AtlasPage page, string path)
|
public virtual void Load(SpineRuntime36.AtlasPage page, string path)
|
||||||
@@ -217,6 +241,14 @@ namespace Spine.Implementations
|
|||||||
if (ForceMipmap) texture.GenerateMipmap();
|
if (ForceMipmap) texture.GenerateMipmap();
|
||||||
|
|
||||||
page.rendererObject = texture;
|
page.rendererObject = texture;
|
||||||
|
|
||||||
|
// 有些旧的 atlas 会省略 size 行, 这时需要在读取纹理时赋值
|
||||||
|
if (page.width <= 0 || page.height <= 0)
|
||||||
|
{
|
||||||
|
var texSize = texture.Size;
|
||||||
|
page.width = (int)texSize.X;
|
||||||
|
page.height = (int)texSize.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Load(SpineRuntime37.AtlasPage page, string path)
|
public virtual void Load(SpineRuntime37.AtlasPage page, string path)
|
||||||
@@ -252,6 +284,14 @@ namespace Spine.Implementations
|
|||||||
if (ForceMipmap) texture.GenerateMipmap();
|
if (ForceMipmap) texture.GenerateMipmap();
|
||||||
|
|
||||||
page.rendererObject = texture;
|
page.rendererObject = texture;
|
||||||
|
|
||||||
|
// 有些旧的 atlas 会省略 size 行, 这时需要在读取纹理时赋值
|
||||||
|
if (page.width <= 0 || page.height <= 0)
|
||||||
|
{
|
||||||
|
var texSize = texture.Size;
|
||||||
|
page.width = (int)texSize.X;
|
||||||
|
page.height = (int)texSize.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Load(SpineRuntime38.AtlasPage page, string path)
|
public virtual void Load(SpineRuntime38.AtlasPage page, string path)
|
||||||
@@ -288,9 +328,13 @@ namespace Spine.Implementations
|
|||||||
|
|
||||||
page.rendererObject = texture;
|
page.rendererObject = texture;
|
||||||
|
|
||||||
// 似乎是不需要设置的, 因为存在某些 png 和 atlas 大小不同的情况, 一般是有一些缩放, 如果设置了反而渲染异常
|
// 有些旧的 atlas 会省略 size 行, 这时需要在读取纹理时赋值
|
||||||
// page.width = (int)texture.Size.X;
|
if (page.width <= 0 || page.height <= 0)
|
||||||
// page.height = (int)texture.Size.Y;
|
{
|
||||||
|
var texSize = texture.Size;
|
||||||
|
page.width = (int)texSize.X;
|
||||||
|
page.height = (int)texSize.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Load(SpineRuntime40.AtlasPage page, string path)
|
public virtual void Load(SpineRuntime40.AtlasPage page, string path)
|
||||||
@@ -326,6 +370,14 @@ namespace Spine.Implementations
|
|||||||
if (ForceMipmap) texture.GenerateMipmap();
|
if (ForceMipmap) texture.GenerateMipmap();
|
||||||
|
|
||||||
page.rendererObject = texture;
|
page.rendererObject = texture;
|
||||||
|
|
||||||
|
// 有些旧的 atlas 会省略 size 行, 这时需要在读取纹理时赋值
|
||||||
|
if (page.width <= 0 || page.height <= 0)
|
||||||
|
{
|
||||||
|
var texSize = texture.Size;
|
||||||
|
page.width = (int)texSize.X;
|
||||||
|
page.height = (int)texSize.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Load(SpineRuntime41.AtlasPage page, string path)
|
public virtual void Load(SpineRuntime41.AtlasPage page, string path)
|
||||||
@@ -361,6 +413,14 @@ namespace Spine.Implementations
|
|||||||
if (ForceMipmap) texture.GenerateMipmap();
|
if (ForceMipmap) texture.GenerateMipmap();
|
||||||
|
|
||||||
page.rendererObject = texture;
|
page.rendererObject = texture;
|
||||||
|
|
||||||
|
// 有些旧的 atlas 会省略 size 行, 这时需要在读取纹理时赋值
|
||||||
|
if (page.width <= 0 || page.height <= 0)
|
||||||
|
{
|
||||||
|
var texSize = texture.Size;
|
||||||
|
page.width = (int)texSize.X;
|
||||||
|
page.height = (int)texSize.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Load(SpineRuntime42.AtlasPage page, string path)
|
public virtual void Load(SpineRuntime42.AtlasPage page, string path)
|
||||||
@@ -396,6 +456,14 @@ namespace Spine.Implementations
|
|||||||
if (ForceMipmap) texture.GenerateMipmap();
|
if (ForceMipmap) texture.GenerateMipmap();
|
||||||
|
|
||||||
page.rendererObject = texture;
|
page.rendererObject = texture;
|
||||||
|
|
||||||
|
// 有些旧的 atlas 会省略 size 行, 这时需要在读取纹理时赋值
|
||||||
|
if (page.width <= 0 || page.height <= 0)
|
||||||
|
{
|
||||||
|
var texSize = texture.Size;
|
||||||
|
page.width = (int)texSize.X;
|
||||||
|
page.height = (int)texSize.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Unload(object texture)
|
public virtual void Unload(object texture)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
||||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||||
<Version>0.16.4</Version>
|
<Version>0.16.6</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ namespace SpineViewer
|
|||||||
_instanceMutex = new Mutex(true, MutexName, out var createdNew);
|
_instanceMutex = new Mutex(true, MutexName, out var createdNew);
|
||||||
if (!createdNew)
|
if (!createdNew)
|
||||||
{
|
{
|
||||||
ShowExistedInstance();
|
|
||||||
SendCommandLineArgs();
|
SendCommandLineArgs();
|
||||||
Environment.Exit(0); // 不再启动新实例
|
Environment.Exit(0); // 不再启动新实例
|
||||||
return;
|
return;
|
||||||
@@ -100,37 +99,6 @@ namespace SpineViewer
|
|||||||
LogManager.Configuration = config;
|
LogManager.Configuration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ShowExistedInstance()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// 遍历同名进程
|
|
||||||
var processes = Process.GetProcessesByName(ProcessName);
|
|
||||||
foreach (var p in processes)
|
|
||||||
{
|
|
||||||
// 跳过当前进程
|
|
||||||
if (p.Id == Process.GetCurrentProcess().Id)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
IntPtr hWnd = p.MainWindowHandle;
|
|
||||||
if (hWnd != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
// 3. 显示并置顶窗口
|
|
||||||
if (User32.IsIconic(hWnd))
|
|
||||||
{
|
|
||||||
User32.ShowWindow(hWnd, User32.SW_RESTORE);
|
|
||||||
}
|
|
||||||
User32.SetForegroundWindow(hWnd);
|
|
||||||
break; // 找到一个就可以退出
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// 忽略异常,不影响当前进程退出
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SendCommandLineArgs()
|
private static void SendCommandLineArgs()
|
||||||
{
|
{
|
||||||
var args = Environment.GetCommandLineArgs().Skip(1).ToArray();
|
var args = Environment.GetCommandLineArgs().Skip(1).ToArray();
|
||||||
@@ -188,11 +156,29 @@ namespace SpineViewer
|
|||||||
|
|
||||||
if (args.Count > 0)
|
if (args.Count > 0)
|
||||||
{
|
{
|
||||||
Current.Dispatcher.Invoke(() =>
|
try
|
||||||
{
|
{
|
||||||
var vm = (MainWindowViewModel)((MainWindow)Current.MainWindow).DataContext;
|
Current.Dispatcher.Invoke(() =>
|
||||||
vm.SpineObjectListViewModel.AddSpineObjectFromFileList(args);
|
{
|
||||||
});
|
// 只要收到参数就可以显示窗口了
|
||||||
|
var window = (MainWindow)Current.MainWindow;
|
||||||
|
window.Show();
|
||||||
|
if (window.WindowState == WindowState.Minimized)
|
||||||
|
{
|
||||||
|
window.WindowState = WindowState.Normal;
|
||||||
|
}
|
||||||
|
window.Activate();
|
||||||
|
|
||||||
|
// 尝试加载参数内容
|
||||||
|
var vm = (MainWindowViewModel)window.DataContext;
|
||||||
|
vm.SpineObjectListViewModel.AddSpineObjectFromFileList(args);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.Trace(ex.ToString());
|
||||||
|
_logger.Error("Failed to process arguments, {0}", ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
||||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||||
<Version>0.16.4</Version>
|
<Version>0.16.6</Version>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user