mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Minor cleanup in editors and formatting.
This commit is contained in:
parent
6b27e295b7
commit
f62b6b2326
@ -31,7 +31,6 @@
|
|||||||
// Contributed by: Mitch Thompson
|
// Contributed by: Mitch Thompson
|
||||||
|
|
||||||
#define SPINE_SKELETON_ANIMATOR
|
#define SPINE_SKELETON_ANIMATOR
|
||||||
//#define SPINE_BAKING
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -50,14 +49,6 @@ namespace Spine.Unity.Editor {
|
|||||||
static bool showSlotList = false;
|
static bool showSlotList = false;
|
||||||
static bool showAttachments = false;
|
static bool showAttachments = false;
|
||||||
|
|
||||||
#if SPINE_BAKING
|
|
||||||
static bool isBakingExpanded = false;
|
|
||||||
static bool bakeAnimations = true;
|
|
||||||
static bool bakeIK = true;
|
|
||||||
static SendMessageOptions bakeEventOptions = SendMessageOptions.DontRequireReceiver;
|
|
||||||
const string ShowBakingPrefsKey = "SkeletonDataAssetInspector_showUnity";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SerializedProperty atlasAssets, skeletonJSON, scale, fromAnimation, toAnimation, duration, defaultMix;
|
SerializedProperty atlasAssets, skeletonJSON, scale, fromAnimation, toAnimation, duration, defaultMix;
|
||||||
#if SPINE_TK2D
|
#if SPINE_TK2D
|
||||||
SerializedProperty spriteCollection;
|
SerializedProperty spriteCollection;
|
||||||
@ -102,13 +93,17 @@ namespace Spine.Unity.Editor {
|
|||||||
atlasAssets.isExpanded = true;
|
atlasAssets.isExpanded = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SPINE_BAKING
|
|
||||||
isBakingExpanded = EditorPrefs.GetBool(ShowBakingPrefsKey, false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));
|
m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));
|
||||||
|
|
||||||
|
EditorApplication.update -= EditorUpdate;
|
||||||
EditorApplication.update += EditorUpdate;
|
EditorApplication.update += EditorUpdate;
|
||||||
|
|
||||||
RepopulateWarnings();
|
RepopulateWarnings();
|
||||||
|
if (m_skeletonDataAsset.skeletonJSON == null) {
|
||||||
|
m_skeletonData = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_skeletonData = warnings.Count == 0 ? m_skeletonDataAsset.GetSkeletonData(false) : null;
|
m_skeletonData = warnings.Count == 0 ? m_skeletonDataAsset.GetSkeletonData(false) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,6 +215,7 @@ namespace Spine.Unity.Editor {
|
|||||||
// Some code depends on the existence of m_skeletonAnimation instance.
|
// Some code depends on the existence of m_skeletonAnimation instance.
|
||||||
// If m_skeletonAnimation is lazy-instantiated elsewhere, this can cause contents to change between Layout and Repaint events, causing GUILayout control count errors.
|
// If m_skeletonAnimation is lazy-instantiated elsewhere, this can cause contents to change between Layout and Repaint events, causing GUILayout control count errors.
|
||||||
InitPreview();
|
InitPreview();
|
||||||
|
|
||||||
if (m_skeletonData != null) {
|
if (m_skeletonData != null) {
|
||||||
GUILayout.Space(20f);
|
GUILayout.Space(20f);
|
||||||
|
|
||||||
|
|||||||
@ -1169,14 +1169,12 @@ namespace Spine.Unity.Editor {
|
|||||||
if (spineJson != null && atlasAssets != null) {
|
if (spineJson != null && atlasAssets != null) {
|
||||||
SkeletonDataAsset skeletonDataAsset = (SkeletonDataAsset)AssetDatabase.LoadAssetAtPath(filePath, typeof(SkeletonDataAsset));
|
SkeletonDataAsset skeletonDataAsset = (SkeletonDataAsset)AssetDatabase.LoadAssetAtPath(filePath, typeof(SkeletonDataAsset));
|
||||||
if (skeletonDataAsset == null) {
|
if (skeletonDataAsset == null) {
|
||||||
skeletonDataAsset = SkeletonDataAsset.CreateInstance<SkeletonDataAsset>();
|
skeletonDataAsset = ScriptableObject.CreateInstance<SkeletonDataAsset>(); {
|
||||||
skeletonDataAsset.atlasAssets = atlasAssets;
|
skeletonDataAsset.atlasAssets = atlasAssets;
|
||||||
skeletonDataAsset.skeletonJSON = spineJson;
|
skeletonDataAsset.skeletonJSON = spineJson;
|
||||||
skeletonDataAsset.fromAnimation = new string[0];
|
skeletonDataAsset.defaultMix = defaultMix;
|
||||||
skeletonDataAsset.toAnimation = new string[0];
|
skeletonDataAsset.scale = defaultScale;
|
||||||
skeletonDataAsset.duration = new float[0];
|
}
|
||||||
skeletonDataAsset.defaultMix = defaultMix;
|
|
||||||
skeletonDataAsset.scale = defaultScale;
|
|
||||||
|
|
||||||
AssetDatabase.CreateAsset(skeletonDataAsset, filePath);
|
AssetDatabase.CreateAsset(skeletonDataAsset, filePath);
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
|
|||||||
@ -446,7 +446,7 @@ namespace Spine.Unity {
|
|||||||
clipper.ClipStart(slot, slot.attachment as ClippingAttachment);
|
clipper.ClipStart(slot, slot.attachment as ClippingAttachment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int slotIndex = instruction.startSlot; slotIndex < instruction.endSlot; slotIndex++) {
|
for (int slotIndex = instruction.startSlot; slotIndex < instruction.endSlot; slotIndex++) {
|
||||||
var slot = drawOrderItems[slotIndex];
|
var slot = drawOrderItems[slotIndex];
|
||||||
var attachment = slot.attachment;
|
var attachment = slot.attachment;
|
||||||
@ -507,7 +507,7 @@ namespace Spine.Unity {
|
|||||||
color.b = (byte)(skeletonB * slot.b * c.b * 255);
|
color.b = (byte)(skeletonB * slot.b * c.b * 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useClipping && clipper.IsClipping()) {
|
if (useClipping && clipper.IsClipping()) {
|
||||||
clipper.ClipTriangles(workingVerts, attachmentVertexCount << 1, attachmentTriangleIndices, attachmentIndexCount, uvs);
|
clipper.ClipTriangles(workingVerts, attachmentVertexCount << 1, attachmentTriangleIndices, attachmentIndexCount, uvs);
|
||||||
workingVerts = clipper.clippedVertices.Items;
|
workingVerts = clipper.clippedVertices.Items;
|
||||||
attachmentVertexCount = clipper.clippedVertices.Count >> 1;
|
attachmentVertexCount = clipper.clippedVertices.Count >> 1;
|
||||||
|
|||||||
@ -28,7 +28,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user