static protected void DrawPerTexVector2NoToggle(int curIdx, int pixel, string keyword, MicroSplatKeywords keywords, MicroSplatPropData propData, V2Cannel channel, GUIContent label) { drawPertexToggle = false; DrawPerTexVector2(curIdx, pixel, keyword, keywords, propData, channel, label); }
static protected bool DrawPerTexVector2(int curIdx, int pixel, string keyword, MicroSplatKeywords keywords, MicroSplatPropData propData, V2Cannel channel, GUIContent label) { EditorGUILayout.BeginHorizontal(); bool enabled = PerTexToggle(keywords, keyword); GUI.enabled = enabled; Color c = propData.GetValue(curIdx, pixel); Vector2 v2 = new Vector2(c.r, c.g); if (channel == V2Cannel.BA) { v2.x = c.b; v2.y = c.a; } Vector2 nv = v2; nv = EditorGUILayout.Vector2Field(label, v2); if (nv != v2) { if (channel == V2Cannel.RG) { c.r = nv.x; c.g = nv.y; } else { c.b = nv.x; c.a = nv.y; } propData.SetValue(curIdx, pixel, c); } if (GUILayout.Button("All", GUILayout.Width(40))) { for (int i = 0; i < 32; ++i) { // don't erase other pixels.. var fv = propData.GetValue(i, pixel); if (channel == V2Cannel.RG) { c.r = nv.x; c.g = nv.y; } else { c.b = nv.x; c.a = nv.y; } propData.SetValue(i, pixel, fv); } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); return(enabled); }