3 Commits
1.1 ... 1.3

Author SHA1 Message Date
max
1251736f5b Updated & tested with Unity 2019.1.8f1
Minor changes.
2019-07-03 00:02:40 +02:00
max
78e4fb0ad1 #if UNITY_EDITOR
Added '#if UNITY_EDITOR' to all the scripts that should only run/be used in the editor.
2019-05-04 13:29:02 +02:00
max
7990f987dc Settings, Hotkey bugfix.
null errors.
2019-03-31 18:45:16 +02:00
19 changed files with 104 additions and 64 deletions

View File

@ -1,3 +1,4 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -100,4 +101,5 @@ namespace MA_TextureAtlasserPro
}
}
}
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -163,4 +164,5 @@ namespace MA_TextureAtlasserPro
debugMode = isDebugging;
}
}
}
}
#endif

View File

@ -1,4 +1,5 @@
using System.Collections;
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@ -10,7 +11,7 @@ namespace MA_TextureAtlasserPro
public class MA_TextureAtlasserProSettings : ScriptableObject
{
[Header("Selection")]
public bool autoFocus = true;
public bool autoFocus = false;
[Header("Duplication:")]
public bool copySelectedQuadData = false;
@ -22,4 +23,5 @@ namespace MA_TextureAtlasserPro
public KeyCode removeQuadHotKey = KeyCode.R;
public KeyCode duplicateHotKey = KeyCode.D;
}
}
}
#endif

View File

@ -1,4 +1,5 @@
using System.Collections;
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -17,3 +18,4 @@ namespace MA_TextureAtlasserPro
public string name;
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
@ -32,4 +33,5 @@ namespace MA_TextureAtlasserPro
editIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "editIcon" + ".png"));
}
}
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -211,7 +212,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)
{
@ -377,4 +378,5 @@ namespace MA_TextureAtlasserPro
}
}
}
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -75,4 +76,5 @@ namespace MA_TextureAtlasserPro
}
}
}
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -131,4 +132,5 @@ namespace MA_TextureAtlasserPro
base.ProcessEvents(e, editorViewRect);
}
}
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -78,4 +79,5 @@ namespace MA_TextureAtlasserPro
base.ProcessEvents(e, editorViewRect);
}
}
}
}
#endif

View File

@ -1,4 +1,5 @@
using System.Collections;
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@ -52,4 +53,5 @@ namespace MA_TextureAtlasserPro
}
}
}
}
}
#endif

View File

@ -1,4 +1,5 @@
using System.Collections;
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MA_Editor;
@ -93,24 +94,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();
}
}
}
}
@ -144,4 +148,5 @@ namespace MA_TextureAtlasserPro
zoomCoordsOrigin = new Vector2(-(curWindow.position.width / 2) + (curWindow.position.width / 3), -(curWindow.position.height / 2) + (curWindow.position.height / 3));
}
}
}
}
#endif

View File

@ -1,4 +1,5 @@
using System.Collections;
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@ -167,4 +168,5 @@ namespace MA_TextureAtlasserPro
isLoaded = true;
}
}
}
}
#endif

View File

@ -1,4 +1,5 @@
using System.Collections;
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@ -132,4 +133,5 @@ namespace MA_TextureAtlasserPro
isLoaded = true;
}
}
}
}
#endif

View File

@ -1,4 +1,5 @@
using System.Collections;
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@ -118,4 +119,5 @@ namespace MA_TextureAtlasserPro
isLoaded = true;
}
}
}
}
#endif

View File

@ -1,6 +1,6 @@
//Maxartz15
//Version 1.0
//https://github.com/maxartz15/MA_EditorUtils
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -58,4 +58,5 @@ namespace MA_Editor.Grid
Handles.EndGUI();
}
}
}
}
#endif

View File

