浏览代码

Rough implementation of new gizmos and colored vectors

/main
RSlysz 7 年前
当前提交
22045d23
共有 3 个文件被更改,包括 334 次插入181 次删除
  1. 400
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs
  2. 37
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  3. 78
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs

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


using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Gizmo;
namespace UnityEditor.Experimental.Rendering
{

internal static Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static 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)
}
};
void OnSceneGUI()
{
var s = m_UIState;

static void Handle_InfluenceFadeEditing(HDReflectionProbeUI s, SerializedHDReflectionProbe sp, Editor o, InfluenceType influenceType)
{
BoxBoundsHandle blendBox;
Gizmo6FacesBoxContained alternativeBlendBox;
SphereBoundsHandle sphereHandle;
Vector3 probeBlendDistancePositive, probeBlendDistanceNegative;
Color color;

case InfluenceType.Standard:
{
blendBox = s.boxBlendHandle;
sphereHandle = s.sphereBlendHandle;
probeBlendDistancePositive = sp.targetData.blendDistancePositive;
probeBlendDistanceNegative = sp.targetData.blendDistanceNegative;
color = k_GizmoThemeColorInfluenceBlend;
break;
}
{
alternativeBlendBox = s.alternativeBoxBlendHandle;
blendBox = s.boxBlendHandle;
sphereHandle = s.sphereBlendHandle;
probeBlendDistancePositive = sp.targetData.blendDistancePositive;
probeBlendDistanceNegative = sp.targetData.blendDistanceNegative;
color = k_GizmoThemeColorInfluenceBlend;
break;
}
{
blendBox = s.boxBlendNormalHandle;
sphereHandle = s.sphereBlendNormalHandle;
probeBlendDistancePositive = sp.targetData.blendNormalDistancePositive;
probeBlendDistanceNegative = sp.targetData.blendNormalDistanceNegative;
color = k_GizmoThemeColorInfluenceNormalBlend;
break;
}
{
alternativeBlendBox = s.alternativeBoxBlendNormalHandle;
blendBox = s.boxBlendNormalHandle;
sphereHandle = s.sphereBlendNormalHandle;
probeBlendDistancePositive = sp.targetData.blendNormalDistancePositive;
probeBlendDistanceNegative = sp.targetData.blendNormalDistanceNegative;
color = k_GizmoThemeColorInfluenceNormalBlend;
break;
}
var mat = Handles.matrix;
var col = Handles.color;

case ShapeType.Box:
{
blendBox.center = sp.target.center - (probeBlendDistancePositive - probeBlendDistanceNegative) * 0.5f;
blendBox.size = sp.target.size - probeBlendDistancePositive - probeBlendDistanceNegative;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
Handles.color = color;
blendBox.DrawHandle();
if (EditorGUI.EndChangeCheck())
Undo.RecordObject(sp.target, "Modified Reflection Probe Influence");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe Influence");
blendBox.center = sp.target.center - (probeBlendDistancePositive - probeBlendDistanceNegative) * 0.5f;
blendBox.size = sp.target.size - probeBlendDistancePositive - probeBlendDistanceNegative;
var center = sp.target.center;
var influenceSize = sp.target.size;
alternativeBlendBox.center = sp.target.center - (probeBlendDistancePositive - probeBlendDistanceNegative) * 0.5f;
alternativeBlendBox.size = sp.target.size - probeBlendDistancePositive - probeBlendDistanceNegative;
var diff = 2 * (blendBox.center - center);
var sum = influenceSize - blendBox.size;
var positive = (sum - diff) * 0.5f;
var negative = (sum + diff) * 0.5f;
var blendDistancePositive = Vector3.Max(Vector3.zero, Vector3.Min(positive, influenceSize));
var blendDistanceNegative = Vector3.Max(Vector3.zero, Vector3.Min(negative, influenceSize));
alternativeBlendBox.container.center = sp.target.center;
alternativeBlendBox.container.size = sp.target.size;
probeBlendDistancePositive = blendDistancePositive;
probeBlendDistanceNegative = blendDistanceNegative;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
Handles.color = color;
if(s.useNewGizmo)
{
alternativeBlendBox.DrawHandle();
}
else
{
blendBox.DrawHandle();
}
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sp.target, "Modified Reflection Probe Influence");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe Influence");
ApplyConstraintsOnTargets(s, sp, o);
var center = sp.target.center;
var influenceSize = sp.target.size;
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
var diff = 2 * ((s.useNewGizmo?alternativeBlendBox.center:blendBox.center) - center);
var sum = influenceSize - (s.useNewGizmo?alternativeBlendBox.size:blendBox.size);
var positive = (sum - diff) * 0.5f;
var negative = (sum + diff) * 0.5f;
var blendDistancePositive = Vector3.Max(Vector3.zero, Vector3.Min(positive, influenceSize));
var blendDistanceNegative = Vector3.Max(Vector3.zero, Vector3.Min(negative, influenceSize));
probeBlendDistancePositive = blendDistancePositive;
probeBlendDistanceNegative = blendDistanceNegative;
ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
break;
}
{
sphereHandle.center = sp.target.center;
sphereHandle.radius = Mathf.Clamp(sp.targetData.influenceSphereRadius - probeBlendDistancePositive.x, 0, sp.targetData.influenceSphereRadius);
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
Handles.color = color;
sphereHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
Undo.RecordObject(sp.target, "Modified Reflection influence volume");
Undo.RecordObject(sp.targetData, "Modified Reflection influence volume");
sphereHandle.center = sp.target.center;
sphereHandle.radius = Mathf.Clamp(sp.targetData.influenceSphereRadius - probeBlendDistancePositive.x, 0, sp.targetData.influenceSphereRadius);
var influenceRadius = sp.targetData.influenceSphereRadius;
var blendRadius = sphereHandle.radius;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
Handles.color = color;
sphereHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sp.target, "Modified Reflection influence volume");
Undo.RecordObject(sp.targetData, "Modified Reflection influence volume");
var blendDistance = Mathf.Clamp(influenceRadius - blendRadius, 0, influenceRadius);
var influenceRadius = sp.targetData.influenceSphereRadius;
var blendRadius = sphereHandle.radius;
probeBlendDistancePositive = Vector3.one * blendDistance;
probeBlendDistanceNegative = probeBlendDistancePositive;
var blendDistance = Mathf.Clamp(influenceRadius - blendRadius, 0, influenceRadius);
ApplyConstraintsOnTargets(s, sp, o);
probeBlendDistancePositive = Vector3.one * blendDistance;
probeBlendDistanceNegative = probeBlendDistancePositive;
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
break;
}
}
Handles.matrix = mat;
Handles.color = col;

