[unity] Minor cleanup in editors and formatting.

This commit is contained in:
pharan 2017-05-24 19:43:18 +08:00
parent 6b27e295b7
commit f62b6b2326
4 changed files with 17 additions and 24 deletions

View File

@ -31,7 +31,6 @@
// Contributed by: Mitch Thompson
#define SPINE_SKELETON_ANIMATOR
//#define SPINE_BAKING
using System;
using System.Collections.Generic;
@ -50,14 +49,6 @@ namespace Spine.Unity.Editor {
static bool showSlotList = 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;
#if SPINE_TK2D
SerializedProperty spriteCollection;
@ -102,13 +93,17 @@ namespace Spine.Unity.Editor {
atlasAssets.isExpanded = true;
#endif
#if SPINE_BAKING
isBakingExpanded = EditorPrefs.GetBool(ShowBakingPrefsKey, false);
#endif
m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));
EditorApplication.update -= EditorUpdate;
EditorApplication.update += EditorUpdate;
RepopulateWarnings();
if (m_skeletonDataAsset.skeletonJSON == null) {
m_skeletonData = null;
return;
}
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.
// If m_skeletonAnimation is lazy-instantiated elsewhere, this can cause contents to change between Layout and Repaint events, causing GUILayout control count errors.
InitPreview();
if (m_skeletonData != null) {
GUILayout.Space(20f);

View File

@ -1169,14 +1169,12 @@ namespace Spine.Unity.Editor {
if (spineJson != null && atlasAssets != null) {
SkeletonDataAsset skeletonDataAsset = (SkeletonDataAsset)AssetDatabase.LoadAssetAtPath(filePath, typeof(SkeletonDataAsset));
if (skeletonDataAsset == null) {
skeletonDataAsset = SkeletonDataAsset.CreateInstance<SkeletonDataAsset>();
skeletonDataAsset.atlasAssets = atlasAssets;
skeletonDataAsset.skeletonJSON = spineJson;
skeletonDataAsset.fromAnimation = new string[0];
skeletonDataAsset.toAnimation = new string[0];
skeletonDataAsset.duration = new float[0];
skeletonDataAsset.defaultMix = defaultMix;
skeletonDataAsset.scale = defaultScale;
skeletonDataAsset = ScriptableObject.CreateInstance<SkeletonDataAsset>(); {
skeletonDataAsset.atlasAssets = atlasAssets;
skeletonDataAsset.skeletonJSON = spineJson;
skeletonDataAsset.defaultMix = defaultMix;
skeletonDataAsset.scale = defaultScale;
}
AssetDatabase.CreateAsset(skeletonDataAsset, filePath);
AssetDatabase.SaveAssets();

View File

@ -446,7 +446,7 @@ namespace Spine.Unity {
clipper.ClipStart(slot, slot.attachment as ClippingAttachment);
}
}
for (int slotIndex = instruction.startSlot; slotIndex < instruction.endSlot; slotIndex++) {
var slot = drawOrderItems[slotIndex];
var attachment = slot.attachment;
@ -507,7 +507,7 @@ namespace Spine.Unity {
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);
workingVerts = clipper.clippedVertices.Items;
attachmentVertexCount = clipper.clippedVertices.Count >> 1;

View File

@ -28,7 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
using System;
using UnityEngine;
namespace Spine.Unity {