Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 73ddaef

Browse files
committed
Fixed the color grading editor in versions older than 2018.1
1 parent 7cb1b88 commit 73ddaef

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

PostProcessing/Editor/Decorators/TrackballDecorator.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,14 @@ void DrawWheel(ref Vector4 value, bool overrideState, TrackballAttribute attr)
7272
s_Material = new Material(Shader.Find("Hidden/PostProcessing/Editor/Trackball")) { hideFlags = HideFlags.HideAndDontSave };
7373

7474
// Wheel texture
75+
#if UNITY_2018_1_OR_NEWER
76+
const RenderTextureReadWrite kReadWrite = RenderTextureReadWrite.sRGB;
77+
#else
78+
const RenderTextureReadWrite kReadWrite = RenderTextureReadWrite.Linear;
79+
#endif
80+
7581
var oldRT = RenderTexture.active;
76-
var rt = RenderTexture.GetTemporary((int)(size * scale), (int)(size * scale), 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
82+
var rt = RenderTexture.GetTemporary((int)(size * scale), (int)(size * scale), 0, RenderTextureFormat.ARGB32, kReadWrite);
7783
s_Material.SetFloat("_Offset", offset);
7884
s_Material.SetFloat("_DisabledState", overrideState ? 1f : 0.5f);
7985
s_Material.SetVector("_Resolution", new Vector2(size * scale, size * scale / 2f));

PostProcessing/Editor/Effects/ColorGradingEditor.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,14 @@ void DrawBackgroundTexture(Rect rect, int pass)
686686

687687
float scale = EditorGUIUtility.pixelsPerPoint;
688688

689+
#if UNITY_2018_1_OR_NEWER
690+
const RenderTextureReadWrite kReadWrite = RenderTextureReadWrite.sRGB;
691+
#else
692+
const RenderTextureReadWrite kReadWrite = RenderTextureReadWrite.Linear;
693+
#endif
694+
689695
var oldRt = RenderTexture.active;
690-
var rt = RenderTexture.GetTemporary(Mathf.CeilToInt(rect.width * scale), Mathf.CeilToInt(rect.height * scale), 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
696+
var rt = RenderTexture.GetTemporary(Mathf.CeilToInt(rect.width * scale), Mathf.CeilToInt(rect.height * scale), 0, RenderTextureFormat.ARGB32, kReadWrite);
691697
s_MaterialGrid.SetFloat("_DisabledState", GUI.enabled ? 1f : 0.5f);
692698
s_MaterialGrid.SetFloat("_PixelScaling", EditorGUIUtility.pixelsPerPoint);
693699

0 commit comments

Comments
 (0)