{
default:
case InfluenceType.Standard:
{
sp.targetData.blendDistancePositive = probeBlendDistancePositive;
sp.targetData.blendDistanceNegative = probeBlendDistanceNegative;
break;
}
{
sp.targetData.blendDistancePositive = probeBlendDistancePositive;
sp.targetData.blendDistanceNegative = probeBlendDistanceNegative;
break;
}
{
sp.targetData.blendNormalDistancePositive = probeBlendDistancePositive;
sp.targetData.blendNormalDistanceNegative = probeBlendDistanceNegative;
break;
}
{
sp.targetData.blendNormalDistancePositive = probeBlendDistancePositive;
sp.targetData.blendNormalDistanceNegative = probeBlendDistanceNegative;
break;
}
}
}

switch ((ShapeType)sp.influenceShape.enumValueIndex)
{
case ShapeType.Box:
{
s.boxInfluenceHandle.center = sp.target.center;
s.boxInfluenceHandle.size = sp.target.size;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
s.boxInfluenceHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
Undo.RecordObject(sp.target, "Modified Reflection Probe AABB");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe AABB");
if (s.useNewGizmo)
{
s.alternativeBoxInfluenceHandle.center = sp.target.center;
s.alternativeBoxInfluenceHandle.size = sp.target.size;
}
else
{
s.boxInfluenceHandle.center = sp.target.center;
s.boxInfluenceHandle.size = sp.target.size;
}
var center = s.boxInfluenceHandle.center;
var size = s.boxInfluenceHandle.size;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
if (s.useNewGizmo)
{
s.alternativeBoxInfluenceHandle.DrawHandle();
}
else
{
s.boxInfluenceHandle.DrawHandle();
}
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sp.target, "Modified Reflection Probe AABB");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe AABB");
HDReflectionProbeEditorUtility.ValidateAABB(sp.target, ref center, ref size);
Vector3 center;
Vector3 size;
if (s.useNewGizmo)
{
center = s.alternativeBoxInfluenceHandle.center;
size = s.alternativeBoxInfluenceHandle.size;
}
else
{
center = s.boxInfluenceHandle.center;
size = s.boxInfluenceHandle.size;
}
sp.target.center = center;
sp.target.size = size;
HDReflectionProbeEditorUtility.ValidateAABB(sp.target, ref center, ref size);
ApplyConstraintsOnTargets(s, sp, o);
sp.target.center = center;
sp.target.size = size;
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
break;
}
{
s.sphereInfluenceHandle.center = sp.target.center;
s.sphereInfluenceHandle.radius = sp.targetData.influenceSphereRadius;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
s.sphereInfluenceHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
Undo.RecordObject(sp.target, "Modified Reflection Probe AABB");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe AABB");
s.sphereInfluenceHandle.center = sp.target.center;
s.sphereInfluenceHandle.radius = sp.targetData.influenceSphereRadius;
var center = sp.target.center;
var influenceRadius = s.sphereInfluenceHandle.radius;
var radius = Vector3.one * influenceRadius;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
s.sphereInfluenceHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sp.target, "Modified Reflection Probe AABB");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe AABB");
var center = sp.target.center;
var influenceRadius = s.sphereInfluenceHandle.radius;
var radius = Vector3.one * influenceRadius;
HDReflectionProbeEditorUtility.ValidateAABB(sp.target, ref center, ref radius);
influenceRadius = radius.x;
HDReflectionProbeEditorUtility.ValidateAABB(sp.target, ref center, ref radius);
influenceRadius = radius.x;
sp.targetData.influenceSphereRadius = influenceRadius;
sp.targetData.influenceSphereRadius = influenceRadius;
ApplyConstraintsOnTargets(s, sp, o);
ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
break;
}
}
Handles.matrix = mat;
Handles.color = col;

