in unity/Assets/PostProcessingV2/Editor/PostProcessLayerEditor.cs [245:334]
void DoCustomEffectSorter()
{
EditorUtilities.DrawSplitter();
m_ShowCustomSorter.boolValue = EditorUtilities.DrawHeader("Custom Effect Sorting", m_ShowCustomSorter.boolValue);
if (m_ShowCustomSorter.boolValue)
{
bool isInPrefab = false;
// Init lists if needed
if (m_CustomLists == null)
{
// In some cases the editor will refresh before components which means
// components might not have been fully initialized yet. In this case we also
// need to make sure that we're not in a prefab as sorteBundles isn't a
// serializable object and won't exist until put on a scene.
if (m_Target.sortedBundles == null)
{
isInPrefab = string.IsNullOrEmpty(m_Target.gameObject.scene.name);
if (!isInPrefab)
{
// sortedBundles will be initialized and ready to use on the next frame
Repaint();
}
}
else
{
// Create a reorderable list for each injection event
m_CustomLists = new Dictionary<PostProcessEvent, ReorderableList>();
foreach (var evt in Enum.GetValues(typeof(PostProcessEvent)).Cast<PostProcessEvent>())
{
var bundles = m_Target.sortedBundles[evt];
var listName = ObjectNames.NicifyVariableName(evt.ToString());
var list = new ReorderableList(bundles, typeof(SerializedBundleRef), true, true, false, false);
list.drawHeaderCallback = (rect) =>
{
EditorGUI.LabelField(rect, listName);
};
list.drawElementCallback = (rect, index, isActive, isFocused) =>
{
var sbr = (SerializedBundleRef)list.list[index];
EditorGUI.LabelField(rect, sbr.bundle.attribute.menuItem);
};
list.onReorderCallback = (l) =>
{
EditorUtility.SetDirty(m_Target);
};
m_CustomLists.Add(evt, list);
}
}
}
GUILayout.Space(5);
if (isInPrefab)
{
EditorGUILayout.HelpBox("Not supported in prefabs.", MessageType.Info);
GUILayout.Space(3);
return;
}
bool anyList = false;
if (m_CustomLists != null)
{
foreach (var kvp in m_CustomLists)
{
var list = kvp.Value;
// Skip empty lists to avoid polluting the inspector
if (list.count == 0)
continue;
list.DoLayoutList();
anyList = true;
}
}
if (!anyList)
{
EditorGUILayout.HelpBox("No custom effect loaded.", MessageType.Info);
GUILayout.Space(3);
}
}
}