Skip to content

Commit

Permalink
com.unity.2d.animation@5.2.6
Browse files Browse the repository at this point in the history
## [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)
  • Loading branch information
Unity Technologies committed Nov 2, 2022
1 parent a87f4db commit a7b3236
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 265 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
10 changes: 9 additions & 1 deletion Editor/Assets/SkinningModule/ToolbarStyle.uss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
104 changes: 6 additions & 98 deletions Editor/Assets/SkinningModule/VisibilityTool.uss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
7 changes: 1 addition & 6 deletions Editor/SkinningModule/VisibilityTool/BoneVisibilityTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Editor/SpriteSkin/SpriteSkinEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down
133 changes: 2 additions & 131 deletions IK/Editor/IKEditorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ internal class IKEditorManager : ScriptableObject

GameObject m_Helper;
GameObject[] m_SelectedGameobjects;
bool m_IgnorePostProcessModifications = false;
HashSet<Transform> m_IgnoreTransformsOnUndo = new HashSet<Transform>();

internal bool isDraggingATool { get; private set; }
internal bool isDragging { get { return IKGizmos.instance.isDragging || isDraggingATool; } }

[InitializeOnLoadMethod]
static void CreateInstance()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
}

Expand All @@ -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;
Expand Down Expand Up @@ -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<Object>();

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)
Expand All @@ -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)
Expand Down
Loading

0 comments on commit a7b3236

Please sign in to comment.