HDReflectionProbeEditorUtility.ChangeVisibility(reflectionProbe, false);
}
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, Editor e, InfluenceType type, bool isEdit)
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, InfluenceType type, bool isEdit)
Gizmo6FacesBoxContained box;
Vector3 boxCenterOffset;
Vector3 boxSizeOffset;
float sphereRadiusOffset;

default:
case InfluenceType.Standard:
{
boxCenterOffset = a.boxBlendCenterOffset;
boxSizeOffset = a.boxBlendSizeOffset;
sphereRadiusOffset = a.sphereBlendRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
break;
}
{
box = e != null ? e.m_UIState.alternativeBoxBlendHandle : null;
boxCenterOffset = a.boxBlendCenterOffset;
boxSizeOffset = a.boxBlendSizeOffset;
sphereRadiusOffset = a.sphereBlendRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
break;
}
{
boxCenterOffset = a.boxBlendNormalCenterOffset;
boxSizeOffset = a.boxBlendNormalSizeOffset;
sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
break;
}
{
box = e != null ? e.m_UIState.alternativeBoxBlendNormalHandle : null;
boxCenterOffset = a.boxBlendNormalCenterOffset;
boxSizeOffset = a.boxBlendNormalSizeOffset;
sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
break;
}
}
Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);

{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
else
Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
break;
}
{
if(e != null && e.m_UIState.useNewGizmo)
{
box.DrawHull(isEdit);
}
else
{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
else
Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
}
break;
}
{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
break;
}
{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
break;
}
}
Gizmos.matrix = mat;

static void Gizmos_Influence(ReflectionProbe p, HDAdditionalReflectionData a, Editor e, bool isEdit)
static void Gizmos_Influence(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, bool isEdit)
{
var col = Gizmos.color;
var mat = Gizmos.matrix;

{
case ShapeType.Box:
{
Gizmos.color = isEdit ? k_GizmoThemeColorExtentFace : k_GizmoThemeColorExtent;
if (isEdit)
Gizmos.DrawCube(p.center, p.size);
else
Gizmos.DrawWireCube(p.center, p.size);
break;
}
{
if(e != null && e.m_UIState.useNewGizmo)
{
e.m_UIState.alternativeBoxInfluenceHandle.DrawHull(isEdit);
}
else
{
Gizmos.color = isEdit ? k_GizmoThemeColorExtentFace : k_GizmoThemeColorExtent;
if (isEdit)
Gizmos.DrawCube(p.center, p.size);
else
Gizmos.DrawWireCube(p.center, p.size);
}
break;
}
{
Gizmos.color = k_GizmoThemeColorExtentFace;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius);
break;
}
{
Gizmos.color = k_GizmoThemeColorExtentFace;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius);
break;
}
}
Gizmos.matrix = mat;

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


CoreEditorUtils.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes."),
s.isSectionExpendedAdvancedBlendDistanceBoxShape
);
if(GUILayout.Button(toolbar_Contents[1], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((s.isSectionExpendedAdvancedBlendDistanceBoxShape.value ? 3 : 1)*(EditorGUIUtility.singleLineHeight+3))))
if (GUILayout.Button(toolbar_Contents[1], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((s.isSectionExpendedAdvancedBlendDistanceBoxShape.value ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3))))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[1], GetBoundsGetter(p)(), owner);
}

