Merge branch '3.7-beta' into 3.7-beta-cpp

This commit is contained in:
badlogic 2018-11-28 16:27:44 +01:00
commit 6cf1d1fb30
10 changed files with 134 additions and 9 deletions

View File

@ -70,8 +70,8 @@ static void trim(Str* str) {
(str->begin)++;
if (str->begin == str->end) return;
str->end--;
while (isspace((unsigned char)*str->end) && str->end >= str->begin)
str->end--;
/*while (isspace((unsigned char)*str->end) && str->end >= str->begin)
str->end--;*/
str->end++;
}

View File

@ -249,9 +249,9 @@ void Atlas::trim(Str *str) {
str->end--;
while (isspace((unsigned char) *str->end) && str->end >= str->begin) {
/*while (isspace((unsigned char) *str->end) && str->end >= str->begin) {
str->end--;
}
}*/
str->end++;
}

View File

@ -633,10 +633,10 @@ namespace Spine {
slot.a = slotData.a;
return;
case MixBlend.First:
slot.r += (slot.r - slotData.r) * alpha;
slot.g += (slot.g - slotData.g) * alpha;
slot.b += (slot.b - slotData.b) * alpha;
slot.a += (slot.a - slotData.a) * alpha;
slot.r += (slotData.r - slot.r) * alpha;
slot.g += (slotData.g - slot.g) * alpha;
slot.b += (slotData.b - slot.b) * alpha;
slot.a += (slotData.a - slot.a) * alpha;
return;
}
return;

View File

@ -0,0 +1,29 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../../build/spine-widget.js"></script>
<link rel="stylesheet" href="../css/spine-player.css">
</head>
<style>
html, body {
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
}
</style>
<body>
<div id="player"></div>
</body>
<script>
window.addEventListener("message", function (event) {
new spine.SpinePlayer(document.getElementById("player"), event.data);
}, false);
</script>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<style>
iframe {
border: none;
}
</style>
<body>
<!--<iframe id="player" src="http://esotericsoftware.com/spine-player/3.7/iframe.html" width="600" height="480"></iframe>-->
<iframe id="player" src="http://localhost:8000/widget/example/iframe-local.html" width="600" height="480"></iframe>
</body>
<script>
var player = document.getElementById("player");
var playerConfig = {
atlasUrl: "http://esotericsoftware.com/files/examples/spineboy/export/spineboy-pma.atlas",
jsonUrl: "http://esotericsoftware.com/files/examples/spineboy/export/spineboy-pro.json",
premultipliedAlpha: true
};
player.addEventListener("load", function () {
player.contentWindow.postMessage(playerConfig, "*");
});
</script>
</html>

View File

@ -0,0 +1,29 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="./spine-widget.js"></script>
<link rel="stylesheet" href="./spine-player.css">
</head>
<style>
html, body {
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
}
</style>
<body>
<div id="player"></div>
</body>
<script>
window.addEventListener("message", function (event) {
new spine.SpinePlayer(document.getElementById("player"), event.data);
}, false);
</script>
</body>
</html>

View File

@ -30,6 +30,12 @@
// With contributions from: Mitch Thompson
#if UNITY_2018_3 || UNITY_2019
#define NEW_PREFAB_SYSTEM
#else
#define NO_PREFAB_MESH
#endif
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@ -122,7 +128,11 @@ namespace Spine.Unity.Editor {
skeletonRenderer.Initialize(false);
skeletonRenderer.LateUpdate();
skeleton = skeletonRenderer.skeleton;
#if NEW_PREFAB_SYSTEM
isPrefab = false;
#else
isPrefab |= PrefabUtility.GetPrefabType(selectedObject) == PrefabType.Prefab;
#endif
UpdateAttachments();
}
}

View File

@ -28,7 +28,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_2018_3 || UNITY_2019
#define NEW_PREFAB_SYSTEM
#else
#define NO_PREFAB_MESH
#endif
using UnityEditor;
using System.Collections.Generic;
@ -81,7 +85,11 @@ namespace Spine.Unity.Editor {
}
protected virtual void OnEnable () {
#if NEW_PREFAB_SYSTEM
isInspectingPrefab = false;
#else
isInspectingPrefab = (PrefabUtility.GetPrefabType(target) == PrefabType.Prefab);
#endif
SpineEditorUtilities.ConfirmInitialization();

View File

@ -28,6 +28,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_2018_3 || UNITY_2019
#define NEW_PREFAB_SYSTEM
#endif
using UnityEngine;
using UnityEditor;
@ -61,7 +65,11 @@ namespace Spine.Unity.Editor {
}
public override void OnInspectorGUI () {
#if !NEW_PREFAB_SYSTEM
bool isInspectingPrefab = (PrefabUtility.GetPrefabType(target) == PrefabType.Prefab);
#else
bool isInspectingPrefab = false;
#endif
// Try to auto-assign SkeletonRenderer field.
if (skeletonRenderer.objectReferenceValue == null) {
@ -94,8 +102,10 @@ namespace Spine.Unity.Editor {
EditorGUILayout.PropertyField(slotName, new GUIContent("Slot"));
if (EditorGUI.EndChangeCheck()) {
serializedObject.ApplyModifiedProperties();
#if !NEW_PREFAB_SYSTEM
if (!isInspectingPrefab)
rebuildRequired = true;
#endif
}
using (new SpineInspectorUtility.LabelWidthScope(150f)) {

View File

@ -28,7 +28,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
// Contributed by: Mitch Thompson
#if UNITY_2018_3 || UNITY_2019
#define NEW_PREFAB_SYSTEM
#endif
using UnityEngine;
using UnityEditor;
@ -46,7 +48,11 @@ namespace Spine.Unity.Editor {
SkeletonUtility skeletonUtility;
Skeleton skeleton;
SkeletonRenderer skeletonRenderer;
#if !NEW_PREFAB_SYSTEM
bool isPrefab;
#endif
readonly GUIContent SpawnHierarchyButtonLabel = new GUIContent("Spawn Hierarchy", Icons.skeleton);
void OnEnable () {
@ -62,14 +68,18 @@ namespace Spine.Unity.Editor {
if (!skeletonRenderer.valid) return;
#if !NEW_PREFAB_SYSTEM
isPrefab |= PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab;
#endif
}
public override void OnInspectorGUI () {
#if !NEW_PREFAB_SYSTEM
if (isPrefab) {
GUILayout.Label(new GUIContent("Cannot edit Prefabs", Icons.warning));
return;
}
#endif
if (!skeletonRenderer.valid) {
GUILayout.Label(new GUIContent("Spine Component invalid. Check Skeleton Data Asset.", Icons.warning));