mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '4.0' into 4.1-beta
This commit is contained in:
commit
2d86973980
@ -246,6 +246,7 @@
|
|||||||
* Prefabs containing `SkeletonRenderer`, `SkeletonAnimation` and `SkeletonMecanim` now provide a proper Editor preview, including the preview thumbnail.
|
* Prefabs containing `SkeletonRenderer`, `SkeletonAnimation` and `SkeletonMecanim` now provide a proper Editor preview, including the preview thumbnail.
|
||||||
* `SkeletonRenderer` (and subclasses`SkeletonAnimation` and `SkeletonMecanim`) now provide a property `Advanced - Fix Prefab Override MeshFilter`, which when enabled fixes the prefab always being marked as changed. It sets the MeshFilter's hide flags to `DontSaveInEditor`. Unfortunately this comes at the cost of references to the `MeshFilter` by other components being lost, therefore this parameter defaults to `false` to keep the safe existing behaviour.
|
* `SkeletonRenderer` (and subclasses`SkeletonAnimation` and `SkeletonMecanim`) now provide a property `Advanced - Fix Prefab Override MeshFilter`, which when enabled fixes the prefab always being marked as changed. It sets the MeshFilter's hide flags to `DontSaveInEditor`. Unfortunately this comes at the cost of references to the `MeshFilter` by other components being lost, therefore this parameter defaults to `false` to keep the safe existing behaviour.
|
||||||
* `BoundingBoxFollower` and `BoundingBoxFollowerGraphic` now provide previously missing `usedByEffector` and `usedByComposite` parameters to be set at all generated colliders.
|
* `BoundingBoxFollower` and `BoundingBoxFollowerGraphic` now provide previously missing `usedByEffector` and `usedByComposite` parameters to be set at all generated colliders.
|
||||||
|
* `BoneFollower` and `BoneFollowerGraphic` now provide an additional `Follow Parent World Scale` parameter to allow following simple scale of parent bones (rotated/skewed scale can't be supported).
|
||||||
|
|
||||||
* **Changes of default values**
|
* **Changes of default values**
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ namespace Spine.Unity.Editor {
|
|||||||
public class BoneFollowerGraphicInspector : Editor {
|
public class BoneFollowerGraphicInspector : Editor {
|
||||||
|
|
||||||
SerializedProperty boneName, skeletonGraphic, followXYPosition, followZPosition, followBoneRotation,
|
SerializedProperty boneName, skeletonGraphic, followXYPosition, followZPosition, followBoneRotation,
|
||||||
followLocalScale, followSkeletonFlip, maintainedAxisOrientation;
|
followLocalScale, followParentWorldScale, followSkeletonFlip, maintainedAxisOrientation;
|
||||||
BoneFollowerGraphic targetBoneFollower;
|
BoneFollowerGraphic targetBoneFollower;
|
||||||
bool needsReset;
|
bool needsReset;
|
||||||
|
|
||||||
@ -77,6 +77,7 @@ namespace Spine.Unity.Editor {
|
|||||||
followXYPosition = serializedObject.FindProperty("followXYPosition");
|
followXYPosition = serializedObject.FindProperty("followXYPosition");
|
||||||
followZPosition = serializedObject.FindProperty("followZPosition");
|
followZPosition = serializedObject.FindProperty("followZPosition");
|
||||||
followLocalScale = serializedObject.FindProperty("followLocalScale");
|
followLocalScale = serializedObject.FindProperty("followLocalScale");
|
||||||
|
followParentWorldScale = serializedObject.FindProperty("followParentWorldScale");
|
||||||
followSkeletonFlip = serializedObject.FindProperty("followSkeletonFlip");
|
followSkeletonFlip = serializedObject.FindProperty("followSkeletonFlip");
|
||||||
maintainedAxisOrientation = serializedObject.FindProperty("maintainedAxisOrientation");
|
maintainedAxisOrientation = serializedObject.FindProperty("maintainedAxisOrientation");
|
||||||
|
|
||||||
@ -172,6 +173,7 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorGUILayout.PropertyField(followXYPosition);
|
EditorGUILayout.PropertyField(followXYPosition);
|
||||||
EditorGUILayout.PropertyField(followZPosition);
|
EditorGUILayout.PropertyField(followZPosition);
|
||||||
EditorGUILayout.PropertyField(followLocalScale);
|
EditorGUILayout.PropertyField(followLocalScale);
|
||||||
|
EditorGUILayout.PropertyField(followParentWorldScale);
|
||||||
EditorGUILayout.PropertyField(followSkeletonFlip);
|
EditorGUILayout.PropertyField(followSkeletonFlip);
|
||||||
if ((followSkeletonFlip.hasMultipleDifferentValues || followSkeletonFlip.boolValue == false) &&
|
if ((followSkeletonFlip.hasMultipleDifferentValues || followSkeletonFlip.boolValue == false) &&
|
||||||
(followBoneRotation.hasMultipleDifferentValues || followBoneRotation.boolValue == true)) {
|
(followBoneRotation.hasMultipleDifferentValues || followBoneRotation.boolValue == true)) {
|
||||||
|
|||||||
@ -38,12 +38,12 @@ namespace Spine.Unity.Editor {
|
|||||||
[CustomEditor(typeof(BoneFollower)), CanEditMultipleObjects]
|
[CustomEditor(typeof(BoneFollower)), CanEditMultipleObjects]
|
||||||
public class BoneFollowerInspector : Editor {
|
public class BoneFollowerInspector : Editor {
|
||||||
SerializedProperty boneName, skeletonRenderer, followXYPosition, followZPosition, followBoneRotation,
|
SerializedProperty boneName, skeletonRenderer, followXYPosition, followZPosition, followBoneRotation,
|
||||||
followLocalScale, followSkeletonFlip, maintainedAxisOrientation;
|
followLocalScale, followParentWorldScale, followSkeletonFlip, maintainedAxisOrientation;
|
||||||
BoneFollower targetBoneFollower;
|
BoneFollower targetBoneFollower;
|
||||||
bool needsReset;
|
bool needsReset;
|
||||||
|
|
||||||
#region Context Menu Item
|
#region Context Menu Item
|
||||||
[MenuItem("CONTEXT/SkeletonRenderer/Add BoneFollower GameObject")]
|
[MenuItem ("CONTEXT/SkeletonRenderer/Add BoneFollower GameObject")]
|
||||||
static void AddBoneFollowerGameObject (MenuCommand cmd) {
|
static void AddBoneFollowerGameObject (MenuCommand cmd) {
|
||||||
var skeletonRenderer = cmd.context as SkeletonRenderer;
|
var skeletonRenderer = cmd.context as SkeletonRenderer;
|
||||||
var go = EditorInstantiation.NewGameObject("New BoneFollower", true);
|
var go = EditorInstantiation.NewGameObject("New BoneFollower", true);
|
||||||
@ -60,7 +60,7 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
[MenuItem("CONTEXT/SkeletonRenderer/Add BoneFollower GameObject", true)]
|
[MenuItem ("CONTEXT/SkeletonRenderer/Add BoneFollower GameObject", true)]
|
||||||
static bool ValidateAddBoneFollowerGameObject (MenuCommand cmd) {
|
static bool ValidateAddBoneFollowerGameObject (MenuCommand cmd) {
|
||||||
var skeletonRenderer = cmd.context as SkeletonRenderer;
|
var skeletonRenderer = cmd.context as SkeletonRenderer;
|
||||||
return skeletonRenderer.valid;
|
return skeletonRenderer.valid;
|
||||||
@ -86,6 +86,7 @@ namespace Spine.Unity.Editor {
|
|||||||
followXYPosition = serializedObject.FindProperty("followXYPosition");
|
followXYPosition = serializedObject.FindProperty("followXYPosition");
|
||||||
followZPosition = serializedObject.FindProperty("followZPosition");
|
followZPosition = serializedObject.FindProperty("followZPosition");
|
||||||
followLocalScale = serializedObject.FindProperty("followLocalScale");
|
followLocalScale = serializedObject.FindProperty("followLocalScale");
|
||||||
|
followParentWorldScale = serializedObject.FindProperty("followParentWorldScale");
|
||||||
followSkeletonFlip = serializedObject.FindProperty("followSkeletonFlip");
|
followSkeletonFlip = serializedObject.FindProperty("followSkeletonFlip");
|
||||||
maintainedAxisOrientation = serializedObject.FindProperty("maintainedAxisOrientation");
|
maintainedAxisOrientation = serializedObject.FindProperty("maintainedAxisOrientation");
|
||||||
|
|
||||||
@ -178,6 +179,7 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorGUILayout.PropertyField(followXYPosition);
|
EditorGUILayout.PropertyField(followXYPosition);
|
||||||
EditorGUILayout.PropertyField(followZPosition);
|
EditorGUILayout.PropertyField(followZPosition);
|
||||||
EditorGUILayout.PropertyField(followLocalScale);
|
EditorGUILayout.PropertyField(followLocalScale);
|
||||||
|
EditorGUILayout.PropertyField(followParentWorldScale);
|
||||||
EditorGUILayout.PropertyField(followSkeletonFlip);
|
EditorGUILayout.PropertyField(followSkeletonFlip);
|
||||||
if ((followSkeletonFlip.hasMultipleDifferentValues || followSkeletonFlip.boolValue == false) &&
|
if ((followSkeletonFlip.hasMultipleDifferentValues || followSkeletonFlip.boolValue == false) &&
|
||||||
(followBoneRotation.hasMultipleDifferentValues || followBoneRotation.boolValue == true)) {
|
(followBoneRotation.hasMultipleDifferentValues || followBoneRotation.boolValue == true)) {
|
||||||
|
|||||||
@ -67,9 +67,11 @@ namespace Spine.Unity {
|
|||||||
[Tooltip("Follows the skeleton's flip state by controlling this Transform's local scale.")]
|
[Tooltip("Follows the skeleton's flip state by controlling this Transform's local scale.")]
|
||||||
public bool followSkeletonFlip = true;
|
public bool followSkeletonFlip = true;
|
||||||
|
|
||||||
[Tooltip("Follows the target bone's local scale. BoneFollower cannot inherit world/skewed scale because of UnityEngine.Transform property limitations.")]
|
[Tooltip("Follows the target bone's local scale.")]
|
||||||
[UnityEngine.Serialization.FormerlySerializedAs("followScale")]
|
[UnityEngine.Serialization.FormerlySerializedAs("followScale")]
|
||||||
public bool followLocalScale = false;
|
public bool followLocalScale = false;
|
||||||
|
[Tooltip("Includes the parent bone's lossy world scale. BoneFollower cannot inherit rotated/skewed scale because of UnityEngine.Transform property limitations.")]
|
||||||
|
public bool followParentWorldScale = false;
|
||||||
|
|
||||||
public enum AxisOrientation {
|
public enum AxisOrientation {
|
||||||
XAxis = 1,
|
XAxis = 1,
|
||||||
@ -206,10 +208,14 @@ namespace Spine.Unity {
|
|||||||
* skeletonLossyScale.y * parentLossyScale.y);
|
* skeletonLossyScale.y * parentLossyScale.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 localScale = followLocalScale ? new Vector3(bone.ScaleX, bone.ScaleY, 1f) : new Vector3(1f, 1f, 1f);
|
Bone parentBone = bone.Parent;
|
||||||
|
Vector3 localScale = new Vector3(1f, 1f, 1f);
|
||||||
|
if (followParentWorldScale && parentBone != null)
|
||||||
|
localScale = new Vector3(parentBone.WorldScaleX, parentBone.WorldScaleY, 1f);
|
||||||
|
if (followLocalScale)
|
||||||
|
localScale.Scale(new Vector3(bone.ScaleX, bone.ScaleY, 1f));
|
||||||
if (followSkeletonFlip)
|
if (followSkeletonFlip)
|
||||||
localScale.y *= Mathf.Sign(bone.Skeleton.ScaleX * bone.Skeleton.ScaleY) * additionalFlipScale;
|
localScale.y *= Mathf.Sign(bone.Skeleton.ScaleX * bone.Skeleton.ScaleY) * additionalFlipScale;
|
||||||
|
|
||||||
thisTransform.localScale = localScale;
|
thisTransform.localScale = localScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,8 +64,10 @@ namespace Spine.Unity {
|
|||||||
public bool followBoneRotation = true;
|
public bool followBoneRotation = true;
|
||||||
[Tooltip("Follows the skeleton's flip state by controlling this Transform's local scale.")]
|
[Tooltip("Follows the skeleton's flip state by controlling this Transform's local scale.")]
|
||||||
public bool followSkeletonFlip = true;
|
public bool followSkeletonFlip = true;
|
||||||
[Tooltip("Follows the target bone's local scale. BoneFollower cannot inherit world/skewed scale because of UnityEngine.Transform property limitations.")]
|
[Tooltip("Follows the target bone's local scale.")]
|
||||||
public bool followLocalScale = false;
|
public bool followLocalScale = false;
|
||||||
|
[Tooltip("Includes the parent bone's lossy world scale. BoneFollower cannot inherit rotated/skewed scale because of UnityEngine.Transform property limitations.")]
|
||||||
|
public bool followParentWorldScale = false;
|
||||||
public bool followXYPosition = true;
|
public bool followXYPosition = true;
|
||||||
public bool followZPosition = true;
|
public bool followZPosition = true;
|
||||||
[Tooltip("Applies when 'Follow Skeleton Flip' is disabled but 'Follow Bone Rotation' is enabled."
|
[Tooltip("Applies when 'Follow Skeleton Flip' is disabled but 'Follow Bone Rotation' is enabled."
|
||||||
@ -185,7 +187,12 @@ namespace Spine.Unity {
|
|||||||
* skeletonLossyScale.y * parentLossyScale.y);
|
* skeletonLossyScale.y * parentLossyScale.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 localScale = followLocalScale ? new Vector3(bone.ScaleX, bone.ScaleY, 1f) : new Vector3(1f, 1f, 1f);
|
Bone parentBone = bone.Parent;
|
||||||
|
Vector3 localScale = new Vector3(1f, 1f, 1f);
|
||||||
|
if (followParentWorldScale && parentBone != null)
|
||||||
|
localScale = new Vector3(parentBone.WorldScaleX, parentBone.WorldScaleY, 1f);
|
||||||
|
if (followLocalScale)
|
||||||
|
localScale.Scale(new Vector3(bone.ScaleX, bone.ScaleY, 1f));
|
||||||
if (followSkeletonFlip)
|
if (followSkeletonFlip)
|
||||||
localScale.y *= Mathf.Sign(bone.Skeleton.ScaleX * bone.Skeleton.ScaleY) * additionalFlipScale;
|
localScale.y *= Mathf.Sign(bone.Skeleton.ScaleX * bone.Skeleton.ScaleY) * additionalFlipScale;
|
||||||
thisTransform.localScale = localScale;
|
thisTransform.localScale = localScale;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user