public static bool DrawHeader(string title, SerializedProperty group, SerializedProperty activeField, PostProcessEffectSettings target, Action resetAction, Action removeAction) { Assert.IsNotNull(group); Assert.IsNotNull(activeField); Assert.IsNotNull(target); var backgroundRect = GUILayoutUtility.GetRect(1f, 17f); var labelRect = backgroundRect; labelRect.xMin += 16f; labelRect.xMax -= 20f; var toggleRect = backgroundRect; toggleRect.y += 2f; toggleRect.width = 13f; toggleRect.height = 13f; var menuIcon = EditorGUIUtility.isProSkin ? Styling.paneOptionsIconDark : Styling.paneOptionsIconLight; var menuRect = new Rect(labelRect.xMax + 4f, labelRect.y + 4f, menuIcon.width, menuIcon.height); // Background rect should be full-width backgroundRect.xMin = 0f; backgroundRect.width += 4f; // Background float backgroundTint = EditorGUIUtility.isProSkin ? 0.1f : 1f; EditorGUI.DrawRect(backgroundRect, new Color(backgroundTint, backgroundTint, backgroundTint, 0.2f)); // Title using (new EditorGUI.DisabledScope(!activeField.boolValue)) EditorGUI.LabelField(labelRect, GetContent(title), EditorStyles.boldLabel); // Active checkbox activeField.serializedObject.Update(); activeField.boolValue = GUI.Toggle(toggleRect, activeField.boolValue, GUIContent.none, Styling.smallTickbox); activeField.serializedObject.ApplyModifiedProperties(); // Dropdown menu icon GUI.DrawTexture(menuRect, menuIcon); // Handle events var e = Event.current; if (e.type == EventType.MouseDown) { if (menuRect.Contains(e.mousePosition)) { ShowHeaderContextMenu(new Vector2(menuRect.x, menuRect.yMax), target, resetAction, removeAction); e.Use(); } else if (labelRect.Contains(e.mousePosition)) { if (e.button == 0) { group.isExpanded = !group.isExpanded; } else { ShowHeaderContextMenu(e.mousePosition, target, resetAction, removeAction); } e.Use(); } } return(group.isExpanded); }
static bool CanPaste(PostProcessEffectSettings target) { return(s_ClipboardContent != null && s_ClipboardContent.GetType() == target.GetType()); }
internal abstract void SetSettings(PostProcessEffectSettings settings);
public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { if (!enabledPost || !cam.postProfile) { data.buffer.Blit(cam.targets.renderTargetIdentifier, cam.cameraTarget); return; } #if UNITY_EDITOR if (!enableInEditor && RenderPipeline.renderingEditor) { data.buffer.Blit(cam.targets.renderTargetIdentifier, cam.cameraTarget); return; } #endif if (customLut) { data.buffer.SetGlobalTexture(ShaderIDs._CustomLut, customLut); data.buffer.EnableShaderKeyword("CUSTOM_LUT"); } else { data.buffer.DisableShaderKeyword("CUSTOM_LUT"); } NativeDictionary <ulong, ulong, PtrEqual> allSettings = new NativeDictionary <ulong, ulong, PtrEqual>(allPostEffects.Count, Unity.Collections.Allocator.Temp, new PtrEqual()); foreach (var i in cam.postProfile.settings) { allSettings.Add((ulong)MUnsafeUtility.GetManagedPtr(i.GetType()), (ulong)MUnsafeUtility.GetManagedPtr(i)); } postContext.camera = cam.cam; postContext.command = data.buffer; postContext.sourceFormat = RenderTextureFormat.ARGBHalf; postContext.autoExposureTexture = RuntimeUtilities.whiteTexture; postContext.bloomBufferNameID = -1; RenderTargetIdentifier source, dest; postContext.source = cam.targets.renderTargetIdentifier; postContext.destination = cam.targets.backupIdentifier; postContext.logHistogram.Generate(postContext); cyberGlitch.Render(data.buffer, ref cam.targets); foreach (var i in allPostEffects) { ulong settingsPtr; if (allSettings.Get((ulong)MUnsafeUtility.GetManagedPtr(i.type), out settingsPtr)) { PostProcessEffectSettings setting = MUnsafeUtility.GetObject <PostProcessEffectSettings>((void *)settingsPtr); if (i.needBlit && setting.active) { PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); postContext.source = source; postContext.destination = dest; } i.renderer.SetSettings(setting); i.renderer.Render(postContext); } } ; allSettings.Dispose(); // data.buffer.Blit(ShaderIDs._CameraMotionVectorsTexture, cam.cameraTarget); // data.buffer.BlitSRT(cam.cameraTarget, debugMat, 0); data.buffer.BlitSRT(cam.targets.renderTargetIdentifier, cam.cameraTarget, postContext.uberSheet.material, 0, postContext.uberSheet.properties); if (postContext.bloomBufferNameID > -1) { data.buffer.ReleaseTemporaryRT(postContext.bloomBufferNameID); } }
private static void SetActive(this PostProcessEffectSettings that, bool active) => that.active = active;
private static bool MatchPostProcessEffectSettings(this PostProcessEffectSettings that, string name) => QFSW.QC.Utilities.StringExtensions.Contains(that.name, name, StringComparison.CurrentCultureIgnoreCase);