Merged goto01 and reworked some code.

Implemented the texture scaler provided by goto01 (Kiryl Tkachou) and removed the old ones.
Implmented the mesh export bugfixes.
Changed mesh export names.
Changed texture export names.
Updated the the export window.
Updated export functionality.
Updated hotkeys.
Fixed quad duplication bug.
Minor visual changes.

Co-Authored-By: Kiryl Tkachou <goto01@users.noreply.github.com>
This commit is contained in:
max
2019-08-30 01:11:33 +02:00
parent 26a0f68454
commit e81a4ec119
9 changed files with 435 additions and 505 deletions

View File

@ -36,7 +36,8 @@ namespace MA_TextureAtlasserPro
editorWorkRect = new Rect(Vector2.zero - zoomCoordsOrigin, textureAtlasSize);
GUI.backgroundColor = new Color(0, 0, 0, 0.1f);
GUI.Box(editorWorkRect, this.name);
GUI.Box(editorWorkRect, "");
GUI.Box(new Rect(editorWorkRect.x, editorWorkRect.y - 25, editorWorkRect.width, 20), this.name);
GUI.backgroundColor = Color.white;
MA_Editor.Grid.Grid.DrawZoomableGrid(editorWorkRect, 64, new Color(0, 0, 0, 0.1f), zoomCoordsOrigin);

View File

@ -25,7 +25,6 @@ namespace MA_TextureAtlasserPro
public Rect dragRectPos;
//Data
public Texture texture; //Replace this with texture groups
public List<MA_TextureGroup> textureGroups;
public List<Mesh> meshes;
@ -43,7 +42,7 @@ namespace MA_TextureAtlasserPro
//Clamp and snap the guiRect
guiRect = new Rect(Mathf.RoundToInt(rect.x / 32) * 32, Mathf.RoundToInt(rect.y / 32) * 32, Mathf.RoundToInt(rect.width / 32) * 32, Mathf.RoundToInt(rect.height / 32) * 32);
//Draw the sqaud background
//Draw the quad background
if(showTexture && textureGroups != null && textureGroups.Count > 0 && textureGroups[0].texture != null)
GUI.DrawTexture(new Rect(guiRect.x - zoomCoordsOrigin.x, guiRect.y - zoomCoordsOrigin.y, guiRect.width, guiRect.height), textureGroups[0].texture, ScaleMode.StretchToFill);
else
@ -54,8 +53,8 @@ namespace MA_TextureAtlasserPro
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
var tempColor = GUI.backgroundColor;
GUI.backgroundColor = Color.white;
GUILayout.Label(this.name, GUI.skin.box);
GUI.backgroundColor = new Color(1, 1, 1, 0.7f);
GUILayout.Label(" " + this.name + " ", GUI.skin.box);
GUI.backgroundColor = tempColor;
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

View File

@ -10,18 +10,31 @@ namespace MA_TextureAtlasserPro
[System.Serializable]
public class MA_TextureAtlasserProSettings : ScriptableObject
{
[Header("Selection")]
public bool autoFocus = false;
[Header("Duplication:")]
public bool copySelectedQuadData = false;
public string duplicatedQuadNamePrefix = "new ";
[Header("Hotkeys:")]
public bool useHotkeys = false;
public EventModifiers modifierKey = EventModifiers.Alt;
public KeyCode addQuadHotKey = KeyCode.Q;
public KeyCode removeQuadHotKey = KeyCode.R;
public KeyCode duplicateHotKey = KeyCode.D;
public KeyCode zoomInHotKey = KeyCode.Equals;
public KeyCode zoomOutHotKey = KeyCode.Minus;
[Header("Duplication:")]
public bool copySelectedQuadData = true;
public string duplicatedQuadNamePrefix = "new ";
[Header("Selection")]
public bool autoFocus = true;
public bool GetHotKey(Event e, KeyCode shortKey)
{
if (e.type == EventType.KeyDown && e.modifiers == modifierKey && e.keyCode == shortKey)
{
return true;
}
return false;
}
}
}
#endif