Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Editor Issue for LiftGammeGain and ShadowsMidtonesHighlights #6813

Merged
merged 3 commits into from
Feb 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Initial commit
  • Loading branch information
johnpars committed Jan 24, 2022
commit e490a4565bbc55cc62571f6951e58314224bbea0
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@ sealed class TrackballUIDrawer
static GUIStyle s_WheelThumb;
static Vector2 s_WheelThumbSize;
static Material s_Material;
static bool s_MaterialConfigured;

Func<Vector4, Vector3> m_ComputeFunc;
bool m_ResetState;
Vector2 m_CursorPos;

static TrackballUIDrawer()
{
if (s_Material == null)
s_Material = new Material(Shader.Find("Hidden/HD PostProcessing/Editor/Trackball")) { hideFlags = HideFlags.HideAndDontSave };
}

public void OnGUI(SerializedProperty property, SerializedProperty overrideState, GUIContent title, Func<Vector4, Vector3> computeFunc)
{
if (property.propertyType != SerializedPropertyType.Vector4)
Expand All @@ -30,6 +25,13 @@ public void OnGUI(SerializedProperty property, SerializedProperty overrideState,
return;
}

if (!s_MaterialConfigured)
{
// Initialization of materials with Shader.Find from static constructors is not allowed.
s_Material = new Material(Shader.Find("Hidden/HD PostProcessing/Editor/Trackball")) { hideFlags = HideFlags.HideAndDontSave };
s_MaterialConfigured = true;
}

m_ComputeFunc = computeFunc;
var value = property.vector4Value;

Expand Down