Exemplo n.º 1
0
 internal static int[] LaunchAsModal(SketchUpNodeInfo[] nodes)
 {
     SketchUpImportDlg windowDontShow = EditorWindow.GetWindowDontShow<SketchUpImportDlg>();
     windowDontShow.Init(nodes, null);
     windowDontShow.isModal = true;
     windowDontShow.ShowModal();
     return windowDontShow.m_DataSource.FetchEnableNodes();
 }
Exemplo n.º 2
0
 public void Init(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor)
 {
     base.titleContent = Styles.styles.windowTitle;
     base.minSize = this.m_WindowMinSize;
     base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y);
     this.m_TreeViewState = new TreeViewState();
     this.m_TreeView = new TreeView(this, this.m_TreeViewState);
     this.m_ImportGUI = new SketchUpTreeViewGUI(this.m_TreeView);
     this.m_DataSource = new SketchUpDataSource(this.m_TreeView, nodes);
     this.m_TreeView.Init(base.position, this.m_DataSource, this.m_ImportGUI, null);
     this.m_TreeView.selectionChangedCallback = (Action<int[]>) Delegate.Combine(this.m_TreeView.selectionChangedCallback, new Action<int[]>(this.OnTreeSelectionChanged));
     this.m_ModelEditor = new WeakReference(suModelEditor);
     this.isModal = false;
 }
 public void Init(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor)
 {
   this.titleContent = SketchUpImportDlg.Styles.styles.windowTitle;
   this.minSize = this.m_WindowMinSize;
   this.position = new Rect(this.position.x, this.position.y, this.minSize.x, this.minSize.y);
   this.m_TreeViewState = new TreeViewState();
   this.m_TreeView = new TreeView((EditorWindow) this, this.m_TreeViewState);
   this.m_ImportGUI = new SketchUpTreeViewGUI(this.m_TreeView);
   this.m_DataSource = new SketchUpDataSource(this.m_TreeView, nodes);
   this.m_TreeView.Init(this.position, (ITreeViewDataSource) this.m_DataSource, (ITreeViewGUI) this.m_ImportGUI, (ITreeViewDragging) null);
   this.m_TreeView.selectionChangedCallback += new System.Action<int[]>(this.OnTreeSelectionChanged);
   this.m_ModelEditor = new WeakReference((object) suModelEditor);
   this.isModal = false;
 }
        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;
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 7
0
        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 SketchUpDataSource(TreeViewController treeView, SketchUpNodeInfo[] nodes) : base(treeView)
 {
     this.m_Nodes = nodes;
     this.FetchData();
 }
 public SketchUpNode(int id, int depth, TreeViewItem parent, string displayName, SketchUpNodeInfo info)
     : base(id, depth, parent, displayName)
 {
     this.Info = info;
     children  = new List <TreeViewItem>();
 }
Exemplo n.º 10
0
 public SketchUpNode(int id, int depth, TreeViewItem parent, string displayName, SketchUpNodeInfo info)
   : base(id, depth, parent, displayName)
 {
   this.Info = info;
   this.children = new List<TreeViewItem>();
 }
Exemplo n.º 11
0
 internal static void Launch(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor)
 {
     SketchUpImportDlg windowDontShow = EditorWindow.GetWindowDontShow<SketchUpImportDlg>();
     windowDontShow.Init(nodes, suModelEditor);
     windowDontShow.ShowAuxWindow();
 }