浏览代码

[HDCameraEditor] refactored Inspector fields

/main
Frédéric Vauchelles 7 年前
当前提交
a9063dca
共有 3 个文件被更改,包括 83 次插入45 次删除
  1. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Camera/HDCameraEditor.Data.cs
  2. 112
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Camera/HDCameraEditor.Drawers.cs
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Camera/HDCameraEditor.cs

14
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Camera/HDCameraEditor.Data.cs


{
SerializedHDCamera m_SerializedHdCamera;
AnimBool[] m_AnimBools = new AnimBool[8];
AnimBool[] m_AnimBools = new AnimBool[10];
public AnimBool isSectionExpandedOrthoOptions { get { return m_AnimBools[0]; } }
public AnimBool isSectionExpandedShaderFeature { get { return m_AnimBools[1]; } }

public AnimBool isSectionExpandedRenderLoopSettings { get { return m_AnimBools[5]; } }
public AnimBool isSectionExpandedXR { get { return m_AnimBools[6]; } }
public AnimBool isSectionExpandedXRSupported { get { return m_AnimBools[7]; } }
public AnimBool isSectionExpandedCaptureSettings { get { return m_AnimBools[8]; } }
public AnimBool isSectionExpandedOutputSettings { get { return m_AnimBools[9]; } }
public bool canOverrideRenderLoopSettings { get; set; }
canOverrideRenderLoopSettings = false;
}
public void Reset(SerializedHDCamera serializedHdCamera, UnityAction repaint)

public void Update()
{
var renderingPath = (HDAdditionalCameraData.RenderingPath)m_SerializedHdCamera.renderingPath.intValue;
canOverrideRenderLoopSettings = renderingPath == HDAdditionalCameraData.RenderingPath.Custom;
var renderingPath = (HDAdditionalCameraData.RenderingPath)m_SerializedHdCamera.renderingPath.intValue;
isSectionExpandedRenderLoopSettings.target = renderingPath == HDAdditionalCameraData.RenderingPath.Custom;
isSectionExpandedRenderLoopSettings.target = canOverrideRenderLoopSettings;
}
}
}

112
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Camera/HDCameraEditor.Drawers.cs


using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Rendering;
namespace UnityEditor.Experimental.Rendering
{

{
static readonly CED.IDrawer[] k_PrimarySection =
{
// Primary settings
CED.Action(Drawer_FieldBackgroundColor),
CED.Action(Drawer_FieldCullingMask),
CED.Action(Drawer_FieldVolumeLayerMask),

// Partial viewport not yet supported
//CED.Action(Drawer_FieldNormalizedViewPort),
CED.Action(Drawer_FieldDepth),
CED.Action(Drawer_FieldRenderTarget),
CED.Action(Drawer_FieldOcclusionCulling),
CED.Action(Drawer_FieldRenderingPath),
CED.space,
// Advanced settings
CED.FoldoutGroup(
"Capture Settings",
(s, p, o) => s.isSectionExpandedCaptureSettings,
true,
CED.Action(Drawer_FieldOcclusionCulling),
CED.Action(Drawer_FieldNormalizedViewPort)),
CED.FoldoutGroup(
"Output Settings",
(s, p, o) => s.isSectionExpandedOutputSettings,
true,
CED.Action(Drawer_SectionMultiDisplay),
CED.Action(Drawer_SectionMultiDisplay),
CED.Action(Drawer_FieldRenderingPath),
// XR not yet supported
//CED.FadeGroup(
// (s, d, o, i) => s.isSectionExpandedXRSupported.faded,
// false,
// CED.FoldoutGroup(
// "XR",
// (s, p, o) => s.isSectionExpandedXR,
// true,
// CED.Action(Drawer_FieldVR),
// CED.Action(Drawer_FieldTargetEye))),
CED.Action(Drawer_FieldDepth),
CED.Action(Drawer_FieldRenderTarget)),
(s, d, o, i) => s.isSectionExpandedRenderLoopSettings.faded,
(s, d, o, i) => s.isSectionExpandedXRSupported.faded,
"Shader Passes",
(s, p, o) => s.isSectionExpandedShaderFeature,
true,
CED.Action(Drawer_SectionShaderFeature)),
CED.FoldoutGroup(
"Screen Space",
(s, p, o) => s.isSectionExpandedScreenSpace,
true,
CED.Action(Drawer_SectionScreenSpace)),
CED.FoldoutGroup(
"Miscellaneous",
(s, p, o) => s.isSectionExpandedMiscellaneous,
true,
CED.Action(Drawer_SectionMiscellaneous)),
CED.FoldoutGroup(
"Light Loop",
(s, p, o) => s.isSectionExpandedLightLoop,
"XR",
(s, p, o) => s.isSectionExpandedXR,
CED.Action(Drawer_SectionLightLoop)))
CED.Action(Drawer_FieldVR),
CED.Action(Drawer_FieldTargetEye))),
// Render Loop Settings
CED.FadeGroup(
(s, d, o, i) => s.isSectionExpandedRenderLoopSettings.faded,
false,
CED.FoldoutGroup(
"Shader Passes",
(s, p, o) => s.isSectionExpandedShaderFeature,
true,
CED.Action(Drawer_SectionShaderFeature)),
CED.FoldoutGroup(
"Screen Space",
(s, p, o) => s.isSectionExpandedScreenSpace,
true,
CED.Action(Drawer_SectionScreenSpace)),
CED.FoldoutGroup(
"Miscellaneous",
(s, p, o) => s.isSectionExpandedMiscellaneous,
true,
CED.Action(Drawer_SectionMiscellaneous)),
CED.FoldoutGroup(
"Light Loop",
(s, p, o) => s.isSectionExpandedLightLoop,
true,
CED.Action(Drawer_SectionLightLoop))),
};
static void Drawer_FieldBackgroundColor(UIState s, SerializedHDCamera p, Editor owner)

