浏览代码

clean reflection editors

/main
RSlysz 6 年前
当前提交
e18daf64
共有 11 个文件被更改,包括 223 次插入161 次删除
  1. 29
      com.unity.render-pipelines.core/CoreRP/Editor/CoreEditorUtils.cs
  2. 14
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeEditor.cs
  3. 143
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs
  4. 31
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Skin.cs
  5. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.cs
  6. 55
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs
  7. 36
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  8. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs
  9. 26
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.cs
  10. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs
  11. 35
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs

29
com.unity.render-pipelines.core/CoreRP/Editor/CoreEditorUtils.cs


throw new System.ArgumentException("Colors must be a 2x3 array.");
GUILayout.BeginVertical();
if(label != GUIContent.none)
EditorGUILayout.LabelField(label);
++EditorGUI.indentLevel;
var rect = GUILayoutUtility.GetRect(0, float.MaxValue, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight);
Rect rect = EditorGUI.IndentedRect(GUILayoutUtility.GetRect(0, float.MaxValue, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight));
if (label != GUIContent.none)
{
var labelRect = rect;
labelRect.x -= 12f;
labelRect.width = EditorGUIUtility.labelWidth;
EditorGUI.LabelField(labelRect, label);
rect.x += EditorGUIUtility.labelWidth - 12f;
rect.width -= EditorGUIUtility.labelWidth - 12f;
}
var v = positive.vector3Value;
EditorGUI.BeginChangeCheck();
v = DrawVector3(rect, k_DrawVector6_Label, v, min, max, false, colors == null ? null : colors[0]);

GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
rect = GUILayoutUtility.GetRect(0, float.MaxValue, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight);
rect = EditorGUI.IndentedRect(GUILayoutUtility.GetRect(0, float.MaxValue, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight));
rect.x += EditorGUIUtility.labelWidth - 12f;
rect.width -= EditorGUIUtility.labelWidth - 12f;
--EditorGUI.indentLevel;
GUILayout.EndVertical();
}

rect = EditorGUI.IndentedRect(rect);
//rect = EditorGUI.IndentedRect(rect);
float fieldWidth = rect.width / 3f;
EditorGUI.BeginChangeCheck();
EditorGUI.MultiFloatField(rect, labels, multifloat);

//Suffix is a hack as sublabel only work with 1 character
if(addMinusPrefix)
{
Rect suffixRect = new Rect(rect.x-33, rect.y, 100, rect.height);
Rect suffixRect = new Rect(rect.x-19, rect.y, 100, rect.height);
suffixRect.x += fieldWidth + .5f;
suffixRect.x += fieldWidth + .66f;
}
}

if (colors.Length != 3)
throw new System.ArgumentException("colors must have 3 elements.");
Rect suffixRect = new Rect(rect.x - 23, rect.y, 100, rect.height);
Rect suffixRect = new Rect(rect.x - 8, rect.y, 100, rect.height);
GUIStyle colorMark = new GUIStyle(EditorStyles.label);
colorMark.normal.textColor = colors[0];
EditorGUI.LabelField(suffixRect, "|", colorMark);

14
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeEditor.cs


internal abstract HDProbe GetTarget(Object editorTarget);
protected SerializedHDProbe m_SerializedHDProbe;
HDProbeUI m_UIState = new HDProbeUI();
HDProbeUI m_UIState;
if(m_UIState == null)
{
m_UIState = HDProbeUI.CreateFor(this);
}
m_UIState.Reset(m_SerializedHDProbe, Repaint);
m_TypedTargets = new HDProbe[targets.Length];

m_TypedTargets[i] = GetTarget(targets[i]);
m_UIHandleState[i] = new HDProbeUI();
m_UIHandleState[i] = HDProbeUI.CreateFor(m_TypedTargets[i]);
m_UIHandleState[i].Reset(m_SerializedHDProbe, null);
s_StateMap[m_TypedTargets[i]] = m_UIHandleState[i];

