private classTreeNode EncodeTree(AssetTreeNode tn, MOG_Properties props, int handle)
        {
            classTreeNode classNode = new classTreeNode(tn.Text);

            classNode.ImageIndex         = BLUEDOT_INDEX;
            classNode.SelectedImageIndex = BLUEDOT_INDEX;

            // Get a local handle for our progress dialog
            MOG_Progress.ProgressUpdate(handle, tn.FullPath);

            // if this is an asset filename node?
            if (tn.IsAnAssetFilename)
            {
                classNode.Text                = classNode.Text;
                classNode.ForeColor           = Color.Blue;
                classNode.ImageIndex          = ARROW_INDEX;
                classNode.SelectedImageIndex  = ARROW_INDEX;
                classNode.IsAssetFilenameNode = true;

                // Inherit Properties from parent
                // 'props' needs to be cloned or else all of these children assets will share the same Properties!!!
                classNode.props = props;

                // Make list o' children
                foreach (AssetTreeNode fileNode in tn.fileNodes)
                {
                    if (fileNode.IsAFile)
                    {
                        classNode.importFiles.Add(fileNode.FileFullPath);
                    }
                }

                // setup gamedatapath
                string assetDirectoryPath = MOG.CONTROLLER.CONTROLLERASSET.MOG_ControllerAsset.GetCommonDirectoryPath(this.projectRootPath, classNode.importFiles);
                string relativePath       = "";
                if (assetDirectoryPath.Length > this.projectRootPath.Length)
                {
                    relativePath = assetDirectoryPath.Substring(this.projectRootPath.Length + 1);
                }
                classNode.props.SyncTargetPath = relativePath;

                // add it to the list of asset filename nodes for later processing
                this.assetFilenameNodes.Add(classNode);

                return(classNode);                              // don't do children of an asset filename node
            }

            // Use our properties to pass along to our children
            props = MOG_ControllerProject.GetClassificationProperties(tn.FullPath.Replace(tn.TreeView.PathSeparator, "~"));
            props.SetImmeadiateMode(true);
            classNode.props = props;

            // Loop through all of our children nodes sending them our Properties
            foreach (AssetTreeNode subNode in tn.Nodes)
            {
                classNode.Nodes.Add(EncodeTree(subNode, props, handle));
            }

            return(classNode);
        }
        private classTreeNode EncodeNode(AssetTreeNode atn, MOG_Properties props)
        {
            classTreeNode classNode = new classTreeNode(atn.Text);

            classNode.ImageIndex         = BLUEDOT_INDEX;
            classNode.SelectedImageIndex = BLUEDOT_INDEX;
            classNode.props = null;

            // if this is an asset filename node?
            if (atn.IsAnAssetFilename)
            {
                classNode.Text                = classNode.Text;
                classNode.ForeColor           = Color.Blue;
                classNode.ImageIndex          = ARROW_INDEX;
                classNode.SelectedImageIndex  = ARROW_INDEX;
                classNode.IsAssetFilenameNode = true;

                // Make list o' children files
                foreach (AssetTreeNode fileNode in atn.fileNodes)
                {
                    if (fileNode.IsAFile)
                    {
                        classNode.importFiles.Add(fileNode.FileFullPath);
                    }
                }

                // Check if we have a props?
                if (classNode.props != null)
                {
                    // Setup SyncTargetPath Property
                    string relativePath       = "";
                    string assetDirectoryPath = MOG.CONTROLLER.CONTROLLERASSET.MOG_ControllerAsset.GetCommonDirectoryPath(this.projectRootPath, classNode.importFiles);
                    if (assetDirectoryPath.Length > this.projectRootPath.Length)
                    {
                        relativePath = assetDirectoryPath.Substring(this.projectRootPath.Length + 1);
                    }

                    // Set our SyncTargetPath
                    classNode.props.SyncTargetPath = relativePath;
                }

                // add it to the list of asset filename nodes for later processing
                this.assetFilenameNodes.Add(classNode);

                return(classNode);                              // don't do children of an asset filename node
            }

            classNode.FilledIn      = false;
            classNode.assetTreeNode = atn;

            // add a dummy child node if necessary
            if (atn.Nodes.Count > 0)
            {
                classNode.Nodes.Add(new classTreeNode("DUMMY_NODE"));
            }

            return(classNode);
        }
Ejemplo n.º 3
0
        public void SetSelectedNode_Recursive(AssetTreeNode val)
        {
            this.SelectedNode = val;

            foreach (AssetTreeNode subNode in this.Nodes)
            {
                subNode.SetSelectedNode_Recursive(val);
            }
        }
Ejemplo n.º 4
0
        private bool IsInParentLine(AssetTreeNode test)
        {
            AssetTreeNode node = this;

            while (node != null)
            {
                if (test == node)
                {
                    return(true);
                }

                node = node.Parent as AssetTreeNode;
            }

            return(false);
        }
Ejemplo n.º 5
0
        public static ArrayList GetUniqueRootNodes(ArrayList nodes)
        {
            ArrayList roots = new ArrayList();

            foreach (AssetTreeNode node in nodes)
            {
                AssetTreeNode ancestor = node.FindAncestor(roots);
                if (ancestor == null)
                {
                    //There is no ancestor in the list for this node
                    //We're going to add it, so that means we don't need any nodes that might be underneath this one in the tree
                    roots = node.GetNonDescendants(roots);

                    //Now add it
                    roots.Add(node);
                }
            }

            return(roots);
        }