浏览代码

Updated Unlit settings master node to also have the new stylish settings view

/main
Martin Thorzen 7 年前
当前提交
6456ff21
共有 8 个文件被更改,包括 32 次插入56 次删除
  1. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PBRSettingsView.cs
  2. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/UnlitSettingsView.cs
  3. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PBRSettings.uss
  4. 14
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/UnlitSettings.uss
  5. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRSettings.uxml.meta
  6. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/UnlitSettings.uxml
  7. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/UnlitSettings.uxml.meta
  8. 19
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRSettings.uxml

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PBRSettingsView.cs


{
row.AddToClassList("row");
row.Add(new Label("Alpha mode"), (label) =>
row.Add(new Label("Alpha Mode"), (label) =>
{
label.AddToClassList("label");
});

29
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/UnlitSettingsView.cs


using System.Linq;
using UnityEditor.Experimental.UIElements;
using UnityEditor.Graphing;
using UnityEditor.Graphing.Util;
using UnityEngine;
using UnityEngine.Experimental.UIElements;

UnlitMasterNode m_Node;
public UnlitSettingsView(INode node)
{
AddStyleSheetPath("Styles/UnlitSettings");
var uxml = Resources.Load<VisualTreeAsset>("UXML/UnlitSettings");
uxml.CloneTree(this, null);
this.Add(new VisualElement{ name="container" }, (container) =>
{
container.Add( new VisualElement(), (row) =>
{
row.AddToClassList("row");
row.Add(new Label { text = "Alpha Mode"}, (label) =>
{
label.AddToClassList("label");
});
m_Container = this.Q("container");
m_AlphaMode = new EnumField(m_Node.alphaMode);
m_AlphaMode.AddToClassList("enumcontainer");
m_Container.Add(m_AlphaMode);
m_AlphaMode.OnValueChanged(ChangeAlphaMode);
row.Add(new EnumField(AlphaMode.AdditiveBlend), (enumField) =>
{
enumField.AddToClassList("enumcontainer");
enumField.value = m_Node.alphaMode;
enumField.OnValueChanged(ChangeAlphaMode);
});
});
} );
}
void ChangeAlphaMode(ChangeEvent<Enum> evt)

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PBRSettings.uss


width: 75;
}
PBRSettingsView > #container > #rowContainer > #itemContainer{
flex-direction: column;
flex-grow: 1;
}
PBRSettingsView > #container > .row > .enumcontainer{
flex-grow: 1;
margin-left: 4;

14
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/UnlitSettings.uss


UnlitSettingsView > #container{
flex-grow: 1;
background-color: rgb(63, 63, 63);
background-color: rgba(0, 0, 0, 0.7);
UnlitSettingsView > #container > .enumcontainer{
UnlitSettingsView > #container > .row {
flex-direction: row;
}
UnlitSettingsView > #container > .row > .label {
width: 75;
}
UnlitSettingsView > #container > .row > .enumcontainer{
flex-grow: 1;
margin-left: 4;
margin-right: 4;
margin-top: 4;

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRSettings.uxml.meta


fileFormatVersion: 2
guid: 18608cc1dad140b47ab3321c8d9d59fe
ScriptedImporter:
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/UnlitSettings.uxml


<UXML xmlns:ui="UnityEngine.Experimental.UIElements">
<ui:VisualElement name="container">
<Style path="Styles/UnlitSettings"/>
</ui:VisualElement>
</UXML>

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/UnlitSettings.uxml.meta


fileFormatVersion: 2
guid: 62180873ad7c1fb4989e7158b0805f32
ScriptedImporter:
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

19
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRSettings.uxml


<UXML xmlns:ui="UnityEngine.Experimental.UIElements"
xmlns:sg="UnityEditor.ShaderGraph.Drawing">
<ui:VisualElement name="container">
<Style path="Styles/PBRSettings"/>
<ui:VisualElement class="row" pickingMode="Ignore">
<!-- <ui:VisualElement name="itemContainer" pickingMode="Ignore" /> -->
<ui:Label class="label" name="typeLabel" text = "Plopp" pickingMode="Ignore" />
<ui:Label text="im an enum" pickingMode="Ignore" />
<ui:VisualElement name="itemContainer" pickingMode="Ignore" />
</ui:VisualElement>
<ui:VisualElement class="row" pickingMode="Ignore">
<!-- <ui:VisualElement name="itemContainer" pickingMode="Ignore" /> -->
<ui:Label class="label" name="typeLabel" text = "Plopp" pickingMode="Ignore" />
<sg:EnumElement />
<ui:VisualElement name="itemContainer" pickingMode="Ignore" />
</ui:VisualElement>
</ui:VisualElement>
</UXML>
正在加载...
取消
保存