d.Apply();
}
protected void OnSceneGUI()
protected virtual void OnSceneGUI()
{
for (var i = 0; i < m_TypedTargets.Length; i++)
{

HDProbeUI.DrawHandles(m_UIHandleState[i], m_TypedTargets[i], this);
}
m_UIState.DoShortcutKey(this);
HDProbeUI.DoShortcutKey(this);
}

143
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs


using System;
using System.Collections.Generic;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Experimental.Rendering.HDPipeline;

)
);
}
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)
{

}
[Flags]
internal enum ToolBar
{
InfluenceShape = 1<<0,
Blend = 1<<1,
NormalBlend = 1<<2,
CapturePosition = 1<<3
}
protected ToolBar[] toolBars = null;
protected enum ToolBar { Influence, Capture }
protected ToolBar[] toolBars = new ToolBar[] { ToolBar.Influence, ToolBar.Capture };
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;
static readonly EditMode.SceneViewEditMode[] k_InfluenceToolbar_SceneViewEditModes =
static Dictionary<ToolBar, EditMode.SceneViewEditMode> s_Toolbar_Mode = null;
protected static Dictionary<ToolBar, EditMode.SceneViewEditMode> toolbar_Mode
EditBaseShape,
EditInfluenceShape,
EditInfluenceNormalShape,
};
get
{
return s_Toolbar_Mode ?? (s_Toolbar_Mode = new Dictionary<ToolBar, EditMode.SceneViewEditMode>
{
{ ToolBar.InfluenceShape, EditBaseShape },
{ ToolBar.Blend, EditInfluenceShape },
{ ToolBar.NormalBlend, EditInfluenceNormalShape },
{ ToolBar.CapturePosition, EditCenter }
});
}
}
static readonly EditMode.SceneViewEditMode[] k_CaptureToolbar_SceneViewEditModes =
//[TODO] change this to be modifiable shortcuts
static Dictionary<KeyCode, ToolBar> s_Toolbar_ShortCutKey = null;
protected static Dictionary<KeyCode, ToolBar> toolbar_ShortCutKey
EditCenter
};
get
{
return s_Toolbar_ShortCutKey ?? (s_Toolbar_ShortCutKey = new Dictionary<KeyCode, ToolBar>
{
{ KeyCode.Alpha1, ToolBar.InfluenceShape },
{ KeyCode.Alpha2, ToolBar.Blend },
{ KeyCode.Alpha3, ToolBar.NormalBlend },
{ KeyCode.Alpha4, ToolBar.CapturePosition }
});
}
}
protected static void Drawer_Toolbars(HDProbeUI s, SerializedHDProbe d, Editor o)
{
GUILayout.BeginHorizontal();

foreach(ToolBar toolBar in s.toolBars)
{
switch (toolBar)
List<EditMode.SceneViewEditMode> listMode = new List<EditMode.SceneViewEditMode>();
List<GUIContent> listContent = new List<GUIContent>();
if ((toolBar & ToolBar.InfluenceShape) > 0)
{
listMode.Add(toolbar_Mode[ToolBar.InfluenceShape]);
listContent.Add(toolbar_Contents[ToolBar.InfluenceShape]);
}
if ((toolBar & ToolBar.Blend) > 0)
{
listMode.Add(toolbar_Mode[ToolBar.Blend]);
listContent.Add(toolbar_Contents[ToolBar.Blend]);
}
if ((toolBar & ToolBar.NormalBlend) > 0)
{
listMode.Add(toolbar_Mode[ToolBar.NormalBlend]);
listContent.Add(toolbar_Contents[ToolBar.NormalBlend]);
}
if ((toolBar & ToolBar.CapturePosition) > 0)
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;
listMode.Add(toolbar_Mode[ToolBar.CapturePosition]);
listContent.Add(toolbar_Contents[ToolBar.CapturePosition]);
EditMode.DoInspectorToolbar(listMode.ToArray(), listContent.ToArray(), GetBoundsGetter(o), o);
}
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)
static internal void Drawer_ToolBarButton(ToolBar button, Editor owner, params GUILayoutOption[] options)
if (GUILayout.Button(captureToolbar_Contents[buttonIndex], styles))
//[TODO] change style here
GUIStyle style = "EditModeSingleButton";
Rect rect = GUILayoutUtility.GetRect(toolbar_Contents[button], style, options);
bool isMouseOver = rect.Contains(Event.current.mousePosition);
bool isActive = EditMode.editMode == toolbar_Mode[button];
//style.Draw(rect, toolbar_Contents[button], isMouseOver && (GUI.enabled || isActive) && (isActive || GUIUtility.hotControl == 0), GUI.enabled && isActive, true, false);
if (GUILayout.Button(toolbar_Contents[button], options))
EditMode.ChangeEditMode(k_CaptureToolbar_SceneViewEditModes[buttonIndex], GetBoundsGetter(owner)(), owner);
EditMode.SceneViewEditMode targetMode = EditMode.editMode == toolbar_Mode[button] ? EditMode.SceneViewEditMode.None : toolbar_Mode[button];
EditMode.ChangeEditMode(targetMode, GetBoundsGetter(owner)(), owner);
}
}

};
}
static readonly KeyCode[] k_ShortCutKeys =
{
KeyCode.Alpha1,
KeyCode.Alpha2,
KeyCode.Alpha3,
};
public static void DoShortcutKey(Editor owner)
public void DoShortcutKey(Editor owner)
for (var i = 0; i < k_ShortCutKeys.Length; ++i)
ToolBar toolbar;
if(toolbar_ShortCutKey.TryGetValue(evt.keyCode, out toolbar))
if (evt.keyCode == k_ShortCutKeys[i])
bool used = false;
foreach(ToolBar t in toolBars)
{
if((t&toolbar)>0)
{
used = true;
break;
}
}
if (!used)
var mode = EditMode.editMode == k_InfluenceToolbar_SceneViewEditModes[i]
? EditMode.SceneViewEditMode.None
: k_InfluenceToolbar_SceneViewEditModes[i];
EditMode.ChangeEditMode(mode, GetBoundsGetter(owner)(), owner);
evt.Use();
break;
return;
var targetMode = toolbar_Mode[toolbar];
var mode = EditMode.editMode == targetMode ? EditMode.SceneViewEditMode.None : targetMode;
EditMode.ChangeEditMode(mode, GetBoundsGetter(owner)(), owner);
evt.Use();
}
}
}

