mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
Merge branch '4.2' into 4.3-beta
This commit is contained in:
commit
8115dd8dde
@ -17,8 +17,8 @@
|
||||
"cpp"
|
||||
],
|
||||
"description": "The official Spine Runtime for Haxe",
|
||||
"version": "4.2.6",
|
||||
"releasenote": "Update to 4.2.6",
|
||||
"version": "4.2.7",
|
||||
"releasenote": "Update to 4.2.7",
|
||||
"contributors": [
|
||||
"esotericsoftware"
|
||||
],
|
||||
|
||||
@ -423,6 +423,10 @@ class SkeletonSprite extends DisplayObject implements IAnimatable {
|
||||
_state = null;
|
||||
}
|
||||
if (_skeleton != null) _skeleton = null;
|
||||
dispatchEventWith(starling.events.Event.REMOVE_FROM_JUGGLER);
|
||||
removeFromParent();
|
||||
|
||||
// this will remove also all starling event listeners
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -658,7 +658,6 @@ namespace Spine.Unity.Editor {
|
||||
foreach (Material m in atlasAsset.materials)
|
||||
vestigialMaterials.Add(m);
|
||||
}
|
||||
|
||||
protectFromStackGarbageCollection.Add(atlasAsset);
|
||||
atlasAsset.atlasFile = atlasText;
|
||||
|
||||
@ -669,6 +668,7 @@ namespace Spine.Unity.Editor {
|
||||
foreach (AtlasPage page in atlas.Pages)
|
||||
pageFiles.Add(page.name);
|
||||
}
|
||||
bool atlasHasCustomMaterials = HasCustomMaterialsAssigned(vestigialMaterials, primaryName, pageFiles);
|
||||
|
||||
List<Material> populatingMaterials = new List<Material>(pageFiles.Count);
|
||||
string materialDirectory = GetMaterialDirectory(assetPath, vestigialMaterials);
|
||||
@ -685,12 +685,8 @@ namespace Spine.Unity.Editor {
|
||||
}
|
||||
|
||||
string pageName = Path.GetFileNameWithoutExtension(pageFiles[i]);
|
||||
|
||||
//because this looks silly
|
||||
if (pageName == primaryName && pageFiles.Count == 1)
|
||||
pageName = "Material";
|
||||
|
||||
string materialPath = materialDirectory + "/" + primaryName + "_" + pageName + ".mat";
|
||||
string materialFileName = GetPageMaterialName(primaryName, pageName, pageFiles) + ".mat";
|
||||
string materialPath = materialDirectory + "/" + materialFileName;
|
||||
Material material = (Material)AssetDatabase.LoadAssetAtPath(materialPath, typeof(Material));
|
||||
if (material == null) {
|
||||
Shader defaultShader = GetDefaultShader();
|
||||
@ -714,10 +710,11 @@ namespace Spine.Unity.Editor {
|
||||
}
|
||||
}
|
||||
|
||||
atlasAsset.materials = populatingMaterials.ToArray();
|
||||
|
||||
for (int i = 0; i < vestigialMaterials.Count; i++)
|
||||
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(vestigialMaterials[i]));
|
||||
if (!atlasHasCustomMaterials) {
|
||||
atlasAsset.materials = populatingMaterials.ToArray();
|
||||
for (int i = 0; i < vestigialMaterials.Count; i++)
|
||||
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(vestigialMaterials[i]));
|
||||
}
|
||||
|
||||
if (AssetDatabase.GetAssetPath(atlasAsset) == "")
|
||||
AssetDatabase.CreateAsset(atlasAsset, atlasPath);
|
||||
@ -727,9 +724,14 @@ namespace Spine.Unity.Editor {
|
||||
EditorUtility.SetDirty(atlasAsset);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
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);
|
||||
else
|
||||
if (pageFiles.Count != atlasAsset.materials.Length) {
|
||||
if (atlasHasCustomMaterials)
|
||||
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);
|
||||
|
||||
// Iterate regions and bake marked.
|
||||
@ -766,6 +768,15 @@ namespace Spine.Unity.Editor {
|
||||
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 () {
|
||||
Shader shader = Shader.Find(SpineEditorUtilities.Preferences.DefaultShader);
|
||||
if (shader == null) shader = Shader.Find("Spine/Skeleton");
|
||||
@ -928,6 +939,13 @@ namespace Spine.Unity.Editor {
|
||||
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) {
|
||||
if (previousMaterials.Count > 0 && previousMaterials[0] != null) {
|
||||
string materialPath = AssetDatabase.GetAssetPath(previousMaterials[0]);
|
||||
|
||||
@ -178,13 +178,13 @@ VertexOutput vert(appdata v) {
|
||||
GetWorldSpaceNormalizeViewDir(positionWS),
|
||||
o.pos.xy,
|
||||
ignoredProbeOcclusion,
|
||||
shadowMask);
|
||||
shadowMask) * v.color.a;
|
||||
#else // _ADAPTIVE_PROBE_VOLUMES_PER_PIXEL
|
||||
half3 bakedGI = half3(0.0, 0.0, 0.0);
|
||||
o.positionCS = o.pos;
|
||||
#endif
|
||||
#else
|
||||
half3 bakedGI = SAMPLE_GI(v.lightmapUV, vertexSH, normalWS);
|
||||
half3 bakedGI = SAMPLE_GI(v.lightmapUV, vertexSH, normalWS) * v.color.a;
|
||||
#endif
|
||||
color.rgb += bakedGI;
|
||||
o.color = color;
|
||||
@ -223,7 +223,7 @@ half4 frag(VertexOutput i
|
||||
GetWorldSpaceNormalizeViewDir(i.positionWS),
|
||||
i.positionCS.xy,
|
||||
ignoredProbeOcclusion,
|
||||
shadowMask);
|
||||
shadowMask) * i.color.a;
|
||||
i.color.rgb += bakedGI;
|
||||
#endif
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.urp-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)",
|
||||
"version": "4.2.42",
|
||||
"version": "4.2.43",
|
||||
"unity": "2019.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user