mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '3.6' into 3.7-beta
This commit is contained in:
commit
5a984d9f06
@ -616,14 +616,10 @@ namespace Spine {
|
|||||||
propertyIDs.Clear();
|
propertyIDs.Clear();
|
||||||
var mixingTo = this.mixingTo;
|
var mixingTo = this.mixingTo;
|
||||||
|
|
||||||
TrackEntry lastEntry = null;
|
|
||||||
var tracksItems = tracks.Items;
|
var tracksItems = tracks.Items;
|
||||||
for (int i = 0, n = tracks.Count; i < n; i++) {
|
for (int i = 0, n = tracks.Count; i < n; i++) {
|
||||||
var entry = tracksItems[i];
|
var entry = tracksItems[i];
|
||||||
if (entry != null) {
|
if (entry != null) entry.SetTimelineData(null, mixingTo, propertyIDs);
|
||||||
entry.SetTimelineData(lastEntry, mixingTo, propertyIDs);
|
|
||||||
lastEntry = entry;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,8 @@ namespace Spine.Unity.Editor {
|
|||||||
SpineEditorUtilities.ConfirmInitialization();
|
SpineEditorUtilities.ConfirmInitialization();
|
||||||
m_skeletonDataAsset = (SkeletonDataAsset)target;
|
m_skeletonDataAsset = (SkeletonDataAsset)target;
|
||||||
|
|
||||||
atlasAssets = serializedObject.FindProperty("atlasAssets");
|
bool newAtlasAssets = atlasAssets == null;
|
||||||
|
if (newAtlasAssets) atlasAssets = serializedObject.FindProperty("atlasAssets");
|
||||||
skeletonJSON = serializedObject.FindProperty("skeletonJSON");
|
skeletonJSON = serializedObject.FindProperty("skeletonJSON");
|
||||||
scale = serializedObject.FindProperty("scale");
|
scale = serializedObject.FindProperty("scale");
|
||||||
fromAnimation = serializedObject.FindProperty("fromAnimation");
|
fromAnimation = serializedObject.FindProperty("fromAnimation");
|
||||||
@ -87,10 +88,10 @@ namespace Spine.Unity.Editor {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SPINE_TK2D
|
#if SPINE_TK2D
|
||||||
atlasAssets.isExpanded = false;
|
if (newAtlasAssets) atlasAssets.isExpanded = false;
|
||||||
spriteCollection = serializedObject.FindProperty("spriteCollection");
|
spriteCollection = serializedObject.FindProperty("spriteCollection");
|
||||||
#else
|
#else
|
||||||
atlasAssets.isExpanded = true;
|
if (newAtlasAssets) atlasAssets.isExpanded = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));
|
m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));
|
||||||
@ -470,44 +471,56 @@ namespace Spine.Unity.Editor {
|
|||||||
if (SpineEditorUtilities.IsSpineData((TextAsset)skeletonJSON.objectReferenceValue) == false) {
|
if (SpineEditorUtilities.IsSpineData((TextAsset)skeletonJSON.objectReferenceValue) == false) {
|
||||||
warnings.Add("Skeleton data file is not a valid JSON or binary file.");
|
warnings.Add("Skeleton data file is not a valid JSON or binary file.");
|
||||||
} else {
|
} else {
|
||||||
#if !SPINE_TK2D
|
#if SPINE_TK2D
|
||||||
bool detectedNullAtlasEntry = false;
|
bool searchForSpineAtlasAssets = true;
|
||||||
var atlasList = new List<Atlas>();
|
bool isSpriteCollectionNull = spriteCollection.objectReferenceValue == null;
|
||||||
var actualAtlasAssets = m_skeletonDataAsset.atlasAssets;
|
if (!isSpriteCollectionNull) searchForSpineAtlasAssets = false;
|
||||||
for (int i = 0; i < actualAtlasAssets.Length; i++) {
|
//else
|
||||||
if (m_skeletonDataAsset.atlasAssets[i] == null) {
|
// warnings.Add("Your sprite collection may have missing images.");
|
||||||
detectedNullAtlasEntry = true;
|
#else
|
||||||
break;
|
const bool searchForSpineAtlasAssets = true;
|
||||||
} else {
|
#endif
|
||||||
atlasList.Add(actualAtlasAssets[i].GetAtlas());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (detectedNullAtlasEntry)
|
if (searchForSpineAtlasAssets) {
|
||||||
warnings.Add("AtlasAsset elements should not be null.");
|
bool detectedNullAtlasEntry = false;
|
||||||
else {
|
var atlasList = new List<Atlas>();
|
||||||
// Get requirements.
|
var actualAtlasAssets = m_skeletonDataAsset.atlasAssets;
|
||||||
var missingPaths = SpineEditorUtilities.GetRequiredAtlasRegions(AssetDatabase.GetAssetPath((TextAsset)skeletonJSON.objectReferenceValue));
|
|
||||||
|
|
||||||
foreach (var atlas in atlasList) {
|
for (int i = 0; i < actualAtlasAssets.Length; i++) {
|
||||||
for (int i = 0; i < missingPaths.Count; i++) {
|
if (m_skeletonDataAsset.atlasAssets[i] == null) {
|
||||||
if (atlas.FindRegion(missingPaths[i]) != null) {
|
detectedNullAtlasEntry = true;
|
||||||
missingPaths.RemoveAt(i);
|
break;
|
||||||
i--;
|
} else {
|
||||||
}
|
atlasList.Add(actualAtlasAssets[i].GetAtlas());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var str in missingPaths)
|
if (detectedNullAtlasEntry) {
|
||||||
warnings.Add("Missing Region: '" + str + "'");
|
warnings.Add("AtlasAsset elements should not be null.");
|
||||||
|
} else {
|
||||||
|
// Get requirements.
|
||||||
|
var missingPaths = SpineEditorUtilities.GetRequiredAtlasRegions(AssetDatabase.GetAssetPath((TextAsset)skeletonJSON.objectReferenceValue));
|
||||||
|
|
||||||
|
foreach (var atlas in atlasList) {
|
||||||
|
for (int i = 0; i < missingPaths.Count; i++) {
|
||||||
|
if (atlas.FindRegion(missingPaths[i]) != null) {
|
||||||
|
missingPaths.RemoveAt(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SPINE_TK2D
|
||||||
|
if (missingPaths.Count > 0)
|
||||||
|
warnings.Add("Missing regions. SkeletonDataAsset requires tk2DSpriteCollectionData or Spine AtlasAssets.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
foreach (var str in missingPaths)
|
||||||
|
warnings.Add("Missing Region: '" + str + "'");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (spriteCollection.objectReferenceValue == null)
|
|
||||||
warnings.Add("SkeletonDataAsset requires tk2DSpriteCollectionData.");
|
|
||||||
// else
|
|
||||||
// warnings.Add("Your sprite collection may have missing images.");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the target bone by its bone name. Returns false if no bone was found.</summary>
|
/// Sets the target bone by its bone name. Returns false if no bone was found.</summary>
|
||||||
public bool SetBoneByName (string name) {
|
public bool SetBone (string name) {
|
||||||
bone = skeletonRenderer.skeleton.FindBone(name);
|
bone = skeletonRenderer.skeleton.FindBone(name);
|
||||||
if (bone == null) {
|
if (bone == null) {
|
||||||
Debug.LogError("Bone not found: " + name, this);
|
Debug.LogError("Bone not found: " + name, this);
|
||||||
@ -130,7 +130,7 @@ namespace Spine.Unity {
|
|||||||
if (bone == null) {
|
if (bone == null) {
|
||||||
if (string.IsNullOrEmpty(boneName)) return;
|
if (string.IsNullOrEmpty(boneName)) return;
|
||||||
bone = skeletonRenderer.skeleton.FindBone(boneName);
|
bone = skeletonRenderer.skeleton.FindBone(boneName);
|
||||||
if (!SetBoneByName(boneName)) return;
|
if (!SetBone(boneName)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Transform thisTransform = this.transform;
|
Transform thisTransform = this.transform;
|
||||||
|
|||||||
@ -357,7 +357,7 @@ namespace Spine.Unity {
|
|||||||
material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
|
material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Material material = (rendererObject.GetType() == typeof(Material)) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject;
|
Material material = (rendererObject is Material) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (current.forceSeparate || (current.rawVertexCount > 0 && !System.Object.ReferenceEquals(current.material, material))) { // Material changed. Add the previous submesh.
|
if (current.forceSeparate || (current.rawVertexCount > 0 && !System.Object.ReferenceEquals(current.material, material))) { // Material changed. Add the previous submesh.
|
||||||
|
|||||||
@ -156,7 +156,7 @@ namespace Spine.Unity.Editor {
|
|||||||
if (Event.current.type == EventType.Repaint) {
|
if (Event.current.type == EventType.Repaint) {
|
||||||
if (addBoneFollower) {
|
if (addBoneFollower) {
|
||||||
var boneFollower = follower.gameObject.AddComponent<BoneFollower>();
|
var boneFollower = follower.gameObject.AddComponent<BoneFollower>();
|
||||||
boneFollower.SetBoneByName(follower.Slot.Data.BoneData.Name);
|
boneFollower.SetBone(follower.Slot.Data.BoneData.Name);
|
||||||
addBoneFollower = false;
|
addBoneFollower = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -122,11 +122,18 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
#region Internals
|
#region Internals
|
||||||
// This is used by the UI system to determine what to put in the MaterialPropertyBlock.
|
// This is used by the UI system to determine what to put in the MaterialPropertyBlock.
|
||||||
public Texture OverrideTexture { get; set; }
|
Texture overrideTexture;
|
||||||
|
public Texture OverrideTexture {
|
||||||
|
get { return overrideTexture; }
|
||||||
|
set {
|
||||||
|
canvasRenderer.SetTexture(value);
|
||||||
|
overrideTexture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
public override Texture mainTexture {
|
public override Texture mainTexture {
|
||||||
get {
|
get {
|
||||||
// Fail loudly when incorrectly set up.
|
// Fail loudly when incorrectly set up.
|
||||||
if (OverrideTexture != null) return OverrideTexture;
|
if (overrideTexture != null) return overrideTexture;
|
||||||
return skeletonDataAsset == null ? null : skeletonDataAsset.atlasAssets[0].materials[0].mainTexture;
|
return skeletonDataAsset == null ? null : skeletonDataAsset.atlasAssets[0].materials[0].mainTexture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user