private void CommandBufferGUI() { if (this.targets.Length != 1) { return; } Camera target = this.target as Camera; if ((UnityEngine.Object)target == (UnityEngine.Object)null) { return; } int commandBufferCount = target.commandBufferCount; if (commandBufferCount == 0) { return; } this.m_CommandBuffersShown = GUILayout.Toggle(this.m_CommandBuffersShown, GUIContent.Temp(commandBufferCount.ToString() + " command buffers"), EditorStyles.foldout, new GUILayoutOption[0]); if (!this.m_CommandBuffersShown) { return; } ++EditorGUI.indentLevel; foreach (CameraEvent evt in (CameraEvent[])Enum.GetValues(typeof(CameraEvent))) { foreach (CommandBuffer commandBuffer in target.GetCommandBuffers(evt)) { using (new GUILayout.HorizontalScope(new GUILayoutOption[0])) { Rect rect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel); rect.xMin += EditorGUI.indent; Rect removeButtonRect = CameraEditor.GetRemoveButtonRect(rect); rect.xMax = removeButtonRect.x; GUI.Label(rect, string.Format("{0}: {1} ({2})", (object)evt, (object)commandBuffer.name, (object)EditorUtility.FormatBytes(commandBuffer.sizeInBytes)), EditorStyles.miniLabel); if (GUI.Button(removeButtonRect, CameraEditor.Styles.iconRemove, CameraEditor.Styles.invisibleButton)) { target.RemoveCommandBuffer(evt, 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])) { target.RemoveAllCommandBuffers(); SceneView.RepaintAll(); GameView.RepaintAll(); } } --EditorGUI.indentLevel; }
private void CommandBufferGUI() { if (base.targets.Length == 1) { Camera camera = base.target as Camera; if (!(camera == null)) { int commandBufferCount = camera.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++; CameraEvent[] array = (CameraEvent[])Enum.GetValues(typeof(CameraEvent)); for (int i = 0; i < array.Length; i++) { CameraEvent cameraEvent = array[i]; CommandBuffer[] commandBuffers = camera.GetCommandBuffers(cameraEvent); 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 = CameraEditor.GetRemoveButtonRect(rect); rect.xMax = removeButtonRect.x; GUI.Label(rect, string.Format("{0}: {1} ({2})", cameraEvent, commandBuffer.name, EditorUtility.FormatBytes(commandBuffer.sizeInBytes)), EditorStyles.miniLabel); if (GUI.Button(removeButtonRect, CameraEditor.Styles.iconRemove, CameraEditor.Styles.invisibleButton)) { camera.RemoveCommandBuffer(cameraEvent, 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])) { camera.RemoveAllCommandBuffers(); SceneView.RepaintAll(); GameView.RepaintAll(); } } EditorGUI.indentLevel--; } } } } }