31
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Skin.cs


using System;
using System.Collections.Generic;
using UnityEditor.AnimatedValues;
using UnityEngine;
using UnityEngine.Events;

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");
protected 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).");

const string captureSettingsHeader = "Capture Settings";
const string additionnalSettingsHeader = "Custom Settings";
static GUIContent[] s_InfluenceToolbar_Contents = null;
protected static GUIContent[] influenceToolbar_Contents
static Dictionary<ToolBar, GUIContent> s_Toolbar_Contents = null;
protected static Dictionary<ToolBar, GUIContent> toolbar_Contents
return s_InfluenceToolbar_Contents ?? (s_InfluenceToolbar_Contents = new[]
return s_Toolbar_Contents ?? (s_Toolbar_Contents = new Dictionary<ToolBar, GUIContent>
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)"),
{ ToolBar.InfluenceShape, EditorGUIUtility.IconContent("EditCollider", "|Modify the base shape. (SHIFT+1)") },
{ ToolBar.Blend, EditorGUIUtility.IconContent("PreMatCube", "|Modify the influence volume. (SHIFT+2)") },
{ ToolBar.NormalBlend, EditorGUIUtility.IconContent("SceneViewOrtho", "|Modify the influence normal volume. (SHIFT+3)") },
{ ToolBar.CapturePosition, EditorGUIUtility.IconContent("MoveTool", "|Change the Offset of the shape.") }
//[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.")
});
}
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.cs


public bool showCaptureHandles { get; set; }
internal HDProbeUI CreateFor(HDProbe p)
internal static HDProbeUI CreateFor(HDProbeEditor o)
{
if (o is PlanarReflectionProbeEditor)
return new PlanarReflectionProbeUI();
else
return new HDReflectionProbeUI();
}
internal static HDProbeUI CreateFor(HDProbe p)
return new HDProbeUI();
return new HDReflectionProbeUI();
}
public HDProbeUI()

55
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs


