Update/bugfix texture export, folder creation, minor changes.

Bugfix texture export: where textures regarding of their settings would be exported as sprites.
Update texture export: original textures will now be copied to get the pixel values with the correct import settings applied to prevent strange-looking normal maps and color changes.
Folder creation: the required folders will now be created by the tool, no need anymore to save empty folders.
Minor changes: Renamed some variables, testing a new layout error fix, started working on material export.
This commit is contained in:
max 2019-11-23 21:59:01 +01:00
parent e7ce849108
commit 279edb1e0e
26 changed files with 196 additions and 233 deletions

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 02a5a3da7e4e5dc4fb18fcef745fc000
folderAsset: yes
timeCreated: 1519504430
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1 +0,0 @@
The created atlasses wil go here.

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 720d130b97942404a8521a9f534e01a3
timeCreated: 1522673504
licenseType: Free
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: d57dd3d8bdc81434eb81f89cfbbd4dce
folderAsset: yes
timeCreated: 1519503997
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1 +0,0 @@
The exported assets will be saved in this folder.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 6fbeeec15b89634488a9e823027e41e5
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,6 +12,7 @@ namespace MA_TextureAtlasserPro
public ModelExportSettings modelExportSettings = new ModelExportSettings(); public ModelExportSettings modelExportSettings = new ModelExportSettings();
public TextureExportSettings textureExportSettings = new TextureExportSettings(); public TextureExportSettings textureExportSettings = new TextureExportSettings();
public MaterialExportSettings materialExportSettings = new MaterialExportSettings();
} }
[System.Serializable] [System.Serializable]
@ -60,4 +61,12 @@ namespace MA_TextureAtlasserPro
Sprite, Sprite,
SpriteSliced SpriteSliced
} }
[System.Serializable]
public class MaterialExportSettings
{
[Header("Material settings:")]
public string shader = "Standard";
public string[] shaderPropertyNames = { "_MainTex", "_MetallicGlossMap", "_BumpMap" };
}
} }

View File

