public override void FetchData() { this.m_RootItem = (TreeViewItem) new SketchUpNode(this.m_Nodes[0].nodeIndex, 0, (TreeViewItem) null, this.m_Nodes[0].name, this.m_Nodes[0]); List<SketchUpNode> sketchUpNodeList = new List<SketchUpNode>(); sketchUpNodeList.Add(this.m_RootItem as SketchUpNode); this.SetExpanded(this.m_RootItem, true); int nodeIndex = this.m_Nodes[0].nodeIndex; for (int index = 1; index < this.m_Nodes.Length; ++index) { SketchUpNodeInfo node = this.m_Nodes[index]; if (node.parent >= 0 && node.parent <= sketchUpNodeList.Count) { if (node.parent >= index) Debug.LogError((object) "Parent node index is greater than child node"); else if (nodeIndex >= node.nodeIndex) { Debug.LogError((object) "Node array is not sorted by nodeIndex"); } else { SketchUpNode sketchUpNode1 = sketchUpNodeList[node.parent]; SketchUpNode sketchUpNode2 = new SketchUpNode(node.nodeIndex, sketchUpNode1.depth + 1, (TreeViewItem) sketchUpNode1, node.name, node); sketchUpNode1.children.Add((TreeViewItem) sketchUpNode2); this.SetExpanded((TreeViewItem) sketchUpNode2, sketchUpNode2.Info.enabled); sketchUpNodeList.Add(sketchUpNode2); if (index % 50 == 0) EditorUtility.DisplayProgressBar("SketchUp Import", "Building Node Selection", (float) index / (float) this.m_Nodes.Length); } } } EditorUtility.ClearProgressBar(); this.m_NeedRefreshVisibleFolders = true; }
public override void OnRowGUI(Rect rowRect, TreeViewItem node, int row, bool selected, bool focused) { this.DoNodeGUI(rowRect, row, node, selected, focused, false); SketchUpNode sketchUpNode = node as SketchUpNode; Rect position = new Rect(2f, rowRect.y, rowRect.height, rowRect.height); sketchUpNode.Enabled = GUI.Toggle(position, sketchUpNode.Enabled, GUIContent.none, SketchUpImportDlg.Styles.styles.toggleStyle); }
private void ToggleChildren(bool toggle) { foreach (TreeViewItem current in this.children) { SketchUpNode sketchUpNode = current as SketchUpNode; sketchUpNode.Info.enabled = toggle; sketchUpNode.ToggleChildren(toggle); } }
// Enable Item private void ToggleChildren(bool toggle) { foreach (var child in children) { SketchUpNode item = child as SketchUpNode; item.Info.enabled = toggle; item.ToggleChildren(toggle); } }
private void ToggleChildren(bool toggle) { foreach (TreeViewItem item in this.children) { SketchUpNode node = item as SketchUpNode; node.Info.enabled = toggle; node.ToggleChildren(toggle); } }
public override void OnRowGUI(Rect rowRect, TreeViewItem node, int row, bool selected, bool focused) { DoItemGUI(rowRect, row, node, selected, focused, false); SketchUpNode suNode = node as SketchUpNode; Rect toggleRect = new Rect(2, rowRect.y, rowRect.height, rowRect.height); suNode.Enabled = GUI.Toggle(toggleRect, suNode.Enabled, GUIContent.none, SketchUpImportDlg.Styles.styles.toggleStyle); }
// Toggle Parent Item. private void ToggleParent(bool toggle) { SketchUpNode parentItem = parent as SketchUpNode; if (parentItem != null) { parentItem.ToggleParent(toggle); parentItem.Info.enabled = toggle; } }
private void InternalFetchEnableNodes(SketchUpNode node, List<int> enable) { if (node.Enabled) enable.Add(node.Info.nodeIndex); using (List<TreeViewItem>.Enumerator enumerator = node.children.GetEnumerator()) { while (enumerator.MoveNext()) this.InternalFetchEnableNodes(enumerator.Current as SketchUpNode, enable); } }
private void ToggleParent(bool toggle) { SketchUpNode parent = this.parent as SketchUpNode; if (parent != null) { parent.ToggleParent(toggle); parent.Info.enabled = toggle; } }
private void ToggleParent(bool toggle) { SketchUpNode sketchUpNode = this.parent as SketchUpNode; if (sketchUpNode != null) { sketchUpNode.ToggleParent(toggle); sketchUpNode.Info.enabled = toggle; } }
private void InternalFetchEnableNodes(SketchUpNode node, List<int> enable) { if (node.Enabled) { enable.Add(node.Info.nodeIndex); } foreach (TreeViewItem item in node.children) { this.InternalFetchEnableNodes(item as SketchUpNode, enable); } }
void InternalFetchEnableNodes(SketchUpNode node, List <int> enable) { if (node.Enabled) { enable.Add(node.Info.nodeIndex); } foreach (var childNode in node.children) { InternalFetchEnableNodes(childNode as SketchUpNode, enable); } }
private void InternalFetchEnableNodes(SketchUpNode node, List <int> enable) { if (node.Enabled) { enable.Add(node.Info.nodeIndex); } foreach (TreeViewItem current in node.children) { this.InternalFetchEnableNodes(current as SketchUpNode, enable); } }
public override Rect OnRowGUI(TreeViewItem node, int row, float rowWidth, bool selected, bool focused) { Rect rect = new Rect(0f, row * base.k_LineHeight, rowWidth, base.k_LineHeight); this.DoNodeGUI(rect, node, selected, focused, false); SketchUpNode node2 = node as SketchUpNode; Rect position = new Rect(2f, rect.y, rect.height, rect.height); node2.Enabled = GUI.Toggle(position, node2.Enabled, GUIContent.none, SketchUpImportDlg.Styles.styles.toggleStyle); return(rect); }
private void ToggleChildren(bool toggle) { using (List <TreeViewItem> .Enumerator enumerator = this.children.GetEnumerator()) { while (enumerator.MoveNext()) { SketchUpNode current = enumerator.Current as SketchUpNode; current.Info.enabled = toggle; current.ToggleChildren(toggle); } } }
private void InternalFetchEnableNodes(SketchUpNode node, List <int> enable) { if (node.Enabled) { enable.Add(node.Info.nodeIndex); } using (List <TreeViewItem> .Enumerator enumerator = node.children.GetEnumerator()) { while (enumerator.MoveNext()) { this.InternalFetchEnableNodes(enumerator.Current as SketchUpNode, enable); } } }
private void HandleKeyboardEvents() { Event current = Event.current; if (current.type == EventType.KeyDown && (current.keyCode == KeyCode.Space || current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter) && this.m_Selection != null && this.m_Selection.Length > 0) { SketchUpNode sketchUpNode = this.m_TreeView.FindItem(this.m_Selection[0]) as SketchUpNode; if (sketchUpNode != null && sketchUpNode != this.m_DataSource.root) { sketchUpNode.Enabled = !sketchUpNode.Enabled; current.Use(); base.Repaint(); } } }
private void HandleKeyboardEvents() { Event current = Event.current; if (((current.type == EventType.KeyDown) && (((current.keyCode == KeyCode.Space) || (current.keyCode == KeyCode.Return)) || (current.keyCode == KeyCode.KeypadEnter))) && ((this.m_Selection != null) && (this.m_Selection.Length > 0))) { SketchUpNode node = this.m_TreeView.FindNode(this.m_Selection[0]) as SketchUpNode; if ((node != null) && (node != this.m_DataSource.root)) { node.Enabled = !node.Enabled; current.Use(); base.Repaint(); } } }
public override void FetchData() { // first item is the root. always. m_RootItem = new SketchUpNode(m_Nodes[0].nodeIndex, 0, null, m_Nodes[0].name, m_Nodes[0]); // We are relying on the assumption that // 1. the nodes are already sorted by nodeIndex // 2. Parent's nodeIndex < child's nodeIndex List <SketchUpNode> nodeList = new List <SketchUpNode>(); nodeList.Add(m_RootItem as SketchUpNode); SetExpanded(m_RootItem, true); int previousNodeIndex = m_Nodes[0].nodeIndex; for (int i = 1; i < m_Nodes.Length; ++i) { SketchUpNodeInfo node = m_Nodes[i]; if (node.parent < 0 || node.parent > nodeList.Count) { continue; } if (node.parent >= i) { Debug.LogError("Parent node index is greater than child node"); continue; } if (previousNodeIndex >= node.nodeIndex) { Debug.LogError("Node array is not sorted by nodeIndex"); continue; } SketchUpNode parent = nodeList[node.parent]; SketchUpNode suNode = new SketchUpNode(node.nodeIndex, parent.depth + 1, parent, node.name, node); parent.children.Add(suNode); SetExpanded(suNode, suNode.Info.enabled); nodeList.Add(suNode); if (i % k_ProgressUpdateStep == 0) { EditorUtility.DisplayProgressBar("SketchUp Import", "Building Node Selection", (float)i / m_Nodes.Length); } } EditorUtility.ClearProgressBar(); m_NeedRefreshRows = true; }
private void HandleKeyboardEvents() { Event current = Event.current; if (current.type != EventType.KeyDown || current.keyCode != KeyCode.Space && current.keyCode != KeyCode.Return && current.keyCode != KeyCode.KeypadEnter || (this.m_Selection == null || this.m_Selection.Length <= 0)) { return; } SketchUpNode node = this.m_TreeView.FindNode(this.m_Selection[0]) as SketchUpNode; if (node == null || node == this.m_DataSource.root) { return; } node.Enabled = !node.Enabled; current.Use(); this.Repaint(); }
void HandleKeyboardEvents() { Event evt = Event.current; if (evt.type == EventType.KeyDown && (evt.keyCode == KeyCode.Space || evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter)) { if (m_Selection != null && m_Selection.Length > 0) { SketchUpNode node = m_TreeView.FindItem(m_Selection[0]) as SketchUpNode; if (node != null && node != m_DataSource.root) { node.Enabled = !node.Enabled; evt.Use(); Repaint(); } } } }
public override void FetchData() { base.m_RootItem = new SketchUpNode(this.m_Nodes[0].nodeIndex, 0, null, this.m_Nodes[0].name, this.m_Nodes[0]); List <SketchUpNode> list = new List <SketchUpNode> { base.m_RootItem as SketchUpNode }; this.SetExpanded(base.m_RootItem, true); int nodeIndex = this.m_Nodes[0].nodeIndex; for (int i = 1; i < this.m_Nodes.Length; i++) { SketchUpNodeInfo info = this.m_Nodes[i]; if ((info.parent >= 0) && (info.parent <= list.Count)) { if (info.parent >= i) { Debug.LogError("Parent node index is greater than child node"); } else if (nodeIndex >= info.nodeIndex) { Debug.LogError("Node array is not sorted by nodeIndex"); } else { SketchUpNode parent = list[info.parent]; SketchUpNode item = new SketchUpNode(info.nodeIndex, parent.depth + 1, parent, info.name, info); parent.children.Add(item); this.SetExpanded(item, item.Info.enabled); list.Add(item); if ((i % 50) == 0) { EditorUtility.DisplayProgressBar("SketchUp Import", "Building Node Selection", ((float)i) / ((float)this.m_Nodes.Length)); } } } } EditorUtility.ClearProgressBar(); base.m_NeedRefreshVisibleFolders = true; }
public override void FetchData() { this.m_RootItem = new SketchUpNode(this.m_Nodes[0].nodeIndex, 0, null, this.m_Nodes[0].name, this.m_Nodes[0]); List <SketchUpNode> list = new List <SketchUpNode>(); list.Add(this.m_RootItem as SketchUpNode); this.SetExpanded(this.m_RootItem, true); int nodeIndex = this.m_Nodes[0].nodeIndex; for (int i = 1; i < this.m_Nodes.Length; i++) { SketchUpNodeInfo info = this.m_Nodes[i]; if (info.parent >= 0 && info.parent <= list.Count) { if (info.parent >= i) { Debug.LogError("Parent node index is greater than child node"); } else if (nodeIndex >= info.nodeIndex) { Debug.LogError("Node array is not sorted by nodeIndex"); } else { SketchUpNode sketchUpNode = list[info.parent]; SketchUpNode sketchUpNode2 = new SketchUpNode(info.nodeIndex, sketchUpNode.depth + 1, sketchUpNode, info.name, info); sketchUpNode.children.Add(sketchUpNode2); this.SetExpanded(sketchUpNode2, sketchUpNode2.Info.enabled); list.Add(sketchUpNode2); if (i % 50 == 0) { EditorUtility.DisplayProgressBar("SketchUp Import", "Building Node Selection", (float)i / (float)this.m_Nodes.Length); } } } } EditorUtility.ClearProgressBar(); this.m_NeedRefreshRows = true; }
public override void FetchData() { this.m_RootItem = (TreeViewItem) new SketchUpNode(this.m_Nodes[0].nodeIndex, 0, (TreeViewItem)null, this.m_Nodes[0].name, this.m_Nodes[0]); List <SketchUpNode> sketchUpNodeList = new List <SketchUpNode>(); sketchUpNodeList.Add(this.m_RootItem as SketchUpNode); this.SetExpanded(this.m_RootItem, true); int nodeIndex = this.m_Nodes[0].nodeIndex; for (int index = 1; index < this.m_Nodes.Length; ++index) { SketchUpNodeInfo node = this.m_Nodes[index]; if (node.parent >= 0 && node.parent <= sketchUpNodeList.Count) { if (node.parent >= index) { Debug.LogError((object)"Parent node index is greater than child node"); } else if (nodeIndex >= node.nodeIndex) { Debug.LogError((object)"Node array is not sorted by nodeIndex"); } else { SketchUpNode sketchUpNode1 = sketchUpNodeList[node.parent]; SketchUpNode sketchUpNode2 = new SketchUpNode(node.nodeIndex, sketchUpNode1.depth + 1, (TreeViewItem)sketchUpNode1, node.name, node); sketchUpNode1.children.Add((TreeViewItem)sketchUpNode2); this.SetExpanded((TreeViewItem)sketchUpNode2, sketchUpNode2.Info.enabled); sketchUpNodeList.Add(sketchUpNode2); if (index % 50 == 0) { EditorUtility.DisplayProgressBar("SketchUp Import", "Building Node Selection", (float)index / (float)this.m_Nodes.Length); } } } } EditorUtility.ClearProgressBar(); this.m_NeedRefreshVisibleFolders = true; }
public override void FetchData() { base.m_RootItem = new SketchUpNode(this.m_Nodes[0].nodeIndex, 0, null, this.m_Nodes[0].name, this.m_Nodes[0]); List<SketchUpNode> list = new List<SketchUpNode> { base.m_RootItem as SketchUpNode }; this.SetExpanded(base.m_RootItem, true); int nodeIndex = this.m_Nodes[0].nodeIndex; for (int i = 1; i < this.m_Nodes.Length; i++) { SketchUpNodeInfo info = this.m_Nodes[i]; if ((info.parent >= 0) && (info.parent <= list.Count)) { if (info.parent >= i) { Debug.LogError("Parent node index is greater than child node"); } else if (nodeIndex >= info.nodeIndex) { Debug.LogError("Node array is not sorted by nodeIndex"); } else { SketchUpNode parent = list[info.parent]; SketchUpNode item = new SketchUpNode(info.nodeIndex, parent.depth + 1, parent, info.name, info); parent.children.Add(item); this.SetExpanded(item, item.Info.enabled); list.Add(item); if ((i % 50) == 0) { EditorUtility.DisplayProgressBar("SketchUp Import", "Building Node Selection", ((float) i) / ((float) this.m_Nodes.Length)); } } } } EditorUtility.ClearProgressBar(); base.m_NeedRefreshRows = true; }