Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
b2a005356d | |||
05b4ea9f80 | |||
0933abdace | |||
5d112a2ced | |||
650600fac3 | |||
b2ccdb2273 | |||
|
df16ba6c05 | ||
|
a3c002cb17 | ||
|
0907259aa8 | ||
|
fa40b918d0 | ||
|
8ff2db7e87 | ||
|
3532465e69 | ||
|
6c2daebb56 | ||
|
696ef848e0 | ||
521cb34541 | |||
d8c59e86ca | |||
e894fcf797 | |||
0dfa466d78 | |||
78f3daa145 | |||
406720d718 | |||
947eb6f18e | |||
279edb1e0e | |||
e7ce849108 | |||
13de8b8e2a | |||
a728366035 | |||
e81a4ec119 | |||
26a0f68454 | |||
|
9f5240967a | ||
|
9a13ddb24e | ||
|
6ac386c1b5 | ||
|
e2abb77afe | ||
|
68b3ddaaa1 | ||
|
9d53f74c4b | ||
7f17793af0 | |||
09f7c488b9 | |||
1251736f5b | |||
78e4fb0ad1 | |||
7990f987dc |
58
.gitignore
vendored
@ -1,13 +1,33 @@
|
|||||||
[Ll]ibrary/
|
# ignore p4
|
||||||
[Tt]emp/
|
.p4ignore
|
||||||
[Oo]bj/
|
|
||||||
[Bb]uild/
|
# This .gitignore file should be placed at the root of your Unity project directory
|
||||||
[Bb]uilds/
|
#
|
||||||
Assets/AssetStoreTools*
|
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
|
||||||
|
#
|
||||||
|
/[Ll]ibrary/
|
||||||
|
/[Tt]emp/
|
||||||
|
/[Oo]bj/
|
||||||
|
/[Bb]uild/
|
||||||
|
/[Bb]uilds/
|
||||||
|
/[Ll]ogs/
|
||||||
|
/[Mm]emoryCaptures/
|
||||||
|
|
||||||
|
# Never ignore Asset meta data
|
||||||
|
!/[Aa]ssets/**/*.meta
|
||||||
|
|
||||||
|
# Uncomment this line if you wish to ignore the asset store tools plugin
|
||||||
|
/[Aa]ssets/AssetStoreTools*
|
||||||
|
|
||||||
|
# Autogenerated Jetbrains Rider plugin
|
||||||
|
[Aa]ssets/Plugins/Editor/JetBrains*
|
||||||
|
|
||||||
# Visual Studio cache directory
|
# Visual Studio cache directory
|
||||||
.vs/
|
.vs/
|
||||||
|
|
||||||
|
# Gradle cache directory
|
||||||
|
.gradle/
|
||||||
|
|
||||||
# Autogenerated VS/MD/Consulo solution and project files
|
# Autogenerated VS/MD/Consulo solution and project files
|
||||||
ExportedObj/
|
ExportedObj/
|
||||||
.consulo/
|
.consulo/
|
||||||
@ -22,22 +42,34 @@ ExportedObj/
|
|||||||
*.booproj
|
*.booproj
|
||||||
*.svd
|
*.svd
|
||||||
*.pdb
|
*.pdb
|
||||||
|
*.mdb
|
||||||
*.opendb
|
*.opendb
|
||||||
|
*.VC.db
|
||||||
|
|
||||||
# Unity3D generated meta files
|
# Unity3D generated meta files
|
||||||
*.pidb.meta
|
*.pidb.meta
|
||||||
*.pdb.meta
|
*.pdb.meta
|
||||||
|
*.mdb.meta
|
||||||
|
|
||||||
# Unity3D meta files (not needed for the git)
|
# Unity3D generated file on crash reports
|
||||||
*.meta
|
|
||||||
|
|
||||||
# Unity3D Generated File On Crash Reports
|
|
||||||
sysinfo.txt
|
sysinfo.txt
|
||||||
|
|
||||||
# Builds
|
# Builds
|
||||||
*.apk
|
*.apk
|
||||||
*.unitypackage
|
*.unitypackage
|
||||||
|
|
||||||
# WorkFiles
|
# Crashlytics generated file
|
||||||
*.psd
|
crashlytics-build.properties
|
||||||
*.fbx
|
|
||||||
|
# workfiles
|
||||||
|
MA_ToolBox/MA_TextureAtlasserPro/Atlasses/*
|
||||||
|
!Atlasses.txt
|
||||||
|
MA_ToolBox/MA_TextureAtlasserPro/Exports/*
|
||||||
|
!Exports.txt
|
||||||
|
MA_ToolBox/MA_TextureAtlasserPro/Settings/*
|
||||||
|
!Settings.txt
|
||||||
|
!MA_TextureAtlasserProSettings.asset
|
||||||
|
MA_ToolBox/MA_TextureAtlasserPro/Settings/ExportSettings/*
|
||||||
|
!ExportSettings.txt
|
||||||
|
!MA_DefaultExportSettings.asset
|
||||||
|
!MA_DefaultSpriteExportSettings.asset
|
8
Assets/MA_ToolBox.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b328187c4d5fec24c8a228ada84605a6
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
9
Assets/MA_ToolBox/MA_TextureAtlasserPro.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f40356e4c9590fc46a493c26a5fbf937
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1519389465
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
9
Assets/MA_ToolBox/MA_TextureAtlasserPro/Icons.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c7a2224cc47fce489a08fb2b34f797c
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1519492248
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 1006 B After Width: | Height: | Size: 1006 B |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 60e555e14fc6a6345a5ee996a49886cb
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 278 B |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 08efa850d9174c947b67855c7813bc63
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 164 B |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 27381d6123e7e5b4eb9d79829b15c2ef
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e7a93919b4509be4aa9f6bd0bb61c1e7
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 301 B |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 05827eed0f3107e4c840c206ceccd7ee
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 1006 B After Width: | Height: | Size: 1006 B |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 25f247791349617498d1ab94bc82ed23
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 878 B |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9f3720ab6077d734780437442e00cd64
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d4c871fedd726904ca8aee58ef52f7a3
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 846 B After Width: | Height: | Size: 846 B |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 750fec6ea06f5504ba56751ecdf9de11
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,86 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6ed3341c780c2894488f04a7203770b9
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 2
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 32
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 2
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
21
Assets/MA_ToolBox/MA_TextureAtlasserPro/LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Max Kruf
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
7
Assets/MA_ToolBox/MA_TextureAtlasserPro/LICENSE.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: daea7b193e8882449a5b12b2b7ac1e2a
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
1
Assets/MA_ToolBox/MA_TextureAtlasserPro/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
README: https://github.com/maxartz15/MA_TextureAtlasser/blob/master/README.md
|
7
Assets/MA_ToolBox/MA_TextureAtlasserPro/README.md.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b27eb5167882915458c9b7ce07b6e712
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
9
Assets/MA_ToolBox/MA_TextureAtlasserPro/Scripts.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 92654d379bc273e4a96514e5306df9e8
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1519389476
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e50a55aa9cc7b30439e7923a3078b9f7
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1519391732
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 34f8bb860cb13ac49ab6602f84a27dfd
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,30 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MA_TextureAtlasserPro
|
||||||
|
{
|
||||||
|
[CustomEditor(typeof(MA_TextureAtlasserProSettings))]
|
||||||
|
[CanEditMultipleObjects]
|
||||||
|
public class MA_TextureAtlasserProSettingsEditor : Editor
|
||||||
|
{
|
||||||
|
GUIContent reloadButton = new GUIContent("Reload", "Update the editor with the changes made.");
|
||||||
|
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
GUILayout.BeginVertical();
|
||||||
|
DrawDefaultInspector();
|
||||||
|
|
||||||
|
GUILayout.Space(15);
|
||||||
|
|
||||||
|
if(GUILayout.Button(reloadButton, GUILayout.Height(40), GUILayout.ExpandWidth(true)))
|
||||||
|
{
|
||||||
|
//Update necessary systems.
|
||||||
|
MA_TextureAtlasserProGuiLoader.LoadEditorGui((MA_TextureAtlasserProSettings)this.target);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9850f2b069cfb36498e9601e4884071a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,15 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MA_TextureAtlasserPro
|
||||||
|
{
|
||||||
|
[System.Serializable]
|
||||||
|
public class MA_ModelGroup
|
||||||
|
{
|
||||||
|
public string name = "Model";
|
||||||
|
public List<Mesh> meshes = new List<Mesh>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1f74ddc7d8c9c30429ec163b4fc801c4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,3 +1,4 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -14,8 +15,8 @@ namespace MA_TextureAtlasserPro
|
|||||||
public List<MA_TextureAtlasserProQuad> textureQuads;
|
public List<MA_TextureAtlasserProQuad> textureQuads;
|
||||||
public MA_TextureAtlasserProQuad selectedTextureQuad;
|
public MA_TextureAtlasserProQuad selectedTextureQuad;
|
||||||
private Rect editorWorkRect;
|
private Rect editorWorkRect;
|
||||||
public bool showTextures = false;
|
public bool showTextures = true;
|
||||||
|
public MA_TextureAtlasserProExportSettings exportSettings;
|
||||||
|
|
||||||
//Data
|
//Data
|
||||||
public Vector2 textureAtlasSize;
|
public Vector2 textureAtlasSize;
|
||||||
@ -35,7 +36,8 @@ namespace MA_TextureAtlasserPro
|
|||||||
editorWorkRect = new Rect(Vector2.zero - zoomCoordsOrigin, textureAtlasSize);
|
editorWorkRect = new Rect(Vector2.zero - zoomCoordsOrigin, textureAtlasSize);
|
||||||
|
|
||||||
GUI.backgroundColor = new Color(0, 0, 0, 0.1f);
|
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;
|
GUI.backgroundColor = Color.white;
|
||||||
|
|
||||||
MA_Editor.Grid.Grid.DrawZoomableGrid(editorWorkRect, 64, new Color(0, 0, 0, 0.1f), zoomCoordsOrigin);
|
MA_Editor.Grid.Grid.DrawZoomableGrid(editorWorkRect, 64, new Color(0, 0, 0, 0.1f), zoomCoordsOrigin);
|
||||||
@ -100,4 +102,5 @@ namespace MA_TextureAtlasserPro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 892d1a7aeb4cc284dbf62e69e125db52
|
||||||
|
timeCreated: 1519392859
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,69 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using MA_Texture;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MA_TextureAtlasserPro
|
||||||
|
{
|
||||||
|
[System.Serializable]
|
||||||
|
public class MA_TextureAtlasserProExportSettings : ScriptableObject
|
||||||
|
{
|
||||||
|
[HideInInspector]
|
||||||
|
public bool canModify = true;
|
||||||
|
|
||||||
|
public bool exportModels = true;
|
||||||
|
public ModelExportSettings modelExportSettings = new ModelExportSettings();
|
||||||
|
public bool exportTextures = true;
|
||||||
|
public TextureExportSettings textureExportSettings = new TextureExportSettings();
|
||||||
|
public bool exportMaterials = true;
|
||||||
|
public MaterialExportSettings materialExportSettings = new MaterialExportSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class ModelExportSettings
|
||||||
|
{
|
||||||
|
[Header("Model settings:")]
|
||||||
|
public ModelFormat modelFormat = ModelFormat.UnityMeshPrefab;
|
||||||
|
public bool uvFlipY = true;
|
||||||
|
public int uvChannel = 0;
|
||||||
|
public bool uvWrap = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class TextureExportSettings
|
||||||
|
{
|
||||||
|
[Header("Texture settings:")]
|
||||||
|
public TextureFormat textureFormat = TextureFormat.Png;
|
||||||
|
public TextureType textureType = TextureType.Default;
|
||||||
|
public MA_TextureUtils.TextureScaleMode textureScaleMode = MA_TextureUtils.TextureScaleMode.Bilinear;
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class MaterialExportSettings
|
||||||
|
{
|
||||||
|
[Header("Material settings:")]
|
||||||
|
public Shader shader = null;
|
||||||
|
public List<string> shaderPropertyNames = new List<string>() { "_MainTex", "_MetallicGlossMap", "_BumpMap" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ModelFormat
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
UnityMeshPrefab
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TextureFormat
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Png
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TextureType
|
||||||
|
{
|
||||||
|
Default,
|
||||||
|
Sprite,
|
||||||
|
SpriteSliced
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f8eb652100ecb804dae35d0cca727164
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,3 +1,4 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -10,23 +11,28 @@ namespace MA_TextureAtlasserPro
|
|||||||
public class MA_TextureAtlasserProQuad : ScriptableObject
|
public class MA_TextureAtlasserProQuad : ScriptableObject
|
||||||
{
|
{
|
||||||
//Editor
|
//Editor
|
||||||
public bool isSelected = false; //Is this thing selected
|
[HideInInspector]
|
||||||
public Rect rect; //The internal rect
|
public bool isSelected = false; //Is this thing selected
|
||||||
public Rect guiRect; //The visual clamped and snapped rect
|
public Rect rect; //The internal rect
|
||||||
public bool debugMode = false; //Are we debugging, for showing some other things (like handles)
|
[HideInInspector]
|
||||||
|
public Rect guiRect; //The visual clamped and snapped rect
|
||||||
|
[HideInInspector]
|
||||||
|
public bool debugMode = false; //Are we debugging, for showing some other things (like handles)
|
||||||
|
|
||||||
private bool isDragging = false; //Are we editing the pos or size
|
private bool isDragging = false; //Are we editing the pos or size
|
||||||
private bool isDraggingRectHeigt = false;
|
private bool isDraggingRectHeigt = false;
|
||||||
|
[HideInInspector]
|
||||||
public Rect dragRectHeight;
|
public Rect dragRectHeight;
|
||||||
private bool isDraggingRectWidth = false;
|
private bool isDraggingRectWidth = false;
|
||||||
|
[HideInInspector]
|
||||||
public Rect dragRectWidth;
|
public Rect dragRectWidth;
|
||||||
private bool isDraggingRectPos = false;
|
private bool isDraggingRectPos = false;
|
||||||
|
[HideInInspector]
|
||||||
public Rect dragRectPos;
|
public Rect dragRectPos;
|
||||||
|
|
||||||
//Data
|
//Data
|
||||||
public Texture texture; //Replace this with texture groups
|
|
||||||
public List<MA_TextureGroup> textureGroups;
|
public List<MA_TextureGroup> textureGroups;
|
||||||
public List<Mesh> meshes;
|
public List<MA_ModelGroup> modelGroups;
|
||||||
|
|
||||||
public void UpdateTextureQuad(Event e, Rect editorViewRect, Rect editorWorkRect, Vector2 zoomCoordsOrigin, bool useEvents, bool showTexture)
|
public void UpdateTextureQuad(Event e, Rect editorViewRect, Rect editorWorkRect, Vector2 zoomCoordsOrigin, bool useEvents, bool showTexture)
|
||||||
{
|
{
|
||||||
@ -42,7 +48,7 @@ namespace MA_TextureAtlasserPro
|
|||||||
//Clamp and snap the guiRect
|
//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);
|
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)
|
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);
|
GUI.DrawTexture(new Rect(guiRect.x - zoomCoordsOrigin.x, guiRect.y - zoomCoordsOrigin.y, guiRect.width, guiRect.height), textureGroups[0].texture, ScaleMode.StretchToFill);
|
||||||
else
|
else
|
||||||
@ -52,7 +58,10 @@ namespace MA_TextureAtlasserPro
|
|||||||
|
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
GUILayout.FlexibleSpace();
|
GUILayout.FlexibleSpace();
|
||||||
GUILayout.Label(this.name);
|
var tempColor = GUI.backgroundColor;
|
||||||
|
GUI.backgroundColor = new Color(1, 1, 1, 0.7f);
|
||||||
|
GUILayout.Label(" " + this.name + " ", GUI.skin.box);
|
||||||
|
GUI.backgroundColor = tempColor;
|
||||||
GUILayout.FlexibleSpace();
|
GUILayout.FlexibleSpace();
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
@ -163,4 +172,5 @@ namespace MA_TextureAtlasserPro
|
|||||||
debugMode = isDebugging;
|
debugMode = isDebugging;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 16ad07a78750c7644b710e19e1a23d4a
|
||||||
|
timeCreated: 1519392859
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,56 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using MA_Editor;
|
||||||
|
|
||||||
|
namespace MA_TextureAtlasserPro
|
||||||
|
{
|
||||||
|
[System.Serializable]
|
||||||
|
public class MA_TextureAtlasserProSettings : ScriptableObject
|
||||||
|
{
|
||||||
|
[Header("GUI (requires reload):")]
|
||||||
|
public MA_TextureAtlasserProGuiSettings editorGuiSettings = new MA_TextureAtlasserProGuiSettings();
|
||||||
|
|
||||||
|
[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 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class MA_TextureAtlasserProGuiSettings
|
||||||
|
{
|
||||||
|
public MA_EditorGuiMode editorGuiMode = MA_EditorGuiMode.IconAndText;
|
||||||
|
public bool enableToolTips = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum MA_EditorGuiMode
|
||||||
|
{
|
||||||
|
IconAndText = 0,
|
||||||
|
Icon = 1,
|
||||||
|
Text = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 73f5e66553c13034e9b894ef2cc31b66
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -17,3 +18,4 @@ namespace MA_TextureAtlasserPro
|
|||||||
public string name;
|
public string name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ad995f47c542a7f4d9148cd7d5c9cfda
|
||||||
|
timeCreated: 1520097393
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1a34d83791d6c9241a9051b316c58169
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1519389484
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4dc196a605811ff4593b2c3d6eab83df
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1519393169
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,115 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace MA_TextureAtlasserPro
|
||||||
|
{
|
||||||
|
public static class MA_TextureAtlasserProGuiLoader
|
||||||
|
{
|
||||||
|
private const string LOADICONPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Icons/";
|
||||||
|
|
||||||
|
public static GUIContent createAtlasGC;
|
||||||
|
public static GUIContent loadAtlasGC;
|
||||||
|
public static GUIContent exportAtlasGC;
|
||||||
|
public static GUIContent createQuadGC;
|
||||||
|
public static GUIContent removeQuadGC;
|
||||||
|
public static GUIContent duplicateQuadGC;
|
||||||
|
public static GUIContent showTexturesOnGC;
|
||||||
|
public static GUIContent showTexturesOffGC;
|
||||||
|
public static GUIContent dragHandleGC;
|
||||||
|
public static GUIContent editGC;
|
||||||
|
public static GUIContent createExportSettingsGC;
|
||||||
|
|
||||||
|
public static void LoadEditorGui(MA_TextureAtlasserProSettings settings)
|
||||||
|
{
|
||||||
|
createAtlasGC = new GUIContent();
|
||||||
|
loadAtlasGC = new GUIContent();
|
||||||
|
exportAtlasGC = new GUIContent();
|
||||||
|
createQuadGC = new GUIContent();
|
||||||
|
removeQuadGC = new GUIContent();
|
||||||
|
duplicateQuadGC = new GUIContent();
|
||||||
|
showTexturesOnGC = new GUIContent();
|
||||||
|
showTexturesOffGC = new GUIContent();
|
||||||
|
dragHandleGC = new GUIContent();
|
||||||
|
editGC = new GUIContent();
|
||||||
|
createExportSettingsGC = new GUIContent();
|
||||||
|
|
||||||
|
switch (settings.editorGuiSettings.editorGuiMode)
|
||||||
|
{
|
||||||
|
case MA_EditorGuiMode.IconAndText:
|
||||||
|
LoadIcons();
|
||||||
|
LoadText();
|
||||||
|
break;
|
||||||
|
case MA_EditorGuiMode.Icon:
|
||||||
|
LoadIcons();
|
||||||
|
break;
|
||||||
|
case MA_EditorGuiMode.Text:
|
||||||
|
LoadText();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LoadIcons();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.editorGuiSettings.enableToolTips)
|
||||||
|
{
|
||||||
|
LoadToolTips(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Exceptions.
|
||||||
|
dragHandleGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "dragHandleIcon" + ".png");
|
||||||
|
dragHandleGC.text = "";
|
||||||
|
editGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "editIcon" + ".png");
|
||||||
|
editGC.text = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void LoadIcons()
|
||||||
|
{
|
||||||
|
createAtlasGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "createAtlasIcon" + ".png");
|
||||||
|
loadAtlasGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "loadAtlasIcon" + ".png");
|
||||||
|
exportAtlasGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "exportAtlasIcon" + ".png");
|
||||||
|
createQuadGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "createQuadIcon" + ".png");
|
||||||
|
removeQuadGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "removeQuadIcon" + ".png");
|
||||||
|
duplicateQuadGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "duplicateQuadIcon" + ".png");
|
||||||
|
showTexturesOnGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "showTexturesOnIcon" + ".png");
|
||||||
|
showTexturesOffGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "showTexturesOffIcon" + ".png");
|
||||||
|
createExportSettingsGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "createAtlasIcon" + ".png");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void LoadText()
|
||||||
|
{
|
||||||
|
createAtlasGC.text = "Create Atlas";
|
||||||
|
loadAtlasGC.text = "Load Atlas";
|
||||||
|
exportAtlasGC.text = "Export Atlas";
|
||||||
|
createQuadGC.text = "Create Quad";
|
||||||
|
removeQuadGC.text = "Remove Quad";
|
||||||
|
duplicateQuadGC.text = "Duplicate Quad";
|
||||||
|
showTexturesOnGC.text = "Hide Textures";
|
||||||
|
showTexturesOffGC.text = "Show Textures";
|
||||||
|
createExportSettingsGC.text = "Create Export Settings";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void LoadToolTips(MA_TextureAtlasserProSettings settings)
|
||||||
|
{
|
||||||
|
createAtlasGC.tooltip = "Opens the create atlas window.";
|
||||||
|
loadAtlasGC.tooltip = "Load an existing atlas.";
|
||||||
|
exportAtlasGC.tooltip = "Opens the export window.";
|
||||||
|
if (settings.useHotkeys)
|
||||||
|
{
|
||||||
|
createQuadGC.tooltip = string.Format("({0}+{1}), Creates a new quad.", settings.modifierKey, settings.addQuadHotKey);
|
||||||
|
removeQuadGC.tooltip = string.Format("({0}+{1}), Removes the selected quad.", settings.modifierKey, settings.removeQuadHotKey);
|
||||||
|
duplicateQuadGC.tooltip = string.Format("({0}+{1}), Duplicates the selected quad.", settings.modifierKey, settings.duplicateHotKey);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
createQuadGC.tooltip = "Creates a new quad.";
|
||||||
|
removeQuadGC.tooltip = "Removes the selected quad.";
|
||||||
|
duplicateQuadGC.tooltip = "Duplicates the selected quad.";
|
||||||
|
}
|
||||||
|
showTexturesOnGC.tooltip = "Hides the preview of the first texture on the quads.";
|
||||||
|
showTexturesOffGC.tooltip = "Shows a preview of the first texture on the quads.";
|
||||||
|
createExportSettingsGC.tooltip = "Opens the create export settings window.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1547329de58c58d4eb6b272309da0c85
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,684 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using MA_Mesh;
|
||||||
|
using MA_Texture;
|
||||||
|
using MA_Toolbox.Utils.Editor;
|
||||||
|
using MA_Toolbox.Utils;
|
||||||
|
|
||||||
|
namespace MA_TextureAtlasserPro
|
||||||
|
{
|
||||||
|
public static class MA_TextureAtlasserProUtils
|
||||||
|
{
|
||||||
|
public const string TEXTURE_ATLASSER_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/";
|
||||||
|
public const string SETTINGS_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Settings/";
|
||||||
|
public const string SAVE_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Atlasses/";
|
||||||
|
public const string LOAD_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Atlasses/";
|
||||||
|
public const string EXPORT_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Exports/";
|
||||||
|
public const string TEMP_ASSET_PATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Temp/";
|
||||||
|
|
||||||
|
public const string DEFAULT_TEXTURE_GROUP_NAME = "Albedo";
|
||||||
|
public const float VIEW_OFFSET = 20;
|
||||||
|
|
||||||
|
public static MA_TextureAtlasserProSettings CreateSettings()
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProSettings _settings = ScriptableObject.CreateInstance<MA_TextureAtlasserProSettings>();
|
||||||
|
|
||||||
|
if (_settings != null)
|
||||||
|
{
|
||||||
|
CreateFolder(SETTINGS_ASSET_PATH);
|
||||||
|
AssetDatabase.CreateAsset(_settings, SETTINGS_ASSET_PATH + "MA_TextureAtlasserProSettings.asset");
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
return _settings;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MA_TextureAtlasserProSettings LoadSettings()
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProSettings _settings = AssetDatabase.LoadAssetAtPath(SETTINGS_ASSET_PATH + "MA_TextureAtlasserProSettings.asset", typeof(MA_TextureAtlasserProSettings)) as MA_TextureAtlasserProSettings;
|
||||||
|
|
||||||
|
if (_settings == null)
|
||||||
|
{
|
||||||
|
_settings = CreateSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MA_TextureAtlasserProExportSettings CreateExportSettings(string name, bool canModify = true)
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProExportSettings _settings = ScriptableObject.CreateInstance<MA_TextureAtlasserProExportSettings>();
|
||||||
|
_settings.canModify = canModify;
|
||||||
|
|
||||||
|
if (_settings != null)
|
||||||
|
{
|
||||||
|
_settings.materialExportSettings.shader = Shader.Find("Standard");
|
||||||
|
|
||||||
|
CreateFolder(EXPORT_ASSET_PATH);
|
||||||
|
AssetDatabase.CreateAsset(_settings, SETTINGS_ASSET_PATH + name + ".asset");
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
return _settings;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MA_TextureAtlasserProExportSettings LoadExportSettings()
|
||||||
|
{
|
||||||
|
string name = "MA_DefaultExportSettings";
|
||||||
|
MA_TextureAtlasserProExportSettings _settings = AssetDatabase.LoadAssetAtPath(SETTINGS_ASSET_PATH + name + ".asset", typeof(MA_TextureAtlasserProExportSettings)) as MA_TextureAtlasserProExportSettings;
|
||||||
|
|
||||||
|
if (_settings == null)
|
||||||
|
{
|
||||||
|
_settings = CreateExportSettings(name, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MA_TextureAtlasserProAtlas CreateTextureAtlas(string name, Vector2 size)
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProAtlas _atlas = ScriptableObject.CreateInstance<MA_TextureAtlasserProAtlas>();
|
||||||
|
|
||||||
|
if (_atlas != null)
|
||||||
|
{
|
||||||
|
_atlas.CreateAtlas(name, size);
|
||||||
|
MA_CheckTextureAtlas(_atlas);
|
||||||
|
|
||||||
|
CreateFolder(SAVE_ASSET_PATH);
|
||||||
|
AssetDatabase.CreateAsset(_atlas, SAVE_ASSET_PATH + name + ".asset");
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
return _atlas;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MA_TextureAtlasserProAtlas LoadTextureAtlas()
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProAtlas _atlas = null;
|
||||||
|
string absPath = EditorUtility.OpenFilePanel("Select Texture Atlas", LOAD_ASSET_PATH, "");
|
||||||
|
|
||||||
|
if (absPath.StartsWith(Application.dataPath))
|
||||||
|
{
|
||||||
|
string relPath = absPath.Substring(Application.dataPath.Length - "Assets".Length);
|
||||||
|
_atlas = AssetDatabase.LoadAssetAtPath(relPath, typeof(MA_TextureAtlasserProAtlas)) as MA_TextureAtlasserProAtlas;
|
||||||
|
|
||||||
|
MA_CheckTextureAtlas(_atlas);
|
||||||
|
|
||||||
|
if (_atlas)
|
||||||
|
{
|
||||||
|
EditorPrefs.SetString("AtlasPath", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_atlas != null)
|
||||||
|
{
|
||||||
|
if (_atlas.selectedTextureQuad != null)
|
||||||
|
{
|
||||||
|
_atlas.selectedTextureQuad.isSelected = false;
|
||||||
|
}
|
||||||
|
_atlas.selectedTextureQuad = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _atlas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void MA_CheckTextureAtlas(MA_TextureAtlasserProAtlas atlas)
|
||||||
|
{
|
||||||
|
if (atlas.textureGroupRegistration == null)
|
||||||
|
{
|
||||||
|
atlas.textureGroupRegistration = new List<MA_TextureGroupRegistration>();
|
||||||
|
|
||||||
|
MA_TextureGroupRegistration groupRegistration = new MA_TextureGroupRegistration
|
||||||
|
{
|
||||||
|
name = DEFAULT_TEXTURE_GROUP_NAME
|
||||||
|
};
|
||||||
|
|
||||||
|
atlas.textureGroupRegistration.Add(groupRegistration);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (atlas.textureQuads == null)
|
||||||
|
{
|
||||||
|
atlas.textureQuads = new List<MA_TextureAtlasserProQuad>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool _sameCount = true;
|
||||||
|
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
||||||
|
{
|
||||||
|
if (q.textureGroups.Count != atlas.textureGroupRegistration.Count)
|
||||||
|
{
|
||||||
|
_sameCount = false;
|
||||||
|
Debug.LogWarning("TextureAtlasser: " + q.name + " doesn't have the right amount of texture groups!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_sameCount)
|
||||||
|
{
|
||||||
|
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < atlas.textureQuads.Count; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < atlas.textureGroupRegistration.Count; j++)
|
||||||
|
{
|
||||||
|
if (atlas.textureQuads[i].textureGroups[j].name != atlas.textureGroupRegistration[j].name)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("TextureAtlasser: " + q.name + " doesn't have the right texture group name!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (atlas.exportSettings == null)
|
||||||
|
{
|
||||||
|
atlas.exportSettings = LoadExportSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MA_TextureAtlasserProQuad CreateTextureQuad(MA_TextureAtlasserProAtlas atlas, string name, Rect rect, bool focus = true)
|
||||||
|
{
|
||||||
|
if (atlas != null)
|
||||||
|
{
|
||||||
|
//Create new list if we haven't one already
|
||||||
|
if (atlas.textureQuads == null)
|
||||||
|
{
|
||||||
|
atlas.textureQuads = new List<MA_TextureAtlasserProQuad>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create new quad
|
||||||
|
MA_TextureAtlasserProQuad _quad = ScriptableObject.CreateInstance<MA_TextureAtlasserProQuad>();
|
||||||
|
|
||||||
|
//Add quad to asset
|
||||||
|
if (_quad != null)
|
||||||
|
{
|
||||||
|
//Set quad settings
|
||||||
|
_quad.name = name;
|
||||||
|
_quad.rect = rect;
|
||||||
|
|
||||||
|
SetTextureGroups(atlas, _quad);
|
||||||
|
|
||||||
|
atlas.textureQuads.Add(_quad);
|
||||||
|
|
||||||
|
AssetDatabase.AddObjectToAsset(_quad, atlas);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
if (focus)
|
||||||
|
{
|
||||||
|
atlas.selectedTextureQuad = atlas.textureQuads[atlas.textureQuads.Count - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return _quad;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("CreateTextureQuad Failed: _TextureQuad");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("CreateTextureQuad Failed: textureAtlas");
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveTextureQuad(MA_TextureAtlasserProAtlas atlas, bool focus = true)
|
||||||
|
{
|
||||||
|
if (atlas != null && atlas.selectedTextureQuad != null)
|
||||||
|
{
|
||||||
|
int _index = atlas.textureQuads.IndexOf(atlas.selectedTextureQuad);
|
||||||
|
|
||||||
|
atlas.textureQuads.RemoveAt(_index);
|
||||||
|
Object.DestroyImmediate(atlas.selectedTextureQuad, true);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
if (focus && atlas.textureQuads.Count > 0)
|
||||||
|
{
|
||||||
|
_index = Mathf.Clamp(_index, 0, atlas.textureQuads.Count - 1);
|
||||||
|
atlas.selectedTextureQuad = atlas.textureQuads[_index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DuplicateTextureQuad(MA_TextureAtlasserProAtlas atlas, bool focus = true, string namePrefix = "new ")
|
||||||
|
{
|
||||||
|
if (atlas != null && atlas.selectedTextureQuad != null)
|
||||||
|
{
|
||||||
|
//MA_TextureAtlasserProQuad q = CreateTextureQuad(atlas, namePrefix + atlas.selectedTextureQuad.name, atlas.selectedTextureQuad.rect, false);
|
||||||
|
MA_TextureAtlasserProQuad q = Object.Instantiate(atlas.selectedTextureQuad);
|
||||||
|
q.name = string.Format("{0}{1}", namePrefix, atlas.selectedTextureQuad.name);
|
||||||
|
atlas.textureQuads.Add(q);
|
||||||
|
|
||||||
|
AssetDatabase.AddObjectToAsset(q, atlas);
|
||||||
|
|
||||||
|
if (focus)
|
||||||
|
{
|
||||||
|
atlas.selectedTextureQuad = q;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetTextureGroups(MA_TextureAtlasserProAtlas atlas, MA_TextureAtlasserProQuad quad)
|
||||||
|
{
|
||||||
|
if (quad.textureGroups == null)
|
||||||
|
{
|
||||||
|
quad.textureGroups = new List<MA_TextureGroup>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add texture groups
|
||||||
|
foreach (MA_TextureGroupRegistration tgr in atlas.textureGroupRegistration)
|
||||||
|
{
|
||||||
|
MA_TextureGroup textureGroup = new MA_TextureGroup
|
||||||
|
{
|
||||||
|
name = tgr.name
|
||||||
|
};
|
||||||
|
quad.textureGroups.Add(textureGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CreateTextureGroup(MA_TextureAtlasserProAtlas atlas, string name)
|
||||||
|
{
|
||||||
|
MA_TextureGroupRegistration _textureGroupRegistration = new MA_TextureGroupRegistration
|
||||||
|
{
|
||||||
|
name = name
|
||||||
|
};
|
||||||
|
atlas.textureGroupRegistration.Add(_textureGroupRegistration);
|
||||||
|
|
||||||
|
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
||||||
|
{
|
||||||
|
MA_TextureGroup _textureGroup = new MA_TextureGroup
|
||||||
|
{
|
||||||
|
name = name
|
||||||
|
};
|
||||||
|
q.textureGroups.Add(_textureGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveTextureGroup(MA_TextureAtlasserProAtlas atlas, int index)
|
||||||
|
{
|
||||||
|
atlas.textureGroupRegistration.RemoveAt(index);
|
||||||
|
|
||||||
|
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
||||||
|
{
|
||||||
|
q.textureGroups.RemoveAt(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CloseWindow(MA_TextureAtlasserProWindow curWindow)
|
||||||
|
{
|
||||||
|
if (curWindow == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("Closing window Failed: curWindow == null");
|
||||||
|
}
|
||||||
|
curWindow.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsPowerOfTwo(int value)
|
||||||
|
{
|
||||||
|
//While x is even and > 1
|
||||||
|
while (((value % 2) == 0) && value > 1)
|
||||||
|
{
|
||||||
|
value /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
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('/'));
|
||||||
|
|
||||||
|
if(!AssetDatabase.IsValidFolder(parentPath))
|
||||||
|
{
|
||||||
|
CreateFolder(parentPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
public static string[] ExportAtlasModels(MA_TextureAtlasserProAtlas atlas, ModelExportSettings modelExportSettings, string materialPath = null, string savePath = EXPORT_ASSET_PATH)
|
||||||
|
{
|
||||||
|
switch (modelExportSettings.modelFormat)
|
||||||
|
{
|
||||||
|
case ModelFormat.None:
|
||||||
|
break;
|
||||||
|
case ModelFormat.UnityMeshPrefab:
|
||||||
|
return ExportAtlasUnityMeshPrefab(atlas, modelExportSettings, materialPath: materialPath, savePath: savePath);
|
||||||
|
//case ModelFormat.Obj:
|
||||||
|
// return ExportAtlasObj(atlas, modelExportSettings, savePath: savePath);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string[] ExportAtlasUnityMeshPrefab(MA_TextureAtlasserProAtlas atlas, ModelExportSettings modelExportSettings, string materialPath = null, string savePath = EXPORT_ASSET_PATH)
|
||||||
|
{
|
||||||
|
if (atlas == null || atlas.textureQuads == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> assetPaths = new List<string>();
|
||||||
|
|
||||||
|
//Directories.
|
||||||
|
string savePathPrefab = savePath + atlas.name + "/";
|
||||||
|
string savePathMeshes = savePathPrefab + "Meshes/";
|
||||||
|
CreateFolder(savePathPrefab);
|
||||||
|
CreateFolder(savePathMeshes);
|
||||||
|
|
||||||
|
foreach (MA_TextureAtlasserProQuad quad in atlas.textureQuads)
|
||||||
|
{
|
||||||
|
foreach (MA_ModelGroup mg in quad.modelGroups)
|
||||||
|
{
|
||||||
|
//Validate name.
|
||||||
|
if (string.IsNullOrEmpty(mg.name) || string.IsNullOrWhiteSpace(mg.name))
|
||||||
|
{
|
||||||
|
mg.name = MA_StringUtils.RandomAlphabetString(6);
|
||||||
|
Debug.LogWarning("No valid model name assigned!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create new prefab asset.
|
||||||
|
string newPrefabPath = MA_PrefabUtils.CreatePrefab(mg.name, savePathPrefab);
|
||||||
|
GameObject newPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(newPrefabPath);
|
||||||
|
|
||||||
|
foreach (Mesh m in mg.meshes)
|
||||||
|
{
|
||||||
|
if(m != null)
|
||||||
|
{
|
||||||
|
//Validate name.
|
||||||
|
if (string.IsNullOrEmpty(m.name) || string.IsNullOrWhiteSpace(m.name))
|
||||||
|
{
|
||||||
|
m.name = MA_StringUtils.RandomAlphabetString(6);
|
||||||
|
Debug.LogWarning("No valid mesh name assigned!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create new mesh.
|
||||||
|
//Duplicate it from the current one.
|
||||||
|
Mesh newMesh = MA_MeshUtils.MA_DuplicateMesh(m);
|
||||||
|
//Remap UV's.
|
||||||
|
newMesh = MA_MeshUtils.MA_UVReMap(newMesh, atlas.textureAtlasSize, quad.guiRect, modelExportSettings.uvChannel, modelExportSettings.uvFlipY, modelExportSettings.uvWrap);
|
||||||
|
//Set name.
|
||||||
|
newMesh.name = string.Format("{0}_{1}", mg.name, m.name);
|
||||||
|
//Save mesh.
|
||||||
|
string savedMeshPath = MA_MeshUtils.MA_SaveMeshAsset(newMesh, savePathMeshes);
|
||||||
|
|
||||||
|
//Load mesh.
|
||||||
|
Mesh savedMesh = AssetDatabase.LoadAssetAtPath<Mesh>(savedMeshPath);
|
||||||
|
//Load material.
|
||||||
|
Material savedMaterial = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
|
||||||
|
|
||||||
|
//Create gameObject.
|
||||||
|
GameObject newGameObject = new GameObject(m.name);
|
||||||
|
//Add mesh filter.
|
||||||
|
MeshFilter mf = newGameObject.AddComponent<MeshFilter>();
|
||||||
|
mf.mesh = savedMesh;
|
||||||
|
//Add mesh renderer.
|
||||||
|
MeshRenderer mr = newGameObject.AddComponent<MeshRenderer>();
|
||||||
|
mr.material = savedMaterial;
|
||||||
|
|
||||||
|
//Add to parent gameObject (prefab).
|
||||||
|
MA_PrefabUtils.AddChild(newPrefab, newGameObject);
|
||||||
|
Object.DestroyImmediate(newGameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assetPaths.Add(newPrefabPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return assetPaths.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string[] ExportAtlasTextures(MA_TextureAtlasserProAtlas atlas, TextureExportSettings textureExportSettings, string savePath = EXPORT_ASSET_PATH, string tempPath = TEXTURE_ATLASSER_PATH)
|
||||||
|
{
|
||||||
|
switch (textureExportSettings.textureFormat)
|
||||||
|
{
|
||||||
|
case TextureFormat.None:
|
||||||
|
break;
|
||||||
|
case TextureFormat.Png:
|
||||||
|
return ExportAtlasPNG(atlas, textureExportSettings, savePath);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string[] 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)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] assetPaths = new string[atlas.textureGroupRegistration.Count];
|
||||||
|
|
||||||
|
//Directories.
|
||||||
|
string savePathTextures = savePath + atlas.name + "/Textures/";
|
||||||
|
CreateFolder(savePathTextures);
|
||||||
|
|
||||||
|
//Create temp folder
|
||||||
|
CreateFolder(tempPath);
|
||||||
|
|
||||||
|
//Foreach texture group
|
||||||
|
for (int i = 0; i < atlas.textureGroupRegistration.Count; i++)
|
||||||
|
{
|
||||||
|
//Create new Texture Atlas
|
||||||
|
Texture2D newTexture = new Texture2D((int)atlas.textureAtlasSize.x, (int)atlas.textureAtlasSize.y)
|
||||||
|
{
|
||||||
|
name = atlas.name + "_" + atlas.textureGroupRegistration[i].name
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
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
|
||||||
|
Texture2D newTexturePart = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(tempCopy);
|
||||||
|
|
||||||
|
//Scale it
|
||||||
|
newTexturePart = newTexturePart.MA_Scale2D((int)q.guiRect.width, (int)q.guiRect.height, textureExportSettings.textureScaleMode);
|
||||||
|
|
||||||
|
//Add it
|
||||||
|
newTexture = newTexture.MA_Combine2D(newTexturePart, (int)q.guiRect.x, (int)q.guiRect.y);
|
||||||
|
|
||||||
|
//Delete temp copy
|
||||||
|
AssetDatabase.DeleteAsset(tempTextureImporter.assetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Save it
|
||||||
|
newTexture.MA_Save2D(newTexture.name, savePathTextures);
|
||||||
|
assetPaths[i] = (savePathTextures + newTexture.name + '.' + textureExportSettings.textureFormat.ToString());
|
||||||
|
|
||||||
|
//Set settings.
|
||||||
|
switch (textureExportSettings.textureType)
|
||||||
|
{
|
||||||
|
case TextureType.Default:
|
||||||
|
{
|
||||||
|
TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(savePathTextures + newTexture.name + '.' + textureExportSettings.textureFormat.ToString());
|
||||||
|
textureImporter.textureType = TextureImporterType.Default;
|
||||||
|
textureImporter.SaveAndReimport();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TextureType.Sprite:
|
||||||
|
SetAtlasSpriteSettings(atlas, textureExportSettings, savePathTextures);
|
||||||
|
break;
|
||||||
|
case TextureType.SpriteSliced:
|
||||||
|
SetAtlasSpriteSettings(atlas, textureExportSettings, savePathTextures);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Delete temp folder
|
||||||
|
DeleteFolder(tempPath);
|
||||||
|
|
||||||
|
//Refresh
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
return assetPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetAtlasSpriteSettings(MA_TextureAtlasserProAtlas atlas, TextureExportSettings textureExportSettings, string savePath)
|
||||||
|
{
|
||||||
|
//Foreach texture group
|
||||||
|
for (int i = 0; i < atlas.textureGroupRegistration.Count; i++)
|
||||||
|
{
|
||||||
|
//Convert
|
||||||
|
string textureName = atlas.name + "_" + atlas.textureGroupRegistration[i].name + '.' + textureExportSettings.textureFormat.ToString();
|
||||||
|
TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(savePath + textureName);
|
||||||
|
textureImporter.textureType = TextureImporterType.Sprite;
|
||||||
|
textureImporter.alphaIsTransparency = true;
|
||||||
|
|
||||||
|
//Slice sprites.
|
||||||
|
if (textureExportSettings.textureType == TextureType.SpriteSliced)
|
||||||
|
{
|
||||||
|
textureImporter.spriteImportMode = SpriteImportMode.None; //Reset it to update?
|
||||||
|
textureImporter.spriteImportMode = SpriteImportMode.Multiple;
|
||||||
|
List<SpriteMetaData> spriteMetaData = new List<SpriteMetaData>();
|
||||||
|
|
||||||
|
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
||||||
|
{
|
||||||
|
if (q.textureGroups != null && q.textureGroups[i].texture != null)
|
||||||
|
{
|
||||||
|
//Create new SpriteMetaData.
|
||||||
|
SpriteMetaData smd = new SpriteMetaData
|
||||||
|
{
|
||||||
|
name = q.name,
|
||||||
|
rect = new Rect(q.guiRect.x, atlas.textureAtlasSize.y - q.guiRect.y - q.guiRect.height, q.guiRect.width, q.guiRect.height)
|
||||||
|
};
|
||||||
|
|
||||||
|
spriteMetaData.Add(smd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
textureImporter.spritesheet = spriteMetaData.ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textureImporter.spriteImportMode = SpriteImportMode.Single;
|
||||||
|
}
|
||||||
|
|
||||||
|
textureImporter.SaveAndReimport();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ExportAtlasMaterial(MA_TextureAtlasserProAtlas atlas, MaterialExportSettings materialExportSettings, string[] textures = null, string savePath = EXPORT_ASSET_PATH)
|
||||||
|
{
|
||||||
|
if (atlas == null || atlas.textureQuads == null || atlas.textureGroupRegistration == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Directories.
|
||||||
|
string savePathMaterial = savePath + atlas.name + "/Materials/";
|
||||||
|
CreateFolder(savePathMaterial);
|
||||||
|
|
||||||
|
Shader shader = materialExportSettings.shader;
|
||||||
|
if (shader)
|
||||||
|
{
|
||||||
|
Material material = new Material(shader)
|
||||||
|
{
|
||||||
|
name = atlas.name
|
||||||
|
};
|
||||||
|
|
||||||
|
if (textures != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < (int)Mathf.Min(materialExportSettings.shaderPropertyNames.Count, textures.Length); i++)
|
||||||
|
{
|
||||||
|
Texture t = AssetDatabase.LoadAssetAtPath<Texture>(textures[i]);
|
||||||
|
if (t != null)
|
||||||
|
{
|
||||||
|
material.SetTexture(materialExportSettings.shaderPropertyNames[i], t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string assetPath = savePathMaterial + material.name + ".mat";
|
||||||
|
|
||||||
|
//Save material
|
||||||
|
AssetDatabase.CreateAsset(material, assetPath);
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
return assetPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 69c76c8a2967c4745a76f5bf5b494f7a
|
||||||
|
timeCreated: 1519393169
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 39bd4da4fed5aaf41858e1e23240cfca
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1519389501
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,3 +1,4 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -32,7 +33,7 @@ namespace MA_TextureAtlasserPro
|
|||||||
curWindow.workView.ResetWindow();
|
curWindow.workView.ResetWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(curWindow.textureAtlas != null)
|
if (curWindow.textureAtlas != null)
|
||||||
{
|
{
|
||||||
GUILayout.FlexibleSpace();
|
GUILayout.FlexibleSpace();
|
||||||
//GUILayout.Label(curWindow.textureAtlas.textureAtlasSize.ToString());
|
//GUILayout.Label(curWindow.textureAtlas.textureAtlasSize.ToString());
|
||||||
@ -75,4 +76,5 @@ namespace MA_TextureAtlasserPro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b40a2786b518d6e41bfca3c464c9630e
|
||||||
|
timeCreated: 1519763882
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,189 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using MA_Editor;
|
||||||
|
using MA_Toolbox.Utils;
|
||||||
|
|
||||||
|
namespace MA_TextureAtlasserPro
|
||||||
|
{
|
||||||
|
public class MA_TextureAtlasserProInspectorView : MA_TextureAtlasserProViewBase
|
||||||
|
{
|
||||||
|
private MA_TextureAtlasserProQuad lastSelectedQuad;
|
||||||
|
private bool isEditing = false;
|
||||||
|
private GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
|
||||||
|
private Vector2 scrollPos = Vector2.zero;
|
||||||
|
|
||||||
|
public MA_TextureAtlasserProInspectorView(MA_TextureAtlasserProWindow currentEditorWindow, string title) : base(currentEditorWindow, title)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateView(Event e, Rect editorViewRect)
|
||||||
|
{
|
||||||
|
//Update base derived class
|
||||||
|
base.UpdateView(e, editorViewRect);
|
||||||
|
|
||||||
|
if (isLoaded)
|
||||||
|
{
|
||||||
|
//Draw inspector
|
||||||
|
if (curWindow.textureAtlas != null && curWindow.textureAtlas.selectedTextureQuad != null)
|
||||||
|
{
|
||||||
|
//Deselect GUI elements when we are focusing on a new quad
|
||||||
|
if (lastSelectedQuad != curWindow.textureAtlas.selectedTextureQuad)
|
||||||
|
{
|
||||||
|
lastSelectedQuad = curWindow.textureAtlas.selectedTextureQuad;
|
||||||
|
GUI.FocusControl(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.BeginArea(editorViewRect, EditorStyles.helpBox);
|
||||||
|
using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollPos, false, false))
|
||||||
|
{
|
||||||
|
scrollPos = scrollViewScope.scrollPosition;
|
||||||
|
|
||||||
|
GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
|
||||||
|
|
||||||
|
GUILayout.Label("Quad Name");
|
||||||
|
curWindow.textureAtlas.selectedTextureQuad.name = EditorGUILayout.TextField(curWindow.textureAtlas.selectedTextureQuad.name);
|
||||||
|
|
||||||
|
GUILayout.Space(MA_TextureAtlasserProUtils.VIEW_OFFSET / 2);
|
||||||
|
|
||||||
|
//Textures
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("Textures", GUILayout.ExpandWidth(true));
|
||||||
|
if (GUILayout.Button(MA_TextureAtlasserProGuiLoader.editGC, EditorStyles.miniButton, GUILayout.Width(36), GUILayout.Height(15)))
|
||||||
|
{
|
||||||
|
isEditing = !isEditing;
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
if (curWindow.textureAtlas.textureGroupRegistration == null || curWindow.textureAtlas.textureGroupRegistration.Count == 0)
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProUtils.CreateTextureGroup(curWindow.textureAtlas, "New TextureGroup");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < curWindow.textureAtlas.textureGroupRegistration.Count; i++)
|
||||||
|
{
|
||||||
|
if (isEditing)
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.textureGroupRegistration[i].name = curWindow.textureAtlas.selectedTextureQuad.textureGroups[i].name = EditorGUILayout.TextField(curWindow.textureAtlas.textureGroupRegistration[i].name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GUILayout.Label(curWindow.textureAtlas.textureGroupRegistration[i].name);
|
||||||
|
}
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
curWindow.textureAtlas.selectedTextureQuad.textureGroups[i].texture = (Texture)EditorGUILayout.ObjectField(curWindow.textureAtlas.selectedTextureQuad.textureGroups[i].texture, typeof(Texture), false);
|
||||||
|
if (isEditing && GUILayout.Button("-", EditorStyles.miniButtonLeft, GUILayout.ExpandWidth(false)))
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProUtils.RemoveTextureGroup(curWindow.textureAtlas, i);
|
||||||
|
}
|
||||||
|
if (isEditing && GUILayout.Button("+", EditorStyles.miniButtonRight, GUILayout.ExpandWidth(false)))
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProUtils.CreateTextureGroup(curWindow.textureAtlas, "New TextureGroup");
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.Space(MA_TextureAtlasserProUtils.VIEW_OFFSET / 2);
|
||||||
|
|
||||||
|
//Models
|
||||||
|
GUILayout.Label("Models");
|
||||||
|
|
||||||
|
SerializedObject serializedObject = new SerializedObject(curWindow.textureAtlas.selectedTextureQuad);
|
||||||
|
serializedObject.Update();
|
||||||
|
|
||||||
|
|
||||||
|
if (curWindow.textureAtlas.selectedTextureQuad.modelGroups != null)
|
||||||
|
{
|
||||||
|
SerializedProperty modelGroupsSP = serializedObject.FindProperty("modelGroups");
|
||||||
|
|
||||||
|
for (int i = 0; i < curWindow.textureAtlas.selectedTextureQuad.modelGroups.Count; i++)
|
||||||
|
{
|
||||||
|
using (new GUILayout.VerticalScope(EditorStyles.helpBox))
|
||||||
|
{
|
||||||
|
using (new GUILayout.HorizontalScope())
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].name = EditorGUILayout.TextField(curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].name);
|
||||||
|
if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups.RemoveAt(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SerializedProperty meshesSP = modelGroupsSP.GetArrayElementAtIndex(i).FindPropertyRelative("meshes");
|
||||||
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
meshesSP.isExpanded = EditorGUILayout.Foldout(meshesSP.isExpanded, "Meshes", true);
|
||||||
|
#else
|
||||||
|
EditorGUILayout.PropertyField(meshesSP, false, GUILayout.ExpandWidth(false), GUILayout.MaxWidth(editorViewRect.width * 0.5f));
|
||||||
|
#endif
|
||||||
|
if (meshesSP.isExpanded)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes.Count; j++)
|
||||||
|
{
|
||||||
|
using (new GUILayout.HorizontalScope())
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes[j] = (Mesh)EditorGUILayout.ObjectField(curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes[j], typeof(Mesh), false);
|
||||||
|
if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes.RemoveAt(j);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("+", EditorStyles.miniButton))
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes.Add(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups.Add(new MA_ModelGroup() { name = MA_StringUtils.RandomAlphabetString(6) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups = new List<MA_ModelGroup>();
|
||||||
|
}
|
||||||
|
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
|
||||||
|
GUILayout.Space(MA_TextureAtlasserProUtils.VIEW_OFFSET / 2);
|
||||||
|
|
||||||
|
//x, y, w, h.
|
||||||
|
GUILayout.FlexibleSpace();
|
||||||
|
if (!MA_TextureAtlasserProUtils.IsPowerOfTwo((int)curWindow.textureAtlas.selectedTextureQuad.guiRect.width) || !MA_TextureAtlasserProUtils.IsPowerOfTwo((int)curWindow.textureAtlas.selectedTextureQuad.guiRect.height))
|
||||||
|
{
|
||||||
|
labelStyle.normal.textColor = Color.red;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
labelStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.Label("x " + curWindow.textureAtlas.selectedTextureQuad.guiRect.x.ToString() + ", y " + curWindow.textureAtlas.selectedTextureQuad.guiRect.y.ToString());
|
||||||
|
GUILayout.Label("w " + curWindow.textureAtlas.selectedTextureQuad.guiRect.width.ToString() + ", h " + curWindow.textureAtlas.selectedTextureQuad.guiRect.height.ToString(), labelStyle);
|
||||||
|
}
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
GUILayout.EndArea();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curWindow.textureAtlas != null && curWindow.textureAtlas.selectedTextureQuad != null)
|
||||||
|
ProcessEvents(e, editorViewRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ProcessEvents(Event e, Rect editorViewRect)
|
||||||
|
{
|
||||||
|
base.ProcessEvents(e, editorViewRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f17051e9a63503f4da7866616d67a6a2
|
||||||
|
timeCreated: 1519505909
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,3 +1,4 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -24,45 +25,45 @@ namespace MA_TextureAtlasserPro
|
|||||||
GUILayout.BeginArea(editorViewRect, EditorStyles.helpBox);
|
GUILayout.BeginArea(editorViewRect, EditorStyles.helpBox);
|
||||||
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
|
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
|
||||||
|
|
||||||
if(GUILayout.Button(MA_TextureAtlasserProIcons.createAtlasIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
if(GUILayout.Button(MA_TextureAtlasserProGuiLoader.createAtlasGC, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||||
{
|
{
|
||||||
MA_TextureAtlasserProCreateWindow.InitEditorWindow(curWindow);
|
MA_TextureAtlasserProCreateWindow.InitEditorWindow(curWindow);
|
||||||
}
|
}
|
||||||
if(GUILayout.Button(MA_TextureAtlasserProIcons.loadAtlasIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
if(GUILayout.Button(MA_TextureAtlasserProGuiLoader.loadAtlasGC, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||||
{
|
{
|
||||||
curWindow.textureAtlas = MA_TextureAtlasserProUtils.LoadTextureAtlas();
|
curWindow.textureAtlas = MA_TextureAtlasserProUtils.LoadTextureAtlas();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(curWindow.textureAtlas != null)
|
if(curWindow.textureAtlas != null)
|
||||||
{
|
{
|
||||||
if(GUILayout.Button(MA_TextureAtlasserProIcons.exportAtlasIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
if(GUILayout.Button(MA_TextureAtlasserProGuiLoader.exportAtlasGC, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||||
{
|
{
|
||||||
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_TextureAtlasserProGuiLoader.showTexturesOnGC, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||||
{
|
{
|
||||||
curWindow.textureAtlas.showTextures = false;
|
curWindow.textureAtlas.showTextures = false;
|
||||||
}
|
}
|
||||||
else if(!curWindow.textureAtlas.showTextures && GUILayout.Button(MA_TextureAtlasserProIcons.showTexturesOffIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
else if(!curWindow.textureAtlas.showTextures && GUILayout.Button(MA_TextureAtlasserProGuiLoader.showTexturesOffGC, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||||
{
|
{
|
||||||
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_TextureAtlasserProGuiLoader.createQuadGC, 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);
|
||||||
}
|
}
|
||||||
if(curWindow.textureAtlas.selectedTextureQuad != null && GUILayout.Button(MA_TextureAtlasserProIcons.removeQuadIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
if(curWindow.textureAtlas.selectedTextureQuad != null && GUILayout.Button(MA_TextureAtlasserProGuiLoader.removeQuadGC, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||||
{
|
{
|
||||||
if(curWindow.textureAtlas.selectedTextureQuad != null)
|
if(curWindow.textureAtlas.selectedTextureQuad != null)
|
||||||
MA_TextureAtlasserProUtils.RemoveTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus);
|
MA_TextureAtlasserProUtils.RemoveTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus);
|
||||||
}
|
}
|
||||||
if (curWindow.textureAtlas.selectedTextureQuad != null && GUILayout.Button(MA_TextureAtlasserProIcons.duplicateQuadIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
if (curWindow.textureAtlas.selectedTextureQuad != null && GUILayout.Button(MA_TextureAtlasserProGuiLoader.duplicateQuadGC, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||||
{
|
{
|
||||||
if (curWindow.textureAtlas.selectedTextureQuad != null)
|
if (curWindow.textureAtlas.selectedTextureQuad != null)
|
||||||
MA_TextureAtlasserProUtils.DuplicateTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus, curWindow.settings.copySelectedQuadData, curWindow.settings.duplicatedQuadNamePrefix);
|
MA_TextureAtlasserProUtils.DuplicateTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus, curWindow.settings.duplicatedQuadNamePrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,4 +79,5 @@ namespace MA_TextureAtlasserPro
|
|||||||
base.ProcessEvents(e, editorViewRect);
|
base.ProcessEvents(e, editorViewRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bed32b77d058ea141ac98ceac0159297
|
||||||
|
timeCreated: 1519392331
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -52,4 +53,5 @@ namespace MA_TextureAtlasserPro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0ad6305c01639b64f8defe0ce7d26067
|
||||||
|
timeCreated: 1518210556
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using MA_Editor;
|
using MA_Editor;
|
||||||
@ -18,7 +19,7 @@ namespace MA_TextureAtlasserPro
|
|||||||
private const float kZoomMax = 2.0f;
|
private const float kZoomMax = 2.0f;
|
||||||
private Rect zoomArea;
|
private Rect zoomArea;
|
||||||
private float zoom = 1.0f;
|
private float zoom = 1.0f;
|
||||||
public float Zoom { get { return zoom; } }
|
public float Zoom { get { return zoom; } set { zoom = Mathf.Clamp(value, kZoomMin, kZoomMax); } }
|
||||||
private Vector2 zoomCoordsOrigin = Vector2.zero;
|
private Vector2 zoomCoordsOrigin = Vector2.zero;
|
||||||
|
|
||||||
public override void UpdateView(Event e, Rect editorViewRect)
|
public override void UpdateView(Event e, Rect editorViewRect)
|
||||||
@ -90,28 +91,42 @@ namespace MA_TextureAtlasserPro
|
|||||||
e.Use();
|
e.Use();
|
||||||
}
|
}
|
||||||
|
|
||||||
//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 (curWindow.settings.GetHotKey(e, 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.settings.GetHotKey(e, curWindow.settings.zoomInHotKey))
|
||||||
{
|
{
|
||||||
MA_TextureAtlasserProUtils.DuplicateTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus);
|
Zoom += 0.25f;
|
||||||
e.Use();
|
e.Use();
|
||||||
}
|
}
|
||||||
|
if(curWindow.settings.GetHotKey(e, curWindow.settings.zoomOutHotKey))
|
||||||
|
{
|
||||||
|
Zoom -= 0.25f;
|
||||||
|
e.Use();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curWindow.textureAtlas.selectedTextureQuad != null)
|
||||||
|
{
|
||||||
|
if (curWindow.settings.GetHotKey(e, curWindow.settings.removeQuadHotKey))
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProUtils.RemoveTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus);
|
||||||
|
e.Use();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curWindow.settings.GetHotKey(e, curWindow.settings.duplicateHotKey))
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProUtils.DuplicateTextureQuad(curWindow.textureAtlas, curWindow.settings.autoFocus, curWindow.settings.duplicatedQuadNamePrefix);
|
||||||
|
e.Use();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,9 +145,9 @@ namespace MA_TextureAtlasserPro
|
|||||||
{
|
{
|
||||||
if(q.isSelected)
|
if(q.isSelected)
|
||||||
{
|
{
|
||||||
GUI.Button(new Rect(q.dragRectPos.x, q.dragRectPos.y, q.dragRectPos.width, q.dragRectPos.height), MA_TextureAtlasserProIcons.dragHandleIcon);
|
GUI.Button(new Rect(q.dragRectPos.x, q.dragRectPos.y, q.dragRectPos.width, q.dragRectPos.height), MA_TextureAtlasserProGuiLoader.dragHandleGC);
|
||||||
GUI.Button(new Rect(q.dragRectWidth.x, q.dragRectWidth.y, q.dragRectWidth.width, q.dragRectWidth.height), MA_TextureAtlasserProIcons.dragHandleIcon);
|
GUI.Button(new Rect(q.dragRectWidth.x, q.dragRectWidth.y, q.dragRectWidth.width, q.dragRectWidth.height), MA_TextureAtlasserProGuiLoader.dragHandleGC);
|
||||||
GUI.Button(new Rect(q.dragRectHeight.x, q.dragRectHeight.y, q.dragRectHeight.width, q.dragRectHeight.height), MA_TextureAtlasserProIcons.dragHandleIcon);
|
GUI.Button(new Rect(q.dragRectHeight.x, q.dragRectHeight.y, q.dragRectHeight.width, q.dragRectHeight.height), MA_TextureAtlasserProGuiLoader.dragHandleGC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,4 +159,5 @@ namespace MA_TextureAtlasserPro
|
|||||||
zoomCoordsOrigin = new Vector2(-(curWindow.position.width / 2) + (curWindow.position.width / 3), -(curWindow.position.height / 2) + (curWindow.position.height / 3));
|
zoomCoordsOrigin = new Vector2(-(curWindow.position.width / 2) + (curWindow.position.width / 3), -(curWindow.position.height / 2) + (curWindow.position.height / 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6385799201fcbf246a8076f7fb2f4664
|
||||||
|
timeCreated: 1519389695
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0bf15f61e8c967348960f91d78ef05ac
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1519389493
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,88 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using MA_Editor;
|
||||||
|
using MA_Texture;
|
||||||
|
|
||||||
|
namespace MA_TextureAtlasserPro
|
||||||
|
{
|
||||||
|
public class MA_TextureAtlasserProCreateExportWindow : EditorWindow
|
||||||
|
{
|
||||||
|
private const int windowHeight = 97;
|
||||||
|
private const int windowWidth = 320;
|
||||||
|
|
||||||
|
//Editor
|
||||||
|
private static MA_TextureAtlasserProCreateExportWindow thisWindow;
|
||||||
|
public static MA_TextureAtlasserProWindow curWindow;
|
||||||
|
|
||||||
|
//Data
|
||||||
|
string settingsName = "Settings name";
|
||||||
|
bool nameError = true;
|
||||||
|
|
||||||
|
[MenuItem("MA_ToolKit/MA_TextureAtlasserPro/New Export Settings")]
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
InitWindow(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InitWindow(MA_TextureAtlasserProWindow currentEditorWindow)
|
||||||
|
{
|
||||||
|
curWindow = currentEditorWindow;
|
||||||
|
|
||||||
|
GetCurrentWindow();
|
||||||
|
|
||||||
|
thisWindow.minSize = new Vector2(windowWidth, windowHeight);
|
||||||
|
thisWindow.maxSize = new Vector2(windowWidth, windowHeight);
|
||||||
|
thisWindow.titleContent.text = "MA_CreateExportSettings";
|
||||||
|
|
||||||
|
thisWindow.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GetCurrentWindow()
|
||||||
|
{
|
||||||
|
thisWindow = (MA_TextureAtlasserProCreateExportWindow)EditorWindow.GetWindow<MA_TextureAtlasserProCreateExportWindow>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnGUI()
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
|
||||||
|
//Input options
|
||||||
|
settingsName = EditorGUILayout.TextField("Settings name", settingsName, GUILayout.ExpandWidth(true));
|
||||||
|
if (settingsName == "Settings name" || string.IsNullOrEmpty(settingsName))
|
||||||
|
{
|
||||||
|
nameError = true;
|
||||||
|
GUI.backgroundColor = Color.red;
|
||||||
|
GUILayout.Box("Error: Enter a valid settings name!", EditorStyles.helpBox);
|
||||||
|
GUI.backgroundColor = Color.white;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nameError = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create
|
||||||
|
if (!nameError)
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("Create!", GUILayout.ExpandWidth(true), GUILayout.Height(37)))
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProExportSettings exportSettings = MA_TextureAtlasserProUtils.CreateExportSettings(settingsName, true);
|
||||||
|
|
||||||
|
if (curWindow != null && curWindow.textureAtlas != null)
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.exportSettings = exportSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
GUILayout.EndArea();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 00058117c24864541a3f85fc4f18f89e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -94,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
|
||||||
@ -167,4 +168,5 @@ namespace MA_TextureAtlasserPro
|
|||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fadd3a216ba8658458040ed46c0d032e
|
||||||
|
timeCreated: 1519504375
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,234 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using MA_Editor;
|
||||||
|
using MA_Texture;
|
||||||
|
|
||||||
|
namespace MA_TextureAtlasserPro
|
||||||
|
{
|
||||||
|
public class MA_TextureAtlasserProExportWindow : EditorWindow
|
||||||
|
{
|
||||||
|
private const int windowHeight = 385;
|
||||||
|
private const int windowWidth = 320;
|
||||||
|
|
||||||
|
//Editor
|
||||||
|
private static MA_TextureAtlasserProExportWindow thisWindow;
|
||||||
|
public static MA_TextureAtlasserProWindow curWindow;
|
||||||
|
|
||||||
|
//Data
|
||||||
|
private static bool isLoaded = false; //Make sure we wait a frame at the start to setup and don't draw.
|
||||||
|
private Vector2 scrollPos;
|
||||||
|
|
||||||
|
[MenuItem("MA_ToolKit/MA_TextureAtlasserPro/Export Atlas")]
|
||||||
|
private static void Init()
|
||||||
|
{
|
||||||
|
GetCurrentWindow();
|
||||||
|
|
||||||
|
thisWindow.minSize = new Vector2(windowWidth, windowHeight);
|
||||||
|
thisWindow.titleContent.text = "MA_ExportTextureAtlas";
|
||||||
|
|
||||||
|
thisWindow.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InitEditorWindow(MA_TextureAtlasserProWindow currentEditorWindow)
|
||||||
|
{
|
||||||
|
curWindow = currentEditorWindow;
|
||||||
|
|
||||||
|
GetCurrentWindow();
|
||||||
|
|
||||||
|
thisWindow.minSize = new Vector2(windowWidth, windowHeight);
|
||||||
|
thisWindow.titleContent.text = "MA_ExportTextureAtlas";
|
||||||
|
|
||||||
|
thisWindow.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GetCurrentWindow()
|
||||||
|
{
|
||||||
|
thisWindow = (MA_TextureAtlasserProExportWindow)EditorWindow.GetWindow<MA_TextureAtlasserProExportWindow>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseWindow()
|
||||||
|
{
|
||||||
|
if(thisWindow == null)
|
||||||
|
{
|
||||||
|
GetCurrentWindow();
|
||||||
|
thisWindow.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thisWindow.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Event ProcessEvents()
|
||||||
|
{
|
||||||
|
Event e = Event.current;
|
||||||
|
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
[UnityEditor.Callbacks.DidReloadScripts]
|
||||||
|
private static void OnReload()
|
||||||
|
{
|
||||||
|
//Make sure that when the compiler is finished and reloads the scripts, we are waiting for the next Event.
|
||||||
|
isLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGUI()
|
||||||
|
{
|
||||||
|
if(thisWindow == null)
|
||||||
|
{
|
||||||
|
GetCurrentWindow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get current event
|
||||||
|
Event e = ProcessEvents();
|
||||||
|
|
||||||
|
if(isLoaded)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
|
||||||
|
if (curWindow != null && curWindow.textureAtlas != null)
|
||||||
|
{
|
||||||
|
//Export
|
||||||
|
GUILayout.BeginVertical();
|
||||||
|
DrawExportMenu();
|
||||||
|
|
||||||
|
curWindow.textureAtlas.exportSettings = (MA_TextureAtlasserProExportSettings)EditorGUILayout.ObjectField(curWindow.textureAtlas.exportSettings, typeof(MA_TextureAtlasserProExportSettings), false);
|
||||||
|
|
||||||
|
if(curWindow.textureAtlas.exportSettings != null)
|
||||||
|
{
|
||||||
|
DrawExportOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
}
|
||||||
|
else if(curWindow == null)
|
||||||
|
{
|
||||||
|
GUI.backgroundColor = Color.red;
|
||||||
|
GUILayout.Box("Error: Link with the Texture Atlas Editor lost!", EditorStyles.helpBox);
|
||||||
|
if(GUILayout.Button("Link Atlas Editor", GUILayout.ExpandWidth(true), GUILayout.Height(37)))
|
||||||
|
{
|
||||||
|
curWindow = (MA_TextureAtlasserProWindow)EditorWindow.GetWindow<MA_TextureAtlasserProWindow>();
|
||||||
|
}
|
||||||
|
GUI.backgroundColor = Color.white;
|
||||||
|
}
|
||||||
|
else if(curWindow.textureAtlas == null)
|
||||||
|
{
|
||||||
|
GUI.backgroundColor = Color.red;
|
||||||
|
GUILayout.Box("Error: No Texture Atlas found make sure to open one!", EditorStyles.helpBox);
|
||||||
|
GUI.backgroundColor = Color.white;
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
GUILayout.EndArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e.type == EventType.Repaint)
|
||||||
|
isLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawExportMenu()
|
||||||
|
{
|
||||||
|
GUILayout.BeginHorizontal(EditorStyles.helpBox, GUILayout.Height(44));
|
||||||
|
|
||||||
|
if (GUILayout.Button(MA_TextureAtlasserProGuiLoader.createExportSettingsGC, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||||
|
{
|
||||||
|
MA_TextureAtlasserProCreateExportWindow.InitWindow(curWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wasEnabled = GUI.enabled;
|
||||||
|
|
||||||
|
if (curWindow.textureAtlas.exportSettings != null)
|
||||||
|
{
|
||||||
|
GUI.enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GUI.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("Export", GUILayout.ExpandWidth(true), GUILayout.Height(37)))
|
||||||
|
{
|
||||||
|
string[] textures = null;
|
||||||
|
string material = null;
|
||||||
|
string[] models = null;
|
||||||
|
|
||||||
|
if (curWindow.textureAtlas.exportSettings.exportTextures)
|
||||||
|
{
|
||||||
|
textures = MA_TextureAtlasserProUtils.ExportAtlasTextures(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.textureExportSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curWindow.textureAtlas.exportSettings.exportMaterials)
|
||||||
|
{
|
||||||
|
material = MA_TextureAtlasserProUtils.ExportAtlasMaterial(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.materialExportSettings, textures: textures);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curWindow.textureAtlas.exportSettings.exportModels)
|
||||||
|
{
|
||||||
|
models = MA_TextureAtlasserProUtils.ExportAtlasModels(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.modelExportSettings, materialPath: material);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.enabled = wasEnabled;
|
||||||
|
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawExportOptions()
|
||||||
|
{
|
||||||
|
bool wasEnabled = GUI.enabled;
|
||||||
|
|
||||||
|
if (curWindow.textureAtlas.exportSettings.canModify)
|
||||||
|
{
|
||||||
|
GUI.enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GUI.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
||||||
|
|
||||||
|
curWindow.textureAtlas.exportSettings.exportModels = GUILayout.Toggle(curWindow.textureAtlas.exportSettings.exportModels, "Models:", EditorStyles.toggle);
|
||||||
|
curWindow.textureAtlas.exportSettings.modelExportSettings.modelFormat = (ModelFormat)EditorGUILayout.EnumPopup("ModelFormat:", curWindow.textureAtlas.exportSettings.modelExportSettings.modelFormat);
|
||||||
|
curWindow.textureAtlas.exportSettings.modelExportSettings.uvFlipY = EditorGUILayout.Toggle("UV FlipY:", curWindow.textureAtlas.exportSettings.modelExportSettings.uvFlipY);
|
||||||
|
curWindow.textureAtlas.exportSettings.modelExportSettings.uvChannel = EditorGUILayout.IntField("UV Channel:", curWindow.textureAtlas.exportSettings.modelExportSettings.uvChannel);
|
||||||
|
curWindow.textureAtlas.exportSettings.modelExportSettings.uvWrap = EditorGUILayout.Toggle("UV Wrap:", curWindow.textureAtlas.exportSettings.modelExportSettings.uvWrap);
|
||||||
|
|
||||||
|
curWindow.textureAtlas.exportSettings.exportTextures = GUILayout.Toggle(curWindow.textureAtlas.exportSettings.exportTextures, "Textures:", EditorStyles.toggle);
|
||||||
|
curWindow.textureAtlas.exportSettings.textureExportSettings.textureFormat = (TextureFormat)EditorGUILayout.EnumPopup("TextureFormat:", curWindow.textureAtlas.exportSettings.textureExportSettings.textureFormat);
|
||||||
|
curWindow.textureAtlas.exportSettings.textureExportSettings.textureType = (TextureType)EditorGUILayout.EnumPopup("TextureType:", curWindow.textureAtlas.exportSettings.textureExportSettings.textureType);
|
||||||
|
curWindow.textureAtlas.exportSettings.textureExportSettings.textureScaleMode = (MA_TextureUtils.TextureScaleMode)EditorGUILayout.EnumPopup("TextureScaleMode:", curWindow.textureAtlas.exportSettings.textureExportSettings.textureScaleMode);
|
||||||
|
|
||||||
|
curWindow.textureAtlas.exportSettings.exportMaterials = GUILayout.Toggle(curWindow.textureAtlas.exportSettings.exportMaterials, "Materials:", EditorStyles.toggle);
|
||||||
|
curWindow.textureAtlas.exportSettings.materialExportSettings.shader = (Shader)EditorGUILayout.ObjectField("Shader:", curWindow.textureAtlas.exportSettings.materialExportSettings.shader, typeof(UnityEngine.Shader), false);
|
||||||
|
|
||||||
|
scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
|
||||||
|
for (int i = 0; i < curWindow.textureAtlas.exportSettings.materialExportSettings.shaderPropertyNames.Count; i++)
|
||||||
|
{
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
curWindow.textureAtlas.exportSettings.materialExportSettings.shaderPropertyNames[i] = EditorGUILayout.TextField("", curWindow.textureAtlas.exportSettings.materialExportSettings.shaderPropertyNames[i]);
|
||||||
|
if (GUILayout.Button("-", EditorStyles.miniButtonLeft, GUILayout.ExpandWidth(false)))
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.exportSettings.materialExportSettings.shaderPropertyNames.RemoveAt(i);
|
||||||
|
}
|
||||||
|
if (GUILayout.Button("+", EditorStyles.miniButtonRight, GUILayout.ExpandWidth(false)))
|
||||||
|
{
|
||||||
|
curWindow.textureAtlas.exportSettings.materialExportSettings.shaderPropertyNames.Insert(i + 1, "");
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
EditorGUILayout.EndScrollView();
|
||||||
|
|
||||||
|
EditorGUILayout.EndVertical();
|
||||||
|
|
||||||
|
GUI.enabled = wasEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 142cd2d260a4ef948a2f16b16cd9e00e
|
||||||
|
timeCreated: 1521826727
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -33,7 +34,7 @@ namespace MA_TextureAtlasserPro
|
|||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
//Load the icons
|
//Load the icons
|
||||||
MA_TextureAtlasserProIcons.LoadIcons();
|
//MA_TextureAtlasserProGuiLoader.LoadEditorGui(thisWindow.settings.editorGuiSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GetCurrentWindow()
|
private static void GetCurrentWindow()
|
||||||
@ -58,6 +59,7 @@ namespace MA_TextureAtlasserPro
|
|||||||
}
|
}
|
||||||
|
|
||||||
thisWindow.settings = MA_TextureAtlasserProUtils.LoadSettings();
|
thisWindow.settings = MA_TextureAtlasserProUtils.LoadSettings();
|
||||||
|
MA_TextureAtlasserProGuiLoader.LoadEditorGui(thisWindow.settings);
|
||||||
thisWindow.workView = new MA_TextureAtlasserProWorkView(thisWindow, "workView");
|
thisWindow.workView = new MA_TextureAtlasserProWorkView(thisWindow, "workView");
|
||||||
thisWindow.menuView = new MA_TextureAtlasserProMenuView(thisWindow, "menuView");
|
thisWindow.menuView = new MA_TextureAtlasserProMenuView(thisWindow, "menuView");
|
||||||
thisWindow.inspectorView = new MA_TextureAtlasserProInspectorView(thisWindow, "inspectorView");
|
thisWindow.inspectorView = new MA_TextureAtlasserProInspectorView(thisWindow, "inspectorView");
|
||||||
@ -99,9 +101,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)
|
||||||
@ -118,4 +120,5 @@ namespace MA_TextureAtlasserPro
|
|||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 21fee5883ec8a9c4c911f3c40ab47ecf
|
||||||
|
timeCreated: 1519392331
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
9
Assets/MA_ToolBox/MA_Utilities.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3b68846f992a7304189ffd3ff39072ff
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1518369341
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
9
Assets/MA_ToolBox/MA_Utilities/EditorUtils.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6aa9d38bd8e54d0448095604d7d62fd1
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1522672244
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,6 +1,6 @@
|
|||||||
//Maxartz15
|
//https://github.com/maxartz15/MA_EditorUtils
|
||||||
//Version 1.0
|
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -58,4 +58,5 @@ namespace MA_Editor.Grid
|
|||||||
Handles.EndGUI();
|
Handles.EndGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 64df885d83caddf48acfa78533a3e76f
|
||||||
|
timeCreated: 1522672827
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,6 +1,9 @@
|
|||||||
//Maxartz15
|
//https://github.com/maxartz15/MA_EditorUtils
|
||||||
//Version 1.0
|
|
||||||
|
|
||||||
|
//References:
|
||||||
|
//http://martinecker.com/martincodes/unity-editor-window-zooming/
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using MA_Editor;
|
using MA_Editor;
|
||||||
|
|
||||||
@ -67,4 +70,5 @@ namespace MA_Editor.RectUtils
|
|||||||
return multipliedRect;
|
return multipliedRect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1ec1c2403bd92a84798e0ad68ebf4bad
|
||||||
|
timeCreated: 1522671138
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,6 +1,9 @@
|
|||||||
//Maxartz15
|
//https://github.com/maxartz15/MA_EditorUtils
|
||||||
//Version 1.0
|
|
||||||
|
|
||||||
|
//References:
|
||||||
|
//http://martinecker.com/martincodes/unity-editor-window-zooming/
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using MA_Editor;
|
using MA_Editor;
|
||||||
using MA_Editor.RectUtils;
|
using MA_Editor.RectUtils;
|
||||||
@ -36,4 +39,5 @@ namespace MA_Editor.GUILayoutZoom
|
|||||||
GUI.BeginGroup(new Rect(0.0f, EditorWindowTabHeight, Screen.width, Screen.height));
|
GUI.BeginGroup(new Rect(0.0f, EditorWindowTabHeight, Screen.width, Screen.height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ea365137c05cbd64489983567390af51
|
||||||
|
timeCreated: 1522669939
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
9
Assets/MA_ToolBox/MA_Utilities/MeshUtils.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ac03fa4896f5ed74c80155bbbfccd958
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1522672266
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
179
Assets/MA_ToolBox/MA_Utilities/MeshUtils/MA_MeshUtils.cs
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
//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;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace MA_Mesh
|
||||||
|
{
|
||||||
|
public static class MA_MeshUtils
|
||||||
|
{
|
||||||
|
public static string MA_SaveMeshAsset(Mesh mesh, string savePath)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(mesh.name))
|
||||||
|
{
|
||||||
|
mesh.name = UnityEngine.Random.Range(11111, 99999).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
string assetPath = savePath + mesh.name + ".asset";
|
||||||
|
|
||||||
|
AssetDatabase.CreateAsset(mesh, assetPath);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
|
||||||
|
return assetPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string MA_SaveMeshPrefab(Mesh mesh, string prefabName, string savePath, string materialPath)
|
||||||
|
{
|
||||||
|
string assetPath = null;
|
||||||
|
|
||||||
|
string meshAssetPath = MA_SaveMeshAsset(mesh, savePath);
|
||||||
|
Mesh meshAsset = AssetDatabase.LoadAssetAtPath<Mesh>(meshAssetPath);
|
||||||
|
|
||||||
|
if (meshAsset != null)
|
||||||
|
{
|
||||||
|
GameObject gameObject = new GameObject
|
||||||
|
{
|
||||||
|
name = prefabName
|
||||||
|
};
|
||||||
|
|
||||||
|
gameObject.AddComponent<MeshFilter>().mesh = meshAsset;
|
||||||
|
gameObject.AddComponent<MeshRenderer>();
|
||||||
|
|
||||||
|
Material curMaterial = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
|
||||||
|
if (curMaterial != null)
|
||||||
|
{
|
||||||
|
gameObject.GetComponent<MeshRenderer>().material = curMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(prefabName))
|
||||||
|
{
|
||||||
|
prefabName = UnityEngine.Random.Range(11111, 99999).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
assetPath = savePath + prefabName + ".prefab";
|
||||||
|
|
||||||
|
PrefabUtility.SaveAsPrefabAsset(gameObject, assetPath);
|
||||||
|
UnityEngine.Object.DestroyImmediate(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
return assetPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Mesh MA_DuplicateMesh(Mesh mesh)
|
||||||
|
{
|
||||||
|
Mesh newMesh = new Mesh
|
||||||
|
{
|
||||||
|
name = mesh.name,
|
||||||
|
bounds = mesh.bounds,
|
||||||
|
subMeshCount = mesh.subMeshCount
|
||||||
|
};
|
||||||
|
|
||||||
|
newMesh.SetVertices(new List<Vector3>(mesh.vertices));
|
||||||
|
for (int i = 0; i < mesh.subMeshCount; i++)
|
||||||
|
{
|
||||||
|
newMesh.SetTriangles(mesh.GetTriangles(i), i);
|
||||||
|
}
|
||||||
|
newMesh.SetNormals(new List<Vector3>(mesh.normals));
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
List<Vector2> uvs = new List<Vector2>();
|
||||||
|
mesh.GetUVs(i, uvs);
|
||||||
|
newMesh.SetUVs(i, uvs);
|
||||||
|
}
|
||||||
|
newMesh.SetTangents(new List<Vector4>(mesh.tangents));
|
||||||
|
newMesh.SetColors(new List<Color>(mesh.colors));
|
||||||
|
|
||||||
|
return newMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Mesh MA_ReMapUV(this Mesh mesh, Vector2 atlasSize, Vector2 textureSize, Vector2 texturePosition, int uvChannel = 0)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
0 1
|
||||||
|
512 x 512
|
||||||
|
|
||||||
|
0 .5 = 1 / 512 * 256
|
||||||
|
256 x 256
|
||||||
|
|
||||||
|
+ pos
|
||||||
|
*/
|
||||||
|
|
||||||
|
List<Vector2> uvs = new List<Vector2>();
|
||||||
|
|
||||||
|
//Get UV's
|
||||||
|
mesh.GetUVs(uvChannel, uvs);
|
||||||
|
|
||||||
|
foreach (Vector2 uvCordinate in uvs)
|
||||||
|
{
|
||||||
|
float x = (uvCordinate.x / atlasSize.x * textureSize.x) + texturePosition.x;
|
||||||
|
float y = (uvCordinate.y / atlasSize.y * textureSize.y) + texturePosition.y;
|
||||||
|
uvCordinate.Set(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh.SetUVs(uvChannel, uvs);
|
||||||
|
|
||||||
|
return mesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Mesh MA_UVReMap(this Mesh mesh, Vector2 atlasSize, Rect textureRect, int uvChannel = 0, bool flipY = true, bool wrap = true)
|
||||||
|
{
|
||||||
|
//Get UV's
|
||||||
|
List<Vector2> uvs = new List<Vector2>();
|
||||||
|
mesh.GetUVs(uvChannel, uvs);
|
||||||
|
|
||||||
|
//Min and max bounds in 0-1 space.
|
||||||
|
float xMin, xMax, yMin, yMax;
|
||||||
|
xMin = (1f / atlasSize.x * textureRect.width);
|
||||||
|
xMax = (1f / atlasSize.x * textureRect.x);
|
||||||
|
yMin = (1f / atlasSize.y * textureRect.height);
|
||||||
|
|
||||||
|
//Flip uv's if needed.
|
||||||
|
if (flipY)
|
||||||
|
{
|
||||||
|
yMax = (1f / atlasSize.y * (atlasSize.y - textureRect.height - textureRect.y));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yMax = (1f / atlasSize.y * textureRect.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < uvs.Count; i++)
|
||||||
|
{
|
||||||
|
float newX = uvs[i].x * xMin + xMax;
|
||||||
|
float newY = uvs[i].y * yMin + yMax;
|
||||||
|
|
||||||
|
//Wrap the verts outside of the uv space around back into the uv space.
|
||||||
|
if (wrap)
|
||||||
|
{
|
||||||
|
newX = Wrap(newX, xMax, xMin + xMax);
|
||||||
|
newY = Wrap(newY, yMax, yMin + yMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
uvs[i] = new Vector2(newX, newY);
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh.SetUVs(uvChannel, uvs);
|
||||||
|
|
||||||
|
return mesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float Wrap(float val, float min, float max)
|
||||||
|
{
|
||||||
|
val -= (float)Math.Round((val - min) / (max - min)) * (max - min);
|
||||||
|
if (val < min)
|
||||||
|
val = val + max - min;
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b8292e68eba0ff5488f218a303e60a5b
|
||||||
|
timeCreated: 1518370877
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/MA_ToolBox/MA_Utilities/PrefabUtils.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9946d57c8e1c3714183228268fff08a5
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
41
Assets/MA_ToolBox/MA_Utilities/PrefabUtils/MA_PrefabUtils.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
//-
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MA_Toolbox.Utils.Editor
|
||||||
|
{
|
||||||
|
public static class MA_PrefabUtils
|
||||||
|
{
|
||||||
|
public static string CreatePrefab(string prefabName, string savePath)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrEmpty(prefabName) || string.IsNullOrWhiteSpace(prefabName))
|
||||||
|
{
|
||||||
|
Debug.LogError("Invalid prefab name.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameObject gameObject = new GameObject
|
||||||
|
{
|
||||||
|
name = prefabName
|
||||||
|
};
|
||||||
|
|
||||||
|
string assetPath = savePath + prefabName + ".prefab";
|
||||||
|
|
||||||
|
PrefabUtility.SaveAsPrefabAsset(gameObject, assetPath);
|
||||||
|
UnityEngine.Object.DestroyImmediate(gameObject);
|
||||||
|
|
||||||
|
return assetPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddChild(GameObject prefab, GameObject child)
|
||||||
|
{
|
||||||
|
GameObject p = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
|
||||||
|
child.transform.SetParent(p.transform);
|
||||||
|
PrefabUtility.ApplyPrefabInstance(p, InteractionMode.AutomatedAction);
|
||||||
|
UnityEngine.Object.DestroyImmediate(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 04e1a62b7d6bb434eb0314336ac94f8f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/MA_ToolBox/MA_Utilities/StringUtils.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f38cac7c10bd77748ab01c8642751035
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
28
Assets/MA_ToolBox/MA_Utilities/StringUtils/MA_StringUtils.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
//-
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MA_Toolbox.Utils
|
||||||
|
{
|
||||||
|
public static class MA_StringUtils
|
||||||
|
{
|
||||||
|
private const string ALPHABET = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
|
||||||
|
|
||||||
|
public static string RandomAlphabetString(int length)
|
||||||
|
{
|
||||||
|
string s = "";
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
s += RandomAlphabetChar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static char RandomAlphabetChar()
|
||||||
|
{
|
||||||
|
return ALPHABET[Random.Range(0, ALPHABET.Length)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fc1a5e241141bb549b81ad11dfdc0962
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
9
Assets/MA_ToolBox/MA_Utilities/TextureUtils.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9727f759199d13e4e814f5fb3b8a41de
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1522672279
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,27 +1,24 @@
|
|||||||
//Maxartz15
|
//https://github.com/maxartz15/MA_TextureUtils
|
||||||
//Version 1.0
|
|
||||||
//Part of 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-
|
||||||
|
//https://github.com/maxartz15/MA_TextureAtlasser/commit/9f5240967a51692fa2a17a6b3c8d124dd5dc60f9
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
//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
|
namespace MA_Texture
|
||||||
{
|
{
|
||||||
public static class MA_TextureUtils
|
public static class MA_TextureUtils
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Some base converters and texture settings setters.
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
public static Texture ConvertToReadableTexture(Texture texture)
|
public static Texture ConvertToReadableTexture(Texture texture)
|
||||||
{
|
{
|
||||||
if (texture == null)
|
if (texture == null)
|
||||||
@ -44,11 +41,12 @@ namespace MA_Texture
|
|||||||
RenderTexture.active = tmp;
|
RenderTexture.active = tmp;
|
||||||
|
|
||||||
// Create a new readable Texture2D to copy the pixels to it
|
// Create a new readable Texture2D to copy the pixels to it
|
||||||
Texture2D myTexture2D = new Texture2D(texture.width, texture.width);
|
Texture2D myTexture2D = new Texture2D(texture.width, texture.height);
|
||||||
|
|
||||||
// Copy the pixels from the RenderTexture to the new Texture
|
// Copy the pixels from the RenderTexture to the new Texture
|
||||||
myTexture2D.ReadPixels(new Rect(0, 0, tmp.width, tmp.height), 0, 0);
|
myTexture2D.ReadPixels(new Rect(0, 0, tmp.width, tmp.height), 0, 0);
|
||||||
myTexture2D.Apply();
|
myTexture2D.Apply();
|
||||||
|
myTexture2D.name = texture.name;
|
||||||
|
|
||||||
// Reset the active RenderTexture
|
// Reset the active RenderTexture
|
||||||
RenderTexture.active = previous;
|
RenderTexture.active = previous;
|
||||||
@ -73,8 +71,6 @@ namespace MA_Texture
|
|||||||
bw.Close();
|
bw.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
|
||||||
Debug.Log("Saved texture: " + texture.name);
|
|
||||||
|
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
@ -90,89 +86,122 @@ namespace MA_Texture
|
|||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Scale
|
#region Scale
|
||||||
public static Texture2D MA_Scale2D(this Texture2D texture, int newWidth, int newHeight)
|
public enum TextureScaleMode
|
||||||
|
{
|
||||||
|
Bilinear,
|
||||||
|
Point
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Texture MA_Scale(this Texture texture, int width, int height, TextureScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
Texture2D texture2D = new Texture2D(newWidth, newHeight);
|
Texture2D texture2D = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(texture);
|
||||||
float ratioWidth = texture.width / newWidth;
|
|
||||||
float ratioHeight = texture.height / newHeight;
|
|
||||||
|
|
||||||
for (int x = 0; x < texture.width; x++)
|
texture2D.MA_Scale2D(width, height, scaleMode);
|
||||||
{
|
|
||||||
for (int y = 0; y < texture.height; y++)
|
|
||||||
{
|
|
||||||
Color pixel = texture.GetPixel(x, y);
|
|
||||||
int posX = Mathf.FloorToInt(x / ratioWidth);
|
|
||||||
int posY = Mathf.FloorToInt(y / ratioHeight);
|
|
||||||
texture2D.SetPixel(posX, posY, new Color(pixel.r, pixel.g, pixel.b, pixel.a));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
texture2D.Apply();
|
|
||||||
|
|
||||||
return texture2D;
|
texture = texture2D;
|
||||||
}
|
|
||||||
|
|
||||||
public static Texture MA_Scale(this Texture texture, int newWidth, int newHeight)
|
|
||||||
{
|
|
||||||
Texture2D texture2D = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(texture);
|
|
||||||
|
|
||||||
texture2D.MA_Scale2D(newWidth, newHeight);
|
|
||||||
|
|
||||||
texture = texture2D;
|
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture2D MA_Scale22D(this Texture2D texture, float width, float height)
|
public static Texture2D MA_Scale2D(this Texture2D texture, int newWidth, int newHeight, TextureScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
float ratioWidth = width / texture.width;
|
Color[] curColors = texture.GetPixels();
|
||||||
float ratioHeight = height / texture.height;
|
Color[] newColors = new Color[newWidth * newHeight];
|
||||||
|
|
||||||
int newWidth = Mathf.RoundToInt(texture.width * ratioWidth);
|
switch (scaleMode)
|
||||||
int newHeight = Mathf.RoundToInt(texture.height * ratioHeight);
|
{
|
||||||
|
case TextureScaleMode.Bilinear:
|
||||||
|
newColors = MA_BilinearScale(curColors, texture.width, texture.height, newWidth, newHeight);
|
||||||
|
break;
|
||||||
|
case TextureScaleMode.Point:
|
||||||
|
newColors = MA_PointScale(curColors, texture.width, texture.height, newWidth, newHeight);
|
||||||
|
break;
|
||||||
|
|
||||||
Texture2D newTexture = new Texture2D(newWidth, newHeight);
|
}
|
||||||
|
|
||||||
for (int x = 0; x < texture.width; x++)
|
texture.Resize(newWidth, newHeight);
|
||||||
{
|
texture.SetPixels(newColors);
|
||||||
for (int y = 0; y < texture.height; y++)
|
texture.Apply();
|
||||||
{
|
|
||||||
Color pixel = texture.GetPixel(x, y);
|
|
||||||
int posX = Mathf.RoundToInt(x * ratioWidth);
|
|
||||||
int posY = Mathf.RoundToInt(y * ratioHeight);
|
|
||||||
newTexture.SetPixel(posX, posY, new Color(pixel.r, pixel.g, pixel.b, pixel.a));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
newTexture.name = texture.name;
|
return texture;
|
||||||
|
}
|
||||||
|
|
||||||
newTexture.Apply();
|
private static Color[] MA_BilinearScale(Color[] curColors, int curWidth, int curHeight, int newWidth, int newHeight)
|
||||||
return newTexture;
|
{
|
||||||
}
|
Color[] newColors = new Color[newWidth * newHeight];
|
||||||
|
|
||||||
public static Texture MA_Scale2(this Texture texture, float newWidth, float newHeight)
|
float ratioX = 1.0f / ((float)newWidth / (curWidth - 1));
|
||||||
{
|
float ratioY = 1.0f / ((float)newHeight / (curHeight - 1));
|
||||||
Texture2D texture2D = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(texture);
|
|
||||||
|
|
||||||
texture = texture2D.MA_Scale22D(newWidth, newHeight);
|
for (int y = 0; y < newHeight; y++)
|
||||||
|
{
|
||||||
|
int yFloor = Mathf.FloorToInt(y * ratioY);
|
||||||
|
var y1 = yFloor * curWidth;
|
||||||
|
var y2 = (yFloor + 1) * curWidth;
|
||||||
|
var yw = y * newWidth;
|
||||||
|
|
||||||
return texture;
|
for (int x = 0; x < newWidth; x++)
|
||||||
}
|
{
|
||||||
#endregion
|
int xFloor = Mathf.FloorToInt(x * ratioX);
|
||||||
|
var xLerp = x * ratioX - xFloor;
|
||||||
|
|
||||||
#region combine
|
newColors[yw + x] = ColorLerpUnclamped(ColorLerpUnclamped(curColors[y1 + xFloor], curColors[y1 + xFloor + 1], xLerp),
|
||||||
public static Texture2D MA_Combine2D(this Texture2D texture, Texture2D combineTexture, int offsetX, int offsetY, bool flipY = true)
|
ColorLerpUnclamped(curColors[y2 + xFloor], curColors[y2 + xFloor + 1], xLerp),
|
||||||
|
y * ratioY - yFloor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newColors;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Color[] MA_PointScale(Color[] curColors, int curWidth, int curHeight, int newWidth, int newHeight)
|
||||||
|
{
|
||||||
|
Color[] newColors = new Color[newWidth * newHeight];
|
||||||
|
|
||||||
|
float ratioX = 1.0f / ((float)newWidth / (curWidth - 1));
|
||||||
|
float ratioY = 1.0f / ((float)newHeight / (curHeight - 1));
|
||||||
|
|
||||||
|
for (int y = 0; y < newHeight; y++)
|
||||||
|
{
|
||||||
|
int yFloor = Mathf.FloorToInt(y * ratioY);
|
||||||
|
var y1 = (yFloor + 1) * curWidth;
|
||||||
|
var yw = y * newWidth;
|
||||||
|
|
||||||
|
for (int x = 0; x < newWidth; x++)
|
||||||
|
{
|
||||||
|
int xFloor = Mathf.FloorToInt(x * ratioX);
|
||||||
|
|
||||||
|
newColors[yw + x] = curColors[Mathf.RoundToInt(y1 + xFloor)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newColors;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Color ColorLerpUnclamped(Color c1, Color c2, float value)
|
||||||
|
{
|
||||||
|
return new Color(c1.r + (c2.r - c1.r) * value,
|
||||||
|
c1.g + (c2.g - c1.g) * value,
|
||||||
|
c1.b + (c2.b - c1.b) * value,
|
||||||
|
c1.a + (c2.a - c1.a) * value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region combine
|
||||||
|
public static Texture2D MA_Combine2D(this Texture2D texture, Texture2D combineTexture, int offsetX, int offsetY, bool flipY = true)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < combineTexture.width; x++)
|
for (int x = 0; x < combineTexture.width; x++)
|
||||||
{
|
{
|
||||||
if(flipY)
|
if(flipY)
|
||||||
{
|
{
|
||||||
//Y is 'flipped' because textures are made from left to right, bottom to top. We want to draw from left to right and top to bottom.
|
//Y is 'flipped' because textures are made from left to right, bottom to top. We want to draw from left to right and top to bottom.
|
||||||
for (int y = combineTexture.height; y > 0; y--)
|
for (int y = combineTexture.height - 1; y >= 0; y--)
|
||||||
{
|
{
|
||||||
texture.SetPixel(x + offsetX, texture.height - y - offsetY, combineTexture.GetPixel(x, texture.height - y));
|
texture.SetPixel(x + offsetX, y + (texture.height - offsetY - combineTexture.height), combineTexture.GetPixel(x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -192,7 +221,7 @@ namespace MA_Texture
|
|||||||
public static Texture MA_Combine(this Texture texture, Texture combineTexture, int offsetX, int offsetY)
|
public static Texture MA_Combine(this Texture texture, Texture combineTexture, int offsetX, int offsetY)
|
||||||
{
|
{
|
||||||
Texture2D texture2D = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(texture);
|
Texture2D texture2D = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(texture);
|
||||||
Texture2D combineTexture2D = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(texture);
|
Texture2D combineTexture2D = (Texture2D)MA_TextureUtils.ConvertToReadableTexture(combineTexture);
|
||||||
|
|
||||||
texture = texture2D.MA_Combine2D(combineTexture2D, offsetX, offsetY);
|
texture = texture2D.MA_Combine2D(combineTexture2D, offsetX, offsetY);
|
||||||
|
|
||||||
@ -200,4 +229,5 @@ namespace MA_Texture
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a156d40c509995b4bbc8c259cdac9519
|
||||||
|
timeCreated: 1518369341
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2018 Max Kruf
|
Copyright (c) 2019 Max Kruf
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1 +0,0 @@
|
|||||||
The created atlasses wil go here.
|
|
@ -1 +0,0 @@
|
|||||||
The exported assets will be saved in this folder.
|
|
@ -1,25 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
using MA_Editor;
|
|
||||||
|
|
||||||
namespace MA_TextureAtlasserPro
|
|
||||||
{
|
|
||||||
[System.Serializable]
|
|
||||||
public class MA_TextureAtlasserProSettings : ScriptableObject
|
|
||||||
{
|
|
||||||
[Header("Selection")]
|
|
||||||
public bool autoFocus = true;
|
|
||||||
|
|
||||||
[Header("Duplication:")]
|
|
||||||
public bool copySelectedQuadData = false;
|
|
||||||
public string duplicatedQuadNamePrefix = "new ";
|
|
||||||
|
|
||||||
[Header("Hotkeys:")]
|
|
||||||
public bool useHotkeys = false;
|
|
||||||
public KeyCode addQuadHotKey = KeyCode.Q;
|
|
||||||
public KeyCode removeQuadHotKey = KeyCode.R;
|
|
||||||
public KeyCode duplicateHotKey = KeyCode.D;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace MA_TextureAtlasserPro
|
|
||||||
{
|
|
||||||
public static class MA_TextureAtlasserProIcons
|
|
||||||
{
|
|
||||||
private const string LOADICONPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Icons/";
|
|
||||||
|
|
||||||
public static GUIContent createAtlasIcon;
|
|
||||||
public static GUIContent loadAtlasIcon;
|
|
||||||
public static GUIContent exportAtlasIcon;
|
|
||||||
public static GUIContent createQuadIcon;
|
|
||||||
public static GUIContent removeQuadIcon;
|
|
||||||
public static GUIContent duplicateQuadIcon;
|
|
||||||
public static GUIContent showTexturesOnIcon;
|
|
||||||
public static GUIContent showTexturesOffIcon;
|
|
||||||
public static GUIContent dragHandleIcon;
|
|
||||||
public static GUIContent editIcon;
|
|
||||||
|
|
||||||
public static void LoadIcons()
|
|
||||||
{
|
|
||||||
createAtlasIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "createAtlasIcon" + ".png"));
|
|
||||||
loadAtlasIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "loadAtlasIcon" + ".png"));
|
|
||||||
exportAtlasIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "exportAtlasIcon" + ".png"));
|
|
||||||
createQuadIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "createQuadIcon" + ".png"));
|
|
||||||
removeQuadIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "removeQuadIcon" + ".png"));
|
|
||||||
duplicateQuadIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "duplicateQuadIcon" + ".png"));
|
|
||||||
showTexturesOnIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "showTexturesOnIcon" + ".png"));
|
|
||||||
showTexturesOffIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "showTexturesOffIcon" + ".png"));
|
|
||||||
dragHandleIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "dragHandleIcon" + ".png"));
|
|
||||||
editIcon = new GUIContent("", (Texture)EditorGUIUtility.Load(LOADICONPATH + "editIcon" + ".png"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,380 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
using MA_Mesh;
|
|
||||||
using MA_Texture;
|
|
||||||
|
|
||||||
namespace MA_TextureAtlasserPro
|
|
||||||
{
|
|
||||||
public static class MA_TextureAtlasserProUtils
|
|
||||||
{
|
|
||||||
public const string SETTINGSASSETPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Settings/";
|
|
||||||
public const string SAVEASSETPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Atlasses/";
|
|
||||||
public const string LOADASSETPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Atlasses/";
|
|
||||||
public const string EXPORTASSETPATH = "Assets/MA_ToolBox/MA_TextureAtlasserPro/Exports/";
|
|
||||||
public const float VIEWOFFSET = 20;
|
|
||||||
public const string DEFAULTTEXTUREGROUPNAME = "Albedo";
|
|
||||||
|
|
||||||
public static MA_TextureAtlasserProSettings CreateSettings()
|
|
||||||
{
|
|
||||||
MA_TextureAtlasserProSettings _settings = (MA_TextureAtlasserProSettings)ScriptableObject.CreateInstance<MA_TextureAtlasserProSettings>();
|
|
||||||
|
|
||||||
if(_settings != null)
|
|
||||||
{
|
|
||||||
AssetDatabase.CreateAsset(_settings, SETTINGSASSETPATH + "MA_TextureAtlasserProSettings.asset");
|
|
||||||
AssetDatabase.SaveAssets();
|
|
||||||
AssetDatabase.Refresh();
|
|
||||||
|
|
||||||
return _settings;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MA_TextureAtlasserProSettings LoadSettings()
|
|
||||||
{
|
|
||||||
MA_TextureAtlasserProSettings _settings = AssetDatabase.LoadAssetAtPath(SETTINGSASSETPATH + "MA_TextureAtlasserProSettings.asset", typeof(MA_TextureAtlasserProSettings)) as MA_TextureAtlasserProSettings;
|
|
||||||
|
|
||||||
if (_settings == null)
|
|
||||||
{
|
|
||||||
_settings = CreateSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MA_TextureAtlasserProAtlas CreateTextureAtlas(string name, Vector2 size)
|
|
||||||
{
|
|
||||||
MA_TextureAtlasserProAtlas _atlas = (MA_TextureAtlasserProAtlas)ScriptableObject.CreateInstance<MA_TextureAtlasserProAtlas>();
|
|
||||||
|
|
||||||
if(_atlas != null)
|
|
||||||
{
|
|
||||||
_atlas.CreateAtlas(name, size);
|
|
||||||
MA_CheckTextureAtlas(_atlas);
|
|
||||||
|
|
||||||
AssetDatabase.CreateAsset(_atlas, SAVEASSETPATH + name + ".asset");
|
|
||||||
AssetDatabase.SaveAssets();
|
|
||||||
AssetDatabase.Refresh();
|
|
||||||
|
|
||||||
return _atlas;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MA_TextureAtlasserProAtlas LoadTextureAtlas()
|
|
||||||
{
|
|
||||||
MA_TextureAtlasserProAtlas _atlas = null;
|
|
||||||
string absPath = EditorUtility.OpenFilePanel("Select Texture Atlas", LOADASSETPATH, "");
|
|
||||||
|
|
||||||
if(absPath.StartsWith(Application.dataPath))
|
|
||||||
{
|
|
||||||
string relPath = absPath.Substring(Application.dataPath.Length - "Assets".Length);
|
|
||||||
_atlas = AssetDatabase.LoadAssetAtPath(relPath, typeof(MA_TextureAtlasserProAtlas)) as MA_TextureAtlasserProAtlas;
|
|
||||||
|
|
||||||
MA_CheckTextureAtlas(_atlas);
|
|
||||||
|
|
||||||
if(_atlas)
|
|
||||||
{
|
|
||||||
EditorPrefs.SetString("AtlasPath", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_atlas != null)
|
|
||||||
{
|
|
||||||
if(_atlas.selectedTextureQuad != null)
|
|
||||||
{
|
|
||||||
_atlas.selectedTextureQuad.isSelected = false;
|
|
||||||
}
|
|
||||||
_atlas.selectedTextureQuad = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _atlas;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void MA_CheckTextureAtlas(MA_TextureAtlasserProAtlas atlas)
|
|
||||||
{
|
|
||||||
if(atlas.textureGroupRegistration == null)
|
|
||||||
{
|
|
||||||
atlas.textureGroupRegistration = new List<MA_TextureGroupRegistration>();
|
|
||||||
|
|
||||||
MA_TextureGroupRegistration groupRegistration = new MA_TextureGroupRegistration();
|
|
||||||
groupRegistration.name = DEFAULTTEXTUREGROUPNAME;
|
|
||||||
|
|
||||||
atlas.textureGroupRegistration.Add(groupRegistration);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(atlas.textureQuads == null)
|
|
||||||
{
|
|
||||||
atlas.textureQuads = new List<MA_TextureAtlasserProQuad>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool _sameCount = true;
|
|
||||||
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
|
||||||
{
|
|
||||||
if(q.textureGroups.Count != atlas.textureGroupRegistration.Count)
|
|
||||||
{
|
|
||||||
_sameCount = false;
|
|
||||||
Debug.LogWarning("TextureAtlasser: " + q.name + " doesn't have the right amount of texture groups!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_sameCount)
|
|
||||||
{
|
|
||||||
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < atlas.textureQuads.Count; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < atlas.textureGroupRegistration.Count; j++)
|
|
||||||
{
|
|
||||||
if(atlas.textureQuads[i].textureGroups[j].name != atlas.textureGroupRegistration[j].name)
|
|
||||||
{
|
|
||||||
Debug.LogWarning("TextureAtlasser: " + q.name + " doesn't have the right texture group name!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CreateTextureQuad(MA_TextureAtlasserProAtlas atlas, string name, Rect rect, bool focus = true)
|
|
||||||
{
|
|
||||||
if(atlas != null)
|
|
||||||
{
|
|
||||||
//Create new list if we haven't one already
|
|
||||||
if(atlas.textureQuads == null)
|
|
||||||
{
|
|
||||||
atlas.textureQuads = new List<MA_TextureAtlasserProQuad>();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Create new quad
|
|
||||||
MA_TextureAtlasserProQuad _quad = (MA_TextureAtlasserProQuad)ScriptableObject.CreateInstance("MA_TextureAtlasserProQuad");
|
|
||||||
|
|
||||||
//Add quad to asset
|
|
||||||
if(_quad != null)
|
|
||||||
{
|
|
||||||
//Set quad settings
|
|
||||||
_quad.name = name;
|
|
||||||
_quad.rect = rect;
|
|
||||||
|
|
||||||
SetTextureGroups(atlas, _quad);
|
|
||||||
|
|
||||||
atlas.textureQuads.Add((MA_TextureAtlasserProQuad)_quad);
|
|
||||||
|
|
||||||
AssetDatabase.AddObjectToAsset(_quad, atlas);
|
|
||||||
AssetDatabase.SaveAssets();
|
|
||||||
AssetDatabase.Refresh();
|
|
||||||
|
|
||||||
if(focus)
|
|
||||||
{
|
|
||||||
atlas.selectedTextureQuad = atlas.textureQuads[atlas.textureQuads.Count - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogError("CreateTextureQuad Failed: _TextureQuad");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogError("CreateTextureQuad Failed: textureAtlas");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RemoveTextureQuad(MA_TextureAtlasserProAtlas atlas, bool focus = true)
|
|
||||||
{
|
|
||||||
if(atlas != null && atlas.selectedTextureQuad != null)
|
|
||||||
{
|
|
||||||
int _index = atlas.textureQuads.IndexOf(atlas.selectedTextureQuad);
|
|
||||||
|
|
||||||
atlas.textureQuads.RemoveAt(_index);
|
|
||||||
GameObject.DestroyImmediate(atlas.selectedTextureQuad, true);
|
|
||||||
AssetDatabase.SaveAssets();
|
|
||||||
AssetDatabase.Refresh();
|
|
||||||
|
|
||||||
if (focus && atlas.textureQuads.Count > 0)
|
|
||||||
{
|
|
||||||
_index = Mathf.Clamp(_index, 0, atlas.textureQuads.Count - 1);
|
|
||||||
atlas.selectedTextureQuad = atlas.textureQuads[_index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DuplicateTextureQuad(MA_TextureAtlasserProAtlas atlas, bool focus = true, bool copyData = false, string namePrefix = "new ")
|
|
||||||
{
|
|
||||||
if(atlas != null && atlas.selectedTextureQuad != null)
|
|
||||||
{
|
|
||||||
CreateTextureQuad(atlas, namePrefix + atlas.selectedTextureQuad.name, atlas.selectedTextureQuad.rect);
|
|
||||||
|
|
||||||
if(copyData)
|
|
||||||
{
|
|
||||||
atlas.textureQuads[atlas.textureQuads.Count - 1].meshes = atlas.selectedTextureQuad.meshes;
|
|
||||||
atlas.textureQuads[atlas.textureQuads.Count - 1].textureGroups = atlas.selectedTextureQuad.textureGroups;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(focus)
|
|
||||||
{
|
|
||||||
atlas.selectedTextureQuad = atlas.textureQuads[atlas.textureQuads.Count - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetTextureGroups(MA_TextureAtlasserProAtlas atlas, MA_TextureAtlasserProQuad quad)
|
|
||||||
{
|
|
||||||
if(quad.textureGroups == null)
|
|
||||||
{
|
|
||||||
quad.textureGroups = new List<MA_TextureGroup>();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Add texture groups
|
|
||||||
foreach (MA_TextureGroupRegistration tgr in atlas.textureGroupRegistration)
|
|
||||||
{
|
|
||||||
MA_TextureGroup textureGroup = new MA_TextureGroup();
|
|
||||||
textureGroup.name = tgr.name;
|
|
||||||
quad.textureGroups.Add(textureGroup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CreateTextureGroup(MA_TextureAtlasserProAtlas atlas, string name)
|
|
||||||
{
|
|
||||||
MA_TextureGroupRegistration _textureGroupRegistration = new MA_TextureGroupRegistration();
|
|
||||||
_textureGroupRegistration.name = name;
|
|
||||||
atlas.textureGroupRegistration.Add(_textureGroupRegistration);
|
|
||||||
|
|
||||||
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
|
||||||
{
|
|
||||||
MA_TextureGroup _textureGroup = new MA_TextureGroup();
|
|
||||||
_textureGroup.name = name;
|
|
||||||
q.textureGroups.Add(_textureGroup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RemoveTextureGroup(MA_TextureAtlasserProAtlas atlas, int index)
|
|
||||||
{
|
|
||||||
atlas.textureGroupRegistration.RemoveAt(index);
|
|
||||||
|
|
||||||
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
|
||||||
{
|
|
||||||
q.textureGroups.RemoveAt(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CloseWindow(MA_TextureAtlasserProWindow curWindow)
|
|
||||||
{
|
|
||||||
if(curWindow == null)
|
|
||||||
{
|
|
||||||
Debug.LogError("Closing window Failed: curWindow == null");
|
|
||||||
}
|
|
||||||
curWindow.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ExportAtlas(MA_TextureAtlasserProAtlas atlas, string savePath = EXPORTASSETPATH)
|
|
||||||
{
|
|
||||||
if(atlas != null && atlas.textureQuads != null)
|
|
||||||
{
|
|
||||||
ExportAtlasMeshesObj(atlas);
|
|
||||||
ExportAtlasTexturesPNG(atlas);
|
|
||||||
|
|
||||||
AssetDatabase.Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ExportAtlasMeshesObj(MA_TextureAtlasserProAtlas atlas, string savePath = EXPORTASSETPATH)
|
|
||||||
{
|
|
||||||
if(atlas != null && atlas.textureQuads != null)
|
|
||||||
{
|
|
||||||
foreach (MA_TextureAtlasserProQuad ta in atlas.textureQuads)
|
|
||||||
{
|
|
||||||
//Export Mesh
|
|
||||||
if(ta.meshes != null)
|
|
||||||
{
|
|
||||||
for (int m = 0; m < ta.meshes.Count; m++)
|
|
||||||
{
|
|
||||||
if(ta.meshes[m] != null)
|
|
||||||
{
|
|
||||||
//Create new mesh
|
|
||||||
Mesh newMesh = new Mesh();
|
|
||||||
//Duplicate it from the current one
|
|
||||||
newMesh = MA_MeshUtils.MA_DuplicateMesh(ta.meshes[m]);
|
|
||||||
//Remap uvs
|
|
||||||
newMesh = MA_MeshUtils.MA_UVReMap(newMesh, atlas.textureAtlasSize, ta.guiRect);
|
|
||||||
//Save it
|
|
||||||
MA_MeshUtils.MeshToFile(newMesh, "MA_" + ta.name, savePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static void ExportAtlasTexturePNG(MA_TextureAtlasserProAtlas atlas, string savePath = EXPORTASSETPATH)
|
|
||||||
// {
|
|
||||||
// if(atlas != null && atlas.textureQuads != null)
|
|
||||||
// {
|
|
||||||
// //Create new Texture Atlas
|
|
||||||
// Texture2D newTexture = new Texture2D((int)atlas.textureAtlasSize.x, (int)atlas.textureAtlasSize.y);
|
|
||||||
// newTexture.name = atlas.name;
|
|
||||||
|
|
||||||
// foreach (MA_TextureAtlasserProQuad ta in atlas.textureQuads)
|
|
||||||
// {
|
|
||||||
// //Export Texture Atlas
|
|
||||||
// //TODO: Replace with texture groups (foreacht ...)
|
|
||||||
// if(ta.texture != null)
|
|
||||||
// {
|
|
||||||
// //Create new texture part
|
|
||||||
// Texture2D newTexturePart = (Texture2D)MA_Texture.MA_TextureUtils.ConvertToReadableTexture(ta.texture);
|
|
||||||
// //Scale it
|
|
||||||
// newTexturePart = newTexturePart.MA_Scale2D((int)ta.guiRect.width, (int)ta.guiRect.height);
|
|
||||||
// //Add it
|
|
||||||
// newTexture = newTexture.MA_Combine2D(newTexturePart, (int)ta.guiRect.x, (int)ta.guiRect.y);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //Save it
|
|
||||||
// newTexture.MA_Save2D("MA_" + newTexture.name, savePath);
|
|
||||||
// //Refresh
|
|
||||||
// AssetDatabase.Refresh();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static void ExportAtlasTexturesPNG(MA_TextureAtlasserProAtlas atlas, string savePath = EXPORTASSETPATH)
|
|
||||||
{
|
|
||||||
if(atlas != null && atlas.textureQuads != null && atlas.textureGroupRegistration != null)
|
|
||||||
{
|
|
||||||
//Foreach texture group
|
|
||||||
for (int i = 0; i < atlas.textureGroupRegistration.Count; i++)
|
|
||||||
{
|
|
||||||
//Create new Texture Atlas
|
|
||||||
Texture2D newTexture = new Texture2D((int)atlas.textureAtlasSize.x, (int)atlas.textureAtlasSize.y);
|
|
||||||
newTexture.name = atlas.name + "_" + atlas.textureGroupRegistration[i].name;
|
|
||||||
|
|
||||||
foreach (MA_TextureAtlasserProQuad q in atlas.textureQuads)
|
|
||||||
{
|
|
||||||
if(q.textureGroups != null && q.textureGroups[i].texture != null)
|
|
||||||
{
|
|
||||||
//Create new texture part
|
|
||||||
Texture2D newTexturePart = (Texture2D)MA_Texture.MA_TextureUtils.ConvertToReadableTexture(q.textureGroups[i].texture);
|
|
||||||
//Scale it
|
|
||||||
newTexturePart = newTexturePart.MA_Scale2D((int)q.guiRect.width, (int)q.guiRect.height);
|
|
||||||
//Add it
|
|
||||||
newTexture = newTexture.MA_Combine2D(newTexturePart, (int)q.guiRect.x, (int)q.guiRect.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Save it
|
|
||||||
newTexture.MA_Save2D("MA_" + newTexture.name, savePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Refresh
|
|
||||||
AssetDatabase.Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,134 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
using MA_Editor;
|
|
||||||
|
|
||||||
namespace MA_TextureAtlasserPro
|
|
||||||
{
|
|
||||||
public class MA_TextureAtlasserProInspectorView : MA_TextureAtlasserProViewBase
|
|
||||||
{
|
|
||||||
private MA_TextureAtlasserProQuad lastSelectedQuad;
|
|
||||||
|
|
||||||
private bool isEditing = false;
|
|
||||||
|
|
||||||
public MA_TextureAtlasserProInspectorView(MA_TextureAtlasserProWindow currentEditorWindow, string title) : base(currentEditorWindow, title)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void UpdateView(Event e, Rect editorViewRect)
|
|
||||||
{
|
|
||||||
//Update base derived class
|
|
||||||
base.UpdateView(e, editorViewRect);
|
|
||||||
|
|
||||||
if(isLoaded)
|
|
||||||
{
|
|
||||||
//Draw inspector
|
|
||||||
if(curWindow.textureAtlas != null && curWindow.textureAtlas.selectedTextureQuad != null)
|
|
||||||
{
|
|
||||||
//Deselect GUI elements when we are focusing on a new quad
|
|
||||||
if(lastSelectedQuad != curWindow.textureAtlas.selectedTextureQuad)
|
|
||||||
{
|
|
||||||
lastSelectedQuad = curWindow.textureAtlas.selectedTextureQuad;
|
|
||||||
GUI.FocusControl(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.BeginArea(editorViewRect, EditorStyles.helpBox);
|
|
||||||
GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
|
|
||||||
|
|
||||||
GUILayout.Label("Quad Name");
|
|
||||||
curWindow.textureAtlas.selectedTextureQuad.name = EditorGUILayout.TextField(curWindow.textureAtlas.selectedTextureQuad.name);
|
|
||||||
|
|
||||||
GUILayout.Space(MA_TextureAtlasserProUtils.VIEWOFFSET / 2);
|
|
||||||
|
|
||||||
//Textures
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
GUILayout.Label("Textures", GUILayout.ExpandWidth(true));
|
|
||||||
if(GUILayout.Button(MA_TextureAtlasserProIcons.editIcon, EditorStyles.miniButton, GUILayout.Width(36), GUILayout.Height(15)))
|
|
||||||
{
|
|
||||||
isEditing = !isEditing;
|
|
||||||
}
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
if(curWindow.textureAtlas.textureGroupRegistration == null || curWindow.textureAtlas.textureGroupRegistration.Count == 0)
|
|
||||||
{
|
|
||||||
if(GUILayout.Button("+", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
|
||||||
{
|
|
||||||
MA_TextureAtlasserProUtils.CreateTextureGroup(curWindow.textureAtlas, "New TextureGroup");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i < curWindow.textureAtlas.textureGroupRegistration.Count; i++)
|
|
||||||
{
|
|
||||||
if(isEditing)
|
|
||||||
{
|
|
||||||
curWindow.textureAtlas.textureGroupRegistration[i].name = curWindow.textureAtlas.selectedTextureQuad.textureGroups[i].name = EditorGUILayout.TextField(curWindow.textureAtlas.textureGroupRegistration[i].name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GUILayout.Label(curWindow.textureAtlas.textureGroupRegistration[i].name);
|
|
||||||
}
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
curWindow.textureAtlas.selectedTextureQuad.textureGroups[i].texture = (Texture)EditorGUILayout.ObjectField(curWindow.textureAtlas.selectedTextureQuad.textureGroups[i].texture, typeof(Texture), false);
|
|
||||||
if(isEditing && GUILayout.Button("-", EditorStyles.miniButtonLeft, GUILayout.ExpandWidth(false)))
|
|
||||||
{
|
|
||||||
MA_TextureAtlasserProUtils.RemoveTextureGroup(curWindow.textureAtlas, i);
|
|
||||||
}
|
|
||||||
if(isEditing && GUILayout.Button("+", EditorStyles.miniButtonRight, GUILayout.ExpandWidth(false)))
|
|
||||||
{
|
|
||||||
MA_TextureAtlasserProUtils.CreateTextureGroup(curWindow.textureAtlas, "New TextureGroup");
|
|
||||||
}
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.Space(MA_TextureAtlasserProUtils.VIEWOFFSET / 2);
|
|
||||||
|
|
||||||
//Meshes
|
|
||||||
GUILayout.Label("Meshes");
|
|
||||||
if(curWindow.textureAtlas.selectedTextureQuad.meshes != null)
|
|
||||||
{
|
|
||||||
if(curWindow.textureAtlas.selectedTextureQuad.meshes.Count == 0)
|
|
||||||
{
|
|
||||||
if(GUILayout.Button("+", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
|
||||||
{
|
|
||||||
curWindow.textureAtlas.selectedTextureQuad.meshes.Add(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i < curWindow.textureAtlas.selectedTextureQuad.meshes.Count; i++)
|
|
||||||
{
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
curWindow.textureAtlas.selectedTextureQuad.meshes[i] = (Mesh)EditorGUILayout.ObjectField(curWindow.textureAtlas.selectedTextureQuad.meshes[i], typeof(Mesh), false);
|
|
||||||
if(GUILayout.Button("-", EditorStyles.miniButtonLeft, GUILayout.ExpandWidth(false)))
|
|
||||||
{
|
|
||||||
curWindow.textureAtlas.selectedTextureQuad.meshes.RemoveAt(i);
|
|
||||||
}
|
|
||||||
if(GUILayout.Button("+", EditorStyles.miniButtonRight, GUILayout.ExpandWidth(false)))
|
|
||||||
{
|
|
||||||
curWindow.textureAtlas.selectedTextureQuad.meshes.Insert(i, null);
|
|
||||||
}
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curWindow.textureAtlas.selectedTextureQuad.meshes = new List<Mesh>();
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.FlexibleSpace();
|
|
||||||
GUILayout.Label("x " + curWindow.textureAtlas.selectedTextureQuad.guiRect.x.ToString() + ", y " + curWindow.textureAtlas.selectedTextureQuad.guiRect.y.ToString());
|
|
||||||
GUILayout.Label("w " + curWindow.textureAtlas.selectedTextureQuad.guiRect.width.ToString() + ", h " + curWindow.textureAtlas.selectedTextureQuad.guiRect.height.ToString());
|
|
||||||
|
|
||||||
GUILayout.EndVertical();
|
|
||||||
GUILayout.EndArea();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(curWindow.textureAtlas != null && curWindow.textureAtlas.selectedTextureQuad != null)
|
|
||||||
ProcessEvents(e, editorViewRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void ProcessEvents(Event e, Rect editorViewRect)
|
|
||||||
{
|
|
||||||
base.ProcessEvents(e, editorViewRect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,135 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
using MA_Editor;
|
|
||||||
|
|
||||||
namespace MA_TextureAtlasserPro
|
|
||||||
{
|
|
||||||
public class MA_TextureAtlasserProExportWindow : EditorWindow
|
|
||||||
{
|
|
||||||
//Editor
|
|
||||||
private static MA_TextureAtlasserProExportWindow thisWindow;
|
|
||||||
public static MA_TextureAtlasserProWindow curWindow;
|
|
||||||
|
|
||||||
//Data
|
|
||||||
private static bool isLoaded = false; //Make sure we wait a frame at the start to setup and don't draw.
|
|
||||||
|
|
||||||
[MenuItem("MA_ToolKit/MA_TextureAtlasserPro/Export Atlas")]
|
|
||||||
private static void Init()
|
|
||||||
{
|
|
||||||
GetCurrentWindow();
|
|
||||||
|
|
||||||
thisWindow.minSize = new Vector2(500,160);
|
|
||||||
thisWindow.maxSize = new Vector2(500,160);
|
|
||||||
|
|
||||||
thisWindow.titleContent.text = "MA_ExportTextureAtlas";
|
|
||||||
|
|
||||||
thisWindow.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InitEditorWindow(MA_TextureAtlasserProWindow currentEditorWindow)
|
|
||||||
{
|
|
||||||
curWindow = currentEditorWindow;
|
|
||||||
|
|
||||||
GetCurrentWindow();
|
|
||||||
|
|
||||||
thisWindow.minSize = new Vector2(500,160);
|
|
||||||
thisWindow.maxSize = new Vector2(500,160);
|
|
||||||
|
|
||||||
thisWindow.titleContent.text = "MA_ExportTextureAtlas";
|
|
||||||
|
|
||||||
thisWindow.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void GetCurrentWindow()
|
|
||||||
{
|
|
||||||
thisWindow = (MA_TextureAtlasserProExportWindow)EditorWindow.GetWindow<MA_TextureAtlasserProExportWindow>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CloseWindow()
|
|
||||||
{
|
|
||||||
if(thisWindow == null)
|
|
||||||
{
|
|
||||||
GetCurrentWindow();
|
|
||||||
thisWindow.Close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
thisWindow.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Event ProcessEvents()
|
|
||||||
{
|
|
||||||
Event e = Event.current;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
[UnityEditor.Callbacks.DidReloadScripts]
|
|
||||||
private static void OnReload()
|
|
||||||
{
|
|
||||||
//Make sure that when the compiler is finished and reloads the scripts, we are waiting for the next Event.
|
|
||||||
isLoaded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnGUI()
|
|
||||||
{
|
|
||||||
if(thisWindow == null)
|
|
||||||
{
|
|
||||||
GetCurrentWindow();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get current event
|
|
||||||
Event e = ProcessEvents();
|
|
||||||
|
|
||||||
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.BeginVertical();
|
|
||||||
|
|
||||||
|
|
||||||
if(curWindow != null && curWindow.textureAtlas != null)
|
|
||||||
{
|
|
||||||
//Export options
|
|
||||||
GUILayout.Box("Note: No custom export options right now.. :<", EditorStyles.helpBox);
|
|
||||||
|
|
||||||
//Export
|
|
||||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
|
||||||
|
|
||||||
GUILayout.Label("Meshes: OBJ | Textures: PNG");
|
|
||||||
if(GUILayout.Button("Export Atlas", GUILayout.ExpandWidth(true), GUILayout.Height(37)))
|
|
||||||
{
|
|
||||||
MA_TextureAtlasserProUtils.ExportAtlas(curWindow.textureAtlas);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.EndVertical();
|
|
||||||
}
|
|
||||||
else if(curWindow == null)
|
|
||||||
{
|
|
||||||
GUI.backgroundColor = Color.red;
|
|
||||||
GUILayout.Box("Error: Link with the Texture Atlas Editor lost!", EditorStyles.helpBox);
|
|
||||||
if(GUILayout.Button("Link Atlas Editor", GUILayout.ExpandWidth(true), GUILayout.Height(37)))
|
|
||||||
{
|
|
||||||
curWindow = (MA_TextureAtlasserProWindow)EditorWindow.GetWindow<MA_TextureAtlasserProWindow>();
|
|
||||||
}
|
|
||||||
GUI.backgroundColor = Color.white;
|
|
||||||
}
|
|
||||||
else if(curWindow.textureAtlas == null)
|
|
||||||
{
|
|
||||||
GUI.backgroundColor = Color.red;
|
|
||||||
GUILayout.Box("Error: No Texture Atlas found make sure to open one!", EditorStyles.helpBox);
|
|
||||||
GUI.backgroundColor = Color.white;
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.EndVertical();
|
|
||||||
GUILayout.EndArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(e.type == EventType.Repaint)
|
|
||||||
isLoaded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
Settigns are supposed to be here.
|
|