Vector4 ApplyModify(Vector4 _src, float _value, enum_PaintMode _paintMode, enum_PaintColor _targetColor) { switch (_paintMode) { default: throw new Exception("Invalid Type:" + _paintMode); case enum_PaintMode.Const: switch (_targetColor) { default: throw new Exception("Invalid Target:" + _targetColor); case enum_PaintColor.R: return(new Vector4(_value, _src.y, _src.z, _src.w)); case enum_PaintColor.G: return(new Vector4(_src.x, _value, _src.z, _src.w)); case enum_PaintColor.B: return(new Vector4(_src.x, _src.y, _value, _src.w)); case enum_PaintColor.A: return(new Vector4(_src.x, _src.y, _src.z, _value)); } case enum_PaintMode.Modify: switch (_targetColor) { default: throw new Exception("Invalid Target:" + _targetColor); case enum_PaintColor.R: return(new Vector4(Mathf.Clamp(_src.x, 0, 1) + _value, _src.y, _src.z, _src.w)); case enum_PaintColor.G: return(new Vector4(_src.x, Mathf.Clamp(_src.y + _value, 0, 1), _src.z, _src.w)); case enum_PaintColor.B: return(new Vector4(_src.x, _src.y, Mathf.Clamp(_src.z + _value, 0, 1), _src.w)); case enum_PaintColor.A: return(new Vector4(_src.x, _src.y, _src.z, Mathf.Clamp(_src.w + _value, 0, 1))); } } }
public override void OnKeyboradInteract(KeyCode _keycode) { base.OnKeyboradInteract(_keycode); switch (_keycode) { case KeyCode.R: ResetSelected(); break; case KeyCode.Tab: m_PaintMode = m_PaintMode.Next(); break; case KeyCode.LeftControl: m_PaintColor.Check(m_PaintColor.m_Value.Next()); break; case KeyCode.CapsLock: m_PaintNormal = m_PaintNormal.Next(); break; case KeyCode.Q: m_PaintValue = Mathf.Clamp(m_PaintValue - .1f, 0, 1); break; case KeyCode.E: m_PaintValue = Mathf.Clamp(m_PaintValue + .1f, 0, 1); break; case KeyCode.Z: m_PaintSize = Mathf.Clamp(m_PaintSize - .1f, s_PaintSizeRange.start, s_PaintSizeRange.end); break; case KeyCode.X: m_PaintSize = Mathf.Clamp(m_PaintSize + .1f, s_PaintSizeRange.start, s_PaintSizeRange.end); break; } }
public override void OnEditorWindowGUI() { base.OnEditorWindowGUI(); m_VertexDataSource.Check((enum_VertexData)EditorGUILayout.EnumPopup("Data Source", m_VertexDataSource)); if (!m_AvailableDatas) { EditorGUILayout.LabelField("<Color=#FF0000>Empty Vertex Data</Color>", UEGUIStyle_Window.m_ErrorLabel); if (GUILayout.Button("Fill With Empty Colors")) { for (int i = 0; i < m_Verticies.Length; i++) { m_VertexDatas.Add(Vector4.zero); } m_ModifingMesh.SetVertexData(m_VertexDataSource, m_VertexDatas); } return; } m_PaintColor.Check((enum_PaintColor)EditorGUILayout.EnumPopup("Color (LCtrl)", m_PaintColor)); m_PaintMode = (enum_PaintMode)EditorGUILayout.EnumPopup("Mode (Tab)", m_PaintMode); m_PaintNormal = (enum_PaintNormal)EditorGUILayout.EnumPopup("Normal (Capslock)", m_PaintNormal); m_PaintSize = EditorGUILayout.Slider("Size (Z X)", m_PaintSize, s_PaintSizeRange.start, s_PaintSizeRange.end); m_PaintValue = EditorGUILayout.Slider("Value (Q E)", m_PaintValue, 0f, 1f); }