mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Merge branch '3.6' into 3.7-beta
This commit is contained in:
commit
3b3527ffc7
@ -517,12 +517,19 @@ public class AnimationState {
|
||||
}
|
||||
|
||||
/** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
|
||||
* {@link TrackEntry#getMixDuration()}.
|
||||
* {@link TrackEntry#getMixDuration()}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
|
||||
* <p>
|
||||
* Mixing out is done by setting an empty animation. A mix duration of 0 still mixes out over one frame.
|
||||
* Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation(int, float)},
|
||||
* {@link #setEmptyAnimations(float)}, or {@link #addEmptyAnimation(int, float, float)}. Mixing to an empty animation causes
|
||||
* the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
|
||||
* transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
|
||||
* 0 still mixes out over one frame.
|
||||
* <p>
|
||||
* To mix in, first set an empty animation and add an animation using {@link #addAnimation(int, Animation, boolean, float)},
|
||||
* then set the {@link TrackEntry#setMixDuration(float)} on the returned track entry. */
|
||||
* Mixing in is done by first setting an empty animation, then adding an animation using
|
||||
* {@link #addAnimation(int, Animation, boolean, float)} and on the returned track entry, set the
|
||||
* {@link TrackEntry#setMixDuration(float)}. Mixing from an empty animation causes the new animation to be applied more and
|
||||
* more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
|
||||
* setup pose value if no lower tracks key the property to the value keyed in the new animation. */
|
||||
public TrackEntry setEmptyAnimation (int trackIndex, float mixDuration) {
|
||||
TrackEntry entry = setAnimation(trackIndex, emptyAnimation, false);
|
||||
entry.mixDuration = mixDuration;
|
||||
@ -533,6 +540,8 @@ public class AnimationState {
|
||||
/** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
|
||||
* {@link TrackEntry#getMixDuration()}. If the track is empty, it is equivalent to calling
|
||||
* {@link #setEmptyAnimation(int, float)}.
|
||||
* <p>
|
||||
* See {@link #setEmptyAnimation(int, float)}.
|
||||
* @param delay Seconds to begin this animation after the start of the previous animation. May be <= 0 to use the animation
|
||||
* duration of the previous track minus any mix duration plus <code>delay</code>.
|
||||
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
||||
@ -810,8 +819,8 @@ public class AnimationState {
|
||||
* is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
|
||||
* properties keyed by the animation are set to the setup pose and the track is cleared.
|
||||
* <p>
|
||||
* It may be desired to use {@link AnimationState#addEmptyAnimation(int, float, float)} to mix the properties back to the
|
||||
* setup pose over time, rather than have it happen instantly. */
|
||||
* It may be desired to use {@link AnimationState#addEmptyAnimation(int, float, float)} rather than have the animation
|
||||
* abruptly cease being applied. */
|
||||
public float getTrackEnd () {
|
||||
return trackEnd;
|
||||
}
|
||||
|
||||
@ -811,19 +811,19 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
|
||||
public boolean touchDown (int screenX, int screenY, int pointer, int button) {
|
||||
offsetX = screenX;
|
||||
offsetY = Gdx.graphics.getHeight() - screenY;
|
||||
offsetY = Gdx.graphics.getHeight() - 1 - screenY;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean touchDragged (int screenX, int screenY, int pointer) {
|
||||
float deltaX = screenX - offsetX;
|
||||
float deltaY = Gdx.graphics.getHeight() - screenY - offsetY;
|
||||
float deltaY = Gdx.graphics.getHeight() - 1 - screenY - offsetY;
|
||||
|
||||
camera.position.x -= deltaX * camera.zoom;
|
||||
camera.position.y -= deltaY * camera.zoom;
|
||||
|
||||
offsetX = screenX;
|
||||
offsetY = Gdx.graphics.getHeight() - screenY;
|
||||
offsetY = Gdx.graphics.getHeight() - 1 - screenY;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -230,9 +230,16 @@ namespace Spine.Unity.Editor {
|
||||
EditorApplication.hierarchyWindowItemOnGUI += HierarchyDragAndDrop;
|
||||
|
||||
// Hierarchy Icons
|
||||
#if UNITY_2017_2_OR_NEWER
|
||||
EditorApplication.playModeStateChanged -= HierarchyIconsOnPlaymodeStateChanged;
|
||||
EditorApplication.playModeStateChanged += HierarchyIconsOnPlaymodeStateChanged;
|
||||
HierarchyIconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
|
||||
#else
|
||||
EditorApplication.playmodeStateChanged -= HierarchyIconsOnPlaymodeStateChanged;
|
||||
EditorApplication.playmodeStateChanged += HierarchyIconsOnPlaymodeStateChanged;
|
||||
HierarchyIconsOnPlaymodeStateChanged();
|
||||
#endif
|
||||
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
@ -255,7 +262,11 @@ namespace Spine.Unity.Editor {
|
||||
showHierarchyIcons = EditorGUILayout.Toggle(new GUIContent("Show Hierarchy Icons", "Show relevant icons on GameObjects with Spine Components on them. Disable this if you have large, complex scenes."), showHierarchyIcons);
|
||||
if (EditorGUI.EndChangeCheck()) {
|
||||
EditorPrefs.SetBool(SHOW_HIERARCHY_ICONS_KEY, showHierarchyIcons);
|
||||
#if UNITY_2017_2_OR_NEWER
|
||||
HierarchyIconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
|
||||
#else
|
||||
HierarchyIconsOnPlaymodeStateChanged();
|
||||
#endif
|
||||
}
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
@ -496,7 +507,11 @@ namespace Spine.Unity.Editor {
|
||||
#endregion
|
||||
|
||||
#region Hierarchy
|
||||
#if UNITY_2017_2_OR_NEWER
|
||||
static void HierarchyIconsOnPlaymodeStateChanged (PlayModeStateChange stateChange) {
|
||||
#else
|
||||
static void HierarchyIconsOnPlaymodeStateChanged () {
|
||||
#endif
|
||||
skeletonRendererTable.Clear();
|
||||
skeletonUtilityBoneTable.Clear();
|
||||
boundingBoxFollowerTable.Clear();
|
||||
|
||||
@ -113,37 +113,37 @@ namespace Spine.Unity.Modules.AttachmentTools {
|
||||
#region Runtime RegionAttachments
|
||||
/// <summary>
|
||||
/// Creates a RegionAttachment based on a sprite. This method creates a real, usable AtlasRegion. That AtlasRegion uses a new AtlasPage with the Material provided./// </summary>
|
||||
public static RegionAttachment ToRegionAttachment (this Sprite sprite, Material material) {
|
||||
return sprite.ToRegionAttachment(material.ToSpineAtlasPage());
|
||||
public static RegionAttachment ToRegionAttachment (this Sprite sprite, Material material, float rotation = 0f) {
|
||||
return sprite.ToRegionAttachment(material.ToSpineAtlasPage(), rotation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a RegionAttachment based on a sprite. This method creates a real, usable AtlasRegion. That AtlasRegion uses the AtlasPage provided./// </summary>
|
||||
public static RegionAttachment ToRegionAttachment (this Sprite sprite, AtlasPage page) {
|
||||
public static RegionAttachment ToRegionAttachment (this Sprite sprite, AtlasPage page, float rotation = 0f) {
|
||||
if (sprite == null) throw new System.ArgumentNullException("sprite");
|
||||
if (page == null) throw new System.ArgumentNullException("page");
|
||||
var region = sprite.ToAtlasRegion(page);
|
||||
var unitsPerPixel = 1f / sprite.pixelsPerUnit;
|
||||
return region.ToRegionAttachment(sprite.name, unitsPerPixel);
|
||||
return region.ToRegionAttachment(sprite.name, unitsPerPixel, rotation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Spine.AtlasRegion that uses a premultiplied alpha duplicate texture of the Sprite's texture data. Returns a RegionAttachment that uses it. Use this if you plan to use a premultiply alpha shader such as "Spine/Skeleton"</summary>
|
||||
public static RegionAttachment ToRegionAttachmentPMAClone (this Sprite sprite, Shader shader, TextureFormat textureFormat = AtlasUtilities.SpineTextureFormat, bool mipmaps = AtlasUtilities.UseMipMaps, Material materialPropertySource = null) {
|
||||
public static RegionAttachment ToRegionAttachmentPMAClone (this Sprite sprite, Shader shader, TextureFormat textureFormat = AtlasUtilities.SpineTextureFormat, bool mipmaps = AtlasUtilities.UseMipMaps, Material materialPropertySource = null, float rotation = 0f) {
|
||||
if (sprite == null) throw new System.ArgumentNullException("sprite");
|
||||
if (shader == null) throw new System.ArgumentNullException("shader");
|
||||
var region = sprite.ToAtlasRegionPMAClone(shader, textureFormat, mipmaps, materialPropertySource);
|
||||
var unitsPerPixel = 1f / sprite.pixelsPerUnit;
|
||||
return region.ToRegionAttachment(sprite.name, unitsPerPixel);
|
||||
return region.ToRegionAttachment(sprite.name, unitsPerPixel, rotation);
|
||||
}
|
||||
|
||||
public static RegionAttachment ToRegionAttachmentPMAClone (this Sprite sprite, Material materialPropertySource, TextureFormat textureFormat = AtlasUtilities.SpineTextureFormat, bool mipmaps = AtlasUtilities.UseMipMaps) {
|
||||
return sprite.ToRegionAttachmentPMAClone(materialPropertySource.shader, textureFormat, mipmaps, materialPropertySource);
|
||||
public static RegionAttachment ToRegionAttachmentPMAClone (this Sprite sprite, Material materialPropertySource, TextureFormat textureFormat = AtlasUtilities.SpineTextureFormat, bool mipmaps = AtlasUtilities.UseMipMaps, float rotation = 0f) {
|
||||
return sprite.ToRegionAttachmentPMAClone(materialPropertySource.shader, textureFormat, mipmaps, materialPropertySource, rotation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new RegionAttachment from a given AtlasRegion.</summary>
|
||||
public static RegionAttachment ToRegionAttachment (this AtlasRegion region, string attachmentName, float scale = 0.01f) {
|
||||
public static RegionAttachment ToRegionAttachment (this AtlasRegion region, string attachmentName, float scale = 0.01f, float rotation = 0f) {
|
||||
if (string.IsNullOrEmpty(attachmentName)) throw new System.ArgumentException("attachmentName can't be null or empty.", "attachmentName");
|
||||
if (region == null) throw new System.ArgumentNullException("region");
|
||||
|
||||
@ -162,14 +162,13 @@ namespace Spine.Unity.Modules.AttachmentTools {
|
||||
attachment.Path = region.name;
|
||||
attachment.scaleX = 1;
|
||||
attachment.scaleY = 1;
|
||||
attachment.rotation = 0;
|
||||
attachment.rotation = rotation;
|
||||
|
||||
attachment.r = 1;
|
||||
attachment.g = 1;
|
||||
attachment.b = 1;
|
||||
attachment.a = 1;
|
||||
|
||||
|
||||
// pass OriginalWidth and OriginalHeight because UpdateOffset uses it in its calculation.
|
||||
attachment.width = attachment.regionOriginalWidth * scale;
|
||||
attachment.height = attachment.regionOriginalHeight * scale;
|
||||
|
||||
@ -344,8 +344,8 @@ VertexOutput vert(VertexInput input)
|
||||
output.pos = calculateLocalPos(input.vertex);
|
||||
output.color = calculateVertexColor(input.color);
|
||||
output.texcoord = float3(calculateTextureCoord(input.texcoord), 0);
|
||||
|
||||
float3 viewPos = mul(UNITY_MATRIX_MV, input.vertex);
|
||||
|
||||
float3 viewPos = UnityObjectViewPos(input.vertex); //float3 viewPos = mul(UNITY_MATRIX_MV, input.vertex);
|
||||
#if defined(FIXED_NORMALS_BACKFACE_RENDERING) || defined(_RIM_LIGHTING)
|
||||
float4 powWorld = calculateWorldPos(input.vertex);
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user