浏览代码

Fix missing serialized update when using fade part of gizmo

/main
RSlysz 6 年前
当前提交
6c716b5b
共有 4 个文件被更改,包括 28 次插入34 次删除
  1. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeEditor.cs
  2. 36
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Handles.cs
  3. 13
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Handles.cs
  4. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Handles.cs

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


protected virtual 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);
}
HDProbeUI.DrawHandles(m_UIState, m_SerializedHDProbe, this);
}
}

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


partial class HDProbeUI
{
internal static void DrawHandles(HDProbeUI s, HDProbe d, Editor o)
internal static void DrawHandles(HDProbeUI s, SerializedHDProbe d, Editor o)
var mat = Matrix4x4.TRS(d.transform.position, d.transform.rotation, Vector3.one);
HDProbe probe = d.target as HDProbe;
var mat = Matrix4x4.TRS(probe.transform.position, probe.transform.rotation, Vector3.one);
InfluenceVolumeUI.DrawHandles_EditBase(s.influenceVolume, d.influenceVolume, o, mat, d);
InfluenceVolumeUI.DrawHandles_EditBase(s.influenceVolume, probe.influenceVolume, o, mat, probe);
InfluenceVolumeUI.DrawHandles_EditInfluence(s.influenceVolume, d.influenceVolume, o, mat, d);
InfluenceVolumeUI.DrawHandles_EditInfluence(s.influenceVolume, probe.influenceVolume, o, mat, probe);
InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(s.influenceVolume, d.influenceVolume, o, mat, d);
InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(s.influenceVolume, probe.influenceVolume, o, mat, probe);
Vector3 offsetWorld = d.transform.position + d.transform.rotation * d.influenceVolume.offset;
Vector3 offsetWorld = probe.transform.position + probe.transform.rotation * probe.influenceVolume.offset;
var newOffsetWorld = Handles.PositionHandle(offsetWorld, d.transform.rotation);
var newOffsetWorld = Handles.PositionHandle(offsetWorld, probe.transform.rotation);
Vector3 newOffset = Quaternion.Inverse(d.transform.rotation) * (newOffsetWorld - d.transform.position);
Undo.RecordObjects(new Object[] { d, d.transform }, "Translate Capture Position");
d.influenceVolume.offset = newOffset;
EditorUtility.SetDirty(d);
Vector3 newOffset = Quaternion.Inverse(probe.transform.rotation) * (newOffsetWorld - probe.transform.position);
Undo.RecordObjects(new Object[] { probe, probe.transform }, "Translate Influence Position");
d.influenceVolume.offset.vector3Value = newOffset;
d.influenceVolume.Apply();
//call modification to legacy ReflectionProbe
probe.influenceVolume.offset = newOffset;
EditorUtility.SetDirty(probe);
}
}
break;

switch (EditMode.editMode)
{
case EditBaseShape:
InfluenceVolumeUI.DrawGizmos(
s.influenceVolume,
d.influenceVolume,
mat,
InfluenceVolumeUI.HandleType.Base,
InfluenceVolumeUI.HandleType.All);
InfluenceVolumeUI.DrawGizmos(s.influenceVolume, d.influenceVolume, mat,
InfluenceVolumeUI.HandleType.Base, InfluenceVolumeUI.HandleType.All);
break;
case EditInfluenceShape:
InfluenceVolumeUI.DrawGizmos(

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


{
static readonly Color k_GizmoMirrorPlaneCamera = new Color(128f / 255f, 128f / 255f, 233f / 255f, 128f / 255f);
internal static void DrawHandles(PlanarReflectionProbeUI s, PlanarReflectionProbe d, Editor o)
internal static void DrawHandles(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
PlanarReflectionProbe probe = d.target;
if (d.useMirrorPlane)
if (probe.useMirrorPlane)
var mat = Matrix4x4.TRS(d.transform.position, d.transform.rotation, Vector3.one*1.5f);
var mat = Matrix4x4.TRS(probe.transform.position, probe.transform.rotation, Vector3.one*1.5f);
d.captureMirrorPlaneLocalPosition,
Quaternion.LookRotation(d.captureMirrorPlaneLocalNormal),
HandleUtility.GetHandleSize(d.captureMirrorPlaneLocalPosition),
probe.captureMirrorPlaneLocalPosition,
Quaternion.LookRotation(probe.captureMirrorPlaneLocalNormal),
HandleUtility.GetHandleSize(probe.captureMirrorPlaneLocalPosition),
Event.current.type
);
}

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


s.data.boxBlendDistancePositive.vector3Value = positive;
s.data.boxBlendDistanceNegative.vector3Value = negative;
////save advanced/simplified saved data
//save advanced/simplified saved data
if (s.data.editorAdvancedModeEnabled.boolValue)
{
s.data.editorAdvancedModeBlendDistancePositive.vector3Value = positive;

正在加载...
取消
保存