Example #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;
 }
Example #2
0
        public override void OnInspectorGUI()
        {
            ConnectionGUIInspectorHelper helper = target as ConnectionGUIInspectorHelper;

            if (m_groupViewController == null)
            {
                m_groupViewController = new GroupViewController(helper.groupViewContext);
            }

            var con = helper.connectionGUI;

            if (con == null)
            {
                return;
            }

            var count       = 0;
            var assetGroups = helper.assetGroups;

            if (assetGroups == null)
            {
                return;
            }

            foreach (var assets in assetGroups.Values)
            {
                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();
        }
Example #3
0
 public GroupListTree(GroupViewController parent, TreeViewState state, MultiColumnHeaderState mchs) : base(state, new MultiColumnHeader(mchs))
 {
     m_controller = parent;
     showBorder   = true;
     multiColumnHeader.sortingChanged += OnSortingChanged;
 }
Example #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.", node.Id);
            }
                );

            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;
                }
            }
            var groupName = groupCount.ToString();

            if (incoming != null)
            {
                foreach (var ag in incoming)
                {
                    foreach (var assets in ag.assetGroups.Values)
                    {
                        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 = groupCount.ToString();
                            }
                        }
                    }
                }
            }

            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;
        }