Normal
}
void OnSceneGUI()
protected override void OnSceneGUI()
base.OnSceneGUI();
var s = m_UIState;
var p = m_SerializedHDProbe as SerializedHDReflectionProbe;
var o = this;

HDReflectionProbeUI.DoShortcutKey(o);
if (!s.sceneViewEditing)
return;
//if (!s.sceneViewEditing)
// return;
var mat = Matrix4x4.TRS(p.targetLegacy.transform.position, p.targetLegacy.transform.rotation, Vector3.one);
//var mat = Matrix4x4.TRS(p.targetLegacy.transform.position, p.targetLegacy.transform.rotation, Vector3.one);
EditorGUI.BeginChangeCheck();
//EditorGUI.BeginChangeCheck();
switch (EditMode.editMode)
{
// Influence editing
case EditMode.SceneViewEditMode.ReflectionProbeBox:
InfluenceVolumeUI.DrawHandles_EditBase(s.influenceVolume, p.target.influenceVolume, o, mat, p.target);
break;
// Influence fade editing
case EditMode.SceneViewEditMode.GridBox:
InfluenceVolumeUI.DrawHandles_EditInfluence(s.influenceVolume, p.target.influenceVolume, o, mat, p.target);
break;
// Influence normal fade editing
case EditMode.SceneViewEditMode.Collider:
InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(s.influenceVolume, p.target.influenceVolume, o, mat, p.target);
break;
// Origin editing
case EditMode.SceneViewEditMode.ReflectionProbeOrigin:
Handle_OriginEditing(s, p, o);
break;
}
//switch (EditMode.editMode)
//{
// // Influence editing
// case EditMode.SceneViewEditMode.ReflectionProbeBox:
// InfluenceVolumeUI.DrawHandles_EditBase(s.influenceVolume, p.target.influenceVolume, o, mat, p.target);
// break;
// // Influence fade editing
// case EditMode.SceneViewEditMode.GridBox:
// InfluenceVolumeUI.DrawHandles_EditInfluence(s.influenceVolume, p.target.influenceVolume, o, mat, p.target);
// break;
// // Influence normal fade editing
// case EditMode.SceneViewEditMode.Collider:
// InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(s.influenceVolume, p.target.influenceVolume, o, mat, p.target);
// break;
// // Origin editing
// case EditMode.SceneViewEditMode.ReflectionProbeOrigin:
// Handle_OriginEditing(s, p, o);
// break;
//}
if (EditorGUI.EndChangeCheck())
Repaint();
//if (EditorGUI.EndChangeCheck())
// Repaint();
}
static void Handle_OriginEditing(HDReflectionProbeUI s, SerializedHDReflectionProbe sp, Editor o)

36
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs


