Skip to content

Commit

Permalink
com.unity.2d.animation@9.0.0
Browse files Browse the repository at this point in the history
## [9.0.0] - 2022-08-03
### Added
- Added bone weight index validation in SpriteSkin's validate method, to ensure valid data before continuing with deformation.

### Fixed
- Fixed a case where moving vertices forcefully in the Skinning editor could cause a quad reset of the mesh. (case DANB-7)
- Fixed a case where multi selecting Sprite Skins would cause a null reference exception to be thrown. (case DANB-126)

### Changed
- Refactored internal triangulation and tessellation APIs.
  • Loading branch information
Unity Technologies committed Aug 3, 2022
1 parent 9d5bcbe commit df690dc
Show file tree
Hide file tree
Showing 85 changed files with 1,974 additions and 1,380 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [9.0.0] - 2022-08-03
### Added
- Added bone weight index validation in SpriteSkin's validate method, to ensure valid data before continuing with deformation.

### Fixed
- Fixed a case where moving vertices forcefully in the Skinning editor could cause a quad reset of the mesh. (case DANB-7)
- Fixed a case where multi selecting Sprite Skins would cause a null reference exception to be thrown. (case DANB-126)

### Changed
- Refactored internal triangulation and tessellation APIs.

## [9.0.0-pre.3] - 2022-05-31
### Changed
- Update dependency package version.
Expand All @@ -14,6 +25,7 @@

### Changed
- Added ability to create Sprite Library Asset variant from the create menu.
- Added dialog box to the Skinning Editor when entering Play Mode to allow saving unsaved changes.

