浏览代码

[ReflectionProbeEditor] Added shortcut keys to edit volumes

/feature-ReflectionProbeFit
Frédéric Vauchelles 7 年前
当前提交
72e5e720
共有 3 个文件被更改,包括 48 次插入15 次删除
  1. 29
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Drawers.cs
  2. 6
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Handles.cs
  3. 28
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.cs

29
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Drawers.cs


GUI.changed = false;
var oldEditMode = EditMode.editMode;
Func<Bounds> getBounds = () =>
{
var bounds = new Bounds();
foreach (var targetObject in p.so.targetObjects)
{
var rp = (ReflectionProbe)targetObject;
var b = rp.bounds;
bounds.Encapsulate(b);
}
return bounds;
};
EditMode.DoInspectorToolbar(k_Toolbar_SceneViewEditModes, toolbar_Contents, getBounds, owner);
EditMode.DoInspectorToolbar(k_Toolbar_SceneViewEditModes, toolbar_Contents, GetBoundsGetter(p), owner);
//if (GUILayout.Button(EditorGUIUtility.IconContent("Navigation", "|Fit the reflection probe volume to the surrounding colliders.")))
// s.AddOperation(Operation.FitVolumeToSurroundings);

GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
static Func<Bounds> GetBoundsGetter(SerializedReflectionProbe p)
{
return () =>
{
var bounds = new Bounds();
foreach (var targetObject in p.so.targetObjects)
{
var rp = (ReflectionProbe)targetObject;
var b = rp.bounds;
bounds.Encapsulate(b);
}
return bounds;
};
}
#endregion

6
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Handles.cs


BakeRealtimeProbeIfPositionChanged(s, p, o);
DoShortcutKey(p, o);
if (!s.sceneViewEditing)
return;

ChangeVisibility(reflectionProbe, false);
}
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, InfluenceType type, bool isEdit)
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, Editor e, InfluenceType type, bool isEdit)
{
var col = Gizmos.color;
var mat = Gizmos.matrix;

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

28
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.cs


serializedObject.ApplyModifiedProperties();
HideAdditionalComponents(false);
DoShortcutKey(p, this);
}
static void PerformOperations(UIState s, SerializedReflectionProbe p, HDReflectionProbeEditor o)

sp.targetData.blendDistance2 = Vector3.Min(sp.targetData.blendDistance2, maxBlendDistance);
sp.targetData.blendNormalDistance = Vector3.Min(sp.targetData.blendNormalDistance, maxBlendDistance);
sp.targetData.blendNormalDistance2 = Vector3.Min(sp.targetData.blendNormalDistance2, maxBlendDistance);
break;
}
}
}
static readonly KeyCode[] k_ShortCutKeys =
{
KeyCode.Alpha1,
KeyCode.Alpha2,
KeyCode.Alpha3,
};
static void DoShortcutKey(SerializedReflectionProbe p, Editor o)
{
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_Toolbar_SceneViewEditModes[i]
? EditMode.SceneViewEditMode.None
: k_Toolbar_SceneViewEditModes[i];
EditMode.ChangeEditMode(mode, GetBoundsGetter(p)(), o);
evt.Use();
break;
}
}

正在加载...
取消
保存