public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) { if (!MaterialKeywordEnumDrawer.IsPropertyTypeSuitable(prop)) { return(40f); } return(base.GetPropertyHeight(prop, label, editor)); }
public override void Apply(MaterialProperty prop) { base.Apply(prop); if (!MaterialKeywordEnumDrawer.IsPropertyTypeSuitable(prop) || prop.hasMixedValue) { return; } this.SetKeyword(prop, (int)prop.floatValue); }
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) { float result; if (!MaterialKeywordEnumDrawer.IsPropertyTypeSuitable(prop)) { result = 40f; } else { result = base.GetPropertyHeight(prop, label, editor); } return(result); }
public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { if (!MaterialKeywordEnumDrawer.IsPropertyTypeSuitable(prop)) { GUIContent label2 = EditorGUIUtility.TempContent("KeywordEnum used on a non-float property: " + prop.name, EditorGUIUtility.GetHelpIcon(MessageType.Warning)); EditorGUI.LabelField(position, label2, EditorStyles.helpBox); return; } EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = prop.hasMixedValue; int num = (int)prop.floatValue; num = EditorGUI.Popup(position, label, num, this.keywords); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { prop.floatValue = (float)num; this.SetKeyword(prop, num); } }
public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor) { if (!MaterialKeywordEnumDrawer.IsPropertyTypeSuitable(prop)) { GUIContent label1 = EditorGUIUtility.TempContent("KeywordEnum used on a non-float property: " + prop.name, (Texture)EditorGUIUtility.GetHelpIcon(MessageType.Warning)); EditorGUI.LabelField(position, label1, EditorStyles.helpBox); } else { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = prop.hasMixedValue; int floatValue = (int)prop.floatValue; int index = EditorGUI.Popup(position, label, floatValue, this.keywords); EditorGUI.showMixedValue = false; if (!EditorGUI.EndChangeCheck()) { return; } prop.floatValue = (float)index; this.SetKeyword(prop, index); } }