mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-02 05:39:07 +08:00
Merge branch '4.2' into 4.3-beta
This commit is contained in:
commit
8115dd8dde
@ -17,8 +17,8 @@
|
|||||||
"cpp"
|
"cpp"
|
||||||
],
|
],
|
||||||
"description": "The official Spine Runtime for Haxe",
|
"description": "The official Spine Runtime for Haxe",
|
||||||
"version": "4.2.6",
|
"version": "4.2.7",
|
||||||
"releasenote": "Update to 4.2.6",
|
"releasenote": "Update to 4.2.7",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"esotericsoftware"
|
"esotericsoftware"
|
||||||
],
|
],
|
||||||
|
|||||||
@ -423,6 +423,10 @@ class SkeletonSprite extends DisplayObject implements IAnimatable {
|
|||||||
_state = null;
|
_state = null;
|
||||||
}
|
}
|
||||||
if (_skeleton != null) _skeleton = null;
|
if (_skeleton != null) _skeleton = null;
|
||||||
|
dispatchEventWith(starling.events.Event.REMOVE_FROM_JUGGLER);
|
||||||
|
removeFromParent();
|
||||||
|
|
||||||
|
// this will remove also all starling event listeners
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -658,7 +658,6 @@ namespace Spine.Unity.Editor {
|
|||||||
foreach (Material m in atlasAsset.materials)
|
foreach (Material m in atlasAsset.materials)
|
||||||
vestigialMaterials.Add(m);
|
vestigialMaterials.Add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
protectFromStackGarbageCollection.Add(atlasAsset);
|
protectFromStackGarbageCollection.Add(atlasAsset);
|
||||||
atlasAsset.atlasFile = atlasText;
|
atlasAsset.atlasFile = atlasText;
|
||||||
|
|
||||||
@ -669,6 +668,7 @@ namespace Spine.Unity.Editor {
|
|||||||
foreach (AtlasPage page in atlas.Pages)
|
foreach (AtlasPage page in atlas.Pages)
|
||||||
pageFiles.Add(page.name);
|
pageFiles.Add(page.name);
|
||||||
}
|
}
|
||||||
|
bool atlasHasCustomMaterials = HasCustomMaterialsAssigned(vestigialMaterials, primaryName, pageFiles);
|
||||||
|
|
||||||
List<Material> populatingMaterials = new List<Material>(pageFiles.Count);
|
List<Material> populatingMaterials = new List<Material>(pageFiles.Count);
|
||||||
string materialDirectory = GetMaterialDirectory(assetPath, vestigialMaterials);
|
string materialDirectory = GetMaterialDirectory(assetPath, vestigialMaterials);
|
||||||
@ -685,12 +685,8 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string pageName = Path.GetFileNameWithoutExtension(pageFiles[i]);
|
string pageName = Path.GetFileNameWithoutExtension(pageFiles[i]);
|
||||||
|
string materialFileName = GetPageMaterialName(primaryName, pageName, pageFiles) + ".mat";
|
||||||
//because this looks silly
|
string materialPath = materialDirectory + "/" + materialFileName;
|
||||||
if (pageName == primaryName && pageFiles.Count == 1)
|
|
||||||
pageName = "Material";
|
|
||||||
|
|
||||||
string materialPath = materialDirectory + "/" + primaryName + "_" + pageName + ".mat";
|
|
||||||
Material material = (Material)AssetDatabase.LoadAssetAtPath(materialPath, typeof(Material));
|
Material material = (Material)AssetDatabase.LoadAssetAtPath(materialPath, typeof(Material));
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
Shader defaultShader = GetDefaultShader();
|
Shader defaultShader = GetDefaultShader();
|
||||||
@ -714,10 +710,11 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
atlasAsset.materials = populatingMaterials.ToArray();
|
if (!atlasHasCustomMaterials) {
|
||||||
|
atlasAsset.materials = populatingMaterials.ToArray();
|
||||||
for (int i = 0; i < vestigialMaterials.Count; i++)
|
for (int i = 0; i < vestigialMaterials.Count; i++)
|
||||||
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(vestigialMaterials[i]));
|
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(vestigialMaterials[i]));
|
||||||
|
}
|
||||||
|
|
||||||
if (AssetDatabase.GetAssetPath(atlasAsset) == "")
|
if (AssetDatabase.GetAssetPath(atlasAsset) == "")
|
||||||
AssetDatabase.CreateAsset(atlasAsset, atlasPath);
|
AssetDatabase.CreateAsset(atlasAsset, atlasPath);
|
||||||
@ -727,9 +724,14 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorUtility.SetDirty(atlasAsset);
|
EditorUtility.SetDirty(atlasAsset);
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
|
|
||||||
if (pageFiles.Count != atlasAsset.materials.Length)
|
if (pageFiles.Count != atlasAsset.materials.Length) {
|
||||||
Debug.LogWarning(string.Format("{0} :: Not all atlas pages were imported. If you rename your image files, please make sure you also edit the filenames specified in the atlas file.", atlasAsset.name), atlasAsset);
|
if (atlasHasCustomMaterials)
|
||||||
else
|
Debug.LogWarning(string.Format("{0} :: Found custom materials at atlas asset, but atlas page count " +
|
||||||
|
"changed. Please update the Materials list accordingly.", atlasAsset.name), atlasAsset);
|
||||||
|
else
|
||||||
|
Debug.LogWarning(string.Format("{0} :: Not all atlas pages were imported. If you rename your image " +
|
||||||
|
"files, please make sure you also edit the filenames specified in the atlas file.", atlasAsset.name), atlasAsset);
|
||||||
|
} else
|
||||||
Debug.Log(string.Format("{0} :: Imported with {1} material", atlasAsset.name, atlasAsset.materials.Length), atlasAsset);
|
Debug.Log(string.Format("{0} :: Imported with {1} material", atlasAsset.name, atlasAsset.materials.Length), atlasAsset);
|
||||||
|
|
||||||
// Iterate regions and bake marked.
|
// Iterate regions and bake marked.
|
||||||
@ -766,6 +768,15 @@ namespace Spine.Unity.Editor {
|
|||||||
return loadedAtlas != null ? loadedAtlas : atlasAsset;
|
return loadedAtlas != null ? loadedAtlas : atlasAsset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool HasCustomMaterialsAssigned (List<Material> vestigialMaterials, string primaryName, List<string> pageFiles) {
|
||||||
|
if (pageFiles.Count == 0 || vestigialMaterials.Count == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
string firstPageName = Path.GetFileNameWithoutExtension(pageFiles[0]);
|
||||||
|
string defaultMaterialName = GetPageMaterialName(primaryName, firstPageName, pageFiles);
|
||||||
|
return vestigialMaterials[0].name != defaultMaterialName;
|
||||||
|
}
|
||||||
|
|
||||||
public static Shader GetDefaultShader () {
|
public static Shader GetDefaultShader () {
|
||||||
Shader shader = Shader.Find(SpineEditorUtilities.Preferences.DefaultShader);
|
Shader shader = Shader.Find(SpineEditorUtilities.Preferences.DefaultShader);
|
||||||
if (shader == null) shader = Shader.Find("Spine/Skeleton");
|
if (shader == null) shader = Shader.Find("Spine/Skeleton");
|
||||||
@ -928,6 +939,13 @@ namespace Spine.Unity.Editor {
|
|||||||
return (AtlasAssetBase)AssetDatabase.LoadAssetAtPath(atlasPath, typeof(AtlasAssetBase));
|
return (AtlasAssetBase)AssetDatabase.LoadAssetAtPath(atlasPath, typeof(AtlasAssetBase));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string GetPageMaterialName (string primaryName, string pageName, List<string> pageFiles) {
|
||||||
|
// use skeleton_Material.mat instead of skeleton_skeleton.mat if we have just a single atlas page
|
||||||
|
if (pageName == primaryName && pageFiles.Count == 1)
|
||||||
|
pageName = "Material";
|
||||||
|
return primaryName + "_" + pageName;
|
||||||
|
}
|
||||||
|
|
||||||
static string GetMaterialDirectory (string assetPath, List<Material> previousMaterials) {
|
static string GetMaterialDirectory (string assetPath, List<Material> previousMaterials) {
|
||||||
if (previousMaterials.Count > 0 && previousMaterials[0] != null) {
|
if (previousMaterials.Count > 0 && previousMaterials[0] != null) {
|
||||||
string materialPath = AssetDatabase.GetAssetPath(previousMaterials[0]);
|
string materialPath = AssetDatabase.GetAssetPath(previousMaterials[0]);
|
||||||
|
|||||||
@ -178,13 +178,13 @@ VertexOutput vert(appdata v) {
|
|||||||
GetWorldSpaceNormalizeViewDir(positionWS),
|
GetWorldSpaceNormalizeViewDir(positionWS),
|
||||||
o.pos.xy,
|
o.pos.xy,
|
||||||
ignoredProbeOcclusion,
|
ignoredProbeOcclusion,
|
||||||
shadowMask);
|
shadowMask) * v.color.a;
|
||||||
#else // _ADAPTIVE_PROBE_VOLUMES_PER_PIXEL
|
#else // _ADAPTIVE_PROBE_VOLUMES_PER_PIXEL
|
||||||
half3 bakedGI = half3(0.0, 0.0, 0.0);
|
half3 bakedGI = half3(0.0, 0.0, 0.0);
|
||||||
o.positionCS = o.pos;
|
o.positionCS = o.pos;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
half3 bakedGI = SAMPLE_GI(v.lightmapUV, vertexSH, normalWS);
|
half3 bakedGI = SAMPLE_GI(v.lightmapUV, vertexSH, normalWS) * v.color.a;
|
||||||
#endif
|
#endif
|
||||||
color.rgb += bakedGI;
|
color.rgb += bakedGI;
|
||||||
o.color = color;
|
o.color = color;
|
||||||
@ -223,7 +223,7 @@ half4 frag(VertexOutput i
|
|||||||
GetWorldSpaceNormalizeViewDir(i.positionWS),
|
GetWorldSpaceNormalizeViewDir(i.positionWS),
|
||||||
i.positionCS.xy,
|
i.positionCS.xy,
|
||||||
ignoredProbeOcclusion,
|
ignoredProbeOcclusion,
|
||||||
shadowMask);
|
shadowMask) * i.color.a;
|
||||||
i.color.rgb += bakedGI;
|
i.color.rgb += bakedGI;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.urp-shaders",
|
"name": "com.esotericsoftware.spine.urp-shaders",
|
||||||
"displayName": "Spine Universal RP Shaders",
|
"displayName": "Spine Universal RP Shaders",
|
||||||
"description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
|
"description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
|
||||||
"version": "4.2.42",
|
"version": "4.2.43",
|
||||||
"unity": "2019.3",
|
"unity": "2019.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user