浏览代码

Merge pull request #1697 from Unity-Technologies/fix-coupling-of-camera-workflow

Fix/coupling hdcamera workflow
/main
GitHub 6 年前
当前提交
355693fa
共有 2 个文件被更改,包括 30 次插入28 次删除
  1. 52
      com.unity.render-pipelines.high-definition/HDRP/Camera/HDAdditionalCameraData.cs
  2. 6
      com.unity.render-pipelines.high-definition/HDRP/Editor/Camera/HDCameraEditor.cs

52
com.unity.render-pipelines.high-definition/HDRP/Camera/HDAdditionalCameraData.cs


None
};
public ClearColorMode clearColorMode;
public ClearColorMode clearColorMode = ClearColorMode.Sky;
public Color backgroundColorHDR;
public bool clearDepth;
public Color backgroundColorHDR = new Color(0.025f, 0.07f, 0.19f, 0.0f);
public bool clearDepth = true;
public RenderingPath renderingPath;
public RenderingPath renderingPath = RenderingPath.Default;
public LayerMask volumeLayerMask;
public LayerMask volumeLayerMask = -1;
public float aperture;
public float shutterSpeed;
public float iso;
public float aperture = 8f;
public float shutterSpeed = 1f / 200f;
public float iso = 400f;
// To be able to turn on/off FrameSettings properties at runtime for debugging purpose without affecting the original one
// we create a runtime copy (m_ActiveFrameSettings that is used, and any parametrization is done on serialized frameSettings)

bool m_IsDebugRegistered = false;
string m_CameraRegisterName;
// When we are a preview, there is no way inside Unity to make a disctinctoin between camera preview and material preview.
// When we are a preview, there is no way inside Unity to make a distinction between camera preview and material preview.
private void Awake()
// This is use to copy data into camera for the Reset() workflow in camera editor
public void CopyTo(HDAdditionalCameraData data)
Init();
}
data.clearColorMode = clearColorMode;
data.backgroundColorHDR = backgroundColorHDR;
data.clearDepth = clearDepth;
data.renderingPath = renderingPath;
data.volumeLayerMask = volumeLayerMask;
data.aperture = aperture;
data.shutterSpeed = shutterSpeed;
data.iso = iso;
public void Reset()
{
Init();
}
m_FrameSettings.CopyTo(data.m_FrameSettings);
m_FrameSettingsRuntime.CopyTo(data.m_FrameSettingsRuntime);
data.m_frameSettingsIsDirty = true; // Let's be sure it is dirty for update
private void Init()
{
clearColorMode = ClearColorMode.Sky;
backgroundColorHDR = new Color(0.025f, 0.07f, 0.19f, 0.0f);
clearDepth = true;
renderingPath = RenderingPath.Default;
volumeLayerMask = -1;
aperture = 8f;
shutterSpeed = 1f / 200f;
iso = 400f;
// We must not copy the following
//data.m_IsDebugRegistered = m_IsDebugRegistered;
//data.m_CameraRegisterName = m_CameraRegisterName;
//data.isEditorCameraPreview = isEditorCameraPreview;
}
// This is the function use outside to access FrameSettings. It return the current state of FrameSettings for the camera

6
com.unity.render-pipelines.high-definition/HDRP/Editor/Camera/HDCameraEditor.cs


partial class HDCameraEditor : Editor
{
[MenuItem("CONTEXT/Camera/Remove Component", false, 0)]
static void RemoveLight(MenuCommand menuCommand)
static void RemoveCamera(MenuCommand menuCommand)
{
GameObject go = ((Camera)menuCommand.context).gameObject;

Undo.SetCurrentGroupName("Reset HD Camera");
Undo.RecordObjects(new UnityEngine.Object[] { camera, cameraAdditionalData }, "Reset HD Camera");
camera.Reset();
cameraAdditionalData.Reset();
// To avoid duplicating init code we copy default settings to Reset additional data
// Note: we can't call this code inside the HDAdditionalCameraData, thus why we don't wrap it in a Reset() function
HDUtils.s_DefaultHDAdditionalCameraData.CopyTo(cameraAdditionalData);
}
SerializedHDCamera m_SerializedCamera;

正在加载...
取消
保存