Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Reset bind pose of 2d rigged sprite with unity's animation package

Discussion in 'Animation' started by krenar_, Jun 16, 2021.

  1. krenar_

    krenar_

    Joined:
    Dec 11, 2020
    Posts:
    10
    Hi, is there a way to reset bind pose of a rigged 2d sprite, rigged with Unity's animation package (from package manager)?

    As a reference, please find a screenshot that shows where button is called in SpriteSkin.cs (this script is provided in animation package)

    P.S. SpriteSkin.cs has no method that can be called to reset bind pose.

    Screenshot 2021-06-15 at 9.33.39 AM.png
     
    Last edited: Jun 17, 2021
  2. tonytopper

    tonytopper

    Joined:
    Jun 25, 2018
    Posts:
    225
    I am also looking for a way to essentially call "Reset Bind Pose" on all the Sprite Skin components within a rig. This would be really handy as I perfect and iterate on my sprites, weights, layering, etc.

    The function ResetBindPose is called in Editor/SpriteSkin/SpriteSkinEditor.cs I dug around and couldn't find where it was declared and unfortunately Visual Studio doesn't seem to be loading the Animation package in so my advanced search functions aren't available. Will try to report back.
     
  3. tonytopper

    tonytopper

    Joined:
    Jun 25, 2018
    Posts:
    225
    ResetBindPose is declared in com.unity.2d.animation@7.0.1\Runtime\SpriteSkinUtility.cs

    It's part of
    Code (CSharp):
    1. internal static class SpriteSkinUtility
     
  4. MarekUnity

    MarekUnity

    Unity Technologies

    Joined:
    Jan 6, 2017
    Posts:
    203
    @tonytopper you're right, Reset Bind Pose code is internal.

    I would like to understand your process a little bit more and learn how you iterate. Is there anything that prevents you from iterating in the Skinning Editor?
     
  5. tonytopper

    tonytopper

    Joined:
    Jun 25, 2018
    Posts:
    225
    The current features I am working on have a whole lot of stuff outside the Skinning Editor going on, bone scaling, IK targets, sprite swapping. Just to name a few, off the top of my head.

    When iterating, I might back out all the way to Adobe Illustrator to make changes based on how a sprite deforms. Sprite deformation is the big one. And this is affected by moving the rig round via IK, posing bones, swapping sprites, or scaling bone lengths.

    Regarding ResetBindPose, I just ended up pulling the code out of ResetBindPose and basically rolling my own copy of the function, which isn't super graceful. I wanted to reset all the bones in the rig and reset all the IKs with one button press.
     
    MarekUnity likes this.
  6. MarekUnity

    MarekUnity

    Unity Technologies

    Joined:
    Jan 6, 2017
    Posts:
    203
    Thanks for sharing @tonytopper. I'll notify the rest of the team about the points you mentioned.
     
    tonytopper likes this.
  7. temurleng1

    temurleng1

    Joined:
    Jun 28, 2018
    Posts:
    17
    @MarekUnity Hello,

    Is there any news? When I change the sprite through sprite Library, Sprite Skin doesn't reset the bind position. Since everything become a mass. I need to manually resetting bind pose
     
    tonytopper likes this.
  8. MarekUnity

    MarekUnity

    Unity Technologies

    Joined:
    Jan 6, 2017
    Posts:
    203
    @sezercanaktemur I don't have any news on this now.

    To help me understand the issue you're facing, why
    things don't look correctly after swapping the sprite library? Are the Sprites you're swapping skinned to different bones?