CoreEditorUtils.GetContent("Blend Normal Distance|Area around the probe where the normals influence the probe. Only used in deferred probes."),
s.isSectionExpendedAdvancedBlendNormalDistanceBoxShape
);
if(GUILayout.Button(toolbar_Contents[2], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((s.isSectionExpendedAdvancedBlendNormalDistanceBoxShape.value ? 3 : 1)*(EditorGUIUtility.singleLineHeight+3))))
if (GUILayout.Button(toolbar_Contents[2], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((s.isSectionExpendedAdvancedBlendNormalDistanceBoxShape.value ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3))))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[2], GetBoundsGetter(p)(), owner);
}

EditorGUILayout.LabelField(CoreEditorUtils.GetContent("Face fade|Fade faces of the cubemap."));
if(GUILayout.Button(CoreEditorUtils.GetContent(s.isSectionExpendedAdvancedBlendFaceFadeBoxShape.value ? "Hide" : "Advanced")))
if (GUILayout.Button(CoreEditorUtils.GetContent(s.isSectionExpendedAdvancedBlendFaceFadeBoxShape.value ? "Hide" : "Advanced")))
if(s.isSectionExpendedAdvancedBlendFaceFadeBoxShape.value)
if (s.isSectionExpendedAdvancedBlendFaceFadeBoxShape.value)
p.boxSideFadePositive, p.boxSideFadeNegative, Vector3.zero, Vector3.one);
p.boxSideFadePositive, p.boxSideFadeNegative, Vector3.zero, Vector3.one, HDReflectionProbeEditor.k_handlesColor);
}
}

EditorGUI.BeginChangeCheck();
maxDistance = EditorGUILayout.FloatField(content, maxDistance, advanced.value ? styleTextDisabled : GUI.skin.textField);
if(advanced.value)
if (advanced.value)
{
maxDistance = originalMaxDistance;
EditorGUI.EndChangeCheck();

blendDistanceNegative.vector3Value = bdn;
}
if(GUILayout.Button(CoreEditorUtils.GetContent(advanced.value ? "Hide" : "Advanced"), GUILayout.MaxWidth(70)))
if (GUILayout.Button(CoreEditorUtils.GetContent(advanced.value ? "Hide" : "Advanced"), GUILayout.MaxWidth(70)))
{
advanced.value ^= true;
}

if(advanced.value)
if (advanced.value)
blendDistancePositive, blendDistanceNegative, Vector3.zero, maxBlendDistance);
blendDistancePositive, blendDistanceNegative, Vector3.zero, maxBlendDistance, HDReflectionProbeEditor.k_handlesColor);
}
GUILayout.EndVertical();

p.blendDistancePositive.vector3Value = Vector3.one * blendDistance;
p.blendDistanceNegative.vector3Value = Vector3.one * blendDistance;
}
if(GUILayout.Button(toolbar_Contents[1], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight+3)))
if (GUILayout.Button(toolbar_Contents[1], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[1], GetBoundsGetter(p)(), owner);
}

