Эх сурвалжийг харах

Merge branch '3.8' into 4.0-beta

Harald Csaszar 4 жил өмнө
parent
commit
e5c47852cc

+ 12 - 3
spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonAnimationInspector.cs

@@ -37,6 +37,7 @@ namespace Spine.Unity.Editor {
 	[CanEditMultipleObjects]
 	[CanEditMultipleObjects]
 	public class SkeletonAnimationInspector : SkeletonRendererInspector {
 	public class SkeletonAnimationInspector : SkeletonRendererInspector {
 		protected SerializedProperty animationName, loop, timeScale, autoReset;
 		protected SerializedProperty animationName, loop, timeScale, autoReset;
+		protected bool wasAnimationParameterChanged = false;
 		protected bool requireRepaint;
 		protected bool requireRepaint;
 		readonly GUIContent LoopLabel = new GUIContent("Loop", "Whether or not .AnimationName should loop. This only applies to the initial animation specified in the inspector, or any subsequent Animations played through .AnimationName. Animations set through state.SetAnimation are unaffected.");
 		readonly GUIContent LoopLabel = new GUIContent("Loop", "Whether or not .AnimationName should loop. This only applies to the initial animation specified in the inspector, or any subsequent Animations played through .AnimationName. Animations set through state.SetAnimation are unaffected.");
 		readonly GUIContent TimeScaleLabel = new GUIContent("Time Scale", "The rate at which animations progress over time. 1 means normal speed. 0.5 means 50% speed.");
 		readonly GUIContent TimeScaleLabel = new GUIContent("Time Scale", "The rate at which animations progress over time. 1 means normal speed. 0.5 means 50% speed.");
@@ -60,9 +61,14 @@ namespace Spine.Unity.Editor {
 			if (!sameData) {
 			if (!sameData) {
 				EditorGUILayout.DelayedTextField(animationName);
 				EditorGUILayout.DelayedTextField(animationName);
 			} else {
 			} else {
+				EditorGUI.BeginChangeCheck();
 				EditorGUILayout.PropertyField(animationName);
 				EditorGUILayout.PropertyField(animationName);
+				wasAnimationParameterChanged |= EditorGUI.EndChangeCheck(); // Value used in the next update.
 			}
 			}
+
+			EditorGUI.BeginChangeCheck();
 			EditorGUILayout.PropertyField(loop, LoopLabel);
 			EditorGUILayout.PropertyField(loop, LoopLabel);
+			wasAnimationParameterChanged |= EditorGUI.EndChangeCheck(); // Value used in the next update.
 			EditorGUILayout.PropertyField(timeScale, TimeScaleLabel);
 			EditorGUILayout.PropertyField(timeScale, TimeScaleLabel);
 			foreach (var o in targets) {
 			foreach (var o in targets) {
 				var component = o as SkeletonAnimation;
 				var component = o as SkeletonAnimation;
@@ -89,9 +95,12 @@ namespace Spine.Unity.Editor {
 
 
 			TrackEntry current = skeletonAnimation.AnimationState.GetCurrent(0);
 			TrackEntry current = skeletonAnimation.AnimationState.GetCurrent(0);
 			if (!isInspectingPrefab) {
 			if (!isInspectingPrefab) {
-				string activeAnimation = (current != null) ? current.Animation.Name : null;
-				bool wasAnimationNameChanged = activeAnimation != animationName.stringValue;
-				if (wasAnimationNameChanged) {
+				string activeAnimation = (current != null) ? current.Animation.Name : "";
+				bool activeLoop = (current != null) ? current.Loop : false;
+				bool animationParameterChanged = this.wasAnimationParameterChanged &&
+					((activeAnimation != animationName.stringValue) || (activeLoop != loop.boolValue));
+				if (animationParameterChanged) {
+					this.wasAnimationParameterChanged = false;
 					var skeleton = skeletonAnimation.Skeleton;
 					var skeleton = skeletonAnimation.Skeleton;
 					var state = skeletonAnimation.AnimationState;
 					var state = skeletonAnimation.AnimationState;
 
 

+ 2 - 6
spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineSpriteShaderGUI.cs

@@ -679,9 +679,6 @@ public class SpineSpriteShaderGUI : SpineShaderWithOutlineGUI {
 			IsURP3DShader(_materialEditor, out areMixedShaders);
 			IsURP3DShader(_materialEditor, out areMixedShaders);
 
 
 		if (hasReceiveShadowsParameter) {
 		if (hasReceiveShadowsParameter) {
-			bool forceDisableReceiveShadows = !_writeToDepth.hasMixedValue && _writeToDepth.floatValue == 0;
-			EditorGUI.BeginDisabledGroup(forceDisableReceiveShadows);
-
 			EditorGUI.BeginChangeCheck();
 			EditorGUI.BeginChangeCheck();
 			bool mixedValue;
 			bool mixedValue;
 			bool enableReceive = !IsKeywordEnabled(_materialEditor, "_RECEIVE_SHADOWS_OFF", out mixedValue);
 			bool enableReceive = !IsKeywordEnabled(_materialEditor, "_RECEIVE_SHADOWS_OFF", out mixedValue);
@@ -690,11 +687,10 @@ public class SpineSpriteShaderGUI : SpineShaderWithOutlineGUI {
 
 
 			EditorGUI.showMixedValue = false;
 			EditorGUI.showMixedValue = false;
 
 
-			if (EditorGUI.EndChangeCheck() || forceDisableReceiveShadows) {
-				SetKeyword(_materialEditor, "_RECEIVE_SHADOWS_OFF", !enableReceive || forceDisableReceiveShadows);
+			if (EditorGUI.EndChangeCheck()) {
+				SetKeyword(_materialEditor, "_RECEIVE_SHADOWS_OFF", !enableReceive);
 				dataChanged = true;
 				dataChanged = true;
 			}
 			}
-			EditorGUI.EndDisabledGroup(); // forceDisableReceiveShadows
 		}
 		}
 
 
 		return dataChanged;
 		return dataChanged;