static void Drawer_FieldClippingPlanes(UIState s, SerializedHDCamera p, Editor owner)
{
GUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel(_.GetContent("Clipping Planes"));
GUILayout.BeginVertical();
var labelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 45;
GUILayout.EndVertical();
GUILayout.EndHorizontal();
EditorGUIUtility.labelWidth = labelWidth;
}
static void Drawer_FieldNormalizedViewPort(UIState s, SerializedHDCamera p, Editor owner)

static void Drawer_FieldVR(UIState s, SerializedHDCamera p, Editor owner)
{
if (PlayerSettings.virtualRealitySupported)
if (s.canOverrideRenderLoopSettings)
EditorGUILayout.PropertyField(p.frameSettings.enableStereo, _.GetContent("Enable Stereo"));
else
EditorGUILayout.PropertyField(p.stereoSeparation, _.GetContent("Stereo Separation"));
EditorGUILayout.PropertyField(p.stereoConvergence, _.GetContent("Stereo Convergence"));
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
Assert.IsNotNull(hdrp, "This Editor is valid only for HDRP");
var enableStereo = hdrp.GetFrameSettings().enableStereo;
GUI.enabled = false;
EditorGUILayout.Toggle(_.GetContent("Enable Stereo (Set by HDRP)"), enableStereo);
GUI.enabled = true;
EditorGUILayout.PropertyField(p.stereoSeparation, _.GetContent("Stereo Separation"));
EditorGUILayout.PropertyField(p.stereoConvergence, _.GetContent("Stereo Convergence"));
}
#if ENABLE_MULTIPLE_DISPLAYS

{
var prevDisplay = p.targetDisplay.intValue;
EditorGUILayout.Space();
EditorGUILayout.IntPopup(p.targetDisplay, DisplayUtility_GetDisplayNames(), DisplayUtility_GetDisplayIndices(), _.GetContent("Target Display"));
if (prevDisplay != p.targetDisplay.intValue)
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();

EditorGUILayout.PropertyField(p.frameSettings.enableTransparentObjects, _.GetContent("Enable Transparent Objects"));
EditorGUILayout.PropertyField(p.frameSettings.enableMSAA, _.GetContent("Enable MSAA"));
EditorGUILayout.PropertyField(p.frameSettings.enableStereo, _.GetContent("Enable Stereo"));
}
static void Drawer_SectionLightLoop(UIState s, SerializedHDCamera p, Editor owner)

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Camera/HDCameraEditor.cs


namespace UnityEditor.Experimental.Rendering
{
//[CustomEditorForRenderPipeline(typeof(Camera), typeof(HDRenderPipelineAsset))]
[CustomEditorForRenderPipeline(typeof(Camera), typeof(HDRenderPipelineAsset))]
[CanEditMultipleObjects]
partial class HDCameraEditor : Editor
{

正在加载...
取消
保存