forked from luva3178/se.su.dsv.mediastudio.livelinkunity
61 lines
1.6 KiB
C#
61 lines
1.6 KiB
C#
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
namespace Klak.Ndi.Editor {
|
|
|
|
[CanEditMultipleObjects]
|
|
[CustomEditor(typeof(NdiSender))]
|
|
sealed class NdiSenderEditor : UnityEditor.Editor
|
|
{
|
|
static class Labels
|
|
{
|
|
public static Label NdiName = "NDI Name";
|
|
}
|
|
|
|
#pragma warning disable CS0649
|
|
|
|
AutoProperty _ndiName;
|
|
AutoProperty _keepAlpha;
|
|
AutoProperty _captureMethod;
|
|
AutoProperty _sourceCamera;
|
|
AutoProperty _sourceTexture;
|
|
|
|
#pragma warning restore
|
|
|
|
void OnEnable() => AutoProperty.Scan(this);
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
serializedObject.Update();
|
|
|
|
// NDI Name
|
|
if (_captureMethod.Target.hasMultipleDifferentValues ||
|
|
_captureMethod.Target.enumValueIndex != (int)CaptureMethod.GameView)
|
|
EditorGUILayout.DelayedTextField(_ndiName, Labels.NdiName);
|
|
|
|
// Keep Alpha
|
|
EditorGUILayout.PropertyField(_keepAlpha);
|
|
|
|
// Capture Method
|
|
EditorGUILayout.PropertyField(_captureMethod);
|
|
|
|
EditorGUI.indentLevel++;
|
|
|
|
// Source Camera
|
|
if (_captureMethod.Target.hasMultipleDifferentValues ||
|
|
_captureMethod.Target.enumValueIndex == (int)CaptureMethod.Camera)
|
|
EditorGUILayout.PropertyField(_sourceCamera);
|
|
|
|
// Source Texture
|
|
if (_captureMethod.Target.hasMultipleDifferentValues ||
|
|
_captureMethod.Target.enumValueIndex == (int)CaptureMethod.Texture)
|
|
EditorGUILayout.PropertyField(_sourceTexture);
|
|
|
|
EditorGUI.indentLevel--;
|
|
|
|
serializedObject.ApplyModifiedProperties();
|
|
}
|
|
}
|
|
|
|
} // namespace Klak.Ndi.Editor
|