mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Fix SkeletonRendererInspector narrow labels. Added PMA Vertex Colors field.
This commit is contained in:
parent
c9ffdc7eae
commit
3af5290e23
@ -38,7 +38,7 @@ namespace Spine.Unity.Editor {
|
|||||||
[CustomEditor(typeof(SkeletonRenderer))]
|
[CustomEditor(typeof(SkeletonRenderer))]
|
||||||
public class SkeletonRendererInspector : UnityEditor.Editor {
|
public class SkeletonRendererInspector : UnityEditor.Editor {
|
||||||
protected static bool advancedFoldout;
|
protected static bool advancedFoldout;
|
||||||
protected SerializedProperty skeletonDataAsset, initialSkinName, normals, tangents, meshes, immutableTriangles, separatorSlotNames, frontFacing, zSpacing;
|
protected SerializedProperty skeletonDataAsset, initialSkinName, normals, tangents, meshes, immutableTriangles, separatorSlotNames, frontFacing, zSpacing, pmaVertexColors;
|
||||||
protected SpineInspectorUtility.SerializedSortingProperties sortingProperties;
|
protected SpineInspectorUtility.SerializedSortingProperties sortingProperties;
|
||||||
protected bool isInspectingPrefab;
|
protected bool isInspectingPrefab;
|
||||||
protected MeshFilter meshFilter;
|
protected MeshFilter meshFilter;
|
||||||
@ -53,6 +53,7 @@ namespace Spine.Unity.Editor {
|
|||||||
tangents = serializedObject.FindProperty("calculateTangents");
|
tangents = serializedObject.FindProperty("calculateTangents");
|
||||||
meshes = serializedObject.FindProperty("renderMeshes");
|
meshes = serializedObject.FindProperty("renderMeshes");
|
||||||
immutableTriangles = serializedObject.FindProperty("immutableTriangles");
|
immutableTriangles = serializedObject.FindProperty("immutableTriangles");
|
||||||
|
pmaVertexColors = serializedObject.FindProperty("pmaVertexColors");
|
||||||
separatorSlotNames = serializedObject.FindProperty("separatorSlotNames");
|
separatorSlotNames = serializedObject.FindProperty("separatorSlotNames");
|
||||||
separatorSlotNames.isExpanded = true;
|
separatorSlotNames.isExpanded = true;
|
||||||
|
|
||||||
@ -145,20 +146,27 @@ namespace Spine.Unity.Editor {
|
|||||||
if (advancedFoldout) {
|
if (advancedFoldout) {
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
SeparatorsField(separatorSlotNames);
|
SeparatorsField(separatorSlotNames);
|
||||||
EditorGUILayout.PropertyField(meshes,
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
|
// Optimization options
|
||||||
|
SpineInspectorUtility.PropertyFieldWideLabel(meshes,
|
||||||
new GUIContent("Render MeshAttachments", "Disable to optimize rendering for skeletons that don't use Mesh Attachments"));
|
new GUIContent("Render MeshAttachments", "Disable to optimize rendering for skeletons that don't use Mesh Attachments"));
|
||||||
EditorGUILayout.PropertyField(immutableTriangles,
|
SpineInspectorUtility.PropertyFieldWideLabel(immutableTriangles,
|
||||||
new GUIContent("Immutable Triangles", "Enable to optimize rendering for skeletons that never change attachment visbility"));
|
new GUIContent("Immutable Triangles", "Enable to optimize rendering for skeletons that never change attachment visbility"));
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
|
// Render options
|
||||||
const float MinZSpacing = -0.1f;
|
const float MinZSpacing = -0.1f;
|
||||||
const float MaxZSpacing = 0f;
|
const float MaxZSpacing = 0f;
|
||||||
EditorGUILayout.Slider(zSpacing, MinZSpacing, MaxZSpacing);
|
EditorGUILayout.Slider(zSpacing, MinZSpacing, MaxZSpacing);
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
SpineInspectorUtility.PropertyFieldWideLabel(pmaVertexColors,
|
||||||
|
new GUIContent("PMA Vertex Colors", "Use this if you are using the default Spine/Skeleton shader or any premultiply-alpha shader."));
|
||||||
|
|
||||||
// Optional fields. May be disabled in SkeletonRenderer.
|
// Optional fields. May be disabled in SkeletonRenderer.
|
||||||
if (normals != null) EditorGUILayout.PropertyField(normals, new GUIContent("Add Normals"));
|
if (normals != null) SpineInspectorUtility.PropertyFieldWideLabel(normals, new GUIContent("Add Normals"));
|
||||||
if (tangents != null) EditorGUILayout.PropertyField(tangents, new GUIContent("Solve Tangents"));
|
if (tangents != null) SpineInspectorUtility.PropertyFieldWideLabel(tangents, new GUIContent("Solve Tangents"));
|
||||||
if (frontFacing != null) EditorGUILayout.PropertyField(frontFacing);
|
if (frontFacing != null) SpineInspectorUtility.PropertyFieldWideLabel(frontFacing);
|
||||||
|
|
||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,14 @@ namespace Spine.Unity.Editor {
|
|||||||
return n == 1 ? "" : "s";
|
return n == 1 ? "" : "s";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void PropertyFieldWideLabel (SerializedProperty property, GUIContent label = null, float minimumLabelWidth = 150) {
|
||||||
|
using (new EditorGUILayout.HorizontalScope()) {
|
||||||
|
GUILayout.Label(label ?? new GUIContent(property.name, property.tooltip), GUILayout.MinWidth(minimumLabelWidth));
|
||||||
|
//GUILayout.FlexibleSpace();
|
||||||
|
EditorGUILayout.PropertyField(property, GUIContent.none, true, GUILayout.MinWidth(100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Sorting Layer Field Helpers
|
#region Sorting Layer Field Helpers
|
||||||
static readonly GUIContent SortingLayerLabel = new GUIContent("Sorting Layer");
|
static readonly GUIContent SortingLayerLabel = new GUIContent("Sorting Layer");
|
||||||
static readonly GUIContent OrderInLayerLabel = new GUIContent("Order in Layer");
|
static readonly GUIContent OrderInLayerLabel = new GUIContent("Order in Layer");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user