浏览代码
NodeDrawer now derives from Node.
NodeDrawer now derives from Node.
And all the superfluous files have been removed. Signed-off-by: joce <joce@unity3d.com>/main
Peter Bay Bastian
8 年前
当前提交
4ff1c093
共有 16 个文件被更改,包括 79 次插入 和 460 次删除
-
49MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/NodeDrawData.cs
-
136MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/NodeDrawer.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/SerializableGraphView.cs
-
2MaterialGraphProject/Assets/NewUI/Editor/Elements/Node.cs
-
3MaterialGraphProject/Assets/NewUI/Editor/Elements/Presenters/NodePresenter.cs
-
19MaterialGraphProject/Assets/NewUI/Editor/Views/GraphView.uss
-
28MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/MaterialNodeDrawData.cs
-
15MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/cracks.ShaderSubGraph
-
12MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/HeaderDrawData.cs.meta
-
41MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/HeaderDrawData.cs
-
80MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/HeaderDrawer.cs
-
12MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/HeaderDrawer.cs.meta
-
8MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/SerializableGraph.uss.meta
-
24MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/Header.uss
-
8MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/Header.uss.meta
-
100MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/SerializableGraph.uss
|
|||
fileFormatVersion: 2 |
|||
guid: 3a2754e4165dbb54e886b7604ffbfb31 |
|||
timeCreated: 1478187487 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using RMGUI.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEditor.Graphing.Drawing |
|||
{ |
|||
public class HeaderDrawData : GraphElementPresenter |
|||
{ |
|||
protected HeaderDrawData() |
|||
{} |
|||
|
|||
private INode node; |
|||
|
|||
[SerializeField] private bool m_Expanded; |
|||
|
|||
public string title |
|||
{ |
|||
get { return node.name; } |
|||
} |
|||
|
|||
public bool expanded |
|||
{ |
|||
get { return m_Expanded; } |
|||
set |
|||
{ |
|||
var state = node.drawState; |
|||
state.expanded = value; |
|||
node.drawState = state; |
|||
m_Expanded = value; |
|||
} |
|||
} |
|||
|
|||
public void Initialize(INode inNode) |
|||
{ |
|||
node = inNode; |
|||
name = inNode.name + " Header"; |
|||
m_Expanded = node.drawState.expanded; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using RMGUI.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.RMGUI; |
|||
|
|||
namespace UnityEditor.Graphing.Drawing |
|||
{ |
|||
[StyleSheet("Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/Header.uss")] |
|||
public class HeaderDrawer : DataWatchContainer |
|||
{ |
|||
private VisualElement m_Title; |
|||
private VisualElement m_ExpandButton; |
|||
private HeaderDrawData m_DataProvider; |
|||
|
|||
public HeaderDrawData dataProvider |
|||
{ |
|||
get { return m_DataProvider; } |
|||
set |
|||
{ |
|||
if (m_DataProvider == value) |
|||
return; |
|||
RemoveWatch(); |
|||
m_DataProvider = value; |
|||
OnDataChanged(); |
|||
AddWatch(); |
|||
} |
|||
} |
|||
|
|||
public HeaderDrawer() |
|||
{ |
|||
m_Title = new VisualElement() |
|||
{ |
|||
name = "title", |
|||
content = new GUIContent() |
|||
}; |
|||
AddChild(m_Title); |
|||
|
|||
m_ExpandButton = new VisualElement |
|||
{ |
|||
name = "expandButton", |
|||
content = new GUIContent("") |
|||
}; |
|||
var clickable = new Clickable(OnExpandClick); |
|||
m_ExpandButton.AddManipulator(clickable); |
|||
AddChild(m_ExpandButton); |
|||
} |
|||
|
|||
public HeaderDrawer(HeaderDrawData dataProvider) : this() |
|||
{ |
|||
this.dataProvider = dataProvider; |
|||
} |
|||
|
|||
public override void OnDataChanged() |
|||
{ |
|||
base.OnDataChanged(); |
|||
|
|||
if (dataProvider == null) |
|||
{ |
|||
m_Title.content.text = ""; |
|||
return; |
|||
} |
|||
|
|||
m_Title.content.text = dataProvider.title; |
|||
m_ExpandButton.content.text = dataProvider.expanded ? "Collapse" : "Expand"; |
|||
|
|||
this.Touch(ChangeType.Repaint); |
|||
} |
|||
|
|||
private void OnExpandClick() |
|||
{ |
|||
if (dataProvider == null) return; |
|||
dataProvider.expanded = !dataProvider.expanded; |
|||
} |
|||
|
|||
protected override object toWatch |
|||
{ |
|||
get { return m_DataProvider; } |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 82f528cda04f18f4090208d5ff5a4700 |
|||
timeCreated: 1478187487 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c040dbfc587a399438b3f4bf8cc95f4b |
|||
timeCreated: 1478070440 |
|||
licenseType: Pro |
|||
StyleSheetImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
HeaderDrawer { |
|||
flex-direction: row; |
|||
align-items: stretch; |
|||
justify-content: space-between; |
|||
padding-left: 5; |
|||
padding-right: 5; |
|||
padding-top: 5; |
|||
padding-bottom: 5; |
|||
|
|||
} |
|||
|
|||
HeaderDrawer #title { |
|||
flex: 2; |
|||
text-color: #FFFFFF; |
|||
text-alignment: middle-left; |
|||
font-size: 12; |
|||
font-style: bold; |
|||
} |
|||
|
|||
HeaderDrawer #expandButton { |
|||
flex: 1; |
|||
text-color: rgb(153, 153, 153); |
|||
text-alignment: middle-right; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d8ee6a82394ca48bbbdc1184a36492e2 |
|||
timeCreated: 1481286707 |
|||
licenseType: Pro |
|||
StyleSheetImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
.Node { |
|||
flex-direction: row; |
|||
align-items: stretch; |
|||
border-left: 4; |
|||
border-top: 4; |
|||
border-right: 4; |
|||
border-bottom: 4; |
|||
border-width: 2; |
|||
border-radius: 5; |
|||
} |
|||
|
|||
.Node.selected { |
|||
border-color: rgb(210, 152, 0); |
|||
} |
|||
|
|||
.Node .pane { |
|||
flex-direction: column; |
|||
align-items: stretch; |
|||
padding-left: 4; |
|||
padding-right: 4; |
|||
padding-top: 2; |
|||
padding-bottom: 4; |
|||
border-radius: 2; |
|||
} |
|||
|
|||
.Node .pane.left { |
|||
width: 208; |
|||
background-color: rgb(45, 45, 45); |
|||
} |
|||
|
|||
.Node .pane.right { |
|||
background-color: rgb(32, 33, 33); |
|||
margin-left: 2; |
|||
padding-left: 8; |
|||
} |
|||
|
|||
.Node .pane.right.empty { |
|||
margin-left: 0; |
|||
padding-left: 0; |
|||
padding-right: 0; |
|||
} |
|||
|
|||
.Node .paneItem { |
|||
margin-top: 2; |
|||
} |
|||
|
|||
.Node NodeAnchor { |
|||
height: 26; |
|||
align-items: center; |
|||
} |
|||
|
|||
.Node NodeAnchor #connector { |
|||
background-color: rgb(20, 21, 21); |
|||
border-color: rgb(20, 21, 21); |
|||
/* width is currently hard-coded */ |
|||
border-width: 4; |
|||
margin-left: 5; |
|||
margin-right: 5; |
|||
width: 10; |
|||
height: 10; |
|||
border-radius: 15; |
|||
} |
|||
|
|||
.Node NodeAnchor #connector.anchorHighlight { |
|||
background-color: rgb(220, 220, 220); |
|||
border-color: rgb(220, 220, 220); |
|||
} |
|||
|
|||
.Node #input NodeAnchor { |
|||
flex-direction: row; |
|||
} |
|||
|
|||
.Node #output NodeAnchor { |
|||
flex-direction: row-reverse; |
|||
} |
|||
|
|||
.Node NodeAnchor #type { |
|||
text-color: rgb(153, 153, 153); |
|||
flex:1; |
|||
} |
|||
|
|||
.Node #input NodeAnchor #type { |
|||
text-alignment: middle-left; |
|||
} |
|||
|
|||
.Node #output NodeAnchor #type { |
|||
text-alignment: middle-right; |
|||
} |
|||
|
|||
.Node #controls { |
|||
flex-direction: column; |
|||
padding-bottom: 2; |
|||
padding-left: 4; |
|||
padding-right: 4; |
|||
} |
|||
|
|||
.Node #controls #element{ |
|||
flex-direction: column; |
|||
} |
|||
|
撰写
预览
正在加载...
取消
保存
Reference in new issue