p.blendNormalDistancePositive.vector3Value = Vector3.one * blendNormalDistance;
p.blendNormalDistanceNegative.vector3Value = Vector3.one * blendNormalDistance;
}
if(GUILayout.Button(toolbar_Contents[2], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight+3)))
if (GUILayout.Button(toolbar_Contents[2], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[2], GetBoundsGetter(p)(), owner);
}

);
}
switch((ShapeType)p.influenceShape.enumValueIndex)
switch ((ShapeType)p.influenceShape.enumValueIndex)
{
case ShapeType.Box:
Drawer_InfluenceShapeBoxSettings(s, p, owner);

EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(p.boxSize, 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."));
if(GUILayout.Button(toolbar_Contents[0], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight+3)))
if (GUILayout.Button(toolbar_Contents[0], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(EditMode.SceneViewEditMode.ReflectionProbeBox, GetBoundsGetter(p)(), owner);
}

if(GUILayout.Button(toolbar_Contents[3], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight+3)))
if (GUILayout.Button(toolbar_Contents[3], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(EditMode.SceneViewEditMode.ReflectionProbeOrigin, GetBoundsGetter(p)(), owner);
}

{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(p.influenceSphereRadius, CoreEditorUtils.GetContent("Radius"));
if(GUILayout.Button(toolbar_Contents[0], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight+3)))
if (GUILayout.Button(toolbar_Contents[0], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(EditMode.SceneViewEditMode.ReflectionProbeBox, GetBoundsGetter(p)(), owner);
}

if(GUILayout.Button(toolbar_Contents[3], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight+3)))
if (GUILayout.Button(toolbar_Contents[3], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(EditMode.SceneViewEditMode.ReflectionProbeOrigin, GetBoundsGetter(p)(), owner);
}

static void Drawer_InfluenceAreas(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
if(s.IsSectionExpandedShape(ShapeType.Box).value)
if (s.IsSectionExpandedShape(ShapeType.Box).value)
if(s.IsSectionExpandedShape(ShapeType.Sphere).value)
if (s.IsSectionExpandedShape(ShapeType.Sphere).value)
{
Drawer_InfluenceSphereSettings(s, p, owner);
}

{
EditorGUILayout.PropertyField(p.boxProjection, 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"));
s.useNewGizmo = EditorGUILayout.Toggle(CoreEditorUtils.GetContent("New Gizmo"), s.useNewGizmo);
}
static void Drawer_IntensityMultiplier(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)

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


using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Gizmo;
namespace UnityEditor.Experimental.Rendering
{

public void ClearOperation(Operation op) { operations &= ~op; }
public void AddOperation(Operation op) { operations |= op; }
public bool useNewGizmo = false;
public Gizmo6FacesBox alternativeBoxInfluenceHandle = new Gizmo6FacesBox();
public Gizmo6FacesBoxContained alternativeBoxBlendHandle;
public Gizmo6FacesBoxContained alternativeBoxBlendNormalHandle;
public SphereBoundsHandle sphereInfluenceHandle = new SphereBoundsHandle();
public SphereBoundsHandle sphereProjectionHandle = new SphereBoundsHandle();
public SphereBoundsHandle sphereBlendHandle = new SphereBoundsHandle();

isSectionExpendedAdvancedBlendDistanceBoxShape.value = false;
isSectionExpendedAdvancedBlendNormalDistanceBoxShape.value = false;
isSectionExpendedAdvancedBlendFaceFadeBoxShape.value = false;
alternativeBoxBlendHandle = new Gizmo6FacesBoxContained(alternativeBoxInfluenceHandle);
alternativeBoxBlendNormalHandle = new Gizmo6FacesBoxContained(alternativeBoxInfluenceHandle);
Color[] handleColors = new Color[]
{
HDReflectionProbeEditor.k_handlesColor[0][0],
HDReflectionProbeEditor.k_handlesColor[0][1],
HDReflectionProbeEditor.k_handlesColor[0][2],
HDReflectionProbeEditor.k_handlesColor[1][0],
HDReflectionProbeEditor.k_handlesColor[1][1],
HDReflectionProbeEditor.k_handlesColor[1][2]
};
alternativeBoxInfluenceHandle.handleColors = handleColors;
alternativeBoxBlendHandle.handleColors = handleColors;
alternativeBoxBlendNormalHandle.handleColors = handleColors;
//unified color is finally better [Todo: improve gizmo to have an override color]
alternativeBoxInfluenceHandle.faceColors = new Color[]
{
HDReflectionProbeEditor.k_GizmoThemeColorExtent,
HDReflectionProbeEditor.k_GizmoThemeColorExtent,
HDReflectionProbeEditor.k_GizmoThemeColorExtent,
HDReflectionProbeEditor.k_GizmoThemeColorExtent,
HDReflectionProbeEditor.k_GizmoThemeColorExtent,
HDReflectionProbeEditor.k_GizmoThemeColorExtent
};
alternativeBoxInfluenceHandle.faceColorsSelected = new Color[]
{
HDReflectionProbeEditor.k_GizmoThemeColorExtentFace,
HDReflectionProbeEditor.k_GizmoThemeColorExtentFace,
HDReflectionProbeEditor.k_GizmoThemeColorExtentFace,
HDReflectionProbeEditor.k_GizmoThemeColorExtentFace,
HDReflectionProbeEditor.k_GizmoThemeColorExtentFace,
HDReflectionProbeEditor.k_GizmoThemeColorExtentFace
};
alternativeBoxBlendHandle.faceColors = new Color[]
{
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlend
};
alternativeBoxBlendHandle.faceColorsSelected = new Color[]
{
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlendFace
};
alternativeBoxBlendNormalHandle.faceColors = new Color[]
{
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlend,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlend
};
alternativeBoxBlendNormalHandle.faceColorsSelected = new Color[]
{
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlendFace,
HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlendFace
};
}
public override void Update()

正在加载...
取消
保存