## [9.0.0-pre.1] - 2022-03-21
### Added
Expand Down
4 changes: 2 additions & 2 deletions Documentation~/Animating-actor.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Animating an actor
# Animating an actor
After [importing](PreparingArtwork.md) and [rigging](CharacterRig.md) an actor, you can begin animating by simply dragging the rigged actor into the Scene view. By repositioning the different bones of the actor on the Animation timeline with [Unity's animation workflow and tools](https://docs.unity3d.com/Manual/AnimationSection.html). The mesh of the actor [deforms](SpriteSkin.md) with the positioning of the rigged bones, creating smooth animation transitions.

Aside from this method, there are other ways that you can animate with the 2D Animation package. The following are a few examples based on the Sample scenes available for you to import to use with the package.
Expand All @@ -7,4 +7,4 @@ Aside from this method, there are other ways that you can animate with the 2D An
The 2D Animation package allows you to use the [Sprite Swap](SpriteSwapIntro.md) feature to swap to different Sprites at runtime, from [swapping only a single part](CharacterParts.md) of an actor to [swapping the entire Sprite Library Asset](SLASwap.md) it refers to.

### Other Sample projects
[Sample projects ](Examples.md) are distributed with the 2D Animation package and available for import. These projects include examples of the different ways you can animate with the package features, such as the [Flipbook Animation Swap](ex-sprite-swap.md#flipbook-animation-swap) and [Animated Swap](ex-sprite-swap.md#animated-swap) and so on. Refer to the respective Sample documentation pages for more information.
[Sample projects ](Examples.md) are distributed with the 2D Animation package and available for import. These projects include examples of the different ways you can animate with the package features such as an [Animated Swap](ex-sprite-swap.md#animated-swap). Refer to the respective Sample documentation pages for more information.
2 changes: 1 addition & 1 deletion Documentation~/AssetUpgrader.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ The 2D Animation package and its assets are often updated with major and minor t

The 2D Animation Asset Upgrader tool eases the transition and upgrade of older assets to newer ones. This tool has the following features:

- Upgrades [Sprite Library Asset](SLAsset.md) files ending in `.asset` to Sprite Library Source Asset files ending in `.spriteLib`.
- Upgrades [Sprite Library Asset](SL-Asset.md) files ending in `.asset` to Sprite Library Source Asset files ending in `.spriteLib`.
- Moves Sprite Library Assets baked into `.psb` files created in Unity 2019 and Unity 2020 out into their own separate Sprite Library Source Asset files ending in `.spriteLib`.
- Upgrades [Animation Clips](https://docs.unity3d.com/Manual/AnimationClips.html) that animate Sprites based on the [Sprite Resolver component](https://docs.unity3d.com/Packages/com.unity.2d.animation@latest/index.html?subfolder=/manual/SLAsset.html%23sprite-resolver-component)'s [Category and Label](https://docs.unity3d.com/Packages/com.unity.2d.animation@latest/index.html?subfolder=/manual/SLAsset.html%23category) hash in Unity 2019 and Unity 2020, to Sprite Resolver's new **Sprite Hash** property from Unity 2022 onwards.
- Upgrades Animation Clips animating the Sprite Resolver component's **Sprite Key** property in Unity 2021, to Sprite Resolver's new Sprite Hash property from Unity 2022 onwards.
Expand Down
4 changes: 2 additions & 2 deletions Documentation~/CharacterParts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ In the following example, there are two Sprites that are variations of the actor

![](images/bothscarves.PNG)<br/>__Left:__ The original `green scarf` Sprite. __Right:__ An alternate `blue scarf` Sprite.

1. Place the Sprites for both scarves into the same [Sprite Library Asset](SLAsset.md), and add them both to the same **Category** (named `Scarf`).
1. Place the Sprites for both scarves into the same [Sprite Library Asset](SL-Asset.md), and add them both to the same **Category** (named `Scarf`).

2. Give each of the Sprites a unique __Label__ name (in this case `green scarf` and `blue scarf` respectively).
This and the previous step can be automated by dragging and dropping sprites into the Categories tab empty space.
<br/>![](images/2d-anim-change-parts-SLAsset.png)

3. In the Scene, select the [Instantiated Prefab](https://docs.unity3d.com/Manual/InstantiatingPrefabs.html) and then select the `Scarf` GameObject in the Hierarchy window.

4. Go to the [Sprite Resolver component](SLAsset.md#sprite-resolver-component) of the `Scarf` GameObject. The Sprite Resolver‘s visual selector displays the two Sprites available in the `Scarf` Category.<br/>![](images/2d-anim-change-parts-select-green.png)
4. Go to the [Sprite Resolver component](SL-Resolver.md) of the `Scarf` GameObject. The Sprite Resolver‘s visual selector displays the two Sprites available in the `Scarf` Category.<br/>![](images/2d-anim-change-parts-select-green.png)

5. Select the `blue scarf` to switch the Sprite rendered by the `Scarf` GameObject to it instead.<br/>![](images/2d-anim-change-parts-select-blue.png)<br/>The Sprite Resolver's Label is set to `blue scarf`.

Expand Down
7 changes: 3 additions & 4 deletions Documentation~/Examples.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Importing Samples
Sample scenes are available for import from the Package Manger under **Samples**, which demonstrate the different ways you can use the features in the 2D Animation package to achieve a variety of effects and outcomes.
Sample scenes are available for import from the Package Manager under **Samples**, which demonstrate the different ways you can use the features in the 2D Animation package to achieve a variety of effects and outcomes.

![](images/sample-import-button.png)<br/>Select **Import** to download and install the Sample projects and Assets.

Each Sample project contains specific examples with ready-made Assets, demonstrating how to use the 2D Animation package's features and the results and outcomes you can achieve with them.

When the import is complete, Unity installs the Sample projects to `Assets/Samples/2D Animation/[X.Y.Z]/Samples`; where `[X.Y.Z]` is the version of the currently installed 2D Animation package.
When the import is complete, Unity installs the Sample projects to `Assets/Samples/2D Animation/[X.Y.Z]/Samples`; where `[X.Y.Z]` is the version of the installed 2D Animation package.

The following is the list of Sample projects and their respective documentation. Note that some of these Samples require and refer to the [PSD Importer](https://docs.unity3d.com/Packages/com.unity.2d.psdimporter@latest/) package:

- [Simple](ex-simple.md) - a single Sprite rig with simple bone hierarchy and rigging.
- [Single Skinned Sprite](ex-single-skinned-sprite.md) - a more advance single Sprite actor.
- [Character](ex-psd-importer.md) - Imported with the PSD Importer
- [Sprite Swap](ex-sprite-swap.md) - - Contains examples of the many different ways that Sprite Swap can be used.
- [Flipbook Animation Swap](ex-sprite-swap.md#flipbook-animation-swap)
- [Sprite Swap](ex-sprite-swap.md) - - Contains examples of the different ways to use Sprite Swap.
- [Animated Swap](ex-sprite-swap.md#animated-swap)
- [Part Swap](ex-sprite-swap.md#part-swap)
- [Full Skin Swap](ex-sprite-swap.md#full-skin-swap)
Expand Down
44 changes: 44 additions & 0 deletions Documentation~/SL-Asset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Sprite Library Asset in Unity

The **Sprite Library Asset** is an Unity asset that contains the Sprites that you want to use for [Sprite Swapping](SpriteSwapIntro.md). This page explains what are the [Sprite Library Asset properties](#sprite-library-asset-properties) and how to [create a Sprite Library Asset](#create-a-sprite-library-asset) or a [Sprite Library Asset variant](#convert-a-sprite-library-asset-into-a-variant).

A Sprite Library Asset groups the Sprites it contains into [Categories](SL-Editor.md#categories), and you can give these Sprites unique names called [Labels](SL-Editor.md#labels) to differentiate them. You can edit the Sprite Library Asset's content in the [Sprite Library Editor window](SL-Editor.md) (refer to its documentation for more details).

In the [Sprite Swap workflow](SpriteSwapSetup.md), after creating a Sprite Library Asset or several assets, you can select the Sprite Library Asset you want to use with the [Sprite Library](SL-component.md) component, and the [Sprite Resolver](SL-Resolver.md) component will pull information from the asset selected.

## Create a Sprite Library Asset

To create a Sprite Library Asset, go to **Assets** > **Create** > **2D** > **Sprite Library Asset**.

![](images/2D-animation-SLAsset-dropdown.png)

## Sprite Library Asset properties
Select the Sprite Library Asset and go to its Inspector window to view the following properties.

![](images/2D-animation-SLAsset-properties.png)

Property |Description
--|--
**Open in Sprite Library Editor** | Select this to open the [Sprite Library Editor window](SL-Editor.md) to edit the content of this asset.
**Main Library** | Leave this property empty to have this Sprite Library Asset refer to its own Categories and Labels. Assign a different Sprite Library Asset to have it become the [Main Library](SL-Editor-UI.md#main-library) of the selected Sprite Library Asset, which will now refer to the second asset's Categories and Labels instead. Doing so also [converts](#convert-a-sprite-library-asset-into-a-variant) the selected Sprite Library Asset into a Variant asset of the Sprite Library Asset set as the **Main Library**.
**Revert** | Select this to reset property changes back to the last saved state. Selecting this removes all unsaved changes.
**Apply** | Select this to save the current property settings.

## Create a Sprite Library Asset Variant

A Sprite Library Asset Variant inherits **Categories** and **Labels** from a selected Sprite Library Asset, instead of referring to its own. There are two ways to create a Variant.

### Create through the menu

After creating a Sprite Library Asset, select it in the Project window, then go to **Assets** > **Create** > **2D** > **Sprite Library Asset Variant** to create a Variant asset that references it.

![](images/2D-animation-SLAssetVariant-dropdown.png)

### Convert a Sprite Library Asset into a Variant

You can convert an existing Sprite Library Asset into a Variant of another by setting another Sprite Library Asset as its [Main Library](SL-Main-Library.md).

## Additional resources
- [Sprite Library Editor](SL-Editor.md)
- [Setting up for Sprite Swap](SpriteSwapSetup.md)
- [Overrides to the Main Library](SL-Main-Library.md)
77 changes: 77 additions & 0 deletions Documentation~/SL-Drag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Drag sprites to create or edit Categories and Labels

This page shows the different ways you can create or edit Categories and Labels in a Sprite Library Asset by dragging sprites directly into the Sprite Library Editor window.

You can automatically create new Categories and Labels by dragging sprites or [PSD Importer supported file types](https://docs.unity3d.com/Packages/com.unity.2d.psdimporter@latest) directly into the [Sprite Library Editor](SL-Editor.md) window.

## Prerequisites

- [PSD Importer package](https://docs.unity3d.com/Packages/com.unity.2d.psdimporter@latest) is required for the Sprite Library Editor to recognize imported .psb files.

## Create a new Category

1. In the open Sprite Library Editor window, drag a sprite directly onto the Categories column to create a new Category. You can't create Labels without selecting an existing Category first.

![](images/sl-editor-drag-sprite-category.png)

## Create a new Label for each sprite

1. Select a Category, then drag a or a selection of sprites into an empty space in the Labels column.

![](images/2D-animation-SLAsset-drag-n-drop-04.png)<br/>_Dragging the `head` sprite into the Labels column creates a new Label named `head` in the selected Category._

2. Unity creates a new Label for each sprite in the selection and gives it the same name as the sprite it references. **Note:** If an existing Label with the same name already exists at the destination, then the editor appends `_X` to the new Label's name, where `X` is the next number in sequence, starting from zero.

![](images/2D-animation-SLAsset-drag-n-drop-04-finished.png)<br/>_Dragging in a selection of sprites all named `head` results in additional Labels created with the `_X` suffix for each sprite._

## Replace a Label's sprite reference

1. Drag a sprite onto an existing Label.
![](images/2D-animation-SLAsset-drag-n-drop-05.png)

2. The editor replaces the sprite reference to the new sprite. The Label's name remains unchanged.
![](images/2D-animation-SLAsset-drag-n-drop-05-finished.png)

## Create a single Category with multiple Labels

1. Select multiple sprites from the Project window.

![](images/sl-editor-drag-select-sprites.png)
2. Drag the selected sprites into the Categories column to create a new Category. The Category is automatically named after the first sprite in the selection.

![](images/sl-editor-drag-select-sprites-drop.png)

**Note:** If an existing Category with the same name already exists at the destination, then the editor appends `_X` to the new Category's name, where `X` is the next number in sequence, starting from zero.

## Create Categories for each Layer and Layer Group

After you [prepare the .psb](PreparingArtwork.md) of your character, import it into Unity with the PSD Importer package. **Note:** The following [requires](#prerequisites) the PSD Importer package to be installed.

1. Enable **Use Layer Group** in the imported .psb's properties.

![](images/sl-editor-drag-wolf-layer-groups.png)

2. Drag the imported .psb file into the Sprite Library Editor's Categories column.

3. The editor creates a Category for each Layer and Layer Group, and creates Labels for each sprite. Sprites which belonged to the same Layer Group are automatically grouped into the same Category.

![](images/sl-editor-drag-wolf-labels.png)


## Replace each Labels' sprite references

The following steps how to replace each Label's sprite reference with sprites from a different imported .psb. **Note:** This method only works if the imported .psb has Layers and Layer Groups with the same exact names as the original .psb used to [create the Categories and Labels](#create-categories-for-each-layer-and-layer-group).

This method is useful when you have multiple characters with the same Layers and Layer Groups and want to replace their respective sprites without creating a new Sprite Library Asset.

1. Enable **Use Layer Groups** in the replacement .psb file's properties.

![](images/sl-editor-drag-knight-drag.png)

2. Drag the replacement .psb onto an empty space in the Categories column and release. All sprite references of the same name and in the same Categories are automatically replaced with their respective counterparts from the replacement .psb.

![](images/sl-editor-drag-knight-drop.png)

## Additional resources
- [PSD Importer package](https://docs.unity3d.com/Packages/com.unity.2d.psdimporter@latest)
- [Preparing and importing artwork](PreparingArtwork.md)
Loading

0 comments on commit df690dc

Please sign in to comment.