private void DoAddCurveButton(Rect rowRect, TreeViewItem node) { // Is it propertynode. If not, then we don't need plusButton so quit here AddCurvesPopupPropertyNode hierarchyNode = node as AddCurvesPopupPropertyNode; if (hierarchyNode == null || hierarchyNode.curveBindings == null || hierarchyNode.curveBindings.Length == 0) { return; } Rect buttonRect = new Rect(rowRect.width - plusButtonWidth, rowRect.yMin, plusButtonWidth, buttonStyle.fixedHeight); // TODO Make a style for add curves popup // Draw background behind plus button to prevent text overlapping GUI.Box(buttonRect, GUIContent.none, plusButtonBackgroundStyle); // Check if the curve already exists and remove plus button if (GUI.Button(buttonRect, plusIcon, buttonStyle)) { AddCurvesPopup.AddNewCurve(hierarchyNode); // Hold shift key to add new curves and keep window opened. if (Event.current.shift) { m_TreeView.ReloadData(); } else { owner.Close(); } } }
private void AddPropertiesFromSelectedNodes() { int[] ids = m_TreeView.GetSelection(); for (int i = 0; i < ids.Length; ++i) { var node = m_TreeView.FindItem(ids[i]); var propertyNode = node as AddCurvesPopupPropertyNode; if (propertyNode != null) { AddCurvesPopup.AddNewCurve(propertyNode); } else if (node.hasChildren) { foreach (var childNode in node.children) { var childPropertyNode = childNode as AddCurvesPopupPropertyNode; if (childPropertyNode != null) { AddCurvesPopup.AddNewCurve(childPropertyNode); } } } } m_TreeView.ReloadData(); }