Merge branch '3.6' into 3.7-beta

This commit is contained in:
badlogic 2017-12-14 11:03:22 +01:00
commit e8fa57e3aa
16 changed files with 694 additions and 680 deletions

View File

@ -180,7 +180,7 @@ void _spEventQueue_drain (_spEventQueue* self) {
self->drainDisabled = 0;
}
// These two functions are needed in the UE4 runtime, see #1037
/* These two functions are needed in the UE4 runtime, see #1037 */
void _spAnimationState_enableQueue(spAnimationState* self) {
_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
internal->queue->drainDisabled = 0;

View File

@ -732,7 +732,7 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
data->target = spSkeletonData_findBone(skeletonData, targetName);
if (!data->target) {
spSkeletonData_dispose(skeletonData);
_spSkeletonJson_setError(self, root, "Target bone not found: ", boneMap->name);
_spSkeletonJson_setError(self, root, "Target bone not found: ", targetName);
return 0;
}
@ -771,7 +771,7 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
data->target = spSkeletonData_findBone(skeletonData, name);
if (!data->target) {
spSkeletonData_dispose(skeletonData);
_spSkeletonJson_setError(self, root, "Target bone not found: ", boneMap->name);
_spSkeletonJson_setError(self, root, "Target bone not found: ", name);
return 0;
}
@ -822,7 +822,7 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
data->target = spSkeletonData_findSlot(skeletonData, name);
if (!data->target) {
spSkeletonData_dispose(skeletonData);
_spSkeletonJson_setError(self, root, "Target slot not found: ", boneMap->name);
_spSkeletonJson_setError(self, root, "Target slot not found: ", name);
return 0;
}

View File

@ -61,7 +61,7 @@ public:
return SkeletonAnimation::createWithJsonFile(skeletonJsonFile, atlas, scale);
}
// Use createWithJsonFile instead
CC_DEPRECATED_ATTRIBUTE static SkeletonAnimation* createWithile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale = 1)
CC_DEPRECATED_ATTRIBUTE static SkeletonAnimation* createWithFile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale = 1)
{
return SkeletonAnimation::createWithJsonFile(skeletonJsonFile, atlasFile, scale);
}

View File

@ -259,17 +259,12 @@ namespace Spine {
break;
case Dip:
pose = MixPose.Setup;
alpha = mix == 1 ? 0 : alphaDip;
alpha = alphaDip;
break;
default:
pose = MixPose.Setup;
if (mix == 1) {
alpha = 0;
} else {
alpha = alphaDip;
var dipMix = timelineDipMix[i];
alpha *= Math.Max(0, 1 - dipMix.mixTime / dipMix.mixDuration);
}
TrackEntry dipMix = timelineDipMix[i];
alpha = alphaDip * Math.Max(0, 1 - dipMix.mixTime / dipMix.mixDuration);
break;
}
from.totalAlpha += alpha;

View File

