浏览代码

|HDRenderPipeEditor] Dispose created HDRenderPipeline instance when the HDRenderPipelineAsset was modified in the Editor

/main
Frédéric Vauchelles 7 年前
当前提交
7b22dfdd
共有 2 个文件被更改,包括 4 次插入23 次删除
  1. 23
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineInspector.cs
  2. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipelineAsset.cs

23
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineInspector.cs


m_FrameSettingsUI.Reset(serializedFrameSettings, Repaint);
}
static void HackSetDirty(RenderPipelineAsset asset)
{
EditorUtility.SetDirty(asset);
var method = typeof(RenderPipelineAsset).GetMethod("OnValidate", BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Instance);
if (method != null)
method.Invoke(asset, new object[0]);
}
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_SpotCookieSize, s_Styles.spotCookieSize);
EditorGUILayout.PropertyField(m_PointCookieSize, s_Styles.pointCookieSize);
EditorGUILayout.PropertyField(m_ReflectionCubemapSize, s_Styles.reflectionCubemapSize);

EditorGUILayout.PropertyField(m_SkyLightingOverrideLayerMask, s_Styles.skyLightingOverride);
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(hdAsset); // Repaint
}
EditorGUI.indentLevel--;
}

EditorGUILayout.LabelField(s_Styles.renderingSettingsLabel);
EditorGUI.indentLevel++;
EditorGUI.BeginChangeCheck();
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(hdAsset); // Repaint
}
EditorGUI.indentLevel--;
}

EditorGUILayout.LabelField(s_Styles.shadowSettings);
EditorGUI.indentLevel++;
EditorGUI.BeginChangeCheck();
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(hdAsset); // Repaint
}
EditorGUI.indentLevel--;
}

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipelineAsset.cs


// Modification of defaultFrameSettings in the inspector will call OnValidate().
// We do a copy of the settings to those effectively used
serializedFrameSettings.CopyTo(m_FrameSettings);
// All instance created in the editor have obsolete settings
// So we must dispose them
DestroyCreatedInstances();
}
// Store the various RenderPipelineSettings for each platform (for now only one)

正在加载...
取消
保存