static void GUIKeys(Event ev) { if (!ev.isKey || !ev.shift) { return; } if (ev.keyCode == KeyCode.Q) { Tools.current = Tool.None; _tool = Tool4.None; } else if (ev.keyCode == KeyCode.W) { Tools.current = Tool.None; _tool = Tool4.Move; } else if (ev.keyCode == KeyCode.E) { Tools.current = Tool.None; _tool = Tool4.Rotate; } else if (ev.keyCode == KeyCode.R) { Tools.current = Tool.None; _tool = Tool4.Scale; } EditorPrefs.SetInt("Engine4_Trans4Tool", (int)_tool); }
void OnEnable() { m_Position = serializedObject.FindProperty("m_Position"); m_Rotation = serializedObject.FindProperty("m_Rotation"); m_Scale = serializedObject.FindProperty("m_Scale"); m_CanScale = (target as Transform4).GetComponents <MonoBehaviour>().Any((x) => x is INeedTransform4Scale); _tool = (Tool4)EditorPrefs.GetInt("Engine4_Trans4Tool", (int)_tool); }
void GUITools(Rect r, bool scale) { var n = (int)(Tools.current == Tool.None ? _tool : Tool4.None); var c = scale ? 3 : 2; var o = scale ? _toolIcons_3 : _toolIcons_2; for (int i = 0; i < c; i++) { o[i] = _toolIcons[n == i ? i + 3 : i]; } n = GUI.SelectionGrid(r, n, o, 1, _toolStyle); if (n >= 0) { Tools.current = Tool.None; _tool = (Tool4)n; } }