[unity] Inspector field for SkeletonDataModifiers. + fixes.

This commit is contained in:
pharan 2018-09-23 23:57:40 +08:00
parent 5c25239ff1
commit 4044c81ace

View File

@ -30,6 +30,11 @@
#define SPINE_SKELETON_MECANIM #define SPINE_SKELETON_MECANIM
#if (UNITY_2017_4 || UNITY_2018)
#define SPINE_UNITY_2018_PREVIEW_API
#endif
using System; using System;
using System.Reflection; using System.Reflection;
using System.Collections.Generic; using System.Collections.Generic;
@ -51,7 +56,7 @@ namespace Spine.Unity.Editor {
internal static bool showAttachments = false; internal static bool showAttachments = false;
SerializedProperty atlasAssets, skeletonJSON, scale, fromAnimation, toAnimation, duration, defaultMix; SerializedProperty atlasAssets, skeletonJSON, scale, fromAnimation, toAnimation, duration, defaultMix;
SerializedProperty blendModeMaterials; SerializedProperty skeletonDataModifiers;
#if SPINE_TK2D #if SPINE_TK2D
SerializedProperty spriteCollection; SerializedProperty spriteCollection;
#endif #endif
@ -101,7 +106,7 @@ namespace Spine.Unity.Editor {
duration = serializedObject.FindProperty("duration"); duration = serializedObject.FindProperty("duration");
defaultMix = serializedObject.FindProperty("defaultMix"); defaultMix = serializedObject.FindProperty("defaultMix");
blendModeMaterials = serializedObject.FindProperty("blendModeMaterials"); skeletonDataModifiers = serializedObject.FindProperty("skeletonDataModifiers");
#if SPINE_SKELETON_MECANIM #if SPINE_SKELETON_MECANIM
controller = serializedObject.FindProperty("controller"); controller = serializedObject.FindProperty("controller");
@ -302,6 +307,8 @@ namespace Spine.Unity.Editor {
} }
EditorGUILayout.PropertyField(skeletonJSON, SpineInspectorUtility.TempContent(skeletonJSON.displayName, Icons.spine)); EditorGUILayout.PropertyField(skeletonJSON, SpineInspectorUtility.TempContent(skeletonJSON.displayName, Icons.spine));
EditorGUILayout.PropertyField(scale); EditorGUILayout.PropertyField(scale);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(skeletonDataModifiers, true);
} }
void DrawAtlasAssetsFields () { void DrawAtlasAssetsFields () {
@ -318,8 +325,6 @@ namespace Spine.Unity.Editor {
if (atlasAssets.arraySize == 0) if (atlasAssets.arraySize == 0)
EditorGUILayout.HelpBox("AtlasAssets array is empty. Skeleton's attachments will load without being mapped to images.", MessageType.Info); EditorGUILayout.HelpBox("AtlasAssets array is empty. Skeleton's attachments will load without being mapped to images.", MessageType.Info);
EditorGUILayout.PropertyField(blendModeMaterials);
} }
void HandleAtlasAssetsNulls () { void HandleAtlasAssetsNulls () {
@ -681,7 +686,7 @@ namespace Spine.Unity.Editor {
GameObject previewGameObject; GameObject previewGameObject;
internal bool requiresRefresh; internal bool requiresRefresh;
#if !(UNITY_2017_4 || UNITY_2018) #if !SPINE_UNITY_2018_PREVIEW_API
float animationLastTime; float animationLastTime;
#endif #endif
@ -777,7 +782,7 @@ namespace Spine.Unity.Editor {
if (previewRenderUtility == null) { if (previewRenderUtility == null) {
previewRenderUtility = new PreviewRenderUtility(true); previewRenderUtility = new PreviewRenderUtility(true);
#if !(UNITY_2017_4 || UNITY_2018) #if !SPINE_UNITY_2018_PREVIEW_API
animationLastTime = CurrentTime; animationLastTime = CurrentTime;
#endif #endif
@ -808,7 +813,7 @@ namespace Spine.Unity.Editor {
skeletonAnimation.LateUpdate(); skeletonAnimation.LateUpdate();
previewGameObject.GetComponent<Renderer>().enabled = false; previewGameObject.GetComponent<Renderer>().enabled = false;
#if UNITY_2017_4 || UNITY_2018 #if SPINE_UNITY_2018_PREVIEW_API
previewRenderUtility.AddSingleGO(previewGameObject); previewRenderUtility.AddSingleGO(previewGameObject);
#endif #endif
} }
@ -869,7 +874,7 @@ namespace Spine.Unity.Editor {
if (!EditorApplication.isPlaying) { if (!EditorApplication.isPlaying) {
#if !(UNITY_2017_4 || UNITY_2018) #if !SPINE_UNITY_2018_PREVIEW_API
float current = CurrentTime; float current = CurrentTime;
float deltaTime = (current - animationLastTime); float deltaTime = (current - animationLastTime);
skeletonAnimation.Update(deltaTime); skeletonAnimation.Update(deltaTime);