Settings, Hotkey bugfix.

null errors.
This commit is contained in:
max 2019-03-31 18:45:16 +02:00
parent 82efcbb6d0
commit 7990f987dc
2 changed files with 16 additions and 13 deletions

View File

@ -211,7 +211,7 @@ namespace MA_TextureAtlasserPro
{ {
if(atlas != null && atlas.selectedTextureQuad != null) 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) if(copyData)
{ {

View File

@ -93,24 +93,27 @@ namespace MA_TextureAtlasserPro
//Hotkeys. //Hotkeys.
if (curWindow.settings.useHotkeys) 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); if (e.type == EventType.KeyDown && e.keyCode == curWindow.settings.addQuadHotKey)
e.Use();
}
if (curWindow.textureAtlas.selectedTextureQuad != null)
{
if (e.type == EventType.KeyDown && e.keyCode == curWindow.settings.removeQuadHotKey)
{ {
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(); 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); if (e.type == EventType.KeyDown && e.keyCode == curWindow.settings.removeQuadHotKey)
e.Use(); {
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();
}
} }
} }
} }