diff --git a/CHANGELOG.md b/CHANGELOG.md index b210009b0..87f909e4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ * Added `Animation Update` mode (called `UpdateTiming` in code) `In Late Update` for `SkeletonAnimation`, `SkeletonMecanim` and `SkeletonGraphic`. This allows you to update the `SkeletonMecanim` skeleton in the same frame that the Mecanim Animator updated its state, which happens between `Update` and `LateUpdate`. * URP Shaders: Added URP "Blend Mode" shader variants for both URP 3D and URP 2D renderers. They are listed under shader name "Universal Render Pipeline/Spine/Blend Modes/" and "Universal Render Pipeline/2D/Spine/Blend Modes/" respectively. * URP Shaders: Added support for [Tint Black](http://en.esotericsoftware.com/spine-slots#Tint-black) functionality at "Blend Modes" Spine URP shaders (2D and 3D shaders). + * PhysicsConstraints: Skeleton GameObjects now automatically apply Transform translation and rotation to the skeleton's `PhysicsConstraints`. You can disable applying translation or rotation at the Skeleton component Inspector under `Advanced - Physics Constraints` `Transform Translation` and `Transform Rotation`, or by setting the properties `applyTranslationToPhysics` and `applyRotationToPhysics` at the skeleton component via code. * **Breaking changes** * Changed `SpineShaderWithOutlineGUI` outline related methods from `private` to `protected virtual` to allow for custom shader GUI subclasses to switch to different outline shaders. diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs index 808c32cc0..13d54786a 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs @@ -62,6 +62,7 @@ namespace Spine.Unity.Editor { SerializedProperty skeletonDataAsset, initialSkinName; SerializedProperty startingAnimation, startingLoop, timeScale, freeze, updateTiming, updateWhenInvisible, unscaledTime, tintBlack, layoutScaleMode, editReferenceRect; + SerializedProperty applyTranslationToPhysics, applyRotationToPhysics; SerializedProperty initialFlipX, initialFlipY; SerializedProperty meshGeneratorSettings; SerializedProperty allowMultipleCanvasRenderers, separatorSlotNames, enableSeparatorSlots, @@ -72,6 +73,10 @@ namespace Spine.Unity.Editor { "If enabled, AnimationState uses unscaled game time (Time.unscaledDeltaTime), " + "running animations independent of e.g. game pause (Time.timeScale). " + "Instance SkeletonAnimation.timeScale will still be applied."); + readonly GUIContent ApplyTranslationToPhysicsLabel = new GUIContent("Transform Translation", + "When enabled, the GameObject Transform translation movement is applied to PhysicsConstraints of the skeleton."); + readonly GUIContent ApplyRotationToPhysicsLabel = new GUIContent("Transform Rotation", + "When enabled, the GameObject Transform rotation movement is applied to PhysicsConstraints of the skeleton."); SkeletonGraphic thisSkeletonGraphic; protected bool isInspectingPrefab; @@ -136,6 +141,8 @@ namespace Spine.Unity.Editor { updateWhenInvisible = so.FindProperty("updateWhenInvisible"); layoutScaleMode = so.FindProperty("layoutScaleMode"); editReferenceRect = so.FindProperty("editReferenceRect"); + applyTranslationToPhysics = so.FindProperty("applyTranslationToPhysics"); + applyRotationToPhysics = so.FindProperty("applyRotationToPhysics"); meshGeneratorSettings = so.FindProperty("meshGenerator").FindPropertyRelative("settings"); meshGeneratorSettings.isExpanded = SkeletonRendererInspector.advancedFoldout; @@ -307,6 +314,13 @@ namespace Spine.Unity.Editor { EditorGUILayout.Space(); SeparatorsField(separatorSlotNames, enableSeparatorSlots, updateSeparatorPartLocation, updateSeparatorPartScale); + + EditorGUILayout.Space(); + using (new SpineInspectorUtility.LabelWidthScope()) { + EditorGUILayout.LabelField(SpineInspectorUtility.TempContent("Physics Constraints", SpineEditorUtilities.Icons.constraintPhysics), EditorStyles.boldLabel); + EditorGUILayout.PropertyField(applyTranslationToPhysics, ApplyTranslationToPhysicsLabel); + EditorGUILayout.PropertyField(applyRotationToPhysics, ApplyRotationToPhysicsLabel); + } } } diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonRendererInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonRendererInspector.cs index 04fb07f2f..210d3c48c 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonRendererInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonRendererInspector.cs @@ -68,6 +68,7 @@ namespace Spine.Unity.Editor { protected SerializedProperty normals, tangents, zSpacing, pmaVertexColors, tintBlack; // MeshGenerator settings protected SerializedProperty maskInteraction; protected SerializedProperty maskMaterialsNone, maskMaterialsInside, maskMaterialsOutside; + protected SerializedProperty applyTranslationToPhysics, applyRotationToPhysics; protected SpineInspectorUtility.SerializedSortingProperties sortingProperties; protected bool wasInitParameterChanged = false; protected bool requireRepaint = false; @@ -87,6 +88,11 @@ namespace Spine.Unity.Editor { protected GUIContent MaskMaterialsHeadingLabel, MaskMaterialsNoneLabel, MaskMaterialsInsideLabel, MaskMaterialsOutsideLabel; protected GUIContent SetMaterialButtonLabel, ClearMaterialButtonLabel, DeleteMaterialButtonLabel; + readonly GUIContent ApplyTranslationToPhysicsLabel = new GUIContent ("Transform Translation", + "When enabled, the GameObject Transform translation movement is applied to PhysicsConstraints of the skeleton."); + readonly GUIContent ApplyRotationToPhysicsLabel = new GUIContent ("Transform Rotation", + "When enabled, the GameObject Transform rotation movement is applied to PhysicsConstraints of the skeleton."); + const string ReloadButtonString = "Reload"; static GUILayoutOption reloadButtonWidth; static GUILayoutOption ReloadButtonWidth { get { return reloadButtonWidth = reloadButtonWidth ?? GUILayout.Width(GUI.skin.label.CalcSize(new GUIContent(ReloadButtonString)).x + 20); } } @@ -161,6 +167,8 @@ namespace Spine.Unity.Editor { maskMaterialsNone = so.FindProperty("maskMaterials.materialsMaskDisabled"); maskMaterialsInside = so.FindProperty("maskMaterials.materialsInsideMask"); maskMaterialsOutside = so.FindProperty("maskMaterials.materialsOutsideMask"); + applyTranslationToPhysics = so.FindProperty("applyTranslationToPhysics"); + applyRotationToPhysics = so.FindProperty("applyRotationToPhysics"); separatorSlotNames = so.FindProperty("separatorSlotNames"); separatorSlotNames.isExpanded = true; @@ -406,6 +414,11 @@ namespace Spine.Unity.Editor { differentMaskModesSelected, allowDelete: true, isActiveMaterial: activeMaskInteractionValue == (int)SpriteMaskInteraction.VisibleOutsideMask); } #endif + using (new SpineInspectorUtility.LabelWidthScope()) { + EditorGUILayout.LabelField(SpineInspectorUtility.TempContent("Physics Constraints", SpineEditorUtilities.Icons.constraintPhysics), EditorStyles.boldLabel); + EditorGUILayout.PropertyField(applyTranslationToPhysics, ApplyTranslationToPhysicsLabel); + EditorGUILayout.PropertyField(applyRotationToPhysics, ApplyRotationToPhysicsLabel); + } EditorGUILayout.Space(); diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/GUI/icon-constraintPhysics.png b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/GUI/icon-constraintPhysics.png new file mode 100644 index 000000000..703732ada Binary files /dev/null and b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/GUI/icon-constraintPhysics.png differ diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/GUI/icon-constraintPhysics.png.meta b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/GUI/icon-constraintPhysics.png.meta new file mode 100644 index 000000000..4a8fedb07 --- /dev/null +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/GUI/icon-constraintPhysics.png.meta @@ -0,0 +1,124 @@ +fileFormatVersion: 2 +guid: 10e534174824cb04e8a7ec21825f2827 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Icons.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Icons.cs index 13864e4bd..9fb5891a8 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Icons.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Icons.cs @@ -70,6 +70,7 @@ namespace Spine.Unity.Editor { public static Texture2D constraintTransform; public static Texture2D constraintPath; public static Texture2D constraintIK; + public static Texture2D constraintPhysics; public static Texture2D warning; public static Texture2D skeletonUtility; public static Texture2D hingeChain; @@ -113,6 +114,7 @@ namespace Spine.Unity.Editor { constraintTransform = LoadIcon("icon-constraintTransform.png"); constraintPath = LoadIcon("icon-constraintPath.png"); constraintIK = LoadIcon("icon-constraintIK.png"); + constraintPhysics = LoadIcon("icon-constraintPhysics.png"); warning = LoadIcon("icon-warning.png"); skeletonUtility = LoadIcon("icon-skeletonUtility.png"); diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index af546ad0c..31f7ac78b 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity", "displayName": "spine-unity Runtime", "description": "This plugin provides the spine-unity runtime core.", - "version": "4.2.46", + "version": "4.2.47", "unity": "2018.3", "author": { "name": "Esoteric Software",