Skip to content

Commit

Permalink
add help and safety checks for linear vs gamma when using NDI
Browse files Browse the repository at this point in the history
  • Loading branch information
Stella Cannefax committed Sep 20, 2019
1 parent 1cfc0d5 commit a21242c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Editor/Scripts/Inspectors/RenderSharingEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ public void OnEnable()
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorUtils.Help(s_HelpText);

DrawHelp();

EditorGUILayout.PropertyField(m_ProtocolProperty);
var protocol = (VideoSharingProtocol) m_ProtocolProperty.enumValueIndex;

if (protocol != m_PreviousProtocol)
{
s_HelpText = GetHelpText();
Expand All @@ -50,10 +52,29 @@ public override void OnInspectorGUI()

EditorGUILayout.PropertyField(m_CameraProperty);


serializedObject.ApplyModifiedProperties();
m_PreviousProtocol = (VideoSharingProtocol) m_ProtocolProperty.enumValueIndex;
}

void DrawHelp()
{
const string ColorSpaceWarningText = "Please use Linear color mode with NDI! (see Player Settings)\n" +
"Otherwise, you will get washed out colors.\n\n" +
"Alternately, you can remove the LinearToGammaSpace conversion " +
"in the NDI Sender's .shader";

var protocol = (VideoSharingProtocol) m_ProtocolProperty.enumValueIndex;
if (protocol == VideoSharingProtocol.NDI && PlayerSettings.colorSpace == ColorSpace.Gamma)
{
EditorGUILayout.HelpBox(ColorSpaceWarningText, MessageType.Warning);
if(GUILayout.Button("Set Linear Color"))
PlayerSettings.colorSpace = ColorSpace.Linear;
}
else
EditorUtils.Help(s_HelpText);
}

string GetHelpText()
{
const string HelpText = "This component ensures that a {0} component has been " +
Expand Down

0 comments on commit a21242c

Please sign in to comment.