protected void LeftClick(Event e) { if (TitleLabelRect().Contains(e.mousePosition)) { if (EditorApplication.timeSinceStartup - timeClicked <= DoubleClickTime) { timeClicked = double.MinValue; isDragged = false; NodeEditPopup.Init(nodeObject); return; } timeClicked = EditorApplication.timeSinceStartup; isDragged = true; GUI.changed = true; isSelected = true; labelStyle.normal.textColor = Color.white; treeBlueprint.SelectNode(nodeObject); currentStyle = nodeStyle.selectedStyle; Selection.SetActiveObjectWithContext(treeBlueprint, null); e.Use(); } else if (GetRect().Contains(e.mousePosition)) { GUI.changed = true; isSelected = true; labelStyle.normal.textColor = Color.white; treeBlueprint.SelectNode(nodeObject); currentStyle = nodeStyle.selectedStyle; Selection.SetActiveObjectWithContext(treeBlueprint, null); //e.Use(); } else { GUI.changed = true; if (treeBlueprint.GetSelectedNode() == nodeObject) { Deselect(); treeBlueprint.SelectNode(null); } currentStyle = nodeStyle.defaultStyle; } }
public static void Init(NodeEditorObject node) { if (instance == null) { instance = ScriptableObject.CreateInstance<NodeEditPopup>(); instance.position = new Rect( GUIUtility.GUIToScreenPoint(Event.current.mousePosition), new Vector2(250, 150)); instance.ShowPopup(); } else { instance.Repaint(); } editing = node; newname = editing.displayName; newdesc = editing.description; }
public void Hide() { this.Close(); instance = null; }