浏览代码

Merge pull request #408 from Unity-Technologies/Branch_MoveMatRefUI

Move Layered shader Material reference UI to the top and split the sy…
/main
GitHub 7 年前
当前提交
0e0ab9d7
共有 3 个文件被更改,包括 26 次插入18 次删除
  1. 42
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs
  2. 1
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
  3. 1
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader

42
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs


const string kHeightTransition = "_HeightTransition";
// UI
MaterialProperty showMaterialReferences = null;
const string kShowMaterialReferences = "_ShowMaterialReferences";
MaterialProperty[] showLayer = new MaterialProperty[kMaxLayerCount];
const string kShowLayer = "_ShowLayer";

useMainLayerInfluence = FindProperty(kkUseMainLayerInfluence, props);
useHeightBasedBlend = FindProperty(kUseHeightBasedBlend, props);
heightTransition = FindProperty(kHeightTransition, props);
showMaterialReferences = FindProperty(kShowMaterialReferences, props);
for (int i = 0; i < kMaxLayerCount; ++i)
{

bool DoMaterialReferencesGUI(AssetImporter materialImporter)
{
EditorGUILayout.LabelField(styles.materialReferencesText, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
showMaterialReferences.floatValue = EditorGUILayout.Foldout(showMaterialReferences.floatValue != 0.0f, styles.materialReferencesText, styles.layerLabelColors[0]) ? 1.0f : 0.0f;
if (showMaterialReferences.floatValue == 0.0f)
return false;
bool layersChanged = false;
Material material = m_MaterialEditor.target as Material;

SynchronizeLayerProperties(material, m_MaterialLayers, layerIndex, false);
layersChanged = true;
}
}
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
if (GUILayout.Button(styles.syncAllButUVButtonText))
GUILayout.BeginHorizontal();
SynchronizeAllLayersProperties(true);
layersChanged = true;
}
if (GUILayout.Button(styles.syncAllButtonText))
{
SynchronizeAllLayersProperties(false);
layersChanged = true;
GUILayout.FlexibleSpace();
if (GUILayout.Button(styles.syncAllButUVButtonText))
{
SynchronizeLayerProperties(material, m_MaterialLayers, layerIndex, true);
layersChanged = true;
}
if (GUILayout.Button(styles.syncAllButtonText))
{
SynchronizeLayerProperties(material, m_MaterialLayers, layerIndex, false);
layersChanged = true;
}
GUILayout.EndHorizontal();
GUILayout.EndHorizontal();
EditorGUI.indentLevel--;
return layersChanged;
}

EditorGUILayout.Space();
layerChanged |= DoMaterialReferencesGUI(materialImporter);
EditorGUILayout.Space();
for (int i = 0; i < numLayer; i++)
{
layerChanged |= DoLayerGUI(materialImporter, i);

layerChanged |= DoMaterialReferencesGUI(materialImporter);
layerChanged |= GUI.changed;
GUI.changed = false;

1
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader


[HideInInspector] _UVDetailsMappingMask2("_UVDetailsMappingMask2", Color) = (1, 0, 0, 0)
[HideInInspector] _UVDetailsMappingMask3("_UVDetailsMappingMask3", Color) = (1, 0, 0, 0)
[HideInInspector] _ShowMaterialReferences("_ShowMaterialReferences", Float) = 0
[HideInInspector] _ShowLayer0("_ShowLayer0", Float) = 0
[HideInInspector] _ShowLayer1("_ShowLayer1", Float) = 0
[HideInInspector] _ShowLayer2("_ShowLayer2", Float) = 0

1
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader


[ToggleOff] _TessellationTilingScale("Tessellation tiling scale", Float) = 1.0
// TODO: Handle culling mode for backface culling
[HideInInspector] _ShowMaterialReferences("_ShowMaterialReferences", Float) = 0
[HideInInspector] _ShowLayer0("_ShowLayer0", Float) = 0
[HideInInspector] _ShowLayer1("_ShowLayer1", Float) = 0
[HideInInspector] _ShowLayer2("_ShowLayer2", Float) = 0

正在加载...
取消
保存