@ -1483,8 +1483,8 @@ declare module spine.webgl {
private shapes;
private shapesShader;
private activeRenderer;
private skeletonRenderer;
private skeletonDebugRenderer;
skeletonRenderer: SkeletonRenderer;
skeletonDebugRenderer: SkeletonDebugRenderer;
private QUAD;
private QUAD_TRIANGLES;
private WHITE;

View File

@ -1454,8 +1454,8 @@ declare module spine.webgl {
private shapes;
private shapesShader;
private activeRenderer;
private skeletonRenderer;
private skeletonDebugRenderer;
skeletonRenderer: SkeletonRenderer;
skeletonDebugRenderer: SkeletonDebugRenderer;
private QUAD;
private QUAD_TRIANGLES;
private WHITE;

View File

@ -1454,8 +1454,8 @@ declare module spine.webgl {
private shapes;
private shapesShader;
private activeRenderer;
private skeletonRenderer;
private skeletonDebugRenderer;
skeletonRenderer: SkeletonRenderer;
skeletonDebugRenderer: SkeletonDebugRenderer;
private QUAD;
private QUAD_TRIANGLES;
private WHITE;

View File

@ -39,8 +39,8 @@ module spine.webgl {
private shapes: ShapeRenderer;
private shapesShader: Shader;
private activeRenderer: PolygonBatcher | ShapeRenderer | SkeletonDebugRenderer = null;
private skeletonRenderer: SkeletonRenderer;
private skeletonDebugRenderer: SkeletonDebugRenderer;
skeletonRenderer: SkeletonRenderer;
skeletonDebugRenderer: SkeletonDebugRenderer;
private QUAD = [
0, 0, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0,

View File

@ -74,15 +74,16 @@ namespace Spine.Unity.Editor {
return;
}
var dataField = property.FindBaseOrSiblingProperty(TargetAttribute.dataField);
SerializedProperty dataField = property.FindBaseOrSiblingProperty(TargetAttribute.dataField);
if (dataField != null) {
if (dataField.objectReferenceValue is SkeletonDataAsset) {
skeletonDataAsset = (SkeletonDataAsset)dataField.objectReferenceValue;
} else if (dataField.objectReferenceValue is ISkeletonComponent) {
var skeletonComponent = (ISkeletonComponent)dataField.objectReferenceValue;
var objectReferenceValue = dataField.objectReferenceValue;
if (objectReferenceValue is SkeletonDataAsset) {
skeletonDataAsset = (SkeletonDataAsset)objectReferenceValue;
} else if (objectReferenceValue is ISkeletonComponent) {
var skeletonComponent = (ISkeletonComponent)objectReferenceValue;
if (skeletonComponent != null)
skeletonDataAsset = skeletonComponent.SkeletonDataAsset;
} else {
} else if (objectReferenceValue != null) {
EditorGUI.LabelField(position, "ERROR:", "Invalid reference type");
return;
}
@ -95,7 +96,12 @@ namespace Spine.Unity.Editor {
}
if (skeletonDataAsset == null) {
if (TargetAttribute.fallbackToTextField) {
EditorGUI.PropertyField(position, property); //EditorGUI.TextField(position, label, property.stringValue);
} else {
EditorGUI.LabelField(position, "ERROR:", "Must have reference to a SkeletonDataAsset");
}
skeletonDataAsset = property.serializedObject.targetObject as SkeletonDataAsset;
if (skeletonDataAsset == null) return;
}

View File

@ -345,7 +345,7 @@ VertexOutput vert(VertexInput input)
output.color = calculateVertexColor(input.color);
output.texcoord = float3(calculateTextureCoord(input.texcoord), 0);
float3 viewPos = UnityObjectViewPos(input.vertex); //float3 viewPos = mul(UNITY_MATRIX_MV, input.vertex);
float3 viewPos = UnityObjectToViewPos(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

View File

@ -10,127 +10,78 @@ Material:
m_Shader: {fileID: 4800000, guid: fa95b0fb6983c0f40a152e6f9aa82bfb, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: 3000
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 2
serializedVersion: 3
m_TexEnvs:
- first:
name: _BumpMap
second:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailAlbedoMap
second:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailMask
second:
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailNormalMap
second:
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _EmissionMap
second:
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MainTex
second:
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MetallicGlossMap
second:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _OcclusionMap
second:
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _ParallaxMap
second:
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- first:
name: _BumpScale
second: 1
- first:
name: _ColorMask
second: 15
- first:
name: _Cutoff
second: 0.5
- first:
name: _DetailNormalMapScale
second: 1
- first:
name: _DstBlend
second: 0
- first:
name: _Glossiness
second: 0.5
- first:
name: _Metallic
second: 0
- first:
name: _Mode
second: 0
- first:
name: _OcclusionStrength
second: 1
- first:
name: _Parallax
second: 0.02
- first:
name: _SrcBlend
second: 1
- first:
name: _Stencil
second: 0
- first:
name: _StencilComp
second: 8
- first:
name: _StencilOp
second: 0
- first:
name: _StencilReadMask
second: 255
- first:
name: _StencilWriteMask
second: 255
- first:
name: _UVSec
second: 0
- first:
name: _UseUIAlphaClip
second: 0
- first:
name: _ZWrite
second: 1
- PixelSnap: 0
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnableExternalAlpha: 0
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
- first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}

View File

@ -80,15 +80,17 @@ namespace Spine.Unity {
}
// Only provide visual feedback to inspector changes in Unity Editor Edit mode.
if (!Application.isPlaying) {
skeleton.flipX = this.initialFlipX;
skeleton.flipY = this.initialFlipY;
}
skeleton.SetToSetupPose();
if (!string.IsNullOrEmpty(startingAnimation))
skeleton.PoseWithAnimation(startingAnimation, 0f, false);
}
}
} else {
if (skeletonDataAsset != null)
Initialize(true);

View File

@ -76,8 +76,13 @@ namespace Spine.Unity {
if (!valid) return;
#if UNITY_EDITOR
if (Application.isPlaying)
if (Application.isPlaying) {
translator.Apply(skeleton);
} else {
var translatorAnimator = translator.Animator;
if (translatorAnimator != null && translatorAnimator.isInitialized)
translator.Apply(skeleton);
}
#else
translator.Apply(skeleton);
#endif

View File

@ -41,6 +41,7 @@ namespace Spine.Unity {
public string dataField = "";
public string startsWith = "";
public bool includeNone = true;
public bool fallbackToTextField = false;
}
public class SpineSlot : SpineAttributeBase {
@ -52,15 +53,17 @@ namespace Spine.Unity {
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name="containsBoundingBoxes">Disables popup results that don't contain bounding box attachments when true.</param>
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives).
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineSlot(string startsWith = "", string dataField = "", bool containsBoundingBoxes = false, bool includeNone = true) {
public SpineSlot (string startsWith = "", string dataField = "", bool containsBoundingBoxes = false, bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.containsBoundingBoxes = containsBoundingBoxes;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
@ -72,12 +75,14 @@ namespace Spine.Unity {
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives).
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent(SkeletonRenderer)() will be called as a fallback.
/// </param>
public SpineEvent(string startsWith = "", string dataField = "", bool includeNone = true) {
/// <param name="fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
public SpineEvent (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
@ -89,12 +94,14 @@ namespace Spine.Unity {
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives).
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent(SkeletonRenderer)() will be called as a fallback.
/// </param>
public SpineIkConstraint(string startsWith = "", string dataField = "", bool includeNone = true) {
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
public SpineIkConstraint (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
@ -106,12 +113,13 @@ namespace Spine.Unity {
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives).
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent(SkeletonRenderer)() will be called as a fallback.
/// </param>
public SpinePathConstraint(string startsWith = "", string dataField = "", bool includeNone = true) {
public SpinePathConstraint (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
@ -121,14 +129,16 @@ namespace Spine.Unity {
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives).
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineTransformConstraint(string startsWith = "", string dataField = "", bool includeNone = true) {
public SpineTransformConstraint (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
@ -138,14 +148,16 @@ namespace Spine.Unity {
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineSkin(string startsWith = "", string dataField = "", bool includeNone = true) {
public SpineSkin (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
public class SpineAnimation : SpineAttributeBase {
@ -153,15 +165,17 @@ namespace Spine.Unity {
/// Smart popup menu for Spine Animations
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineAnimation(string startsWith = "", string dataField = "", bool includeNone = true) {
public SpineAnimation (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
}
@ -181,11 +195,12 @@ namespace Spine.Unity {
/// <param name="slotField">If specified, a locally scoped field with the name supplied by in slotField will be used to limit the popup results to children of a named slot</param>
/// <param name="skinField">If specified, a locally scoped field with the name supplied by in skinField will be used to limit the popup results to entries of the named skin</param>
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineAttachment (bool currentSkinOnly = true, bool returnAttachmentPath = false, bool placeholdersOnly = false, string slotField = "", string dataField = "", string skinField = "", bool includeNone = true) {
public SpineAttachment (bool currentSkinOnly = true, bool returnAttachmentPath = false, bool placeholdersOnly = false, string slotField = "", string dataField = "", string skinField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.currentSkinOnly = currentSkinOnly;
this.returnAttachmentPath = returnAttachmentPath;
this.placeholdersOnly = placeholdersOnly;
@ -193,6 +208,7 @@ namespace Spine.Unity {
this.dataField = dataField;
this.skinField = skinField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
public static SpineAttachment.Hierarchy GetHierarchy (string fullPath) {
@ -241,15 +257,17 @@ namespace Spine.Unity {
/// Smart popup menu for Spine Bones
/// </summary>
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
/// /// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
/// <param name = "fallbackToTextField">If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error.</param>
/// <param name="dataField">If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results.
/// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives)
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent<SkeletonRenderer>() will be called as a fallback.
/// </param>
public SpineBone(string startsWith = "", string dataField = "", bool includeNone = true) {
public SpineBone (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
this.startsWith = startsWith;
this.dataField = dataField;
this.includeNone = includeNone;
this.fallbackToTextField = fallbackToTextField;
}
public static Spine.Bone GetBone(string boneName, SkeletonRenderer renderer) {