mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-26 19:51:47 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d27e1cd845
@ -35,7 +35,6 @@
|
|||||||
* Full irrevocable rights and permissions granted to Esoteric Software
|
* Full irrevocable rights and permissions granted to Esoteric Software
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#define SPINE_SKELETONANIMATOR
|
#define SPINE_SKELETONANIMATOR
|
||||||
#define SPINE_HIERARCHY_ICONS
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -177,6 +176,10 @@ namespace Spine.Unity.Editor {
|
|||||||
const string DEFAULT_SHADER_KEY = "SPINE_DEFAULT_SHADER";
|
const string DEFAULT_SHADER_KEY = "SPINE_DEFAULT_SHADER";
|
||||||
public static string defaultShader = DEFAULT_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
|
#region Initialization
|
||||||
static SpineEditorUtilities () {
|
static SpineEditorUtilities () {
|
||||||
Initialize();
|
Initialize();
|
||||||
@ -187,6 +190,7 @@ namespace Spine.Unity.Editor {
|
|||||||
defaultMix = EditorPrefs.GetFloat(DEFAULT_MIX_KEY, DEFAULT_DEFAULT_MIX);
|
defaultMix = EditorPrefs.GetFloat(DEFAULT_MIX_KEY, DEFAULT_DEFAULT_MIX);
|
||||||
defaultScale = EditorPrefs.GetFloat(DEFAULT_SCALE_KEY, DEFAULT_DEFAULT_SCALE);
|
defaultScale = EditorPrefs.GetFloat(DEFAULT_SCALE_KEY, DEFAULT_DEFAULT_SCALE);
|
||||||
defaultShader = EditorPrefs.GetString(DEFAULT_SHADER_KEY, DEFAULT_DEFAULT_SHADER);
|
defaultShader = EditorPrefs.GetString(DEFAULT_SHADER_KEY, DEFAULT_DEFAULT_SHADER);
|
||||||
|
showHierarchyIcons = EditorPrefs.GetBool(SHOW_HIERARCHY_ICONS_KEY, DEFAULT_SHOW_HIERARCHY_ICONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneView.onSceneGUIDelegate -= OnSceneGUI;
|
SceneView.onSceneGUIDelegate -= OnSceneGUI;
|
||||||
@ -231,8 +235,20 @@ namespace Spine.Unity.Editor {
|
|||||||
defaultMix = EditorPrefs.GetFloat(DEFAULT_MIX_KEY, DEFAULT_DEFAULT_MIX);
|
defaultMix = EditorPrefs.GetFloat(DEFAULT_MIX_KEY, DEFAULT_DEFAULT_MIX);
|
||||||
defaultScale = EditorPrefs.GetFloat(DEFAULT_SCALE_KEY, DEFAULT_DEFAULT_SCALE);
|
defaultScale = EditorPrefs.GetFloat(DEFAULT_SCALE_KEY, DEFAULT_DEFAULT_SCALE);
|
||||||
defaultShader = EditorPrefs.GetString(DEFAULT_SHADER_KEY, DEFAULT_DEFAULT_SHADER);
|
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);
|
EditorGUILayout.LabelField("Auto-Import Settings", EditorStyles.boldLabel);
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
@ -246,7 +262,7 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorPrefs.SetFloat(DEFAULT_SCALE_KEY, defaultScale);
|
EditorPrefs.SetFloat(DEFAULT_SCALE_KEY, defaultScale);
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
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())
|
if (EditorGUI.EndChangeCheck())
|
||||||
EditorPrefs.SetString(DEFAULT_SHADER_KEY, defaultShader);
|
EditorPrefs.SetString(DEFAULT_SHADER_KEY, defaultShader);
|
||||||
|
|
||||||
@ -399,59 +415,61 @@ namespace Spine.Unity.Editor {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Hierarchy Icons
|
#region Hierarchy Icons
|
||||||
#if SPINE_HIERARCHY_ICONS
|
|
||||||
static void HierarchyWindowChanged () {
|
static void HierarchyWindowChanged () {
|
||||||
skeletonRendererTable.Clear();
|
if (showHierarchyIcons) {
|
||||||
skeletonUtilityBoneTable.Clear();
|
skeletonRendererTable.Clear();
|
||||||
boundingBoxFollowerTable.Clear();
|
skeletonUtilityBoneTable.Clear();
|
||||||
|
boundingBoxFollowerTable.Clear();
|
||||||
|
|
||||||
SkeletonRenderer[] arr = Object.FindObjectsOfType<SkeletonRenderer>();
|
SkeletonRenderer[] arr = Object.FindObjectsOfType<SkeletonRenderer>();
|
||||||
foreach (SkeletonRenderer r in arr)
|
foreach (SkeletonRenderer r in arr)
|
||||||
skeletonRendererTable.Add(r.gameObject.GetInstanceID(), r.gameObject);
|
skeletonRendererTable.Add(r.gameObject.GetInstanceID(), r.gameObject);
|
||||||
|
|
||||||
SkeletonUtilityBone[] boneArr = Object.FindObjectsOfType<SkeletonUtilityBone>();
|
SkeletonUtilityBone[] boneArr = Object.FindObjectsOfType<SkeletonUtilityBone>();
|
||||||
foreach (SkeletonUtilityBone b in boneArr)
|
foreach (SkeletonUtilityBone b in boneArr)
|
||||||
skeletonUtilityBoneTable.Add(b.gameObject.GetInstanceID(), b);
|
skeletonUtilityBoneTable.Add(b.gameObject.GetInstanceID(), b);
|
||||||
|
|
||||||
BoundingBoxFollower[] bbfArr = Object.FindObjectsOfType<BoundingBoxFollower>();
|
BoundingBoxFollower[] bbfArr = Object.FindObjectsOfType<BoundingBoxFollower>();
|
||||||
foreach (BoundingBoxFollower bbf in bbfArr)
|
foreach (BoundingBoxFollower bbf in bbfArr)
|
||||||
boundingBoxFollowerTable.Add(bbf.gameObject.GetInstanceID(), bbf);
|
boundingBoxFollowerTable.Add(bbf.gameObject.GetInstanceID(), bbf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HierarchyWindowItemOnGUI (int instanceId, Rect selectionRect) {
|
static void HierarchyWindowItemOnGUI (int instanceId, Rect selectionRect) {
|
||||||
if (skeletonRendererTable.ContainsKey(instanceId)) {
|
if (showHierarchyIcons) {
|
||||||
|
|
||||||
Rect r = new Rect(selectionRect);
|
Rect r = new Rect(selectionRect);
|
||||||
r.x = r.width - 15;
|
if (skeletonRendererTable.ContainsKey(instanceId)) {
|
||||||
r.width = 15;
|
r.x = r.width - 15;
|
||||||
GUI.Label(r, Icons.spine);
|
r.width = 15;
|
||||||
} else if (skeletonUtilityBoneTable.ContainsKey(instanceId)) {
|
GUI.Label(r, Icons.spine);
|
||||||
Rect r = new Rect(selectionRect);
|
} else if (skeletonUtilityBoneTable.ContainsKey(instanceId)) {
|
||||||
r.x -= 26;
|
r.x -= 26;
|
||||||
if (skeletonUtilityBoneTable[instanceId] != null) {
|
if (skeletonUtilityBoneTable[instanceId] != null) {
|
||||||
if (skeletonUtilityBoneTable[instanceId].transform.childCount == 0)
|
if (skeletonUtilityBoneTable[instanceId].transform.childCount == 0)
|
||||||
r.x += 13;
|
r.x += 13;
|
||||||
r.y += 2;
|
r.y += 2;
|
||||||
r.width = 13;
|
r.width = 13;
|
||||||
r.height = 13;
|
r.height = 13;
|
||||||
if (skeletonUtilityBoneTable[instanceId].mode == SkeletonUtilityBone.Mode.Follow)
|
if (skeletonUtilityBoneTable[instanceId].mode == SkeletonUtilityBone.Mode.Follow)
|
||||||
GUI.DrawTexture(r, Icons.bone);
|
GUI.DrawTexture(r, Icons.bone);
|
||||||
else
|
else
|
||||||
GUI.DrawTexture(r, Icons.poseBones);
|
GUI.DrawTexture(r, Icons.poseBones);
|
||||||
}
|
}
|
||||||
} else if (boundingBoxFollowerTable.ContainsKey(instanceId)) {
|
} else if (boundingBoxFollowerTable.ContainsKey(instanceId)) {
|
||||||
Rect r = new Rect(selectionRect);
|
r.x -= 26;
|
||||||
r.x -= 26;
|
if (boundingBoxFollowerTable[instanceId] != null) {
|
||||||
if (boundingBoxFollowerTable[instanceId] != null) {
|
if (boundingBoxFollowerTable[instanceId].transform.childCount == 0)
|
||||||
if (boundingBoxFollowerTable[instanceId].transform.childCount == 0)
|
r.x += 13;
|
||||||
r.x += 13;
|
r.y += 2;
|
||||||
r.y += 2;
|
r.width = 13;
|
||||||
r.width = 13;
|
r.height = 13;
|
||||||
r.height = 13;
|
GUI.DrawTexture(r, Icons.boundingBox);
|
||||||
GUI.DrawTexture(r, Icons.boundingBox);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Auto-Import Entry Point
|
#region Auto-Import Entry Point
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user