14 public static readonly GUILayoutOption[] GUILayoutEmptyArray =
new GUILayoutOption[0];
16 public static int IndentAmount = 1;
21 return EditorGUILayout.GetControlRect(
true, 18f, EditorStyles.layerMaskField, GUILayoutEmptyArray);
27 thumbRect = EditorGUI.IndentedRect(position);
29 thumbRect.height = 18f;
30 thumbRect.width = 32f;
31 float num = thumbRect.x + 30f;
32 labelRect =
new Rect(num, position.y, thumbRect.x + EditorGUIUtility.labelWidth - num, position.height);
35 public static void BeginHeaderProperty(MaterialEditor matEditor,
string headerText, MaterialProperty prop)
37 matEditor.ShaderProperty(prop, GUIContent.none);
38 var rect = GUILayoutUtility.GetLastRect();
39 EditorGUI.indentLevel += IndentAmount;
40 EditorGUI.LabelField(rect, headerText, EditorStyles.boldLabel);
45 EditorGUILayout.LabelField(headerText, EditorStyles.boldLabel);
46 EditorGUI.indentLevel += IndentAmount;
51 EditorGUI.indentLevel -= IndentAmount;
56 EditorGUILayout.Separator();
57 EditorGUILayout.Separator();
60 public static void SetKeyword(Material mat,
string keyword,
bool state)
64 mat.EnableKeyword(keyword);
68 mat.DisableKeyword(keyword);
72 public static bool TryGetToggle(Material material,
string property,
bool defaultVal)
74 if (material.HasProperty(property))
76 return material.GetFloat(property) == 1.0f;