private static GetRemoveButtonRect ( |
||
r | ||
Résultat |
private void CommandBufferGUI() { if (base.targets.Length == 1) { Light light = base.target as Light; if (!(light == null)) { int commandBufferCount = light.commandBufferCount; if (commandBufferCount != 0) { this.m_CommandBuffersShown = GUILayout.Toggle(this.m_CommandBuffersShown, GUIContent.Temp(commandBufferCount + " command buffers"), EditorStyles.foldout, new GUILayoutOption[0]); if (this.m_CommandBuffersShown) { EditorGUI.indentLevel++; LightEvent[] array = (LightEvent[])Enum.GetValues(typeof(LightEvent)); for (int i = 0; i < array.Length; i++) { LightEvent lightEvent = array[i]; CommandBuffer[] commandBuffers = light.GetCommandBuffers(lightEvent); CommandBuffer[] array2 = commandBuffers; for (int j = 0; j < array2.Length; j++) { CommandBuffer commandBuffer = array2[j]; using (new GUILayout.HorizontalScope(new GUILayoutOption[0])) { Rect rect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel); rect.xMin += EditorGUI.indent; Rect removeButtonRect = LightEditor.GetRemoveButtonRect(rect); rect.xMax = removeButtonRect.x; GUI.Label(rect, string.Format("{0}: {1} ({2})", lightEvent, commandBuffer.name, EditorUtility.FormatBytes(commandBuffer.sizeInBytes)), EditorStyles.miniLabel); if (GUI.Button(removeButtonRect, LightEditor.s_Styles.iconRemove, LightEditor.s_Styles.invisibleButton)) { light.RemoveCommandBuffer(lightEvent, commandBuffer); SceneView.RepaintAll(); GameView.RepaintAll(); GUIUtility.ExitGUI(); } } } } using (new GUILayout.HorizontalScope(new GUILayoutOption[0])) { GUILayout.FlexibleSpace(); if (GUILayout.Button("Remove all", EditorStyles.miniButton, new GUILayoutOption[0])) { light.RemoveAllCommandBuffers(); SceneView.RepaintAll(); GameView.RepaintAll(); } } EditorGUI.indentLevel--; } } } } }