mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[unity] Added warnings when Spine Preferences - Texture Atlas Settings PMA and blend mode materials PMA do not match. Added straight alpha blend modes material templates.
This commit is contained in:
parent
299ab8fff8
commit
6a3fb6a42a
@ -216,6 +216,24 @@ namespace Spine.Unity.Editor {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void ShowBlendModeMaterialProperty (SerializedProperty blendModeMaterialProperty,
|
||||
string blendType, bool isTexturePresetPMA) {
|
||||
|
||||
EditorGUILayout.PropertyField(blendModeMaterialProperty, new GUIContent(blendType + " Material", blendType + " blend mode Material template."));
|
||||
var material = blendModeMaterialProperty.objectReferenceValue as Material;
|
||||
if (material == null)
|
||||
return;
|
||||
|
||||
bool isMaterialPMA = MaterialChecks.IsPMATextureMaterial(material);
|
||||
if (!isTexturePresetPMA && isMaterialPMA) {
|
||||
EditorGUILayout.HelpBox(string.Format("'{0} Material' uses PMA but 'Atlas Texture Settings' uses Straight Alpha. " +
|
||||
"You might want to assign 'SkeletonStraight{0}' instead.", blendType), MessageType.Warning);
|
||||
} else if (isTexturePresetPMA && !isMaterialPMA) {
|
||||
EditorGUILayout.HelpBox(string.Format("'{0} Material' uses Straight Alpha but 'Atlas Texture Settings' uses PMA. " +
|
||||
"You might want to assign 'SkeletonPMA{0}' instead.", blendType), MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
public static void HandlePreferencesGUI (SerializedObject settings) {
|
||||
|
||||
float prevLabelWidth = EditorGUIUtility.labelWidth;
|
||||
@ -254,9 +272,13 @@ namespace Spine.Unity.Editor {
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(settings.FindProperty("blendModeMaterialAdditive"), new GUIContent("Additive Material", "Additive blend mode Material template."));
|
||||
EditorGUILayout.PropertyField(settings.FindProperty("blendModeMaterialMultiply"), new GUIContent("Multiply Material", "Multiply blend mode Material template."));
|
||||
EditorGUILayout.PropertyField(settings.FindProperty("blendModeMaterialScreen"), new GUIContent("Screen Material", "Screen blend mode Material template."));
|
||||
SerializedProperty blendModeMaterialAdditive = settings.FindProperty("blendModeMaterialAdditive");
|
||||
SerializedProperty blendModeMaterialMultiply = settings.FindProperty("blendModeMaterialMultiply");
|
||||
SerializedProperty blendModeMaterialScreen = settings.FindProperty("blendModeMaterialScreen");
|
||||
bool isTexturePresetPMA = IsPMAWorkflow(textureSettingsRef.stringValue);
|
||||
ShowBlendModeMaterialProperty(blendModeMaterialAdditive, "Additive", isTexturePresetPMA);
|
||||
ShowBlendModeMaterialProperty(blendModeMaterialMultiply, "Multiply", isTexturePresetPMA);
|
||||
ShowBlendModeMaterialProperty(blendModeMaterialScreen, "Screen", isTexturePresetPMA);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: SkeletonPMAAdditive
|
||||
m_Shader: {fileID: 4800000, guid: 53efa1d97f5d9f74285d4330cda14e36, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- <noninit>:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- <noninit>: 0
|
||||
- _Cutoff: 0.1
|
||||
- _StraightAlphaInput: 0
|
||||
m_Colors:
|
||||
- <noninit>: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007110106}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 517c2df5a5dc5d44a8b3820eca503d13
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,43 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: SkeletonPMAMultiply
|
||||
m_Shader: {fileID: 4800000, guid: 8bdcdc7ee298e594a9c20c61d25c33b6, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: <noninit>
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: <noninit>
|
||||
second: 0
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: <noninit>
|
||||
second: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007110106}
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 053fed1e18e65064ca564f05c4027e1e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,43 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: SkeletonPMAScreen
|
||||
m_Shader: {fileID: 4800000, guid: 4e8caa36c07aacf4ab270da00784e4d9, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: <noninit>
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: <noninit>
|
||||
second: 0
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: <noninit>
|
||||
second: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007121922}
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a66c2d7ee7642a459bd3831abeb30af
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user