コード例 #1
0
        private void OnControlRenderQueueGUI()
        {
            var mats   = FormatUtility.GetOrderedMaterialsFromActivatedScenes();
            var labels = renderQueueLabels.OrderBy(kvp => kvp.Value).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

            foreach (var kvp in mats)
            {
                DrawRenderQueueLabel(labels, kvp.Key.renderQueue, EmptyStr);
                EditorGUI.BeginChangeCheck();
                var renderQueue = EditorGUILayout.DelayedIntField(RenderQueueStr, kvp.Key.renderQueue);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(kvp.Key, ChangeRenderQueueStr);
                    kvp.Key.renderQueue = renderQueue;
                    EditorUtility.SetDirty(kvp.Key);
                    break;
                }

                if (renderQueueFoldouts.ContainsKey(kvp.Key) && renderQueueFoldouts[kvp.Key])
                {
                    for (int i = 0; i < kvp.Value.Count; i++)
                    {
                        EditorGUILayout.LabelField(EmptyStr);
                    }
                }
            }
        }
コード例 #2
0
        private void OnViewRenderQueueGUI()
        {
            var mats   = FormatUtility.GetOrderedMaterialsFromActivatedScenes();
            var labels = renderQueueLabels.OrderBy(kvp => kvp.Value).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

            foreach (var kvp in mats)
            {
                if (!renderQueueFoldouts.ContainsKey(kvp.Key))
                {
                    renderQueueFoldouts.Add(kvp.Key, false);
                }
                DrawRenderQueueLabel(labels, kvp.Key.renderQueue);
                EditorGUILayout.BeginHorizontal();
                Rect position;
                renderQueueFoldouts[kvp.Key] = EasyGUILayout.Foldout(renderQueueFoldouts[kvp.Key], GUIContent.none, 25, out position);
                EditorGUI.ObjectField(position, kvp.Key, typeof(Material), false);
                EditorGUILayout.EndHorizontal();
                if (renderQueueFoldouts[kvp.Key])
                {
                    EditorGUI.indentLevel += 2;
                    for (int i = 0; i < kvp.Value.Count; i++)
                    {
                        EditorGUILayout.ObjectField(string.Format(ElementStr, i), kvp.Value[i], typeof(GameObject), false);
                    }
                    EditorGUI.indentLevel -= 2;
                }
            }
        }