Merge remote-tracking branch 'origin/master'

This commit is contained in:
NathanSweet 2016-08-09 01:37:47 +02:00
commit d27e1cd845

View File

@ -35,7 +35,6 @@
* Full irrevocable rights and permissions granted to Esoteric Software
*****************************************************************************/
#define SPINE_SKELETONANIMATOR
#define SPINE_HIERARCHY_ICONS
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
@ -177,6 +176,10 @@ namespace Spine.Unity.Editor {
const string DEFAULT_SHADER_KEY = "SPINE_DEFAULT_SHADER";
public static string defaultShader = DEFAULT_DEFAULT_SHADER;
const bool DEFAULT_SHOW_HIERARCHY_ICONS = true;
const string SHOW_HIERARCHY_ICONS_KEY = "SPINE_SHOW_HIERARCHY_ICONS";
public static bool showHierarchyIcons = DEFAULT_SHOW_HIERARCHY_ICONS;
#region Initialization
static SpineEditorUtilities () {
Initialize();
@ -187,6 +190,7 @@ namespace Spine.Unity.Editor {
defaultMix = EditorPrefs.GetFloat(DEFAULT_MIX_KEY, DEFAULT_DEFAULT_MIX);
defaultScale = EditorPrefs.GetFloat(DEFAULT_SCALE_KEY, DEFAULT_DEFAULT_SCALE);
defaultShader = EditorPrefs.GetString(DEFAULT_SHADER_KEY, DEFAULT_DEFAULT_SHADER);
showHierarchyIcons = EditorPrefs.GetBool(SHOW_HIERARCHY_ICONS_KEY, DEFAULT_SHOW_HIERARCHY_ICONS);
}
SceneView.onSceneGUIDelegate -= OnSceneGUI;
@ -231,8 +235,20 @@ namespace Spine.Unity.Editor {
defaultMix = EditorPrefs.GetFloat(DEFAULT_MIX_KEY, DEFAULT_DEFAULT_MIX);
defaultScale = EditorPrefs.GetFloat(DEFAULT_SCALE_KEY, DEFAULT_DEFAULT_SCALE);
defaultShader = EditorPrefs.GetString(DEFAULT_SHADER_KEY, DEFAULT_DEFAULT_SHADER);
showHierarchyIcons = EditorPrefs.GetBool(SHOW_HIERARCHY_ICONS_KEY, DEFAULT_SHOW_HIERARCHY_ICONS);
}
EditorGUI.BeginChangeCheck();
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);
HierarchyWindowChanged();
}
EditorGUILayout.Separator();
EditorGUILayout.LabelField("Auto-Import Settings", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
@ -246,7 +262,7 @@ namespace Spine.Unity.Editor {
EditorPrefs.SetFloat(DEFAULT_SCALE_KEY, defaultScale);
EditorGUI.BeginChangeCheck();
defaultShader = EditorGUILayout.DelayedTextField("Default shader for auto-generated materials", defaultShader);
defaultShader = EditorGUILayout.DelayedTextField(new GUIContent("Default shader", "Default shader for materials auto-generated on import."), defaultShader);
if (EditorGUI.EndChangeCheck())
EditorPrefs.SetString(DEFAULT_SHADER_KEY, defaultShader);
@ -399,8 +415,8 @@ namespace Spine.Unity.Editor {
#endregion
#region Hierarchy Icons
#if SPINE_HIERARCHY_ICONS
static void HierarchyWindowChanged () {
if (showHierarchyIcons) {
skeletonRendererTable.Clear();
skeletonUtilityBoneTable.Clear();
boundingBoxFollowerTable.Clear();
@ -417,15 +433,17 @@ namespace Spine.Unity.Editor {
foreach (BoundingBoxFollower bbf in bbfArr)
boundingBoxFollowerTable.Add(bbf.gameObject.GetInstanceID(), bbf);
}
}
static void HierarchyWindowItemOnGUI (int instanceId, Rect selectionRect) {
if (skeletonRendererTable.ContainsKey(instanceId)) {
if (showHierarchyIcons) {
Rect r = new Rect(selectionRect);
if (skeletonRendererTable.ContainsKey(instanceId)) {
r.x = r.width - 15;
r.width = 15;
GUI.Label(r, Icons.spine);
} else if (skeletonUtilityBoneTable.ContainsKey(instanceId)) {
Rect r = new Rect(selectionRect);
r.x -= 26;
if (skeletonUtilityBoneTable[instanceId] != null) {
if (skeletonUtilityBoneTable[instanceId].transform.childCount == 0)
@ -439,7 +457,6 @@ namespace Spine.Unity.Editor {
GUI.DrawTexture(r, Icons.poseBones);
}
} else if (boundingBoxFollowerTable.ContainsKey(instanceId)) {
Rect r = new Rect(selectionRect);
r.x -= 26;
if (boundingBoxFollowerTable[instanceId] != null) {
if (boundingBoxFollowerTable[instanceId].transform.childCount == 0)
@ -450,8 +467,9 @@ namespace Spine.Unity.Editor {
GUI.DrawTexture(r, Icons.boundingBox);
}
}
}
}
#endif
#endregion
#region Auto-Import Entry Point