浏览代码

HDRenderLoop LayeredLit: Merge layers sync button to only one "Sync-all" button.

/main
Julien Ignace 8 年前
当前提交
0c37e8d3
共有 1 个文件被更改,包括 27 次插入16 次删除
  1. 43
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/LayeredLitUI.cs

43
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/LayeredLitUI.cs


new GUIContent("Material Layer 2"),
new GUIContent("Material Layer 3"),
};
public readonly GUIContent syncButton = new GUIContent("Sync", "Re-synchronize this layer's properties with the referenced Material");
public readonly GUIContent syncButton = new GUIContent("Re-Synchronize Layers", "Re-synchronize all layers's properties with the referenced Material");
public readonly GUIContent layers = new GUIContent("Layers");
public readonly GUIContent layerMapMask = new GUIContent("Layer Mask", "Layer mask (multiplied by vertex color)");
public readonly GUIContent layerCount = new GUIContent("Layer Count", "Number of layers.");

{
set { layerCountProperty.floatValue = (float)value; }
get { return (int)layerCountProperty.floatValue; }
}
void SynchronizeAllLayersProperties()
{
for(int i = 0 ; i < layerCount; ++i)
{
SynchronizeLayerProperties(i);
}
}
void SynchronizeLayerProperties(int layerIndex)

{
Undo.RecordObject(material, "Change layer count");
layerCountProperty.floatValue = (float)newLayerCount;
SynchronizeAllLayersProperties();
layerChanged = true;
}

{
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
m_MaterialLayers[i] = EditorGUILayout.ObjectField(styles.materialLayerLabels[i], m_MaterialLayers[i], typeof(Material), true) as Material;
if (EditorGUI.EndChangeCheck())
EditorGUI.BeginChangeCheck();
m_MaterialLayers[i] = EditorGUILayout.ObjectField(styles.materialLayerLabels[i], m_MaterialLayers[i], typeof(Material), true) as Material;
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(materialImporter, "Change layer material");
SynchronizeLayerProperties(i);
layerChanged = true;
}
Undo.RecordObject(materialImporter, "Change layer material");
SynchronizeLayerProperties(i);
layerChanged = true;
}
}
if (GUILayout.Button(styles.syncButton, GUILayout.Width(kSyncButtonWidth)))
{
SynchronizeLayerProperties(i);
layerChanged = true;
}
EditorGUILayout.Space();
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
if (GUILayout.Button(styles.syncButton))
{
SynchronizeAllLayersProperties();
layerChanged = true;
EditorGUILayout.EndHorizontal();
GUILayout.EndHorizontal();
EditorGUI.indentLevel--;

正在加载...
取消
保存