Esempio n. 1
0
    public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
    {
        float result;

        if (!TCP2ToggleNoKeywordDrawer.IsPropertyTypeSuitable(prop))
        {
            result = 40f;
        }
        else
        {
            result = base.GetPropertyHeight(prop, label, editor);
        }
        return(result);
    }
Esempio n. 2
0
 public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
 {
     if (!TCP2ToggleNoKeywordDrawer.IsPropertyTypeSuitable(prop))
     {
         EditorGUI.HelpBox(position, "Toggle used on a non-float property: " + prop.name, MessageType.Warning);
     }
     else
     {
         EditorGUI.BeginChangeCheck();
         bool flag = Mathf.Abs(prop.floatValue) > 0.001f;
         EditorGUI.showMixedValue = prop.hasMixedValue;
         flag = EditorGUI.Toggle(position, label, flag);
         EditorGUI.showMixedValue = false;
         if (EditorGUI.EndChangeCheck())
         {
             prop.floatValue = ((!flag) ? 0f : 1f);
         }
     }
 }