浏览代码

Removed the dependency on SRP so this is now self contained within Shadergraph.

Also removed the dependency on API changes that are note yet in trunk. Button Container on nodes.
/main
Martin Thorzen 7 年前
当前提交
962fc981
共有 4 个文件被更改,包括 28 次插入18 次删除
  1. 3
      com.unity.shadergraph/Editor/Data/MasterNodes/ISubShader.cs
  2. 12
      com.unity.shadergraph/Editor/Data/Nodes/MasterNode.cs
  3. 24
      com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs
  4. 7
      com.unity.shadergraph/Editor/Resources/Styles/MaterialNodeView.uss

3
com.unity.shadergraph/Editor/Data/MasterNodes/ISubShader.cs


{
public interface ISubShader
{
IMasterNode owner { get; set; }
VisualElement CreateSettingsElement();
void UpdateAfterDeserialization();
}
}

12
com.unity.shadergraph/Editor/Data/Nodes/MasterNode.cs


}
}
}
foreach (var subShader in subShaders)
{
subShader.owner = this;
subShader.UpdateAfterDeserialization();
}
}
public VisualElement CreateSettingsElement()

if (commonSettingsElement != null)
container.Add(commonSettingsElement);
foreach (var subShader in subShaders)
{
var settingsElement = subShader.CreateSettingsElement();
if (settingsElement != null)
container.Add(settingsElement);
}
return container;
}

24
com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs


using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEngine.Experimental.UIElements.StyleEnums;
using UnityEngine.Experimental.UIElements.StyleSheets;
using Node = UnityEditor.Experimental.UIElements.GraphView.Node;
#if UNITY_2018_1
using GeometryChangedEvent = UnityEngine.Experimental.UIElements.PostLayoutEvent;

VisualElement m_Settings;
VisualElement m_NodeSettingsView;
VisualElement m_CollapseButton;
// Remove this after updated to the correct API call has landed in trunk. ------------
VisualElement m_TitleContainer;
VisualElement m_ButtonContainer;
// -----------------------------------------------------------------------------------
public void Initialize(AbstractMaterialNode inNode, PreviewManager previewManager, IEdgeConnectorListener connectorListener)
{

}
m_PortInputContainer.SendToBack();
// Remove this after updated to the correct API call has landed in trunk. ------------
m_TitleContainer = this.Q("title");
// -----------------------------------------------------------------------------------
var settings = node as IHasSettings;
if (settings != null)

{
UpdateSettingsExpandedState(settings);
}));
titleButtonContainer.Add(m_SettingsButton);
titleButtonContainer.Add(m_CollapseButton);
// Remove this after updated to the correct API call has landed in trunk. ------------
m_ButtonContainer = new VisualElement{ name = "button-container" };
m_ButtonContainer.style.flexDirection = StyleValue<FlexDirection>.Create(FlexDirection.Row);
m_ButtonContainer.Add(m_SettingsButton);
m_ButtonContainer.Add(m_CollapseButton);
m_TitleContainer.Add(m_ButtonContainer);
// -----------------------------------------------------------------------------------
//titleButtonContainer.Add(m_SettingsButton);
//titleButtonContainer.Add(m_CollapseButton);
RegisterCallback<GeometryChangedEvent>(OnGeometryChanged);
}

7
com.unity.shadergraph/Editor/Resources/Styles/MaterialNodeView.uss


visibility: visible;
}
.node.collapsed > #node-border > #title > #button-container > #collapse-button > #icon {
background-image: resource("GraphView/Nodes/NodeChevronLeft.png");
}
.node.expanded > #node-border > #title > #button-container > #collapse-button > #icon {
background-image : resource("GraphView/Nodes/NodeChevronDown.png");
}
正在加载...
取消
保存