private void DrawSelectedUI(MaterialColorType key) { EditorGUILayout.BeginVertical(); int index = 0; int counter = 0; EditorGUILayout.BeginHorizontal(); if (key != MaterialColorType.None) { foreach (Color32 col in MaterialColor.Colors[key]) { counter += 1; index += 1; DrawColorButton(key, index, col); if (counter == 5) { counter = 0; EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } } } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }
public static string GetProperty(MaterialColorType bindType) { switch (bindType) { // case MaterialBindType.UvOffset: // case MaterialBindType.UvScale: // return UV_PROPERTY; case MaterialColorType.color: return(COLOR_PROPERTY); case MaterialColorType.emissionColor: return(EMISSION_COLOR_PROPERTY); case MaterialColorType.shadeColor: return(SHADE_COLOR_PROPERTY); case MaterialColorType.rimColor: return(RIM_COLOR_PROPERTY); case MaterialColorType.outlineColor: return(OUTLINE_COLOR_PROPERTY); } throw new NotImplementedException(); }
private void DrawColorButton(MaterialColorType key) { Dictionary <MaterialColorType, List <Color32> > colors = MaterialColor.Colors; if (colors == null) { Debug.LogError("Colors is null"); return; } Color32 color = colors[key][m_ColorSteps]; if (GUILayout.Button("", GetBtnStyle(color), GUILayout.ExpandHeight(true))) { if (Event.current.button == 1) { m_Filter = key; } else { string title = "Copied " + key + "\n Variant " + m_ColorSteps; Copy(color, title); } } ; }
private void DrawBackButton() { if (GUILayout.Button("", GetBtnStyle(Color.black), GUILayout.ExpandHeight(true))) { m_Filter = MaterialColorType.None; } ; }
/// <summary> /// material color tween /// </summary> public TweenConfig materialColor(Color endValue, MaterialColorType colorType = MaterialColorType.Color, bool isRelative = false) { var prop = new MaterialColorTweenProperty(endValue, colorType, isRelative); _tweenProperties.Add(prop); return(this); }
private void DrawColorButton(MaterialColorType key, int variant, Color32 color) { if (GUILayout.Button("", GetBtnStyle(color), GUILayout.ExpandHeight(true))) { string title = "Copied " + key + "\n Variant " + variant; Copy(color, title); } ; }
private void OnGUI() { bool isDefault = m_Filter == MaterialColorType.None; if (isDefault) { EditorGUILayout.BeginHorizontal(); m_ColorSteps = EditorGUILayout.IntSlider("", m_ColorSteps, 0, 9); if (GUILayout.Button("Reset", GUILayout.Width(90f))) { m_ColorSteps = 5; } ; EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(m_Filter.ToString(), EditorStyles.boldLabel, GUILayout.ExpandWidth(true)); if (GUILayout.Button("Back", GUILayout.Width(90f))) { m_Filter = MaterialColorType.None; } ; EditorGUILayout.EndHorizontal(); } if (isDefault) { DrawDefaultUI(); } else { DrawSelectedUI(m_Filter); } }
public MaterialColorTweenProperty( Color endValue, MaterialColorType colorName = MaterialColorType.Color, bool isRelative = false ) : base(endValue, isRelative) { _materialColorName = "_" + colorName.ToString(); }
/// <summary> /// material color tween /// </summary> public TweenConfig materialColor( Color endValue, MaterialColorType colorType = MaterialColorType.Color, bool isRelative = false ) { var prop = new MaterialColorTweenProperty( endValue, colorType, isRelative ); _tweenProperties.Add( prop ); return this; }
public MaterialColorTweenProperty(Color endValue, MaterialColorType colorName = MaterialColorType.Color, bool isRelative = false) : base(endValue, isRelative) { _materialColorName = "_" + colorName.ToString(); }
public static Tween colorFrom( this Material self, float duration, Color endValue, MaterialColorType colorType = MaterialColorType.Color ) { return Go.from( self, duration, new TweenConfig().materialColor( endValue, colorType ) ); }
public static Tween colorFrom(this Material self, float duration, Color endValue, MaterialColorType colorType = MaterialColorType.Color) { return(Go.from(self, duration, new TweenConfig().materialColor(endValue, colorType))); }