fxvVolumeFogGroupEditor.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEditor;
  4. using UnityEditor.SceneManagement;
  5. using UnityEngine;
  6. namespace FXV
  7. {
  8. [CanEditMultipleObjects]
  9. [CustomEditor(typeof(VolumeFogGroup))]
  10. public class fxvVolumeFogGroupEditor : UnityEditor.Editor
  11. {
  12. public override void OnInspectorGUI()
  13. {
  14. GUIStyle wrapLabel = new GUIStyle(EditorStyles.boldLabel);
  15. wrapLabel.wordWrap = true;
  16. GUIStyle wrapLabelRed = new GUIStyle(EditorStyles.boldLabel);
  17. wrapLabelRed.wordWrap = true;
  18. wrapLabelRed.normal.textColor = new Color(0.8f, 0.2f, 0.0f);
  19. GUIStyle groupControlledLabel = new GUIStyle(EditorStyles.label);
  20. groupControlledLabel.wordWrap = true;
  21. groupControlledLabel.normal.textColor = new Color(0.7f, 0.7f, 0.7f);
  22. VolumeFogGroup groupObject = (VolumeFogGroup)target;
  23. EditorGUILayout.Separator();
  24. GUILayout.Label("Group Properties: ", EditorStyles.boldLabel);
  25. EditorGUILayout.Separator();
  26. GUILayout.Label("Enable color control by group. ", wrapLabel);
  27. EditorGUILayout.PropertyField(serializedObject.FindProperty("controlsColor"));
  28. if (groupObject.IsControllingColor())
  29. {
  30. EditorGUI.indentLevel++;
  31. EditorGUILayout.PropertyField(serializedObject.FindProperty("fogColor"));
  32. }
  33. EditorGUILayout.Separator();
  34. GUILayout.Label("Enable faloff param control by group. ", wrapLabel);
  35. EditorGUILayout.PropertyField(serializedObject.FindProperty("controlsFalloffParam"));
  36. if (groupObject.IsControllingFalloffParam())
  37. {
  38. EditorGUI.indentLevel++;
  39. EditorGUILayout.PropertyField(serializedObject.FindProperty("falloffParamMultiplier"));
  40. }
  41. EditorGUILayout.Separator();
  42. GUILayout.Label("Enable ligting control by group. ", wrapLabel);
  43. EditorGUILayout.PropertyField(serializedObject.FindProperty("controlsLighting"));
  44. if (groupObject.IsControllingLighting())
  45. {
  46. EditorGUI.indentLevel++;
  47. EditorGUILayout.PropertyField(serializedObject.FindProperty("affectedByLights"));
  48. if (groupObject.IsAffectedByLights())
  49. {
  50. EditorGUILayout.PropertyField(serializedObject.FindProperty("lightScatteringFactor"));
  51. EditorGUILayout.PropertyField(serializedObject.FindProperty("lightReflectivity"));
  52. EditorGUILayout.PropertyField(serializedObject.FindProperty("lightTransmission"));
  53. }
  54. EditorGUI.indentLevel--;
  55. }
  56. EditorGUILayout.Separator();
  57. if (GUI.changed)
  58. {
  59. serializedObject.ApplyModifiedProperties();
  60. EditorUtility.SetDirty(groupObject);
  61. if (!Application.isPlaying)
  62. {
  63. EditorSceneManager.MarkSceneDirty(groupObject.gameObject.scene);
  64. var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
  65. if (prefabStage != null)
  66. {
  67. EditorSceneManager.MarkSceneDirty(prefabStage.scene);
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }