RSlysz
6 年前
当前提交
03c9bd3d
共有 29 个文件被更改,包括 860 次插入 和 1256 次删除
-
4com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.ProbeUtility.cs
-
69com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs
-
509com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
-
59com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs
-
88com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeEditor.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeEditor.cs.meta
-
211com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Handles.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Handles.cs.meta
-
133com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.cs.meta
-
34com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDProbe.cs
-
16com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs
-
4com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ProxyVolumeUI.cs
-
2com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.ContextualMenu.cs
-
25com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
-
84com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeEditor.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeEditor.cs.meta
-
238com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs
-
98com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Handles.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Handles.cs.meta
-
108com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Skin.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Skin.cs.meta
-
70com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.cs
-
11com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.cs.meta
-
312com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Drawers.cs
-
0/com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs.meta
-
0/com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.ContextualMenu.cs.meta
-
0/com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.ContextualMenu.cs
|
|||
using System; |
|||
using UnityEditor.AnimatedValues; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine.Rendering; |
|||
|
|||
partial class PlanarReflectionProbeUI : BaseUI<SerializedPlanarReflectionProbe> |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine.Rendering; |
|||
using CED = CoreEditorDrawer<HDProbeUI, SerializedHDProbe>; |
|||
|
|||
partial class PlanarReflectionProbeUI : HDProbeUI |
|||
const int k_AnimBoolFields = 6; |
|||
static readonly int k_ReflectionProbeModeModeCount = Enum.GetValues(typeof(ReflectionProbeMode)).Length; |
|||
static readonly int k_AnimBoolTotal = k_AnimBoolFields + k_ReflectionProbeModeModeCount; |
|||
static readonly GUIContent overrideFieldOfViewContent = CoreEditorUtils.GetContent("Override Field Of View"); |
|||
static readonly GUIContent fieldOfViewSolidAngleContent = CoreEditorUtils.GetContent("Field Of View"); |
|||
public InfluenceVolumeUI influenceVolume = new InfluenceVolumeUI(); |
|||
public FrameSettingsUI frameSettings = new FrameSettingsUI(); |
|||
public ReflectionProxyVolumeComponentUI reflectionProxyVolume = new ReflectionProxyVolumeComponentUI(); |
|||
new SerializedPlanarReflectionProbe data; |
|||
public AnimBool isSectionExpandedInfluenceSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount]; } } |
|||
public AnimBool isSectionExpandedCaptureSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 1]; } } |
|||
public static CED.IDrawer Inspector; |
|||
|
|||
public static readonly CED.IDrawer SectionFoldoutCaptureSettings = CED.FoldoutGroup( |
|||
"Capture Settings", |
|||
(s, d, o) => s.isSectionExpandedCaptureSettings, |
|||
FoldoutOption.Indent, |
|||
CED.Action(Drawer_SectionCaptureSettings) |
|||
//CED.FadeGroup(
|
|||
// (s, d, o, i) =>
|
|||
// {
|
|||
// switch (i)
|
|||
// {
|
|||
// default:
|
|||
// case 0: return s.isSectionExpandedCaptureMirrorSettings;
|
|||
// case 1: return s.isSectionExpandedCaptureStaticSettings;
|
|||
// }
|
|||
// },
|
|||
// FadeOption.None,
|
|||
// SectionCaptureMirrorSettings,
|
|||
// SectionCaptureStaticSettings)
|
|||
); |
|||
public AnimBool isSectionExpandedCaptureMirrorSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 2]; } } |
|||
public AnimBool isSectionExpandedCaptureStaticSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 3]; } } |
|||
public AnimBool isSectionExpendedProxyVolume { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 4]; } } |
|||
public AnimBool isSectionExpendedAdditionalSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 5]; } } |
|||
|
|||
public bool showCaptureHandles { get; set; } |
|||
|
|||
public PlanarReflectionProbeUI() |
|||
: base(k_AnimBoolTotal) |
|||
static PlanarReflectionProbeUI() |
|||
isSectionExpandedInfluenceSettings.value = true; |
|||
isSectionExpandedCaptureSettings.value = true; |
|||
isSectionExpendedProxyVolume.value = true; |
|||
isSectionExpendedAdditionalSettings.value = false; |
|||
Inspector = CED.Group( |
|||
CED.Action(Drawer_Toolbars), |
|||
CED.space, |
|||
ProxyVolumeSettings, |
|||
CED.Select( |
|||
(s, d, o) => s.influenceVolume, |
|||
(s, d, o) => d.influenceVolume, |
|||
InfluenceVolumeUI.SectionFoldoutShapePlanar |
|||
), |
|||
CED.Action(Drawer_DifferentShapeError), |
|||
SectionFoldoutCaptureSettings, |
|||
SectionFoldoutAdditionalSettings, |
|||
CED.Select( |
|||
(s, d, o) => s.frameSettings, |
|||
(s, d, o) => d.frameSettings, |
|||
FrameSettingsUI.Inspector |
|||
), |
|||
CED.space, |
|||
CED.Action(Drawer_SectionBakeButton) |
|||
); |
|||
public AnimBool IsSectionExpandedReflectionProbeMode(ReflectionProbeMode mode) |
|||
protected static void Drawer_SectionCaptureSettings(HDProbeUI s, SerializedHDProbe d, Editor o) |
|||
return m_AnimBools[(int)mode]; |
|||
SerializedPlanarReflectionProbe serialized = (SerializedPlanarReflectionProbe)d; |
|||
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset; |
|||
GUI.enabled = false; |
|||
EditorGUILayout.LabelField( |
|||
CoreEditorUtils.GetContent("Probe Texture Size (Set By HDRP)"), |
|||
CoreEditorUtils.GetContent(hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionTextureSize.ToString()), |
|||
EditorStyles.label); |
|||
EditorGUILayout.Toggle( |
|||
CoreEditorUtils.GetContent("Probe Compression (Set By HDRP)"), |
|||
hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionCacheCompressed); |
|||
GUI.enabled = true; |
|||
|
|||
//Rect fieldOfViewRect = EditorGUILayout.GetControlRect();
|
|||
//Rect overrideFieldOfViewRect = new Rect(fieldOfViewRect.x - fieldOfViewRect.height - 5, fieldOfViewRect.y - 1, fieldOfViewRect.height, fieldOfViewRect.height);
|
|||
bool on = serialized.overrideFieldOfView.boolValue; |
|||
EditorGUI.BeginChangeCheck(); |
|||
on = EditorGUILayout.Toggle(overrideFieldOfViewContent, on); |
|||
if (on) |
|||
{ |
|||
serialized.fieldOfViewOverride.floatValue = EditorGUILayout.FloatField(fieldOfViewSolidAngleContent, serialized.fieldOfViewOverride.floatValue); |
|||
} |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
serialized.overrideFieldOfView.boolValue = on; |
|||
serialized.Apply(); |
|||
} |
|||
|
|||
GUI.enabled = false; |
|||
EditorGUILayout.LabelField(resolutionContent, CoreEditorUtils.GetContent(((int)hdrp.GetRenderPipelineSettings().lightLoopSettings.reflectionCubemapSize).ToString())); |
|||
EditorGUILayout.LabelField(shadowDistanceContent, EditorStyles.label); |
|||
EditorGUILayout.LabelField(cullingMaskContent, EditorStyles.label); |
|||
EditorGUILayout.LabelField(useOcclusionCullingContent, EditorStyles.label); |
|||
EditorGUILayout.LabelField(nearClipCullingContent, EditorStyles.label); |
|||
EditorGUILayout.LabelField(farClipCullingContent, EditorStyles.label); |
|||
GUI.enabled = true; |
|||
public override void Reset(SerializedPlanarReflectionProbe data, UnityAction repaint) |
|||
internal PlanarReflectionProbeUI() |
|||
reflectionProxyVolume.Reset(data.reflectionProxyVolume, repaint); |
|||
frameSettings.Reset(data.frameSettings, repaint); |
|||
influenceVolume.Reset(data.influenceVolume, repaint); |
|||
base.Reset(data, repaint); |
|||
toolBars = new[] { ToolBar.Influence }; |
|||
data = base.data as SerializedPlanarReflectionProbe; |
|||
|
|||
for (var i = 0; i < k_ReflectionProbeModeModeCount; i++) |
|||
m_AnimBools[i].target = i == data.mode.intValue; |
|||
|
|||
|
|||
reflectionProxyVolume.Update(); |
|||
frameSettings.Update(); |
|||
influenceVolume.Update(); |
|||
base.Update(); |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Reflection; |
|||
using UnityEditor.Callbacks; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
abstract class HDProbeEditor : Editor |
|||
{ |
|||
static Dictionary<HDProbe, HDProbeUI> s_StateMap = new Dictionary<HDProbe, HDProbeUI>(); |
|||
|
|||
internal static bool TryGetUIStateFor(HDProbe p, out HDProbeUI r) |
|||
{ |
|||
return s_StateMap.TryGetValue(p, out r); |
|||
} |
|||
|
|||
internal abstract HDProbe GetTarget(Object editorTarget); |
|||
|
|||
protected SerializedHDProbe m_SerializedHDProbe; |
|||
HDProbeUI m_UIState = new HDProbeUI(); |
|||
HDProbeUI[] m_UIHandleState; |
|||
protected HDProbe[] m_TypedTargets; |
|||
|
|||
protected virtual void OnEnable() |
|||
{ |
|||
m_UIState.Reset(m_SerializedHDProbe, Repaint); |
|||
|
|||
m_TypedTargets = new HDProbe[targets.Length]; |
|||
m_UIHandleState = new HDProbeUI[m_TypedTargets.Length]; |
|||
for (var i = 0; i < m_TypedTargets.Length; i++) |
|||
{ |
|||
m_TypedTargets[i] = GetTarget(targets[i]); |
|||
m_UIHandleState[i] = new HDProbeUI(); |
|||
m_UIHandleState[i].Reset(m_SerializedHDProbe, null); |
|||
|
|||
s_StateMap[m_TypedTargets[i]] = m_UIHandleState[i]; |
|||
} |
|||
} |
|||
|
|||
protected virtual void OnDisable() |
|||
{ |
|||
for (var i = 0; i < m_TypedTargets.Length; i++) |
|||
s_StateMap.Remove(m_TypedTargets[i]); |
|||
} |
|||
|
|||
protected abstract void Draw(HDProbeUI s, SerializedHDProbe serialized, Editor owner); |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
var s = m_UIState; |
|||
var d = m_SerializedHDProbe; |
|||
var o = this; |
|||
|
|||
s.Update(); |
|||
d.Update(); |
|||
|
|||
Draw(s, d, o); |
|||
|
|||
d.Apply(); |
|||
} |
|||
|
|||
protected void OnSceneGUI() |
|||
{ |
|||
for (var i = 0; i < m_TypedTargets.Length; i++) |
|||
{ |
|||
m_UIHandleState[i].Update(); |
|||
m_UIHandleState[i].influenceVolume.showInfluenceHandles = m_UIState.influenceVolume.isSectionExpandedShape.target; |
|||
m_UIHandleState[i].showCaptureHandles = m_UIState.isSectionExpandedCaptureSettings.target; |
|||
HDProbeUI.DrawHandles(m_UIHandleState[i], m_TypedTargets[i], this); |
|||
} |
|||
|
|||
//[TODO]check
|
|||
//SceneViewOverlay_Window(_.GetContent("Planar Probe"), OnOverlayGUI, -100, target);
|
|||
|
|||
HDProbeUI.DoShortcutKey(this); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7f189b572cf7bf04d9f1976dcc75c942 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditorInternal; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
using _ = CoreEditorUtils; |
|||
using CED = CoreEditorDrawer<HDProbeUI, SerializedHDProbe>; |
|||
|
|||
partial class HDProbeUI |
|||
{ |
|||
public static readonly CED.IDrawer SectionProbeModeSettings; |
|||
public static readonly CED.IDrawer ProxyVolumeSettings = CED.FoldoutGroup( |
|||
proxySettingsHeader, |
|||
(s, d, o) => s.isSectionExpendedProxyVolume, |
|||
FoldoutOption.Indent, |
|||
CED.Action(Drawer_SectionProxySettings) |
|||
); |
|||
public static readonly CED.IDrawer SectionProbeModeBakedSettings = CED.noop; |
|||
public static readonly CED.IDrawer SectionProbeModeRealtimeSettings = CED.Action(Drawer_SectionProbeModeRealtimeSettings); |
|||
public static readonly CED.IDrawer SectionBakeButton = CED.Action(Drawer_SectionBakeButton); |
|||
|
|||
public static readonly CED.IDrawer SectionFoldoutAdditionalSettings = CED.FoldoutGroup( |
|||
additionnalSettingsHeader, |
|||
(s, d, o) => s.isSectionExpendedAdditionalSettings, |
|||
FoldoutOption.Indent, |
|||
CED.Action(Drawer_SectionCustomSettings) |
|||
); |
|||
|
|||
static HDProbeUI() |
|||
{ |
|||
SectionProbeModeSettings = CED.Group( |
|||
CED.Action(Drawer_FieldCaptureType), |
|||
CED.FadeGroup( |
|||
(s, d, o, i) => s.IsSectionExpandedReflectionProbeMode((ReflectionProbeMode)i), |
|||
FadeOption.Indent, |
|||
SectionProbeModeBakedSettings, |
|||
SectionProbeModeRealtimeSettings |
|||
) |
|||
); |
|||
} |
|||
|
|||
protected const EditMode.SceneViewEditMode EditBaseShape = EditMode.SceneViewEditMode.ReflectionProbeBox; |
|||
protected const EditMode.SceneViewEditMode EditInfluenceShape = EditMode.SceneViewEditMode.GridBox; |
|||
protected const EditMode.SceneViewEditMode EditInfluenceNormalShape = EditMode.SceneViewEditMode.Collider; |
|||
protected const EditMode.SceneViewEditMode EditCenter = EditMode.SceneViewEditMode.ReflectionProbeOrigin; |
|||
|
|||
protected static void Drawer_DifferentShapeError(HDProbeUI s, SerializedHDProbe d, Editor o) |
|||
{ |
|||
var proxy = d.proxyVolumeReference.objectReferenceValue as ReflectionProxyVolumeComponent; |
|||
if (proxy != null |
|||
&& (int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex |
|||
&& proxy.proxyVolume.shape != ProxyShape.Infinite) |
|||
{ |
|||
EditorGUILayout.HelpBox( |
|||
proxyInfluenceShapeMismatchHelpBoxText, |
|||
MessageType.Error, |
|||
true |
|||
); |
|||
} |
|||
} |
|||
|
|||
static GUIStyle disabled; |
|||
static void PropertyField(SerializedProperty prop, GUIContent content) |
|||
{ |
|||
if(prop != null) |
|||
{ |
|||
EditorGUILayout.PropertyField(prop, content); |
|||
} |
|||
else |
|||
{ |
|||
if(disabled == null) |
|||
{ |
|||
disabled = new GUIStyle(GUI.skin.label); |
|||
disabled.onNormal.textColor *= 0.5f; |
|||
} |
|||
EditorGUILayout.LabelField(content, disabled); |
|||
} |
|||
} |
|||
|
|||
protected static void Drawer_SectionBakeButton(HDProbeUI s, SerializedHDProbe d, Editor o) |
|||
{ |
|||
if (d.target is HDAdditionalReflectionData) |
|||
EditorReflectionSystemGUI.DrawBakeButton((ReflectionProbeMode)d.mode.intValue, ((HDAdditionalReflectionData)d.target).reflectionProbe); |
|||
else //PlanarReflectionProbe
|
|||
EditorReflectionSystemGUI.DrawBakeButton((ReflectionProbeMode)d.mode.intValue, d.target as PlanarReflectionProbe); |
|||
} |
|||
|
|||
static void Drawer_SectionProbeModeRealtimeSettings(HDProbeUI s, SerializedHDProbe d, Editor o) |
|||
{ |
|||
GUI.enabled = false; |
|||
EditorGUILayout.PropertyField(d.refreshMode, _.GetContent("Refresh Mode")); |
|||
GUI.enabled = true; |
|||
} |
|||
|
|||
protected static void Drawer_SectionProxySettings(HDProbeUI s, SerializedHDProbe d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.proxyVolumeReference, _.GetContent("Reference")); |
|||
|
|||
if (d.proxyVolumeReference.objectReferenceValue != null) |
|||
{ |
|||
var proxy = (ReflectionProxyVolumeComponent)d.proxyVolumeReference.objectReferenceValue; |
|||
if ((int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex |
|||
&& proxy.proxyVolume.shape != ProxyShape.Infinite) |
|||
EditorGUILayout.HelpBox( |
|||
proxyInfluenceShapeMismatchHelpBoxText, |
|||
MessageType.Error, |
|||
true |
|||
); |
|||
} |
|||
else |
|||
{ |
|||
EditorGUILayout.HelpBox( |
|||
noProxyHelpBoxText, |
|||
MessageType.Info, |
|||
true |
|||
); |
|||
} |
|||
} |
|||
|
|||
protected static void Drawer_SectionCustomSettings(HDProbeUI s, SerializedHDProbe d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.weight, weightContent); |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
EditorGUILayout.PropertyField(d.multiplier, multiplierContent); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
d.multiplier.floatValue = Mathf.Max(0.0f, d.multiplier.floatValue); |
|||
} |
|||
|
|||
static void Drawer_FieldCaptureType(HDProbeUI s, SerializedHDProbe d, Editor o) |
|||
{ |
|||
GUI.enabled = false; |
|||
EditorGUILayout.PropertyField(d.mode, fieldCaptureTypeContent); |
|||
GUI.enabled = true; |
|||
} |
|||
|
|||
|
|||
|
|||
protected enum ToolBar { Influence, Capture } |
|||
protected ToolBar[] toolBars = new ToolBar[] { ToolBar.Influence, ToolBar.Capture }; |
|||
|
|||
static readonly EditMode.SceneViewEditMode[] k_InfluenceToolbar_SceneViewEditModes = |
|||
{ |
|||
EditBaseShape, |
|||
EditInfluenceShape, |
|||
EditInfluenceNormalShape, |
|||
}; |
|||
|
|||
static readonly EditMode.SceneViewEditMode[] k_CaptureToolbar_SceneViewEditModes = |
|||
{ |
|||
EditCenter |
|||
}; |
|||
|
|||
protected static void Drawer_Toolbars(HDProbeUI s, SerializedHDProbe d, Editor o) |
|||
{ |
|||
GUILayout.BeginHorizontal(); |
|||
GUILayout.FlexibleSpace(); |
|||
GUI.changed = false; |
|||
|
|||
foreach(ToolBar toolBar in s.toolBars) |
|||
{ |
|||
switch (toolBar) |
|||
{ |
|||
case ToolBar.Influence: |
|||
EditMode.DoInspectorToolbar(k_InfluenceToolbar_SceneViewEditModes, influenceToolbar_Contents, GetBoundsGetter(o), o); |
|||
break; |
|||
case ToolBar.Capture: |
|||
EditMode.DoInspectorToolbar(k_CaptureToolbar_SceneViewEditModes, captureToolbar_Contents, GetBoundsGetter(o), o); |
|||
break; |
|||
} |
|||
} |
|||
GUILayout.FlexibleSpace(); |
|||
GUILayout.EndHorizontal(); |
|||
} |
|||
|
|||
|
|||
static public void Drawer_InfluenceToolBarButton(int buttonIndex, Editor owner, params GUILayoutOption[] styles) |
|||
{ |
|||
if (GUILayout.Button(influenceToolbar_Contents[buttonIndex], styles)) |
|||
{ |
|||
EditMode.ChangeEditMode(k_InfluenceToolbar_SceneViewEditModes[buttonIndex], GetBoundsGetter(owner)(), owner); |
|||
} |
|||
} |
|||
|
|||
static public void Drawer_CaptureToolBarButton(int buttonIndex, Editor owner, params GUILayoutOption[] styles) |
|||
{ |
|||
if (GUILayout.Button(captureToolbar_Contents[buttonIndex], styles)) |
|||
{ |
|||
EditMode.ChangeEditMode(k_CaptureToolbar_SceneViewEditModes[buttonIndex], GetBoundsGetter(owner)(), owner); |
|||
} |
|||
} |
|||
|
|||
static Func<Bounds> GetBoundsGetter(Editor o) |
|||
{ |
|||
return () => |
|||
{ |
|||
var bounds = new Bounds(); |
|||
foreach (Component targetObject in o.targets) |
|||
{ |
|||
var rp = targetObject.transform; |
|||
var b = rp.position; |
|||
bounds.Encapsulate(b); |
|||
} |
|||
return bounds; |
|||
}; |
|||
} |
|||
|
|||
static readonly KeyCode[] k_ShortCutKeys = |
|||
{ |
|||
KeyCode.Alpha1, |
|||
KeyCode.Alpha2, |
|||
KeyCode.Alpha3, |
|||
}; |
|||
|
|||
public static void DoShortcutKey(Editor owner) |
|||
{ |
|||
var evt = Event.current; |
|||
if (evt.type != EventType.KeyDown || !evt.shift) |
|||
return; |
|||
|
|||
for (var i = 0; i < k_ShortCutKeys.Length; ++i) |
|||
{ |
|||
if (evt.keyCode == k_ShortCutKeys[i]) |
|||
{ |
|||
var mode = EditMode.editMode == k_InfluenceToolbar_SceneViewEditModes[i] |
|||
? EditMode.SceneViewEditMode.None |
|||
: k_InfluenceToolbar_SceneViewEditModes[i]; |
|||
EditMode.ChangeEditMode(mode, GetBoundsGetter(owner)(), owner); |
|||
evt.Use(); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEditorInternal; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
partial class HDProbeUI |
|||
{ |
|||
|
|||
internal static void DrawHandles(HDProbeUI s, HDProbe d, Editor o) |
|||
{ |
|||
var mat = Matrix4x4.TRS(d.transform.position, d.transform.rotation, Vector3.one); |
|||
|
|||
switch (EditMode.editMode) |
|||
{ |
|||
case EditBaseShape: |
|||
InfluenceVolumeUI.DrawHandles_EditBase(s.influenceVolume, d.influenceVolume, o, mat, d); |
|||
break; |
|||
case EditInfluenceShape: |
|||
InfluenceVolumeUI.DrawHandles_EditInfluence(s.influenceVolume, d.influenceVolume, o, mat, d); |
|||
break; |
|||
case EditInfluenceNormalShape: |
|||
InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(s.influenceVolume, d.influenceVolume, o, mat, d); |
|||
break; |
|||
//[TODO]
|
|||
//case EditCenter:
|
|||
//{
|
|||
// EditorGUI.BeginChangeCheck();
|
|||
// var m = Handles.matrix;
|
|||
// Handles.matrix = mat;
|
|||
// var p = Handles.PositionHandle(d.captureLocalPosition, d.transform.rotation);
|
|||
// if (EditorGUI.EndChangeCheck())
|
|||
// {
|
|||
// Undo.RecordObject(d, "Translate Capture Position");
|
|||
// d.captureLocalPosition = p;
|
|||
// EditorUtility.SetDirty(d);
|
|||
// }
|
|||
// Handles.matrix = m;
|
|||
// break;
|
|||
//}
|
|||
} |
|||
} |
|||
|
|||
[DrawGizmo(GizmoType.Selected)] |
|||
internal static void DrawGizmos(HDProbe d, GizmoType gizmoType) |
|||
{ |
|||
HDProbeUI s; |
|||
if (!HDProbeEditor.TryGetUIStateFor(d, out s)) |
|||
return; |
|||
|
|||
var mat = Matrix4x4.TRS(d.transform.position, d.transform.rotation, Vector3.one); |
|||
|
|||
switch (EditMode.editMode) |
|||
{ |
|||
case EditBaseShape: |
|||
InfluenceVolumeUI.DrawGizmos( |
|||
s.influenceVolume, |
|||
d.influenceVolume, |
|||
mat, |
|||
InfluenceVolumeUI.HandleType.Base, |
|||
InfluenceVolumeUI.HandleType.All); |
|||
break; |
|||
case EditInfluenceShape: |
|||
InfluenceVolumeUI.DrawGizmos( |
|||
s.influenceVolume, |
|||
d.influenceVolume, |
|||
mat, |
|||
InfluenceVolumeUI.HandleType.Influence, |
|||
InfluenceVolumeUI.HandleType.All); |
|||
break; |
|||
case EditInfluenceNormalShape: |
|||
InfluenceVolumeUI.DrawGizmos( |
|||
s.influenceVolume, |
|||
d.influenceVolume, |
|||
mat, |
|||
InfluenceVolumeUI.HandleType.InfluenceNormal, |
|||
InfluenceVolumeUI.HandleType.All); |
|||
break; |
|||
default: |
|||
{ |
|||
var showedHandles = s.influenceVolume.showInfluenceHandles |
|||
? InfluenceVolumeUI.HandleType.All |
|||
: InfluenceVolumeUI.HandleType.Base; |
|||
InfluenceVolumeUI.DrawGizmos( |
|||
s.influenceVolume, |
|||
d.influenceVolume, |
|||
mat, |
|||
InfluenceVolumeUI.HandleType.None, |
|||
showedHandles); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
if (d.proxyVolume != null) |
|||
ReflectionProxyVolumeComponentUI.DrawGizmos_EditNone(d.proxyVolume); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8ee668677cd59784d8fb06a531b49a77 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor.AnimatedValues; |
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
partial class HDProbeUI |
|||
{ |
|||
static readonly Color k_GizmoThemeColorExtent = new Color(255f / 255f, 229f / 255f, 148f / 255f, 80f / 255f); |
|||
static readonly Color k_GizmoThemeColorExtentFace = new Color(255f / 255f, 229f / 255f, 148f / 255f, 45f / 255f); |
|||
static readonly Color k_GizmoThemeColorInfluenceBlend = new Color(83f / 255f, 255f / 255f, 95f / 255f, 75f / 255f); |
|||
static readonly Color k_GizmoThemeColorInfluenceBlendFace = new Color(83f / 255f, 255f / 255f, 95f / 255f, 17f / 255f); |
|||
static readonly Color k_GizmoThemeColorInfluenceNormalBlend = new Color(0f / 255f, 229f / 255f, 255f / 255f, 80f / 255f); |
|||
static readonly Color k_GizmoThemeColorInfluenceNormalBlendFace = new Color(0f / 255f, 229f / 255f, 255f / 255f, 36f / 255f); |
|||
static readonly Color k_GizmoThemeColorProjection = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f); |
|||
static readonly Color k_GizmoThemeColorProjectionFace = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f); |
|||
static readonly Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f); |
|||
static readonly Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f); |
|||
|
|||
static readonly Color[][] k_handlesColor = new Color[][] |
|||
{ |
|||
new Color[] |
|||
{ |
|||
Color.red, |
|||
Color.green, |
|||
Color.blue |
|||
}, |
|||
new Color[] |
|||
{ |
|||
new Color(.5f, 0f, 0f, 1f), |
|||
new Color(0f, .5f, 0f, 1f), |
|||
new Color(0f, 0f, .5f, 1f) |
|||
} |
|||
}; |
|||
|
|||
static readonly GUIContent bakeTypeContent = CoreEditorUtils.GetContent("Type|'Baked Cubemap' uses the 'Auto Baking' mode from the Lighting window. If it is enabled then baking is automatic otherwise manual bake is needed (use the bake button below). \n'Custom' can be used if a custom cubemap is wanted. \n'Realtime' can be used to dynamically re-render the cubemap during runtime (via scripting)."); |
|||
|
|||
static readonly GUIContent proxyVolumeContent = CoreEditorUtils.GetContent("Proxy Volume"); |
|||
static readonly GUIContent paralaxCorrectionContent = CoreEditorUtils.GetContent("Parallax Correction|Parallax Correction causes reflections to appear to change based on the object's position within the probe's box, while still using a single probe as the source of the reflection. This works well for reflections on objects that are moving through enclosed spaces such as corridors and rooms. Setting Parallax Correction to False and the cubemap reflection will be treated as coming from infinitely far away. Note that this feature can be globally disabled from Graphics Settings -> Tier Settings"); |
|||
|
|||
static readonly GUIContent normalModeContent = CoreEditorUtils.GetContent("Normal|Normal parameters mode (only change for box shape)."); |
|||
static readonly GUIContent advancedModeContent = CoreEditorUtils.GetContent("Advanced|Advanced parameters mode (only change for box shape)."); |
|||
|
|||
static readonly GUIContent shapeContent = CoreEditorUtils.GetContent("Shape"); |
|||
static readonly GUIContent boxSizeContent = CoreEditorUtils.GetContent("Box Size|The size of the box in which the reflections will be applied to objects. The value is not affected by the Transform of the Game Object."); |
|||
static readonly GUIContent sphereRadiusContent = CoreEditorUtils.GetContent("Radius"); |
|||
static readonly GUIContent offsetContent = CoreEditorUtils.GetContent("Offset|The center of the InfluenceVolume in which the reflections will be applied to objects. The value is relative to the position of the Game Object."); |
|||
static readonly GUIContent blendDistanceContent = CoreEditorUtils.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes."); |
|||
static readonly GUIContent blendNormalDistanceContent = CoreEditorUtils.GetContent("Blend Normal Distance|Area around the probe where the normals influence the probe. Only used in deferred probes."); |
|||
static readonly GUIContent faceFadeContent = CoreEditorUtils.GetContent("Face fade|Fade faces of the cubemap."); |
|||
|
|||
protected static readonly GUIContent fieldCaptureTypeContent = CoreEditorUtils.GetContent("Type"); |
|||
protected static readonly GUIContent resolutionContent = CoreEditorUtils.GetContent("Resolution"); |
|||
protected static readonly GUIContent shadowDistanceContent = CoreEditorUtils.GetContent("Shadow Distance"); |
|||
protected static readonly GUIContent cullingMaskContent = CoreEditorUtils.GetContent("Culling Mask"); |
|||
protected static readonly GUIContent useOcclusionCullingContent = CoreEditorUtils.GetContent("Use Occlusion Culling"); |
|||
protected static readonly GUIContent nearClipCullingContent = CoreEditorUtils.GetContent("Near Clip"); |
|||
protected static readonly GUIContent farClipCullingContent = CoreEditorUtils.GetContent("Far Clip"); |
|||
|
|||
static readonly GUIContent weightContent = CoreEditorUtils.GetContent("Weight|Blend weight applied on this reflection probe. This can be used for fading in or out a reflection probe."); |
|||
static readonly GUIContent multiplierContent = CoreEditorUtils.GetContent("Intensity Multiplier|Allows you to boost or dimmer the reflected cubemap. Values above 1 will make reflections brighter and values under 1 will make reflections darker. Using values different than 1 is not physically correct."); |
|||
|
|||
static readonly GUIContent textureSizeContent = CoreEditorUtils.GetContent("Probe Texture Size (Set By HDRP)"); |
|||
static readonly GUIContent compressionTextureContent = CoreEditorUtils.GetContent("Probe Compression (Set By HDRP)"); |
|||
|
|||
|
|||
const string mimapHelpBoxText = "No mipmaps in the cubemap, Smoothness value in Standard shader will be ignored."; |
|||
const string noProxyHelpBoxText = "When no Proxy setted, Influence shape will be used as Proxy shape too."; |
|||
const string proxyInfluenceShapeMismatchHelpBoxText = "Proxy volume and influence volume have different shapes, this is not supported."; |
|||
|
|||
const string proxySettingsHeader = "Proxy Volume"; |
|||
//influenceVolume have its own header
|
|||
const string captureSettingsHeader = "Capture Settings"; |
|||
const string additionnalSettingsHeader = "Custom Settings"; |
|||
|
|||
static GUIContent[] s_InfluenceToolbar_Contents = null; |
|||
protected static GUIContent[] influenceToolbar_Contents |
|||
{ |
|||
get |
|||
{ |
|||
return s_InfluenceToolbar_Contents ?? (s_InfluenceToolbar_Contents = new[] |
|||
{ |
|||
EditorGUIUtility.IconContent("EditCollider", "|Modify the base shape. (SHIFT+1)"), |
|||
EditorGUIUtility.IconContent("PreMatCube", "|Modify the influence volume. (SHIFT+2)"), |
|||
EditorGUIUtility.IconContent("SceneViewOrtho", "|Modify the influence normal volume. (SHIFT+3)"), |
|||
}); |
|||
} |
|||
} |
|||
|
|||
|
|||
//[TODO]extract in HDReflectionProbe?
|
|||
static GUIContent[] s_CaptureToolbar_Contents = null; |
|||
protected static GUIContent[] captureToolbar_Contents |
|||
{ |
|||
get |
|||
{ |
|||
return s_CaptureToolbar_Contents ?? (s_CaptureToolbar_Contents = new[] |
|||
{ |
|||
EditorGUIUtility.IconContent("MoveTool", "|Change the Offset of the shape.") |
|||
}); |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 43443fcbe23ff044eb73250a6d34cedd |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor.AnimatedValues; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
partial class HDProbeUI : BaseUI<SerializedHDProbe> |
|||
{ |
|||
const int k_AnimBoolFields = 6; |
|||
static readonly int k_ReflectionProbeModeModeCount = Enum.GetValues(typeof(ReflectionProbeMode)).Length; |
|||
static readonly int k_AnimBoolTotal = k_AnimBoolFields + k_ReflectionProbeModeModeCount; |
|||
|
|||
public InfluenceVolumeUI influenceVolume = new InfluenceVolumeUI(); |
|||
public FrameSettingsUI frameSettings = new FrameSettingsUI(); |
|||
public ReflectionProxyVolumeComponentUI reflectionProxyVolume = new ReflectionProxyVolumeComponentUI(); |
|||
|
|||
public AnimBool isSectionExpandedInfluenceSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount]; } } |
|||
public AnimBool isSectionExpandedCaptureSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 1]; } } |
|||
|
|||
public AnimBool isSectionExpandedCaptureMirrorSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 2]; } } |
|||
public AnimBool isSectionExpandedCaptureStaticSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 3]; } } |
|||
public AnimBool isSectionExpendedProxyVolume { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 4]; } } |
|||
public AnimBool isSectionExpendedAdditionalSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 5]; } } |
|||
|
|||
public bool showCaptureHandles { get; set; } |
|||
|
|||
internal HDProbeUI CreateFor(HDProbe p) |
|||
{ |
|||
if (p is PlanarReflectionProbe) |
|||
return new PlanarReflectionProbeUI(); |
|||
else |
|||
return new HDProbeUI(); |
|||
} |
|||
|
|||
public HDProbeUI() |
|||
: base(k_AnimBoolTotal) |
|||
{ |
|||
isSectionExpandedInfluenceSettings.value = true; |
|||
isSectionExpandedCaptureSettings.value = true; |
|||
isSectionExpendedProxyVolume.value = true; |
|||
isSectionExpendedAdditionalSettings.value = false; |
|||
} |
|||
|
|||
public AnimBool IsSectionExpandedReflectionProbeMode(ReflectionProbeMode mode) |
|||
{ |
|||
return m_AnimBools[(int)mode]; |
|||
} |
|||
|
|||
public override void Reset(SerializedHDProbe data, UnityAction repaint) |
|||
{ |
|||
//reflectionProxyVolume.Reset(data.proxyVolumeComponent, repaint);
|
|||
frameSettings.Reset(data.frameSettings, repaint); |
|||
influenceVolume.Reset(data.influenceVolume, repaint); |
|||
base.Reset(data, repaint); |
|||
} |
|||
|
|||
public override void Update() |
|||
{ |
|||
for (var i = 0; i < k_ReflectionProbeModeModeCount; i++) |
|||
m_AnimBools[i].target = i == data.mode.intValue; |
|||
|
|||
//reflectionProxyVolume.Update();
|
|||
frameSettings.Update(); |
|||
influenceVolume.Update(); |
|||
base.Update(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f23cf1efede7335468bfa23bd1838cd2 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditorInternal; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
using _ = CoreEditorUtils; |
|||
using CED = CoreEditorDrawer<PlanarReflectionProbeUI, SerializedPlanarReflectionProbe>; |
|||
|
|||
partial class PlanarReflectionProbeUI |
|||
{ |
|||
public static readonly CED.IDrawer Inspector; |
|||
|
|||
public static readonly CED.IDrawer SectionProbeModeSettings; |
|||
public static readonly CED.IDrawer ProxyVolumeSettings = CED.FoldoutGroup( |
|||
"Proxy Volume", |
|||
(s, d, o) => s.isSectionExpendedProxyVolume, |
|||
FoldoutOption.Indent, |
|||
CED.Action(Drawer_SectionProxySettings) |
|||
); |
|||
public static readonly CED.IDrawer SectionProbeModeBakedSettings = CED.noop; |
|||
public static readonly CED.IDrawer SectionProbeModeCustomSettings = CED.Action(Drawer_SectionProbeModeCustomSettings); |
|||
public static readonly CED.IDrawer SectionProbeModeRealtimeSettings = CED.Action(Drawer_SectionProbeModeRealtimeSettings); |
|||
public static readonly CED.IDrawer SectionBakeButton = CED.Action(Drawer_SectionBakeButton); |
|||
|
|||
public static readonly CED.IDrawer SectionFoldoutAdditionalSettings = CED.FoldoutGroup( |
|||
"Artistic Settings", |
|||
(s, d, o) => s.isSectionExpendedAdditionalSettings, |
|||
FoldoutOption.Indent, |
|||
CED.Action(Drawer_SectionInfluenceSettings) |
|||
); |
|||
|
|||
public static readonly CED.IDrawer SectionFoldoutCaptureSettings; |
|||
|
|||
public static readonly CED.IDrawer SectionCaptureMirrorSettings = CED.Action(Drawer_SectionCaptureMirror); |
|||
public static readonly CED.IDrawer SectionCaptureStaticSettings = CED.Action(Drawer_SectionCaptureStatic); |
|||
|
|||
static PlanarReflectionProbeUI() |
|||
{ |
|||
SectionFoldoutCaptureSettings = CED.FoldoutGroup( |
|||
"Capture Settings", |
|||
(s, d, o) => s.isSectionExpandedCaptureSettings, |
|||
FoldoutOption.Indent, |
|||
CED.Action(Drawer_SectionCaptureSettings), |
|||
CED.FadeGroup( |
|||
(s, d, o, i) => |
|||
{ |
|||
switch (i) |
|||
{ |
|||
default: |
|||
case 0: return s.isSectionExpandedCaptureMirrorSettings; |
|||
case 1: return s.isSectionExpandedCaptureStaticSettings; |
|||
} |
|||
}, |
|||
FadeOption.None, |
|||
SectionCaptureMirrorSettings, |
|||
SectionCaptureStaticSettings) |
|||
); |
|||
|
|||
SectionProbeModeSettings = CED.Group( |
|||
CED.Action(Drawer_FieldCaptureType), |
|||
CED.FadeGroup( |
|||
(s, d, o, i) => s.IsSectionExpandedReflectionProbeMode((ReflectionProbeMode)i), |
|||
FadeOption.Indent, |
|||
SectionProbeModeBakedSettings, |
|||
SectionProbeModeRealtimeSettings, |
|||
SectionProbeModeCustomSettings |
|||
) |
|||
); |
|||
|
|||
Inspector = CED.Group( |
|||
CED.Action(Drawer_Toolbar), |
|||
CED.space, |
|||
ProxyVolumeSettings, |
|||
CED.Select( |
|||
(s, d, o) => s.influenceVolume, |
|||
(s, d, o) => d.influenceVolume, |
|||
InfluenceVolumeUI.SectionFoldoutShapePlanar |
|||
), |
|||
CED.Action(Drawer_DifferentShapeError), |
|||
SectionFoldoutCaptureSettings, |
|||
SectionFoldoutAdditionalSettings, |
|||
CED.Select( |
|||
(s, d, o) => s.frameSettings, |
|||
(s, d, o) => d.frameSettings, |
|||
FrameSettingsUI.Inspector |
|||
), |
|||
CED.space, |
|||
CED.Action(Drawer_SectionBakeButton) |
|||
); |
|||
} |
|||
|
|||
const EditMode.SceneViewEditMode EditBaseShape = EditMode.SceneViewEditMode.ReflectionProbeBox; |
|||
const EditMode.SceneViewEditMode EditInfluenceShape = EditMode.SceneViewEditMode.GridBox; |
|||
const EditMode.SceneViewEditMode EditInfluenceNormalShape = EditMode.SceneViewEditMode.Collider; |
|||
const EditMode.SceneViewEditMode EditCenter = EditMode.SceneViewEditMode.ReflectionProbeOrigin; |
|||
const EditMode.SceneViewEditMode EditMirrorPosition = EditMode.SceneViewEditMode.GridMove; |
|||
const EditMode.SceneViewEditMode EditMirrorRotation = EditMode.SceneViewEditMode.GridSelect; |
|||
|
|||
static void Drawer_SectionCaptureStatic(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.captureLocalPosition, _.GetContent("Capture Local Position")); |
|||
|
|||
_.DrawMultipleFields( |
|||
"Clipping Planes", |
|||
new[] { d.captureNearPlane, d.captureFarPlane }, |
|||
new[] { _.GetContent("Near|The closest point relative to the camera that drawing will occur."), _.GetContent("Far|The furthest point relative to the camera that drawing will occur.\n") }); |
|||
} |
|||
|
|||
static void Drawer_SectionCaptureMirror(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
// EditorGUILayout.PropertyField(d.captureMirrorPlaneLocalPosition, _.GetContent("Plane Position"));
|
|||
// EditorGUILayout.PropertyField(d.captureMirrorPlaneLocalNormal, _.GetContent("Plane Normal"));
|
|||
} |
|||
|
|||
static void Drawer_DifferentShapeError(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
var proxy = d.proxyVolumeReference.objectReferenceValue as ReflectionProxyVolumeComponent; |
|||
if (proxy != null && (int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex) |
|||
{ |
|||
EditorGUILayout.HelpBox( |
|||
"Proxy volume and influence volume have different shape types, this is not supported.", |
|||
MessageType.Error, |
|||
true |
|||
); |
|||
} |
|||
} |
|||
|
|||
static void Drawer_SectionCaptureSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset; |
|||
GUI.enabled = false; |
|||
EditorGUILayout.LabelField( |
|||
_.GetContent("Probe Texture Size (Set By HDRP)"), |
|||
_.GetContent(hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionTextureSize.ToString()), |
|||
EditorStyles.label); |
|||
EditorGUILayout.Toggle( |
|||
_.GetContent("Probe Compression (Set By HDRP)"), |
|||
hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionCacheCompressed); |
|||
GUI.enabled = true; |
|||
|
|||
EditorGUILayout.PropertyField(d.overrideFieldOfView, _.GetContent("Override FOV")); |
|||
if (d.overrideFieldOfView.boolValue) |
|||
{ |
|||
++EditorGUI.indentLevel; |
|||
EditorGUILayout.PropertyField(d.fieldOfViewOverride, _.GetContent("Field Of View")); |
|||
--EditorGUI.indentLevel; |
|||
} |
|||
} |
|||
|
|||
static void Drawer_SectionProbeModeCustomSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
d.customTexture.objectReferenceValue = EditorGUILayout.ObjectField(_.GetContent("Capture"), d.customTexture.objectReferenceValue, typeof(Texture), false); |
|||
var texture = d.customTexture.objectReferenceValue as Texture; |
|||
if (texture != null && texture.dimension != TextureDimension.Tex2D) |
|||
EditorGUILayout.HelpBox("Provided Texture is not a 2D Texture, it will be ignored", MessageType.Warning); |
|||
} |
|||
|
|||
static void Drawer_SectionBakeButton(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
EditorReflectionSystemGUI.DrawBakeButton((ReflectionProbeMode)d.mode.intValue, d.target); |
|||
} |
|||
|
|||
static void Drawer_SectionProbeModeRealtimeSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
GUI.enabled = false; |
|||
EditorGUILayout.PropertyField(d.refreshMode, _.GetContent("Refresh Mode")); |
|||
EditorGUILayout.PropertyField(d.capturePositionMode, _.GetContent("Capture Position Mode")); |
|||
GUI.enabled = true; |
|||
} |
|||
|
|||
static void Drawer_SectionProxySettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.proxyVolumeReference, _.GetContent("Reference")); |
|||
|
|||
if (d.proxyVolumeReference.objectReferenceValue != null) |
|||
{ |
|||
var proxy = (ReflectionProxyVolumeComponent)d.proxyVolumeReference.objectReferenceValue; |
|||
if ((int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex) |
|||
EditorGUILayout.HelpBox( |
|||
"Proxy volume and influence volume have different shape types, this is not supported.", |
|||
MessageType.Error, |
|||
true |
|||
); |
|||
} |
|||
else |
|||
{ |
|||
EditorGUILayout.HelpBox( |
|||
"When no Proxy setted, Influence shape will be used as Proxy shape too.", |
|||
MessageType.Info, |
|||
true |
|||
); |
|||
} |
|||
} |
|||
|
|||
static void Drawer_SectionInfluenceSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.weight, _.GetContent("Weight")); |
|||
|
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
EditorGUILayout.PropertyField(d.multiplier, _.GetContent("Multiplier")); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
d.multiplier.floatValue = Mathf.Max(0.0f, d.multiplier.floatValue); |
|||
} |
|||
|
|||
static void Drawer_FieldCaptureType(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
GUI.enabled = false; |
|||
EditorGUILayout.PropertyField(d.mode, _.GetContent("Type")); |
|||
GUI.enabled = true; |
|||
} |
|||
|
|||
static readonly EditMode.SceneViewEditMode[] k_Toolbar_SceneViewEditModes = |
|||
{ |
|||
EditBaseShape, |
|||
EditInfluenceShape, |
|||
EditInfluenceNormalShape, |
|||
//EditCenter
|
|||
}; |
|||
|
|||
static readonly EditMode.SceneViewEditMode[] k_Toolbar_Static_SceneViewEditModes = |
|||
{ |
|||
//EditCenter //offset have no meanings with planar
|
|||
}; |
|||
static readonly EditMode.SceneViewEditMode[] k_Toolbar_Mirror_SceneViewEditModes = |
|||
{ |
|||
//EditMirrorPosition, //offset have no meanings with planar
|
|||
EditMirrorRotation |
|||
}; |
|||
static GUIContent[] s_Toolbar_Contents = null; |
|||
static GUIContent[] toolbar_Contents |
|||
{ |
|||
get |
|||
{ |
|||
return s_Toolbar_Contents ?? (s_Toolbar_Contents = new[] |
|||
{ |
|||
EditorGUIUtility.IconContent("EditCollider", "|Modify the base shape. (SHIFT+1)"), |
|||
EditorGUIUtility.IconContent("PreMatCube", "|Modify the influence volume. (SHIFT+2)"), |
|||
EditorGUIUtility.IconContent("SceneViewOrtho", "|Modify the influence normal volume. (SHIFT+3)"), |
|||
}); |
|||
} |
|||
} |
|||
|
|||
static GUIContent[] s_Toolbar_Static_Contents = null; |
|||
static GUIContent[] toolbar_Static_Contents |
|||
{ |
|||
get |
|||
{ |
|||
return s_Toolbar_Static_Contents ?? (s_Toolbar_Static_Contents = new GUIContent[] |
|||
{ |
|||
//EditorGUIUtility.IconContent("MoveTool", "|Move the capture position.") //offset have no meanings with planar
|
|||
}); |
|||
} |
|||
} |
|||
|
|||
static GUIContent[] s_Toolbar_Mirror_Contents = null; |
|||
static GUIContent[] toolbar_Mirror_Contents |
|||
{ |
|||
get |
|||
{ |
|||
return s_Toolbar_Mirror_Contents ?? (s_Toolbar_Mirror_Contents = new[] |
|||
{ |
|||
//EditorGUIUtility.IconContent("MoveTool", "|Move the mirror plane."), //offset have no meanings with planar
|
|||
EditorGUIUtility.IconContent("RotateTool", "|Rotate the mirror plane.") |
|||
}); |
|||
} |
|||
} |
|||
|
|||
static void Drawer_Toolbar(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
GUILayout.BeginHorizontal(); |
|||
GUILayout.FlexibleSpace(); |
|||
GUI.changed = false; |
|||
|
|||
EditMode.DoInspectorToolbar(k_Toolbar_SceneViewEditModes, toolbar_Contents, GetBoundsGetter(o), o); |
|||
|
|||
if (d.isMirrored) |
|||
EditMode.DoInspectorToolbar(k_Toolbar_Mirror_SceneViewEditModes, toolbar_Mirror_Contents, GetBoundsGetter(o), o); |
|||
else |
|||
EditMode.DoInspectorToolbar(k_Toolbar_Static_SceneViewEditModes, toolbar_Static_Contents, GetBoundsGetter(o), o); |
|||
|
|||
GUILayout.FlexibleSpace(); |
|||
GUILayout.EndHorizontal(); |
|||
} |
|||
|
|||
static public void Drawer_ToolBarButton(int buttonIndex, Editor owner, params GUILayoutOption[] styles) |
|||
{ |
|||
if (GUILayout.Button(toolbar_Contents[buttonIndex], styles)) |
|||
{ |
|||
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[buttonIndex], GetBoundsGetter(owner)(), owner); |
|||
} |
|||
} |
|||
|
|||
static Func<Bounds> GetBoundsGetter(Editor o) |
|||
{ |
|||
return () => |
|||
{ |
|||
var bounds = new Bounds(); |
|||
foreach (Component targetObject in o.targets) |
|||
{ |
|||
var rp = targetObject.transform; |
|||
var b = rp.position; |
|||
bounds.Encapsulate(b); |
|||
} |
|||
return bounds; |
|||
}; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue