diff --git a/CHANGELOG.md b/CHANGELOG.md index 305e0f29..0ae70719 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,21 @@ # Changelog + +## [5.2.6] - 2022-11-02 +### Fixed +- Removed ValidationExceptions.json from the package. + +## [5.2.5] - 2022-10-18 +### Fixed +- Fixed an issue where the Sprite Skin editor would throw an exception if Sprite Renderer doesn't have a Sprite assigned to it. +Fixed IK Manager 2D's inspector slow downs. (case DANB-218) + +### Changed +- Updated Toolbar and Visibility tab buttons' selection color. +- Expand and frame on bone selection. + +### Fixed +- Fixed an issue where Sprite Skins would no longer deform when re-entering the camera frustum. (case DANB-223) + ## [5.2.4] - 2022-08-26 ### Fixed - Fixed a case where multi selecting Sprite Skins would cause a null reference exception to be thrown. (case DANB-126) diff --git a/Editor/Assets/SkinningModule/ToolbarStyle.uss b/Editor/Assets/SkinningModule/ToolbarStyle.uss index f2487f48..4c4b1c18 100644 --- a/Editor/Assets/SkinningModule/ToolbarStyle.uss +++ b/Editor/Assets/SkinningModule/ToolbarStyle.uss @@ -56,7 +56,15 @@ Button > .unity-label { } .unity-button:checked { - background-color: #747474; + background-color: var(--unity-colors-button-background-pressed); +} + +.unity-button:active { + background-color: var(--unity-colors-button-background-pressed); +} + +.unity-button:active:hover { + background-color: var(--unity-colors-button-background-pressed); } PopupWindow { diff --git a/Editor/Assets/SkinningModule/VisibilityTool.uss b/Editor/Assets/SkinningModule/VisibilityTool.uss index 9e1d5277..8fce3e3f 100644 --- a/Editor/Assets/SkinningModule/VisibilityTool.uss +++ b/Editor/Assets/SkinningModule/VisibilityTool.uss @@ -44,14 +44,8 @@ MeshVisibilityToolView{ } #VisibilityToolSelection > Button{ - margin-top: 0; - margin-left: 0; - margin-bottom: 0; - margin-right: 0; - padding-top: 0; - padding-left: 0; - padding-bottom: 0; - padding-right: 0; + margin: 0; + padding: 0; border-left-width: 0; border-top-width: 0; border-right-width: 0; @@ -61,107 +55,21 @@ MeshVisibilityToolView{ .visibilityToolTab { - background-image: none; - color: #505050; -unity-slice-left: 6; -unity-slice-top: 4; -unity-slice-right: 6; -unity-slice-bottom: 4; flex :1 0 auto; - margin-top: 0; - margin-left: 0; - margin-bottom: 0; - margin-right: 0; - padding-top: 0; - padding-left: 0; - padding-bottom: 0; - padding-right: 0; + margin: 0; + padding: 0; border-left-width: 0; border-top-width: 0; border-right-width: 0; border-bottom-width: 0; } -.visibilityToolTabDark{ - color: #B4B4B4; -} - -.visibilityToolTab:checked{ - background-image: resource("Builtin Skins/LightSkin/Images/tabbar on f.png"); - color: #505050; - flex :1 0 auto; - -unity-slice-left: 6; - -unity-slice-top: 4; - -unity-slice-right: 6; - -unity-slice-bottom: 4; - margin-top: 0; - margin-left: 0; - margin-bottom: 0; - margin-right: 0; - padding-top: 0; - padding-left: 0; - padding-bottom: 0; - padding-right: 0; - border-left-width: 0; - border-top-width: 0; - border-right-width: 0; - -} - -.visibilityToolTabDark:checked{ - background-image: resource("Builtin Skins/DarkSkin/Images/tabbar on f.png"); - color: #B4B4B4; -} - -.visibilityToolTab:hover:active:checked{ - background-image: resource("Builtin Skins/LightSkin/Images/tabbar on.png"); - flex :1 0 auto; - -unity-slice-left: 6; - -unity-slice-top: 4; - -unity-slice-right: 6; - -unity-slice-bottom: 4; - margin-top: 0; - margin-left: 0; - margin-bottom: 0; - margin-right: 0; - padding-top: 0; - padding-left: 0; - padding-bottom: 0; - padding-right: 0; - border-left-width: 0; - border-top-width: 0; - border-right-width: 0; - border-bottom-width: 0; -} - -.visibilityToolTabDark:hover:active:checked{ - background-image: resource("Builtin Skins/DarkSkin/Images/tabbar on.png"); -} - -.visibilityToolTab:hover:active{ - background-image: resource("Builtin Skins/LightSkin/Images/tabbar on.png"); - color: #505050; - flex :1 0 auto; - -unity-slice-left: 6; - -unity-slice-top: 4; - -unity-slice-right: 6; - -unity-slice-bottom: 4; - margin-top: 0; - margin-left: 0; - margin-bottom: 0; - margin-right: 0; - padding-top: 0; - padding-left: 0; - padding-bottom: 0; - padding-right: 0; - border-left-width: 0; - border-top-width: 0; - border-right-width: 0; - border-bottom-width: 0; -} - -.visibilityToolTabDark:hover:active{ - background-image: resource("Builtin Skins/DarkSkin/Images/tabbar on.png"); +.visibilityToolTab:checked { + background-color: var(--unity-colors-button-background-pressed); } #OpacitySliderGroup diff --git a/Editor/SkinningModule/VisibilityTool/BoneVisibilityTool.cs b/Editor/SkinningModule/VisibilityTool/BoneVisibilityTool.cs index b5bd95cc..053f5e32 100644 --- a/Editor/SkinningModule/VisibilityTool/BoneVisibilityTool.cs +++ b/Editor/SkinningModule/VisibilityTool/BoneVisibilityTool.cs @@ -170,13 +170,8 @@ public void OnBoneSelectionChanged(SkeletonSelection boneSelection) { var bones = boneSelection.elements.ToSpriteSheetIfNeeded(); var ids = GetController().GetIDsToSelect(bones); - var result = GetController().GetIDsToExpand(bones); - var expandIds = GetExpanded().ToList(); - if (result.Count > 0) - expandIds = expandIds.Union(result).ToList(); - SetExpanded(expandIds); - SetSelection(ids); + SetSelection(ids, TreeViewSelectionOptions.RevealAndFrame); } public void OnBoneExpandedChanged(BoneCache[] bones) diff --git a/Editor/SpriteSkin/SpriteSkinEditor.cs b/Editor/SpriteSkin/SpriteSkinEditor.cs index cfee6f04..c45bf9d4 100644 --- a/Editor/SpriteSkin/SpriteSkinEditor.cs +++ b/Editor/SpriteSkin/SpriteSkinEditor.cs @@ -195,7 +195,7 @@ void InitializeBoneTransformArray() var noOfBones = -1; for (var i = 0; i < m_SpriteSkins.Length; ++i) { - if (m_SpriteSkins[i] == null) + if (m_SpriteSkins[i] == null || m_CurrentSprites[i] == null) continue; if (i == 0) noOfBones = m_CurrentSprites[i].GetBones().Length; @@ -209,7 +209,7 @@ void InitializeBoneTransformArray() if (hasSameNumberOfBones) { var elementCount = m_BoneTransformsProperty.arraySize; - var bones = m_CurrentSprites[0].GetBones(); + var bones = m_CurrentSprites[0] != null ? m_CurrentSprites[0].GetBones() : new SpriteBone[0]; if (elementCount != bones.Length) { diff --git a/IK/Editor/IKEditorManager.cs b/IK/Editor/IKEditorManager.cs index 930686d6..680b0647 100644 --- a/IK/Editor/IKEditorManager.cs +++ b/IK/Editor/IKEditorManager.cs @@ -19,11 +19,8 @@ internal class IKEditorManager : ScriptableObject GameObject m_Helper; GameObject[] m_SelectedGameobjects; - bool m_IgnorePostProcessModifications = false; - HashSet m_IgnoreTransformsOnUndo = new HashSet(); internal bool isDraggingATool { get; private set; } - internal bool isDragging { get { return IKGizmos.instance.isDragging || isDraggingATool; } } [InitializeOnLoadMethod] static void CreateInstance() @@ -66,7 +63,6 @@ private void OnDisable() private void RegisterCallbacks() { EditorApplication.hierarchyChanged += Initialize; - Undo.postprocessModifications += OnPostProcessModifications; #if UNITY_2019_1_OR_NEWER SceneView.duringSceneGui += OnSceneGUI; #else @@ -78,7 +74,6 @@ private void RegisterCallbacks() private void UnregisterCallbacks() { EditorApplication.hierarchyChanged -= Initialize; - Undo.postprocessModifications -= OnPostProcessModifications; #if UNITY_2019_1_OR_NEWER SceneView.duringSceneGui -= OnSceneGUI; #else @@ -205,33 +200,20 @@ private void DoUndo(IKManager2D manager, string undoName, bool record) if (record) { foreach(var t in chain.transforms) - { - if(m_IgnoreTransformsOnUndo.Contains(t)) - continue; - Undo.RecordObject(t, undoName); - } - - if(chain.target && !m_IgnoreTransformsOnUndo.Contains(chain.target)) + if(chain.target) Undo.RecordObject(chain.target, undoName); } else { foreach(var t in chain.transforms) - { - if(m_IgnoreTransformsOnUndo.Contains(t)) - continue; - Undo.RegisterCompleteObjectUndo(t, undoName); - } - if(chain.target && !m_IgnoreTransformsOnUndo.Contains(chain.target)) + if(chain.target) Undo.RegisterCompleteObjectUndo(chain.target, undoName); } } - - m_IgnorePostProcessModifications = true; } } @@ -247,12 +229,6 @@ public void UpdateSolverImmediate(Solver2D solver, bool recordRootLoops) UpdateDirtyManagers(recordRootLoops); } - public void UpdateHierarchyImmediate(Transform hierarchyRoot, bool recordRootLoops) - { - SetDirtyUnderHierarchy(hierarchyRoot); - UpdateDirtyManagers(recordRootLoops); - } - public void SetChainPositionOverride(IKChain2D chain, Vector3 position) { m_ChainPositionOverrides[chain] = position; @@ -304,75 +280,6 @@ private void OnSceneGUI(SceneView sceneView) isDraggingATool = false; } - private bool ProcessTransformPropertyModification(UndoPropertyModification modification, out Transform transform) - { - transform = null; - var targetType = modification.currentValue.target.GetType(); - if ((targetType == typeof(Transform) || targetType.IsSubclassOf(typeof(Transform)))) - { - transform = (Transform)modification.currentValue.target; - return true; - } - - return false; - } - - private UndoPropertyModification[] OnPostProcessModifications(UndoPropertyModification[] modifications) - { - if(!m_IgnorePostProcessModifications && !isDragging) - { - //Prepare transforms that already have an undo modification - foreach (var modification in modifications) - { - if (modification.currentValue == null) - continue; - Transform transform; - if (ProcessTransformPropertyModification(modification, out transform)) - m_IgnoreTransformsOnUndo.Add(transform); - } - - var processedObjectList = new HashSet(); - - foreach (var modification in modifications) - { - if (modification.currentValue == null) - continue; - var target = modification.currentValue.target; - - if(processedObjectList.Contains(target)) - continue; - - processedObjectList.Add(target); - - var targetType = target.GetType(); - Transform transform; - if (ProcessTransformPropertyModification(modification, out transform)) - { - SetDirtySolversAffectedByTransform(transform); - RegisterUndoForDirtyManagers(); - } - if (targetType == typeof(Solver2D) || targetType.IsSubclassOf(typeof(Solver2D))) - { - var solver = (Solver2D)modification.currentValue.target; - SetSolverDirty(solver); - RegisterUndoForDirtyManagers(); - } - if (targetType == typeof(IKManager2D)) - { - var dirtyManager = (IKManager2D)modification.currentValue.target; - SetManagerDirty(dirtyManager); - RegisterUndoForDirtyManagers(); - } - } - - m_IgnoreTransformsOnUndo.Clear(); - } - - m_IgnorePostProcessModifications = false; - - return modifications; - } - private void SetSolverDirty(Solver2D solver) { if (solver && solver.isValid && solver.isActiveAndEnabled) @@ -385,42 +292,6 @@ private void SetManagerDirty(IKManager2D manager) m_DirtyManagers.Add(manager); } - private void SetAllManagersDirty() - { - m_DirtyManagers.Clear(); - - foreach (IKManager2D manager in m_IKManagers) - SetManagerDirty(manager); - } - - private void SetDirtyUnderHierarchy(Transform hierarchyRoot) - { - if (hierarchyRoot == null) - return; - - foreach (Solver2D solver in m_IKSolvers) - { - if (solver.isValid) - { - for (int i = 0; i < solver.chainCount; ++i) - { - var chain = solver.GetChain(i); - - if(chain.target == null) - continue; - - if (hierarchyRoot == chain.target || - IKUtility.IsDescendentOf(chain.target, hierarchyRoot) || - IKUtility.IsDescendentOf(chain.effector, hierarchyRoot)) - { - SetSolverDirty(solver); - break; - } - } - } - } - } - private void SetDirtySolversAffectedByTransform(Transform transform) { foreach (Solver2D solver in m_IKSolvers) diff --git a/Runtime/SpriteSkin.cs b/Runtime/SpriteSkin.cs index 750e28d1..4f399d27 100644 --- a/Runtime/SpriteSkin.cs +++ b/Runtime/SpriteSkin.cs @@ -372,6 +372,7 @@ internal void DeactivateSkinning() InternalEngineBridge.SetLocalAABB(spriteRenderer, sprite.bounds); spriteRenderer.DeactivateDeformableBuffer(); + m_TransformsHash = 0; } internal void ResetSprite() diff --git a/Runtime/SpriteSkinBatch.cs b/Runtime/SpriteSkinBatch.cs index 0d002a14..18f46311 100644 --- a/Runtime/SpriteSkinBatch.cs +++ b/Runtime/SpriteSkinBatch.cs @@ -220,7 +220,8 @@ internal bool BatchValidate() { CacheBoneTransformIds(); CacheCurrentSprite(); - return (m_IsValid && spriteRenderer.enabled && (alwaysUpdate || spriteRenderer.isVisible)); + var hasSprite = m_CurrentDeformSprite != 0; + return (m_IsValid && hasSprite && spriteRenderer.enabled && (alwaysUpdate || spriteRenderer.isVisible)); } void OnBoneTransformChanged() diff --git a/ValidationExceptions.json b/ValidationExceptions.json deleted file mode 100644 index 2904a9df..00000000 --- a/ValidationExceptions.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "ErrorExceptions": [ - { - "ValidationTest": "API Validation", - "ExceptionMessage": "Assembly \"Unity.2D.Animation.Triangle.Runtime\" no longer exists or is no longer included in build. This change requires a new major version.", - "PackageVersion": "5.2.0" - }, - { - "ValidationTest": "API Validation", - "ExceptionMessage": "New assembly \"Unity.2D.Animation.Triangle.Editor\" may only be added in a new minor or major version.", - "PackageVersion": "5.2.0" - } - ], - "WarningExceptions": [] -} \ No newline at end of file diff --git a/ValidationExceptions.json.meta b/ValidationExceptions.json.meta deleted file mode 100644 index 385849a3..00000000 --- a/ValidationExceptions.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: d7518b2b47b19482985877cfc916cf09 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/package.json b/package.json index 114f652e..0f7fb702 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.unity.2d.animation", - "version": "5.2.4", + "version": "5.2.6", "unity": "2020.3", "unityRelease": "26f1", "displayName": "2D Animation", @@ -18,7 +18,7 @@ "com.unity.modules.uielements": "1.0.0" }, "relatedPackages": { - "com.unity.2d.animation.tests": "5.2.4", + "com.unity.2d.animation.tests": "5.2.6", "com.unity.2d.common.tests": "4.2.1", "com.unity.2d.psdimporter": "4.3.1" }, @@ -30,11 +30,11 @@ } ], "upmCi": { - "footprint": "c3357b668b0016920c60c662dd4298e594f1d279" + "footprint": "b2dd1cc78aafa803d8a5d7856c0d976785448fee" }, "repository": { "url": "https://github.cds.internal.unity3d.com/unity/2d.git", "type": "git", - "revision": "c016f0f10972606d85ccfbf9de2033ad5384d6c4" + "revision": "a9671686b9de6dea33e57b306295bc63aacdb1ed" } }