{
SectionPrimarySettings,
ProxyVolumeSettings,
AdditionalProxyVolumeSettings,
CED.Select(
(s, d, o) => s.influenceVolume,
(s, d, o) => d.influenceVolume,

};
}
public static readonly CED.IDrawer SectionPrimarySettings = CED.Group(
static readonly CED.IDrawer SectionPrimarySettings = CED.Group(
CED.Action((s, d, o) => Drawer_Toolbars(s, d, o)),
CED.space,
CED.Action(Drawer_ReflectionProbeMode),

)
);
public static readonly CED.IDrawer SectionCaptureSettings = CED.FoldoutGroup(
static readonly CED.IDrawer SectionCaptureSettings = CED.FoldoutGroup(
"Capture Settings",
(s, p, o) => s.isSectionExpandedCaptureSettings,
FoldoutOption.Indent,

static readonly CED.IDrawer AdditionalProxyVolumeSettings = CED.Action(Drawer_AdditionalProxyVolumeSettings);
static void Drawer_AdditionalProxyVolumeSettings(HDProbeUI s, SerializedHDProbe p, Editor owner)
{
HDReflectionProbeUI ui = ((HDReflectionProbeEditor)owner).m_UIState;
if (p.target.proxyVolume == null && ui.isSectionExpendedProxyVolume.value)
{
SerializedHDReflectionProbe serialized = (SerializedHDReflectionProbe)p;
EditorGUI.BeginChangeCheck();
++EditorGUI.indentLevel;
EditorGUILayout.PropertyField(serialized.boxProjection, paralaxCorrectionContent);
--EditorGUI.indentLevel;
if (EditorGUI.EndChangeCheck())
{
serialized.Apply();
}
}
}
EditorGUILayout.LabelField(CoreEditorUtils.GetContent("Resolution"), CoreEditorUtils.GetContent(p.resolution.intValue.ToString()));
EditorGUILayout.LabelField(resolutionContent, CoreEditorUtils.GetContent(p.resolution.intValue.ToString()));
EditorGUILayout.PropertyField(p.shadowDistance, CoreEditorUtils.GetContent("Shadow Distance"));
EditorGUILayout.PropertyField(p.cullingMask, CoreEditorUtils.GetContent("Culling Mask"));
EditorGUILayout.PropertyField(p.useOcclusionCulling, CoreEditorUtils.GetContent("Use Occlusion Culling"));
EditorGUILayout.PropertyField(p.nearClip, CoreEditorUtils.GetContent("Near Clip"));
EditorGUILayout.PropertyField(p.farClip, CoreEditorUtils.GetContent("Far Clip"));
EditorGUILayout.PropertyField(p.shadowDistance, shadowDistanceContent);
EditorGUILayout.PropertyField(p.cullingMask, cullingMaskContent);
EditorGUILayout.PropertyField(p.useOcclusionCulling, useOcclusionCullingContent);
EditorGUILayout.PropertyField(p.nearClip, nearClipCullingContent);
EditorGUILayout.PropertyField(p.farClip, farClipCullingContent);
}
static readonly GUIContent[] k_Content_ReflectionProbeMode = { new GUIContent("Baked"), new GUIContent("Custom"), new GUIContent("Realtime") };

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs


internal HDReflectionProbeUI()
{
toolBars = new[] { ToolBar.Influence, ToolBar.Capture };
toolBars = new[] { ToolBar.InfluenceShape | ToolBar.Blend | ToolBar.NormalBlend, ToolBar.CapturePosition };
}
[Flags]

26
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.cs


static readonly GUIContent overrideFieldOfViewContent = CoreEditorUtils.GetContent("Override Field Of View");
static readonly GUIContent fieldOfViewSolidAngleContent = CoreEditorUtils.GetContent("Field Of View");
new SerializedPlanarReflectionProbe data;
public static CED.IDrawer Inspector;
public static readonly CED.IDrawer SectionFoldoutCaptureSettings = CED.FoldoutGroup(

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)
);
static PlanarReflectionProbeUI()

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);

internal PlanarReflectionProbeUI()
{
toolBars = new[] { ToolBar.Influence };
data = base.data as SerializedPlanarReflectionProbe;
toolBars = new[] { ToolBar.InfluenceShape | ToolBar.Blend };
isSectionExpandedCaptureMirrorSettings.target = data.isMirrored;
isSectionExpandedCaptureStaticSettings.target = !data.isMirrored;
SerializedPlanarReflectionProbe serialized = data as SerializedPlanarReflectionProbe;
isSectionExpandedCaptureMirrorSettings.target = serialized.isMirrored;
isSectionExpandedCaptureStaticSettings.target = !serialized.isMirrored;
base.Update();
}
}

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs


