|
|
|
|
|
|
using UnityEditor.IMGUI.Controls; |
|
|
|
using UnityEditorInternal; |
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine.Experimental.Rendering; |
|
|
|
using UnityEngine.Experimental.Rendering.HDPipeline; |
|
|
|
using UnityEditor.Experimental.Rendering.HDPipeline; |
|
|
|
|
|
|
|
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|
|
|
{ |
|
|
|
partial class HDReflectionProbeEditor |
|
|
|
{ |
|
|
|
enum InfluenceType |
|
|
|
{ |
|
|
|
Standard, |
|
|
|
Normal |
|
|
|
} |
|
|
|
|
|
|
|
protected override void OnSceneGUI() |
|
|
|
{ |
|
|
|
base.OnSceneGUI(); |
|
|
|
|
|
|
|
var s = m_UIState; |
|
|
|
var p = m_SerializedHDProbe as SerializedHDReflectionProbe; |
|
|
|
var o = this; |
|
|
|
|
|
|
|
if(EditMode.editMode == EditMode.SceneViewEditMode.ReflectionProbeOrigin) |
|
|
|
{ |
|
|
|
Handle_OriginEditing(s, p, o); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void Handle_OriginEditing(HDReflectionProbeUI s, SerializedHDReflectionProbe sp, Editor o) |
|
|
|
{ |
|
|
|
var p = (ReflectionProbe)sp.serializedLegacyObject.targetObject; |
|
|
|
var transformPosition = p.transform.position; |
|
|
|
var size = p.size; |
|
|
|
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
var newPostion = Handles.PositionHandle(transformPosition, HDReflectionProbeEditorUtility.GetLocalSpaceRotation(p)); |
|
|
|
|
|
|
|
var changed = EditorGUI.EndChangeCheck(); |
|
|
|
|
|
|
|
if (changed || s.oldLocalSpace != HDReflectionProbeEditorUtility.GetLocalSpace(p)) |
|
|
|
{ |
|
|
|
var localNewPosition = s.oldLocalSpace.inverse.MultiplyPoint3x4(newPostion); |
|
|
|
|
|
|
|
var b = new Bounds(p.center, size); |
|
|
|
localNewPosition = b.ClosestPoint(localNewPosition); |
|
|
|
|
|
|
|
Undo.RecordObject(p.transform, "Modified Reflection Probe Origin"); |
|
|
|
p.transform.position = s.oldLocalSpace.MultiplyPoint3x4(localNewPosition); |
|
|
|
|
|
|
|
Undo.RecordObject(p, "Modified Reflection Probe Origin"); |
|
|
|
p.center = HDReflectionProbeEditorUtility.GetLocalSpace(p).inverse.MultiplyPoint3x4(s.oldLocalSpace.MultiplyPoint3x4(p.center)); |
|
|
|
|
|
|
|
EditorUtility.SetDirty(p); |
|
|
|
|
|
|
|
s.UpdateOldLocalSpace(p); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |