CaptureFromCamera360Editor.cs 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. using UnityEditor;
  4. //-----------------------------------------------------------------------------
  5. // Copyright 2012-2017 RenderHeads Ltd. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. namespace RenderHeads.Media.AVProMovieCapture.Editor
  8. {
  9. [CanEditMultipleObjects]
  10. [CustomEditor(typeof(CaptureFromCamera360))]
  11. public class CaptureFromCamera360Editor : CaptureBaseEditor
  12. {
  13. //private CaptureFromCamera360 _capture;
  14. private SerializedProperty _propCamera;
  15. private SerializedProperty _propRenderResolution;
  16. private SerializedProperty _propRenderSize;
  17. private SerializedProperty _propAntiAliasing;
  18. private SerializedProperty _propCubemapResolution;
  19. private SerializedProperty _propCubemapDepth;
  20. private SerializedProperty _propSupportGUI;
  21. private SerializedProperty _propSupporCameraRotation;
  22. private SerializedProperty _propStereoRendering;
  23. private SerializedProperty _propIPD;
  24. protected override void OnEnable()
  25. {
  26. base.OnEnable();
  27. //_capture = (this.target) as CaptureFromCamera360;
  28. _propCamera = serializedObject.FindProperty("_camera");
  29. _propRenderResolution = serializedObject.FindProperty("_renderResolution");
  30. _propRenderSize = serializedObject.FindProperty("_renderSize");
  31. _propAntiAliasing = serializedObject.FindProperty("_renderAntiAliasing");
  32. _propCubemapResolution = serializedObject.FindProperty("_cubemapResolution");
  33. _propCubemapDepth = serializedObject.FindProperty("_cubemapDepth");
  34. _propSupportGUI = serializedObject.FindProperty("_supportGUI");
  35. _propSupporCameraRotation = serializedObject.FindProperty("_supportCameraRotation");
  36. _propStereoRendering = serializedObject.FindProperty("_stereoRendering");
  37. _propIPD = serializedObject.FindProperty("_ipd");
  38. }
  39. protected void GUI_Camera()
  40. {
  41. EditorGUILayout.PropertyField(_propCamera);
  42. EditorUtils.EnumAsDropdown("Resolution", _propRenderResolution, CaptureBaseEditor.ResolutionStrings);
  43. if (_propRenderResolution.enumValueIndex == (int)CaptureBase.Resolution.Custom)
  44. {
  45. EditorGUILayout.PropertyField(_propRenderSize, new GUIContent("Size"));
  46. _propRenderSize.vector2Value = new Vector2(Mathf.Clamp((int)_propRenderSize.vector2Value.x, 1, NativePlugin.MaxRenderWidth), Mathf.Clamp((int)_propRenderSize.vector2Value.y, 1, NativePlugin.MaxRenderHeight));
  47. }
  48. {
  49. string currentAA = "None";
  50. if (QualitySettings.antiAliasing > 1)
  51. {
  52. currentAA = QualitySettings.antiAliasing.ToString() + "x";
  53. }
  54. EditorUtils.IntAsDropdown("Anti-aliasing", _propAntiAliasing, new string[] { "Current (" + currentAA + ")", "None", "2x", "4x", "8x" }, new int[] { -1, 1, 2, 4, 8 });
  55. }
  56. EditorUtils.IntAsDropdown("Cubemap Resolution", _propCubemapResolution, new string[] { "256", "512", "1024", "2048", "4096", "8192" }, new int[] { 256, 512, 1024, 2048, 4096, 8192 });
  57. EditorUtils.IntAsDropdown("Cubemap Depth", _propCubemapDepth, new string[] { "0", "16", "24" }, new int[] { 0, 16, 24 });
  58. EditorGUILayout.PropertyField(_propSupportGUI, new GUIContent("Capture GUI"));
  59. EditorGUILayout.PropertyField(_propSupporCameraRotation);
  60. EditorGUILayout.PropertyField(_propStereoRendering);
  61. if (_propStereoRendering.enumValueIndex != (int)StereoPacking.None)
  62. {
  63. EditorGUILayout.PropertyField(_propIPD, new GUIContent("Interpupillary distance"));
  64. }
  65. }
  66. protected override void GUI_User()
  67. {
  68. if (_baseCapture != null && !_baseCapture.IsCapturing())
  69. {
  70. serializedObject.Update();
  71. bool boolTrue = true;
  72. EditorUtils.DrawSection("Capture From Camera 360+Stereo", ref boolTrue, GUI_Camera);
  73. if (serializedObject.ApplyModifiedProperties())
  74. {
  75. EditorUtility.SetDirty(target);
  76. }
  77. }
  78. }
  79. }
  80. }
  81. #endif