From 7990f987dcf87e16cf87c0207d852a9b70f6a4a7 Mon Sep 17 00:00:00 2001 From: max Date: Sun, 31 Mar 2019 18:45:16 +0200 Subject: [PATCH] Settings, Hotkey bugfix. null errors. --- .../Utils/MA_TextureAtlasserProUtils.cs | 2 +- .../Views/MA_TextureAtlasserProWorkView.cs | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/MA_ToolBox/MA_TextureAtlasserPro/Scripts/Editor/Utils/MA_TextureAtlasserProUtils.cs b/MA_ToolBox/MA_TextureAtlasserPro/Scripts/Editor/Utils/MA_TextureAtlasserProUtils.cs index 7541639..b0d47e0 100644 --- a/MA_ToolBox/MA_TextureAtlasserPro/Scripts/Editor/Utils/MA_TextureAtlasserProUtils.cs +++ b/MA_ToolBox/MA_TextureAtlasserPro/Scripts/Editor/Utils/MA_TextureAtlasserProUtils.cs @@ -211,7 +211,7 @@ namespace MA_TextureAtlasserPro { if(atlas != null && atlas.selectedTextureQuad != null) { - CreateTextureQuad(atlas, namePrefix + atlas.selectedTextureQuad.name, atlas.selectedTextureQuad.rect); + CreateTextureQuad(atlas, namePrefix + atlas.selectedTextureQuad.name, atlas.selectedTextureQuad.rect, false); if(copyData) { diff --git a/MA_ToolBox/MA_TextureAtlasserPro/Scripts/Editor/Views/MA_TextureAtlasserProWorkView.cs b/MA_ToolBox/MA_TextureAtlasserPro/Scripts/Editor/Views/MA_TextureAtlasserProWorkView.cs index 0d73d96..2fc9ea5 100644 --- a/MA_ToolBox/MA_TextureAtlasserPro/Scripts/Editor/Views/MA_TextureAtlasserProWorkView.cs +++ b/MA_ToolBox/MA_TextureAtlasserPro/Scripts/Editor/Views/MA_TextureAtlasserProWorkView.cs @@ -93,24 +93,27 @@ namespace MA_TextureAtlasserPro //Hotkeys. if (curWindow.settings.useHotkeys) { - if (e.type == EventType.KeyDown && e.keyCode == curWindow.settings.addQuadHotKey) + if(curWindow.textureAtlas != null) { - MA_TextureAtlasserProUtils.CreateTextureQuad(curWindow.textureAtlas, "new Quad", new Rect(0, 0, 128, 128), curWindow.settings.autoFocus); - e.Use(); - } - - if (curWindow.textureAtlas.selectedTextureQuad != null) - { - if (e.type == EventType.KeyDown && e.keyCode == curWindow.settings.removeQuadHotKey) + if (e.type == EventType.KeyDown && e.keyCode == curWindow.settings.addQuadHotKey) { - MA_TextureAtlasserProUtils.RemoveTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus); + MA_TextureAtlasserProUtils.CreateTextureQuad(curWindow.textureAtlas, "new Quad", new Rect(0, 0, 128, 128), curWindow.settings.autoFocus); e.Use(); } - if (e.type == EventType.KeyDown && e.keyCode == curWindow.settings.duplicateHotKey) + if (curWindow.textureAtlas.selectedTextureQuad != null) { - MA_TextureAtlasserProUtils.DuplicateTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus); - e.Use(); + if (e.type == EventType.KeyDown && e.keyCode == curWindow.settings.removeQuadHotKey) + { + MA_TextureAtlasserProUtils.RemoveTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus); + e.Use(); + } + + if (e.type == EventType.KeyDown && e.keyCode == curWindow.settings.duplicateHotKey) + { + MA_TextureAtlasserProUtils.DuplicateTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus, curWindow.settings.copySelectedQuadData, curWindow.settings.duplicatedQuadNamePrefix); + e.Use(); + } } } }