legacyBlendDistance.floatValue = 0;
}
public void Apply()
public new void Apply()
{
serializedLegacyObject.ApplyModifiedProperties();
serializedObject.ApplyModifiedProperties();

35
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs


//[TODO: planar / non planar will be redone in next PR]
public static readonly CED.IDrawer SectionFoldoutShapePlanar;
public static readonly CED.IDrawer SectionFoldoutShape;
public static readonly CED.IDrawer SectionShapeBoxPlanar = CED.Action((s, p, o) => Drawer_SectionShapeBox(s,p,o,false,false));
public static readonly CED.IDrawer SectionShapeBox = CED.Action((s, p, o) => Drawer_SectionShapeBox(s, p, o, true, true));
public static readonly CED.IDrawer SectionShapeBoxPlanar = CED.Action((s, p, o) => Drawer_SectionShapeBox( s, p, o, false, false, false));
public static readonly CED.IDrawer SectionShapeBox = CED.Action((s, p, o) => Drawer_SectionShapeBox(s, p, o, true, true, true));
public static readonly CED.IDrawer SectionShapeSpherePlanar = CED.Action((s, p, o) => Drawer_SectionShapeSphere(s, p, o, false, false));
public static readonly CED.IDrawer SectionShapeSphere = CED.Action((s, p, o) => Drawer_SectionShapeSphere(s, p, o, true, true));

}
}
static void Drawer_SectionShapeBox(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o, bool drawOffset, bool drawNormal)
static void Drawer_SectionShapeBox(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o, bool drawOffset, bool drawNormal, bool drawFace)
{
bool advanced = d.editorAdvancedModeEnabled.boolValue;
var maxFadeDistance = d.boxSize.vector3Value * 0.5f;

EditorGUILayout.PropertyField(d.boxSize, _.GetContent("Box Size"));
HDProbeUI.Drawer_InfluenceToolBarButton(0, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
HDProbeUI.Drawer_ToolBarButton(HDProbeUI.ToolBar.InfluenceShape, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
EditorGUILayout.EndHorizontal();
if (drawOffset)

HDProbeUI.Drawer_CaptureToolBarButton(0, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
HDProbeUI.Drawer_ToolBarButton(HDProbeUI.ToolBar.CapturePosition, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
EditorGUILayout.BeginHorizontal();
Drawer_AdvancedBlendDistance(

CoreEditorUtils.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes.")
);
HDProbeUI.Drawer_InfluenceToolBarButton(1, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((advanced ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3)));
HDProbeUI.Drawer_ToolBarButton(HDProbeUI.ToolBar.Blend, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((advanced ? 2 : 1) * (EditorGUIUtility.singleLineHeight + 3)));
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * 2f);
if (drawNormal)
{

maxFadeDistance,
CoreEditorUtils.GetContent("Blend Normal Distance|Area around the probe where the normals influence the probe. Only used in deferred probes.")
);
HDProbeUI.Drawer_InfluenceToolBarButton(2, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((advanced ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3)));
HDProbeUI.Drawer_ToolBarButton(HDProbeUI.ToolBar.NormalBlend, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((advanced ? 2 : 1) * (EditorGUIUtility.singleLineHeight + 3)));
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * 2f);
if (advanced)
if (advanced && drawFace)
EditorGUILayout.BeginHorizontal();
GUILayout.Space(28f + 9f); //add right margin for alignment
EditorGUILayout.EndHorizontal();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * 2f);
}
}

EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(d.sphereRadius, _.GetContent("Radius"));
HDProbeUI.Drawer_InfluenceToolBarButton(0, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
HDProbeUI.Drawer_ToolBarButton(HDProbeUI.ToolBar.InfluenceShape, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
EditorGUILayout.EndHorizontal();
if(drawOffset)

HDReflectionProbeUI.Drawer_InfluenceToolBarButton(3, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
HDReflectionProbeUI.Drawer_ToolBarButton(HDProbeUI.ToolBar.CapturePosition, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
EditorGUILayout.EndHorizontal();
}

{
d.sphereBlendDistance.floatValue = Mathf.Clamp(d.sphereBlendDistance.floatValue, 0, maxBlendDistance);
}
HDProbeUI.Drawer_InfluenceToolBarButton(1, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight + 3));
HDProbeUI.Drawer_ToolBarButton(HDProbeUI.ToolBar.Blend, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight + 3));
EditorGUILayout.EndHorizontal();
if (drawNormal)

{
d.sphereBlendNormalDistance.floatValue = Mathf.Clamp(d.sphereBlendNormalDistance.floatValue, 0, maxBlendDistance);
}
HDProbeUI.Drawer_InfluenceToolBarButton(2, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight + 3));
HDProbeUI.Drawer_ToolBarButton(HDProbeUI.ToolBar.NormalBlend, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight + 3));
EditorGUILayout.EndHorizontal();
}
}
正在加载...
取消
保存