浏览代码
Fix visual selection issue (no border + title disappearing) and extract header into its own drawer
/main
Fix visual selection issue (no border + title disappearing) and extract header into its own drawer
/main
Peter Bay Bastian
8 年前
当前提交
14f32a76
共有 5 个文件被更改,包括 103 次插入 和 29 次删除
-
4MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/NodeDrawData.cs
-
17MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/NodeDrawer.cs
-
54MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Styles/MaterialGraph.uss
-
18MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/HeaderDrawData.cs
-
39MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/HeaderDrawer.cs
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEditor.Graphing.Drawing |
|||
{ |
|||
public class HeaderDrawData : NodeDrawData |
|||
{ |
|||
protected HeaderDrawData() |
|||
{} |
|||
|
|||
public INode node { get; private set; } |
|||
|
|||
public void Initialize(INode inNode) |
|||
{ |
|||
node = inNode; |
|||
name = inNode.name + " Header"; |
|||
} |
|||
} |
|||
} |
|
|||
using RMGUI.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.RMGUI; |
|||
|
|||
namespace UnityEditor.Graphing.Drawing |
|||
{ |
|||
public class HeaderDrawer : GraphElement |
|||
{ |
|||
private VisualElement m_Title; |
|||
|
|||
public HeaderDrawer() |
|||
{ |
|||
pickingMode = PickingMode.Ignore; |
|||
RemoveFromClassList("graphElement"); |
|||
m_Title = new VisualElement() |
|||
{ |
|||
name = "title", |
|||
content = new GUIContent(), |
|||
pickingMode = PickingMode.Ignore |
|||
}; |
|||
AddChild(m_Title); |
|||
} |
|||
|
|||
public override void OnDataChanged() |
|||
{ |
|||
base.OnDataChanged(); |
|||
|
|||
var headerData = dataProvider as HeaderDrawData; |
|||
|
|||
if (headerData == null) |
|||
{ |
|||
m_Title.content.text = ""; |
|||
return; |
|||
} |
|||
|
|||
m_Title.content.text = headerData.node.name; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue