mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-07 03:06:55 +08:00
Merge branch '4.1' of https://github.com/esotericsoftware/spine-runtimes into 4.1
This commit is contained in:
commit
0f118ba3bd
@ -664,7 +664,7 @@ namespace Spine.Unity.Editor {
|
|||||||
Material material = (Material)AssetDatabase.LoadAssetAtPath(materialPath, typeof(Material));
|
Material material = (Material)AssetDatabase.LoadAssetAtPath(materialPath, typeof(Material));
|
||||||
|
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
Shader defaultShader = Shader.Find(SpineEditorUtilities.Preferences.DefaultShader);
|
Shader defaultShader = GetDefaultShader();
|
||||||
material = defaultShader != null ? new Material(defaultShader) : null;
|
material = defaultShader != null ? new Material(defaultShader) : null;
|
||||||
if (material) {
|
if (material) {
|
||||||
ApplyPMAOrStraightAlphaSettings(material, SpineEditorUtilities.Preferences.textureSettingsReference);
|
ApplyPMAOrStraightAlphaSettings(material, SpineEditorUtilities.Preferences.textureSettingsReference);
|
||||||
@ -737,6 +737,13 @@ namespace Spine.Unity.Editor {
|
|||||||
return loadedAtlas != null ? loadedAtlas : atlasAsset;
|
return loadedAtlas != null ? loadedAtlas : atlasAsset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Shader GetDefaultShader () {
|
||||||
|
Shader shader = Shader.Find(SpineEditorUtilities.Preferences.DefaultShader);
|
||||||
|
if (shader == null) shader = Shader.Find("Spine/Skeleton");
|
||||||
|
if (shader == null) shader = Shader.Find("Standard");
|
||||||
|
return shader;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool SpriteAtlasSettingsNeedAdjustment (UnityEngine.U2D.SpriteAtlas spriteAtlas) {
|
public static bool SpriteAtlasSettingsNeedAdjustment (UnityEngine.U2D.SpriteAtlas spriteAtlas) {
|
||||||
#if EXPOSES_SPRITE_ATLAS_UTILITIES
|
#if EXPOSES_SPRITE_ATLAS_UTILITIES
|
||||||
UnityEditor.U2D.SpriteAtlasPackingSettings packingSettings = UnityEditor.U2D.SpriteAtlasExtensions.GetPackingSettings(spriteAtlas);
|
UnityEditor.U2D.SpriteAtlasPackingSettings packingSettings = UnityEditor.U2D.SpriteAtlasExtensions.GetPackingSettings(spriteAtlas);
|
||||||
@ -851,24 +858,24 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
{
|
{
|
||||||
string pageName = "SpriteAtlas";
|
string pageName = "SpriteAtlas";
|
||||||
|
|
||||||
string materialPath = assetPath + "/" + primaryName + "_" + pageName + ".mat";
|
string materialPath = assetPath + "/" + primaryName + "_" + pageName + ".mat";
|
||||||
Material mat = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
|
Material material = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
|
||||||
|
|
||||||
if (mat == null) {
|
if (material == null) {
|
||||||
mat = new Material(Shader.Find(SpineEditorUtilities.Preferences.defaultShader));
|
Shader defaultShader = GetDefaultShader();
|
||||||
ApplyPMAOrStraightAlphaSettings(mat, SpineEditorUtilities.Preferences.textureSettingsReference);
|
material = defaultShader != null ? new Material(defaultShader) : null;
|
||||||
AssetDatabase.CreateAsset(mat, materialPath);
|
ApplyPMAOrStraightAlphaSettings(material, SpineEditorUtilities.Preferences.textureSettingsReference);
|
||||||
|
AssetDatabase.CreateAsset(material, materialPath);
|
||||||
} else {
|
} else {
|
||||||
vestigialMaterials.Remove(mat);
|
vestigialMaterials.Remove(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture != null)
|
if (texture != null)
|
||||||
mat.mainTexture = texture;
|
material.mainTexture = texture;
|
||||||
|
|
||||||
EditorUtility.SetDirty(mat);
|
EditorUtility.SetDirty(material);
|
||||||
// note: don't call AssetDatabase.SaveAssets() since this would trigger OnPostprocessAllAssets() every time unnecessarily.
|
// note: don't call AssetDatabase.SaveAssets() since this would trigger OnPostprocessAllAssets() every time unnecessarily.
|
||||||
populatingMaterials.Add(mat); //atlasAsset.materials[i] = mat;
|
populatingMaterials.Add(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
atlasAsset.materials = populatingMaterials.ToArray();
|
atlasAsset.materials = populatingMaterials.ToArray();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-unity",
|
"name": "com.esotericsoftware.spine.spine-unity",
|
||||||
"displayName": "spine-unity Runtime",
|
"displayName": "spine-unity Runtime",
|
||||||
"description": "This plugin provides the spine-unity runtime core.",
|
"description": "This plugin provides the spine-unity runtime core.",
|
||||||
"version": "4.1.14",
|
"version": "4.1.15",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user