浏览代码

[HDCameraEditor] Refactored fields and removed unused ones

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

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


{
SerializedHDCamera m_SerializedHdCamera;
AnimBool[] m_AnimBools = new AnimBool[8];
AnimBool[] m_AnimBools = new AnimBool[7];
public AnimBool isSectionExpandedBGColorOptions { get { return m_AnimBools[0]; } }
public AnimBool isSectionExpandedOrthoOptions { get { return m_AnimBools[1]; } }
public AnimBool isSectionExpandedTargetEyeOptions { get { return m_AnimBools[2]; } }
public AnimBool isSectionExpandedShaderFeature { get { return m_AnimBools[3]; } }
public AnimBool isSectionExpandedLightLoop { get { return m_AnimBools[4]; } }
public AnimBool isSectionExpandedScreenSpace { get { return m_AnimBools[5]; } }
public AnimBool isSectionExpandedMiscellaneous { get { return m_AnimBools[6]; } }
public AnimBool isSectionExpandedRenderLoopSettings { get { return m_AnimBools[7]; } }
public AnimBool isSectionExpandedOrthoOptions { get { return m_AnimBools[0]; } }
public AnimBool isSectionExpandedTargetEyeOptions { get { return m_AnimBools[1]; } }
public AnimBool isSectionExpandedShaderFeature { get { return m_AnimBools[2]; } }
public AnimBool isSectionExpandedLightLoop { get { return m_AnimBools[3]; } }
public AnimBool isSectionExpandedScreenSpace { get { return m_AnimBools[4]; } }
public AnimBool isSectionExpandedMiscellaneous { get { return m_AnimBools[5]; } }
public AnimBool isSectionExpandedRenderLoopSettings { get { return m_AnimBools[6]; } }
public UIState()
{

public void Update()
{
var clearFlags = (CameraClearFlags)m_SerializedHdCamera.clearFlags.intValue;
var clearFlagsHasMultipleValues = m_SerializedHdCamera.clearFlags.hasMultipleDifferentValues;
isSectionExpandedBGColorOptions.target = !clearFlagsHasMultipleValues && (clearFlags == CameraClearFlags.SolidColor || clearFlags == CameraClearFlags.Skybox);
isSectionExpandedOrthoOptions.target = !m_SerializedHdCamera.orthographic.hasMultipleDifferentValues && m_SerializedHdCamera.orthographic.boolValue;
var targetEyeValue = (StereoTargetEyeMask)m_SerializedHdCamera.targetEye.intValue;

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


{
static readonly CED.IDrawer[] k_PrimarySection =
{
CED.Action(Drawer_FieldClearFlags),
CED.FadeGroup(
(s, d, o, i) => s.isSectionExpandedBGColorOptions.faded,
true,
CED.Action(Drawer_FieldBackgroundColor)),
CED.Action(Drawer_FieldBackgroundColor),
CED.Action(Drawer_FieldCullingMask),
CED.Action(Drawer_FieldVolumeLayerMask),
CED.space,

CED.space,
CED.Action(Drawer_FieldDepth),
CED.Action(Drawer_FieldRenderingPath),
CED.Action(Drawer_FieldAllowMSAA),
CED.Action(Drawer_FieldAllowDynamicResolution),
CED.Action(Drawer_FieldRenderingPath),
CED.FadeGroup(
(s, d, o, i) => s.isSectionExpandedTargetEyeOptions.faded,
true,

CED.Action(Drawer_SectionLightLoop)))
};
static void Drawer_FieldClearFlags(UIState s, SerializedHDCamera p, Editor owner)
{
EditorGUILayout.PropertyField(p.clearFlags, _.GetContent("Clear Flags|What to display in empty areas of this Camera's view.\n\nChoose Skybox to display a skybox in empty areas, defaulting to a background color if no skybox is found.\n\nChoose Solid Color to display a background color in empty areas.\n\nChoose Depth Only to display nothing in empty areas.\n\nChoose Don't Clear to display whatever was displayed in the previous frame in empty areas."));
}
EditorGUILayout.PropertyField(p.backgroundColor, _.GetContent("Background|The Camera clears the screen to this color before rendering."));
EditorGUILayout.PropertyField(p.backgroundColor, _.GetContent("Background Color|The Camera clears the screen to this color before rendering."));
}
static void Drawer_FieldVolumeLayerMask(UIState s, SerializedHDCamera p, Editor owner)

static void Drawer_FieldOcclusionCulling(UIState s, SerializedHDCamera p, Editor owner)
{
EditorGUILayout.PropertyField(p.occlusionCulling, _.GetContent("Occlusion Culling"));
}
static void Drawer_FieldAllowMSAA(UIState s, SerializedHDCamera p, Editor owner)
{
EditorGUILayout.PropertyField(p.allowMSAA, _.GetContent("Allow MSAA"));
}
static void Drawer_FieldAllowDynamicResolution(UIState s, SerializedHDCamera p, Editor owner)
{
EditorGUILayout.PropertyField(p.allowDynamicResolution, _.GetContent("Allow Dynamic Resolution"));
}
static void Drawer_CameraWarnings(UIState s, SerializedHDCamera p, Editor owner)

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Camera/SerializedHDCamera.cs


public SerializedObject serializedObject;
public SerializedObject serializedAdditionalDataObject;
public SerializedProperty clearFlags;
public SerializedProperty backgroundColor;
public SerializedProperty normalizedViewPortRect;
public SerializedProperty fieldOfView;

public SerializedProperty cullingMask;
public SerializedProperty _renderingPath; // Legacy rendering path
public SerializedProperty allowMSAA;
public SerializedProperty allowDynamicResolution;
public SerializedProperty stereoConvergence;
public SerializedProperty stereoSeparation;
public SerializedProperty nearClippingPlane;

hideFlags.intValue = (int)HideFlags.HideInInspector;
serializedAdditionalDataObject.ApplyModifiedProperties();
clearFlags = serializedObject.FindProperty("m_ClearFlags");
backgroundColor = serializedObject.FindProperty("m_BackGroundColor");
normalizedViewPortRect = serializedObject.FindProperty("m_NormalizedViewPortRect");
nearClippingPlane = serializedObject.FindProperty("near clip plane");

orthographicSize = serializedObject.FindProperty("orthographic size");
depth = serializedObject.FindProperty("m_Depth");
cullingMask = serializedObject.FindProperty("m_CullingMask");
_renderingPath = serializedObject.FindProperty("m_RenderingPath");
allowMSAA = serializedObject.FindProperty("m_AllowMSAA");
allowDynamicResolution = serializedObject.FindProperty("m_AllowDynamicResolution");
stereoConvergence = serializedObject.FindProperty("m_StereoConvergence");
stereoSeparation = serializedObject.FindProperty("m_StereoSeparation");

正在加载...
取消
保存