@ -1,6 +1,9 @@
//Maxartz15
//Version 1.0
//https://github.com/maxartz15/MA_EditorUtils
//References:
//http://martinecker.com/martincodes/unity-editor-window-zooming/
#if UNITY_EDITOR
using UnityEngine;
using MA_Editor;
@ -67,4 +70,5 @@ namespace MA_Editor.RectUtils
return multipliedRect;
}
}
}
}
#endif

View File

@ -1,6 +1,9 @@
//Maxartz15
//Version 1.0
//https://github.com/maxartz15/MA_EditorUtils
//References:
//http://martinecker.com/martincodes/unity-editor-window-zooming/
#if UNITY_EDITOR
using UnityEngine;
using MA_Editor;
using MA_Editor.RectUtils;
@ -36,4 +39,5 @@ namespace MA_Editor.GUILayoutZoom
GUI.BeginGroup(new Rect(0.0f, EditorWindowTabHeight, Screen.width, Screen.height));
}
}
}
}
#endif

View File

@ -1,6 +1,9 @@
//Maxartz15
//Version 1.0
//https://github.com/maxartz15/MA_MeshUtils
//References:
//http://wiki.unity3d.com/index.php?title=ObjExporter
#if UNITY_EDITOR
using System;
using System.IO;
using System.Text;
@ -89,15 +92,15 @@ namespace MA_Mesh
{
if(flipY)
{
Debug.Log("01" + uvs[i].x);
//Debug.Log("01" + uvs[i].x);
uvs[i] = new Vector2((uvs[i].x / atlasSize.x * textureRect.width) + (1 / atlasSize.x * textureRect.x), (uvs[i].y / atlasSize.y * textureRect.height) + (1 / atlasSize.y * (atlasSize.y - textureRect.height - textureRect.y)));
Debug.Log("02" + uvs[i].x);
//Debug.Log("02" + uvs[i].x);
}
else
{
Debug.Log("01" + uvs[i].x);
//Debug.Log("01" + uvs[i].x);
uvs[i] = new Vector2((uvs[i].x / atlasSize.x * textureRect.width) + (1 / atlasSize.x * textureRect.x), (uvs[i].y / atlasSize.y * textureRect.height) + (1 / atlasSize.y * textureRect.y));
Debug.Log("02" + uvs[i].x);
//Debug.Log("02" + uvs[i].x);
}
}
@ -184,4 +187,5 @@ namespace MA_Mesh
public string name;
public string textureName;
}
}
}
#endif

View File

@ -1,27 +1,22 @@
//Maxartz15
//Version 1.0
//Part of MA_TextureUtils
//https://github.com/maxartz15/MA_TextureUtils
//https://github.com/maxartz15/MA_TextureUtils
//References:
//http://www.gamasutra.com/blogs/JoshSutphin/20131007/201829/Adding_to_Unitys_BuiltIn_Classes_Using_Extension_Methods.php
//https://forum.unity3d.com/threads/contribution-texture2d-blur-in-c.185694/
//http://orbcreation.com/orbcreation/page.orb?1180
//https://support.unity3d.com/hc/en-us/articles/206486626-How-can-I-get-pixels-from-unreadable-textures-
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections;
using System.Collections.Generic;
//http://www.gamasutra.com/blogs/JoshSutphin/20131007/201829/Adding_to_Unitys_BuiltIn_Classes_Using_Extension_Methods.php
//https://forum.unity3d.com/threads/contribution-texture2d-blur-in-c.185694/
//http://orbcreation.com/orbcreation/page.orb?1180
//https://support.unity3d.com/hc/en-us/articles/206486626-How-can-I-get-pixels-from-unreadable-textures-
namespace MA_Texture
{
public static class MA_TextureUtils
{
/// <summary>
/// Some base converters and texture settings setters.
/// </summary>
public static Texture ConvertToReadableTexture(Texture texture)
{
if (texture == null)
@ -200,4 +195,5 @@ namespace MA_Texture
}
#endregion
}
}
}
#endif