IsPropertyTypeSuitable() private static method

private static IsPropertyTypeSuitable ( MaterialProperty prop ) : bool
prop MaterialProperty
return bool
 public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
 {
     if (!MaterialToggleDrawer.IsPropertyTypeSuitable(prop))
     {
         return(40f);
     }
     return(base.GetPropertyHeight(prop, label, editor));
 }
 public override void Apply(MaterialProperty prop)
 {
     base.Apply(prop);
     if (!MaterialToggleDrawer.IsPropertyTypeSuitable(prop) || prop.hasMixedValue)
     {
         return;
     }
     this.SetKeyword(prop, (double)Math.Abs(prop.floatValue) > 1.0 / 1000.0);
 }
 public override void Apply(MaterialProperty prop)
 {
     base.Apply(prop);
     if (MaterialToggleDrawer.IsPropertyTypeSuitable(prop))
     {
         if (!prop.hasMixedValue)
         {
             this.SetKeyword(prop, Math.Abs(prop.floatValue) > 0.001f);
         }
     }
 }
        public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
        {
            float result;

            if (!MaterialToggleDrawer.IsPropertyTypeSuitable(prop))
            {
                result = 40f;
            }
            else
            {
                result = base.GetPropertyHeight(prop, label, editor);
            }
            return(result);
        }
Exemplo n.º 5
0
        public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
        {
            if (!MaterialToggleDrawer.IsPropertyTypeSuitable(prop))
            {
                GUIContent label2 = EditorGUIUtility.TempContent("Toggle used on a non-float property: " + prop.name, EditorGUIUtility.GetHelpIcon(MessageType.Warning));
                EditorGUI.LabelField(position, label2, EditorStyles.helpBox);
                return;
            }
            EditorGUI.BeginChangeCheck();
            bool flag = Math.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);
                this.SetKeyword(prop, flag);
            }
        }
 public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
 {
     if (!MaterialToggleDrawer.IsPropertyTypeSuitable(prop))
     {
         GUIContent label1 = EditorGUIUtility.TempContent("Toggle used on a non-float property: " + prop.name, (Texture)EditorGUIUtility.GetHelpIcon(MessageType.Warning));
         EditorGUI.LabelField(position, label1, EditorStyles.helpBox);
     }
     else
     {
         EditorGUI.BeginChangeCheck();
         bool flag = (double)Math.Abs(prop.floatValue) > 1.0 / 1000.0;
         EditorGUI.showMixedValue = prop.hasMixedValue;
         bool on = EditorGUI.Toggle(position, label, flag);
         EditorGUI.showMixedValue = false;
         if (!EditorGUI.EndChangeCheck())
         {
             return;
         }
         prop.floatValue = !on ? 0.0f : 1f;
         this.SetKeyword(prop, on);
     }
 }