Ejemplo n.º 1
0
 public GroupAssetListTree(GroupViewController parent, TreeViewState state, MultiColumnHeaderState mchs) : base(state, new MultiColumnHeader(mchs))
 {
     m_controller = parent;
     showBorder   = true;
     showAlternatingRowBackgrounds = true;
     //DefaultStyles.label.richText = true;
     multiColumnHeader.sortingChanged += OnSortingChanged;
 }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            ConnectionGUI con = target as ConnectionGUI;

            if (m_groupViewController == null)
            {
                m_groupViewController = new GroupViewController(con.AssetGroupViewContext);
            }

            if (con == null)
            {
                return;
            }

            var count       = 0;
            var assetGroups = con.AssetGroups;

            if (assetGroups == null)
            {
                return;
            }

            foreach (var assets in assetGroups.Values)
            {
                if (assets == null)
                {
                    continue;
                }
                count += assets.Count;
            }

            var groupCount = assetGroups.Keys.Count;

            GUILayout.Label("Stats", "BoldLabel");
            EditorGUILayout.LabelField("Total groups", groupCount.ToString());
            EditorGUILayout.LabelField("Total items", count.ToString());
            GUILayout.Space(8f);

            m_groupViewController.SetGroups(assetGroups);
            m_groupViewController.OnGroupViewGUI();
        }
Ejemplo n.º 3
0
 public GroupListTree(GroupViewController parent, TreeViewState state, MultiColumnHeaderState mchs) : base(state, new MultiColumnHeader(mchs))
 {
     m_controller = parent;
     showBorder   = true;
     multiColumnHeader.sortingChanged += OnSortingChanged;
 }
Ejemplo n.º 4
0
        private void GroupingOutput(BuildTarget target,
                                    Model.NodeData node,
                                    IEnumerable <PerformGraph.AssetGroups> incoming,
                                    IEnumerable <Model.ConnectionData> connectionsToOutput,
                                    PerformGraph.Output Output)
        {
            ValidateGroupingKeyword(
                m_groupSizeByte[target],
                () => {
                throw new NodeException("Invalid size.", "Set a valid size. Size must be a positive number.", node);
            }
                );

            if (connectionsToOutput == null || Output == null)
            {
                return;
            }

            var  outputDict = new Dictionary <string, List <AssetReference> >();
            long szGroup    = m_groupSizeByte[target] * 1000;

            int  groupCount   = 0;
            long szGroupCount = 0;

            if (m_freezeGroups && m_savedGroups != null)
            {
                while (m_savedGroups.ContainsKey(groupCount.ToString()))
                {
                    ++groupCount;
                }
            }

            if (incoming != null)
            {
                foreach (var ag in incoming)
                {
                    foreach (var g in ag.assetGroups.Keys)
                    {
                        var assets    = ag.assetGroups[g];
                        var groupName = GetGroupName(target, g, groupCount);
                        foreach (var a in assets)
                        {
                            if (m_freezeGroups && m_savedGroups != null)
                            {
                                var savedGroupName = m_savedGroups.FindGroupOfAsset(a.importFrom);
                                if (!string.IsNullOrEmpty(savedGroupName))
                                {
                                    if (!outputDict.ContainsKey(savedGroupName))
                                    {
                                        outputDict[savedGroupName] = new List <AssetReference>();
                                    }
                                    outputDict[savedGroupName].Add(a);
                                    continue;
                                }
                            }

                            szGroupCount += GetSizeOfAsset(a, (GroupingType)m_groupingType[target]);

                            if (!outputDict.ContainsKey(groupName))
                            {
                                outputDict[groupName] = new List <AssetReference>();
                            }
                            outputDict[groupName].Add(a);

                            if (szGroupCount >= szGroup)
                            {
                                szGroupCount = 0;
                                ++groupCount;
                                if (m_freezeGroups && m_savedGroups != null)
                                {
                                    while (m_savedGroups.ContainsKey(groupCount.ToString()))
                                    {
                                        ++groupCount;
                                    }
                                }
                                groupName = GetGroupName(target, g, groupCount);
                            }
                        }
                    }
                }
            }

            var dst = (connectionsToOutput == null || !connectionsToOutput.Any())?
                      null : connectionsToOutput.First();

            Output(dst, outputDict);

            if (m_groupViewController == null)
            {
                m_groupViewController = new GroupViewController(m_groupViewContext);
            }
            m_groupViewController.SetGroups(outputDict);
            m_lastOutputGroups = outputDict;
        }