@ -12,13 +12,15 @@ namespace MA_TextureAtlasserPro
public static class MA_TextureAtlasserProUtils public static class MA_TextureAtlasserProUtils
{ {
public const string SETTINGSASSETPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Settings/"; public const string TEXTURE_ATLASSER_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/";
public const string EXPORTSETTINGSASSETPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Settings/ExportSettings/"; public const string SETTINGS_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Settings/";
public const string SAVEASSETPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Atlasses/"; public const string SAVE_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Atlasses/";
public const string LOADASSETPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Atlasses/"; public const string LOAD_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Atlasses/";
public const string EXPORTASSETPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Exports/"; public const string EXPORT_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Exports/";
public const float VIEWOFFSET = 20; public const string TEMP_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Temp/";
public const string DEFAULTTEXTUREGROUPNAME = "Albedo";
public const string DEFAULT_TEXTURE_GROUP_NAME = "Albedo";
public const float VIEW_OFFSET = 20;
public static MA_TextureAtlasserProSettings CreateSettings() public static MA_TextureAtlasserProSettings CreateSettings()
{ {
@ -26,7 +28,8 @@ namespace MA_TextureAtlasserPro
if(_settings != null) if(_settings != null)
{ {
AssetDatabase.CreateAsset(_settings, SETTINGSASSETPATH + "MA_TextureAtlasserProSettings.asset"); CreateFolder(SETTINGS_ASSET_PATH);
AssetDatabase.CreateAsset(_settings, SETTINGS_ASSET_PATH + "MA_TextureAtlasserProSettings.asset");
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
AssetDatabase.Refresh(); AssetDatabase.Refresh();
@ -40,7 +43,7 @@ namespace MA_TextureAtlasserPro
public static MA_TextureAtlasserProSettings LoadSettings() public static MA_TextureAtlasserProSettings LoadSettings()
{ {
MA_TextureAtlasserProSettings _settings = AssetDatabase.LoadAssetAtPath(SETTINGSASSETPATH + "MA_TextureAtlasserProSettings.asset", typeof(MA_TextureAtlasserProSettings)) as MA_TextureAtlasserProSettings; MA_TextureAtlasserProSettings _settings = AssetDatabase.LoadAssetAtPath(SETTINGS_ASSET_PATH + "MA_TextureAtlasserProSettings.asset", typeof(MA_TextureAtlasserProSettings)) as MA_TextureAtlasserProSettings;
if (_settings == null) if (_settings == null)
{ {
@ -57,7 +60,8 @@ namespace MA_TextureAtlasserPro
if (_settings != null) if (_settings != null)
{ {
AssetDatabase.CreateAsset(_settings, EXPORTSETTINGSASSETPATH + name + ".asset"); CreateFolder(EXPORT_ASSET_PATH);
AssetDatabase.CreateAsset(_settings, SETTINGS_ASSET_PATH + name + ".asset");
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
AssetDatabase.Refresh(); AssetDatabase.Refresh();
@ -72,7 +76,7 @@ namespace MA_TextureAtlasserPro
public static MA_TextureAtlasserProExportSettings LoadExportSettings() public static MA_TextureAtlasserProExportSettings LoadExportSettings()
{ {
string name = "MA_DefaultExportSettings"; string name = "MA_DefaultExportSettings";
MA_TextureAtlasserProExportSettings _settings = AssetDatabase.LoadAssetAtPath(EXPORTSETTINGSASSETPATH + name + ".asset", typeof(MA_TextureAtlasserProExportSettings)) as MA_TextureAtlasserProExportSettings; MA_TextureAtlasserProExportSettings _settings = AssetDatabase.LoadAssetAtPath(SETTINGS_ASSET_PATH + name + ".asset", typeof(MA_TextureAtlasserProExportSettings)) as MA_TextureAtlasserProExportSettings;
if (_settings == null) if (_settings == null)
{ {
@ -91,7 +95,8 @@ namespace MA_TextureAtlasserPro
_atlas.CreateAtlas(name, size); _atlas.CreateAtlas(name, size);
MA_CheckTextureAtlas(_atlas); MA_CheckTextureAtlas(_atlas);
AssetDatabase.CreateAsset(_atlas, SAVEASSETPATH + name + ".asset"); CreateFolder(SAVE_ASSET_PATH);
AssetDatabase.CreateAsset(_atlas, SAVE_ASSET_PATH + name + ".asset");
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
AssetDatabase.Refresh(); AssetDatabase.Refresh();
@ -106,7 +111,7 @@ namespace MA_TextureAtlasserPro
public static MA_TextureAtlasserProAtlas LoadTextureAtlas() public static MA_TextureAtlasserProAtlas LoadTextureAtlas()
{ {
MA_TextureAtlasserProAtlas _atlas = null; MA_TextureAtlasserProAtlas _atlas = null;
string absPath = EditorUtility.OpenFilePanel("Select Texture Atlas", LOADASSETPATH, ""); string absPath = EditorUtility.OpenFilePanel("Select Texture Atlas", LOAD_ASSET_PATH, "");
if(absPath.StartsWith(Application.dataPath)) if(absPath.StartsWith(Application.dataPath))
{ {
@ -141,7 +146,7 @@ namespace MA_TextureAtlasserPro
MA_TextureGroupRegistration groupRegistration = new MA_TextureGroupRegistration MA_TextureGroupRegistration groupRegistration = new MA_TextureGroupRegistration
{ {
name = DEFAULTTEXTUREGROUPNAME name = DEFAULT_TEXTURE_GROUP_NAME
}; };
atlas.textureGroupRegistration.Add(groupRegistration); atlas.textureGroupRegistration.Add(groupRegistration);
@ -350,8 +355,39 @@ namespace MA_TextureAtlasserPro
return (value == 1); return (value == 1);
} }
public static void CreateFolder(string folderPath)
{
if (folderPath.LastIndexOf('/') == folderPath.Length - 1)
{
folderPath = folderPath.Remove(folderPath.LastIndexOf('/'));
}
if (!AssetDatabase.IsValidFolder(folderPath))
{
string parentPath = folderPath.Substring(0, folderPath.LastIndexOf('/'));
string folderName = folderPath.Substring(folderPath.LastIndexOf('/') + 1);
AssetDatabase.CreateFolder(parentPath, folderName);
AssetDatabase.Refresh();
}
}
public static void DeleteFolder(string folderPath)
{
if (folderPath.LastIndexOf('/') == folderPath.Length - 1)
{
folderPath = folderPath.Remove(folderPath.LastIndexOf('/'));
}
if (AssetDatabase.IsValidFolder(folderPath))
{
AssetDatabase.DeleteAsset(folderPath);
AssetDatabase.Refresh();
}
}
#region Export #region Export
public static void ExportAtlasModels(MA_TextureAtlasserProAtlas atlas, ModelExportSettings modelExportSettings, string savePath = EXPORTASSETPATH) public static void ExportAtlasModels(MA_TextureAtlasserProAtlas atlas, ModelExportSettings modelExportSettings, string savePath = EXPORT_ASSET_PATH)
{ {
switch(modelExportSettings.modelFormat) switch(modelExportSettings.modelFormat)
{ {
@ -365,7 +401,7 @@ namespace MA_TextureAtlasserPro
} }
} }
private static void ExportAtlasObj(MA_TextureAtlasserProAtlas atlas, ModelExportSettings modelExportSettings, string savePath = EXPORTASSETPATH) private static void ExportAtlasObj(MA_TextureAtlasserProAtlas atlas, ModelExportSettings modelExportSettings, string savePath = EXPORT_ASSET_PATH)
{ {
if (atlas == null || atlas.textureQuads == null) if (atlas == null || atlas.textureQuads == null)
return; return;
@ -424,7 +460,7 @@ namespace MA_TextureAtlasserPro
} }
} }
public static void ExportAtlasTextures(MA_TextureAtlasserProAtlas atlas, TextureExportSettings textureExportSettings, string savePath = EXPORTASSETPATH) public static void ExportAtlasTextures(MA_TextureAtlasserProAtlas atlas, TextureExportSettings textureExportSettings, string savePath = EXPORT_ASSET_PATH, string tempPath = TEXTURE_ATLASSER_PATH)
{ {
switch (textureExportSettings.textureFormat) switch (textureExportSettings.textureFormat)
{ {
@ -438,7 +474,7 @@ namespace MA_TextureAtlasserPro
} }
} }
private static void ExportAtlasPNG(MA_TextureAtlasserProAtlas atlas, TextureExportSettings textureExportSettings, string savePath = EXPORTASSETPATH) private static void ExportAtlasPNG(MA_TextureAtlasserProAtlas atlas, TextureExportSettings textureExportSettings, string savePath = EXPORT_ASSET_PATH, string tempPath = TEMP_ASSET_PATH)
{ {
if (atlas == null || atlas.textureQuads == null || atlas.textureGroupRegistration == null) if (atlas == null || atlas.textureQuads == null || atlas.textureGroupRegistration == null)
return; return;
@ -456,36 +492,80 @@ namespace MA_TextureAtlasserPro
{ {
if (q.textureGroups != null && q.textureGroups[i].texture != null) if (q.textureGroups != null && q.textureGroups[i].texture != null)
{ {
//Make temp copy
string orginalTexturePath = AssetDatabase.GetAssetPath(q.textureGroups[i].texture);
string orginalTextureExtension = System.IO.Path.GetExtension(orginalTexturePath);
//Create temp folder
CreateFolder(tempPath);
string tempTexturePath = tempPath + q.textureGroups[i].texture.name + orginalTextureExtension;
AssetDatabase.CopyAsset(orginalTexturePath, tempTexturePath);
//Set temp copy to default settings
TextureImporter tempTextureImporter = (TextureImporter)AssetImporter.GetAtPath(tempTexturePath);
tempTextureImporter.textureType = TextureImporterType.Default;
tempTextureImporter.sRGBTexture = false;
tempTextureImporter.alphaIsTransparency = false;
tempTextureImporter.maxTextureSize = (int)Mathf.Max(atlas.textureAtlasSize.x, atlas.textureAtlasSize.y);
tempTextureImporter.textureCompression = TextureImporterCompression.Uncompressed;
tempTextureImporter.SaveAndReimport();
//Load temp copy
Texture tempCopy = AssetDatabase.LoadAssetAtPath<Texture>(tempTextureImporter.assetPath);
//Create new texture part //Create new texture part
Texture2D newTexturePart = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(q.textureGroups[i].texture); Texture2D newTexturePart = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(tempCopy);
//Scale it //Scale it
newTexturePart = newTexturePart.MA_Scale2D((int)q.guiRect.width, (int)q.guiRect.height, textureExportSettings.textureScaleMode); newTexturePart = newTexturePart.MA_Scale2D((int)q.guiRect.width, (int)q.guiRect.height, textureExportSettings.textureScaleMode);
//Add it //Add it
newTexture = newTexture.MA_Combine2D(newTexturePart, (int)q.guiRect.x, (int)q.guiRect.y); newTexture = newTexture.MA_Combine2D(newTexturePart, (int)q.guiRect.x, (int)q.guiRect.y);
//Delete temp copy
AssetDatabase.DeleteAsset(tempTextureImporter.assetPath);
} }
} }
//Delete temp folder
DeleteFolder(tempPath);
//Save it //Save it
newTexture.MA_Save2D(newTexture.name, savePath); newTexture.MA_Save2D(newTexture.name, savePath);
TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(savePath + newTexture.name + ".png"); //Set settings.
switch (textureExportSettings.textureType)
{
case TextureType.Default:
{
TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(savePath + newTexture.name + '.' + textureExportSettings.textureFormat.ToString());
textureImporter.textureType = TextureImporterType.Default; textureImporter.textureType = TextureImporterType.Default;
textureImporter.SaveAndReimport(); textureImporter.SaveAndReimport();
} }
break;
SetAtlasPNGSpriteSettings(atlas, textureExportSettings, savePath); case TextureType.Sprite:
SetAtlasSpriteSettings(atlas, textureExportSettings, savePath);
break;
case TextureType.SpriteSliced:
SetAtlasSpriteSettings(atlas, textureExportSettings, savePath);
break;
default:
break;
}
}
//Refresh //Refresh
AssetDatabase.Refresh(); AssetDatabase.Refresh();
} }
private static void SetAtlasPNGSpriteSettings(MA_TextureAtlasserProAtlas atlas, TextureExportSettings textureExportSettings, string savePath = EXPORTASSETPATH) private static void SetAtlasSpriteSettings(MA_TextureAtlasserProAtlas atlas, TextureExportSettings textureExportSettings, string savePath = EXPORT_ASSET_PATH)
{ {
//Foreach texture group //Foreach texture group
for (int i = 0; i < atlas.textureGroupRegistration.Count; i++) for (int i = 0; i < atlas.textureGroupRegistration.Count; i++)
{ {
//Convert //Convert
string textureName = atlas.name + "_" + atlas.textureGroupRegistration[i].name + ".png"; string textureName = atlas.name + "_" + atlas.textureGroupRegistration[i].name + '.' + textureExportSettings.textureFormat.ToString();
TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(savePath + textureName); TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(savePath + textureName);
textureImporter.textureType = TextureImporterType.Sprite; textureImporter.textureType = TextureImporterType.Sprite;
textureImporter.alphaIsTransparency = true; textureImporter.alphaIsTransparency = true;
@ -522,6 +602,28 @@ namespace MA_TextureAtlasserPro
textureImporter.SaveAndReimport(); textureImporter.SaveAndReimport();
} }
} }
public static void ExportAtlasMaterial(MA_TextureAtlasserProAtlas atlas, MaterialExportSettings materialExportSettings, Texture[] textures, string savePath = EXPORT_ASSET_PATH)
{
if (atlas == null || atlas.textureQuads == null || atlas.textureGroupRegistration == null || textures == null)
return;
Shader shader = Shader.Find(materialExportSettings.shader);
if (shader)
{
Material material = new Material(shader);
material.name = atlas.name;
for (int i = 0; i < (int)Mathf.Max(materialExportSettings.shaderPropertyNames.Length - 1, textures.Length - 1); i++)
{
material.SetTexture(materialExportSettings.shaderPropertyNames[i], textures[i]);
}
//Save material
AssetDatabase.CreateAsset(material, EXPORT_ASSET_PATH + material.name);
AssetDatabase.Refresh();
}
}
#endregion #endregion
} }
} }

View File

@ -15,6 +15,8 @@ namespace MA_TextureAtlasserPro
private GUIStyle labelStyle = new GUIStyle(GUI.skin.label); private GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
bool useAddMeshButton = false;
public MA_TextureAtlasserProInspectorView(MA_TextureAtlasserProWindow currentEditorWindow, string title) : base(currentEditorWindow, title) public MA_TextureAtlasserProInspectorView(MA_TextureAtlasserProWindow currentEditorWindow, string title) : base(currentEditorWindow, title)
{ {
@ -30,8 +32,21 @@ namespace MA_TextureAtlasserPro
//Draw inspector //Draw inspector
if(curWindow.textureAtlas != null && curWindow.textureAtlas.selectedTextureQuad != null) if(curWindow.textureAtlas != null && curWindow.textureAtlas.selectedTextureQuad != null)
{ {
//Change layout during layout event to prevent gui errors
if (e.type == EventType.Layout)
{
if (curWindow.textureAtlas.selectedTextureQuad.meshes != null && curWindow.textureAtlas.selectedTextureQuad.meshes.Count == 0)
{
useAddMeshButton = true;
}
else
{
useAddMeshButton = false;
}
}
//Deselect GUI elements when we are focusing on a new quad //Deselect GUI elements when we are focusing on a new quad
if(lastSelectedQuad != curWindow.textureAtlas.selectedTextureQuad) if (lastSelectedQuad != curWindow.textureAtlas.selectedTextureQuad)
{ {
lastSelectedQuad = curWindow.textureAtlas.selectedTextureQuad; lastSelectedQuad = curWindow.textureAtlas.selectedTextureQuad;
GUI.FocusControl(null); GUI.FocusControl(null);
@ -43,7 +58,7 @@ namespace MA_TextureAtlasserPro
GUILayout.Label("Quad Name"); GUILayout.Label("Quad Name");
curWindow.textureAtlas.selectedTextureQuad.name = EditorGUILayout.TextField(curWindow.textureAtlas.selectedTextureQuad.name); curWindow.textureAtlas.selectedTextureQuad.name = EditorGUILayout.TextField(curWindow.textureAtlas.selectedTextureQuad.name);
GUILayout.Space(MA_TextureAtlasserProUtils.VIEWOFFSET / 2); GUILayout.Space(MA_TextureAtlasserProUtils.VIEW_OFFSET / 2);
//Textures //Textures
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
@ -83,19 +98,20 @@ namespace MA_TextureAtlasserPro
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
GUILayout.Space(MA_TextureAtlasserProUtils.VIEWOFFSET / 2); GUILayout.Space(MA_TextureAtlasserProUtils.VIEW_OFFSET / 2);
//Meshes //Meshes
GUILayout.Label("Meshes"); GUILayout.Label("Meshes");
if(curWindow.textureAtlas.selectedTextureQuad.meshes != null) if (useAddMeshButton)
{ {
if(curWindow.textureAtlas.selectedTextureQuad.meshes.Count == 0) if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
{
if(GUILayout.Button("+", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
{ {
curWindow.textureAtlas.selectedTextureQuad.meshes.Add(null); curWindow.textureAtlas.selectedTextureQuad.meshes.Add(null);
} }
} }
if (curWindow.textureAtlas.selectedTextureQuad.meshes != null)
{
for (int i = 0; i < curWindow.textureAtlas.selectedTextureQuad.meshes.Count; i++) for (int i = 0; i < curWindow.textureAtlas.selectedTextureQuad.meshes.Count; i++)
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
@ -116,8 +132,9 @@ namespace MA_TextureAtlasserPro
curWindow.textureAtlas.selectedTextureQuad.meshes = new List<Mesh>(); curWindow.textureAtlas.selectedTextureQuad.meshes = new List<Mesh>();
} }
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
if(!MA_TextureAtlasserProUtils.IsPowerOfTwo((int)curWindow.textureAtlas.selectedTextureQuad.guiRect.width) || !MA_TextureAtlasserProUtils.IsPowerOfTwo((int)curWindow.textureAtlas.selectedTextureQuad.guiRect.height)) if (!MA_TextureAtlasserProUtils.IsPowerOfTwo((int)curWindow.textureAtlas.selectedTextureQuad.guiRect.width) || !MA_TextureAtlasserProUtils.IsPowerOfTwo((int)curWindow.textureAtlas.selectedTextureQuad.guiRect.height))
{ {
labelStyle.normal.textColor = Color.red; labelStyle.normal.textColor = Color.red;
} }

View File

@ -41,7 +41,7 @@ namespace MA_TextureAtlasserPro
MA_TextureAtlasserProExportWindow.InitEditorWindow(curWindow); MA_TextureAtlasserProExportWindow.InitEditorWindow(curWindow);
//MA_TextureAtlasserProUtils.ExportAtlas(curWindow.textureAtlas); //MA_TextureAtlasserProUtils.ExportAtlas(curWindow.textureAtlas);
} }
GUILayout.Space(MA_TextureAtlasserProUtils.VIEWOFFSET); GUILayout.Space(MA_TextureAtlasserProUtils.VIEW_OFFSET);
if(curWindow.textureAtlas.showTextures && GUILayout.Button(MA_TextureAtlasserProIcons.showTexturesOnIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true))) if(curWindow.textureAtlas.showTextures && GUILayout.Button(MA_TextureAtlasserProIcons.showTexturesOnIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
{ {
curWindow.textureAtlas.showTextures = false; curWindow.textureAtlas.showTextures = false;
@ -50,7 +50,7 @@ namespace MA_TextureAtlasserPro
{ {
curWindow.textureAtlas.showTextures = true; curWindow.textureAtlas.showTextures = true;
} }
GUILayout.Space(MA_TextureAtlasserProUtils.VIEWOFFSET); GUILayout.Space(MA_TextureAtlasserProUtils.VIEW_OFFSET);
if(GUILayout.Button(MA_TextureAtlasserProIcons.createQuadIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true))) if(GUILayout.Button(MA_TextureAtlasserProIcons.createQuadIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
{ {
MA_TextureAtlasserProUtils.CreateTextureQuad(curWindow.textureAtlas, "new Quad", new Rect(0, 0, 128, 128), curWindow.settings.autoFocus); MA_TextureAtlasserProUtils.CreateTextureQuad(curWindow.textureAtlas, "new Quad", new Rect(0, 0, 128, 128), curWindow.settings.autoFocus);

View File

@ -47,7 +47,7 @@ namespace MA_TextureAtlasserPro
void OnGUI() void OnGUI()
{ {
GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, MA_TextureAtlasserProUtils.VIEWOFFSET, position.width - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2))); GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEW_OFFSET, MA_TextureAtlasserProUtils.VIEW_OFFSET, position.width - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 2)));
GUILayout.BeginVertical(); GUILayout.BeginVertical();
//Input options //Input options

View File

@ -95,7 +95,7 @@ namespace MA_TextureAtlasserPro
if(isLoaded) if(isLoaded)
{ {
GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, MA_TextureAtlasserProUtils.VIEWOFFSET, position.width - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2))); GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEW_OFFSET, MA_TextureAtlasserProUtils.VIEW_OFFSET, position.width - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 2)));
GUILayout.BeginVertical(); GUILayout.BeginVertical();
//Input options //Input options

View File

@ -88,7 +88,7 @@ namespace MA_TextureAtlasserPro
if(isLoaded) if(isLoaded)
{ {
GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, MA_TextureAtlasserProUtils.VIEWOFFSET, position.width - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2))); GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEW_OFFSET, MA_TextureAtlasserProUtils.VIEW_OFFSET, position.width - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 2)));
GUILayout.BeginVertical(); GUILayout.BeginVertical();
@ -156,6 +156,7 @@ namespace MA_TextureAtlasserPro
{ {
MA_TextureAtlasserProUtils.ExportAtlasModels(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.modelExportSettings); MA_TextureAtlasserProUtils.ExportAtlasModels(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.modelExportSettings);
MA_TextureAtlasserProUtils.ExportAtlasTextures(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.textureExportSettings); MA_TextureAtlasserProUtils.ExportAtlasTextures(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.textureExportSettings);
//MA_TextureAtlasserProUtils.ExportAtlasMaterial(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.materialExportSettings);
} }
GUI.enabled = wasEnabled; GUI.enabled = wasEnabled;

View File

@ -100,9 +100,9 @@ namespace MA_TextureAtlasserPro
//Calculate view rects //Calculate view rects
Rect workViewRect = new Rect(position.width - position.width, position.height - position.height, position.width, position.height); Rect workViewRect = new Rect(position.width - position.width, position.height - position.height, position.width, position.height);
Rect debugViewRect = new Rect(position.width - MA_TextureAtlasserProUtils.VIEWOFFSET - 164, position.height - MA_TextureAtlasserProUtils.VIEWOFFSET - 22, 164, 22); Rect debugViewRect = new Rect(position.width - MA_TextureAtlasserProUtils.VIEW_OFFSET - 164, position.height - MA_TextureAtlasserProUtils.VIEW_OFFSET - 22, 164, 22);
Rect menuViewRect = new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, MA_TextureAtlasserProUtils.VIEWOFFSET, position.width - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2), 44); Rect menuViewRect = new Rect(MA_TextureAtlasserProUtils.VIEW_OFFSET, MA_TextureAtlasserProUtils.VIEW_OFFSET, position.width - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 2), 44);
Rect inspectorViewRect = new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, menuViewRect.y + menuViewRect.height + MA_TextureAtlasserProUtils.VIEWOFFSET, 164, position.height - menuViewRect.height - (MA_TextureAtlasserProUtils.VIEWOFFSET * 3)); Rect inspectorViewRect = new Rect(MA_TextureAtlasserProUtils.VIEW_OFFSET, menuViewRect.y + menuViewRect.height + MA_TextureAtlasserProUtils.VIEW_OFFSET, 164, position.height - menuViewRect.height - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 3));
//Draw views and windows in the right oder from back to front //Draw views and windows in the right oder from back to front
if(isLoaded) if(isLoaded)

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f8bde1ccdaaf89e4fb4743ccfcff941d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 379a005a9f28e9948b62809c65bbcd1b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1 +0,0 @@
Export settigns are supposed to be here.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 797d231c0151c5146a0da1482b480f43
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,25 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f8eb652100ecb804dae35d0cca727164, type: 3}
m_Name: MA_DefaultExportSettings
m_EditorClassIdentifier:
canModify: 0
modelExportSettings:
modelFormat: 1
replaceModel: 0
uvFlipY: 1
uvChannel: 0
uvWrap: 1
textureExportSettings:
textureFormat: 1
textureType: 0
textureScaleMode: 0

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3a4e7ee656413624ea3ac0ab666cc5f7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,25 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f8eb652100ecb804dae35d0cca727164, type: 3}
m_Name: MA_DefaultSpriteExportSettings
m_EditorClassIdentifier:
canModify: 0
modelExportSettings:
modelFormat: 0
replaceModel: 0
uvFlipY: 0
uvChannel: 0
uvWrap: 0
textureExportSettings:
textureFormat: 1
textureType: 2
textureScaleMode: 0

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f2a8020dc0b658447b53eec982e136f4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,24 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 73f5e66553c13034e9b894ef2cc31b66, type: 3}
m_Name: MA_TextureAtlasserProSettings
m_EditorClassIdentifier:
useHotkeys: 0
modifierKey: 4
addQuadHotKey: 113
removeQuadHotKey: 114
duplicateHotKey: 100
zoomInHotKey: 61
zoomOutHotKey: 45
copySelectedQuadData: 1
duplicatedQuadNamePrefix: 'new '
autoFocus: 1

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 0be88ac94b5c5a44d96befde176454ac
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1 +0,0 @@
Settigns are supposed to be here.

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1dff191e3795506498c3ba0ec68a9f29
timeCreated: 1522673504
licenseType: Free
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant: