浏览代码

Updated the settings visual element for nodes

/main
Martin Thorzen 7 年前
当前提交
324ad522
共有 7 个文件被更改,包括 29 次插入40 次删除
  1. 44
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
  2. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialNodeView.uss
  3. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/NodeSettings.uss
  4. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PBRMaster.uss
  5. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PBRSettings.uss
  6. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRMaster.uxml
  7. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRSettings.uxml

44
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs


VisualElement m_SettingsContainer;
bool m_ShowSettings = false;
VisualElement m_SettingsButton;
VisualElement m_SettingsDivider;
VisualElement m_Settings;
public void Initialize(AbstractMaterialNode inNode, PreviewManager previewManager, IEdgeConnectorListener connectorListener)
{

parent.Add(buttonContainer);
m_SettingsContainer = new VisualElement { name = "settings-container" };
Add(m_SettingsContainer);
m_SettingsContainer.SendToBack();
//m_SettingsContainer.SendToBack();
m_SettingsContainer = new VisualElement { name = "settings-container" };
contents.Add(m_SettingsContainer);
if (node.hasPreview)
m_SettingsContainer.PlaceBehind(m_PreviewFiller);
//if(!m_ShowSettings)
//else
// settingsButton.Add(new VisualElement { name = "icon-clicked" });
{
//var graph = (AbstractMaterialGraph)node.owner;
// martintt have to add this to the node to the right of it.
{
/*
if (m_ShowSettings)
{
m_SettingsContainer.Add(settings.CreateSettingsElement());
}
else
m_SettingsContainer.RemoveAt(0);
*/
//Add(settings.CreateSettingsElement());
}
buttonContainer.Add(collapseButton);
}

m_ShowSettings = !m_ShowSettings;
if (m_ShowSettings)
{
m_SettingsContainer.Add(settings.CreateSettingsElement());
m_SettingsDivider = new VisualElement { name = "divider" };
m_SettingsDivider.AddToClassList("horizontal");
m_SettingsContainer.Add(m_SettingsDivider);
m_Settings = settings.CreateSettingsElement();
m_SettingsContainer.Add(m_Settings);
m_SettingsContainer.RemoveAt(0);
m_SettingsDivider.RemoveFromHierarchy();
m_Settings.RemoveFromHierarchy();
m_SettingsButton.RemoveFromClassList("clicked");
}
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialNodeView.uss


}
MaterialNodeView > #settings-container {
position-type : absolute;
width : 200;
position-left : 200;
}
MaterialNodeView > #node-border > #title > #button-container{

MaterialNodeView > #node-border > #title > #button-container > #settings-button:hover{
background-color: #2B2B2B;
}
MaterialNodeView > #node-border > #title > #button-container > #settings-button.clicked{
background-color: #2B2B2B;

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/NodeSettings.uss


NodeSettingsView > #mainContainer {
width: 200;
/*width: 200;*/
/*background-color: #e8596e;*/
border-color: #e8596e;

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PBRMaster.uss


NodeSettingsView > #mainContainer > #title {
font-style: bold;
font-color: rgb(200,0,200);
font-color: rgb(0, 177, 200);
background-color: #F0F0F0;
width: 200;
}

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


PBRSettingsView > #container{
font-style: bold;
text-color: rgb(200,0,200);
background-color: #F0F0F0;
}
PBRSettingsView > #container > #nodename {
font-style: bold;
text-color: rgb(200,0,200);
background-color: #F0F0F0;
background-color: rgb(167, 142, 142);
text-color: rgb(245, 155, 225);
text-color: rgb(155, 245, 245);
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRMaster.uxml


<UXML xmlns:ui="UnityEngine.Experimental.UIElements">
<ui:VisualElement name="container" class="row">
<Style path="Styles/NodeSettings"/>
<ui:Label name="nodename" text="PBR Master"/>
<ui:Label name="nodename" text="Settings"/>
</UXML>
</UXML>

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


<UXML xmlns:ui="UnityEngine.Experimental.UIElements">
<ui:VisualElement name="container">
<Style path="Styles/PBRSettings"/>
<ui:Label name="nodename" text="PBR Master"/>
<!-->ui:Label name="nodename" text="Settings"/-->
</ui:VisualElement>
</UXML>
正在加载...
取消
保存