浏览代码

Made title bar look more like the one in the scene view and added button for showing graph in scene view (not functional yet though)

/main
Peter Bay Bastian 8 年前
当前提交
235ac2cb
共有 2 个文件被更改,包括 39 次插入13 次删除
  1. 25
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/TitleBarDrawer.cs
  2. 27
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/TitleBar.uss

25
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/TitleBarDrawer.cs


public class TitleBarDrawer : DataWatchContainer
{
private TitleBarDrawData m_dataProvider;
private Label m_title;
private VisualElement m_title;
public TitleBarDrawData dataProvider
{

};
AddChild(rightContainer);
m_title = new Label(new GUIContent(""))
var titleItem = new VisualContainer() { classList = new ClassList("titleBarItem") };
titleItem.AddChild(new VisualElement() { classList = new ClassList("titleBarItemBorder") });
m_title = new VisualElement()
name = "title",
pickingMode = PickingMode.Ignore
classList = new ClassList("titleBarItemLabel"),
content = new GUIContent("")
leftContainer.AddChild(m_title);
titleItem.AddChild(m_title);
titleItem.AddChild(new VisualElement() { classList = new ClassList("titleBarItemBorder") });
leftContainer.AddChild(titleItem);
var showInProjectItem = new VisualContainer() { classList = new ClassList("titleBarItem") };
showInProjectItem.AddChild(new VisualElement() { classList = new ClassList("titleBarItemBorder") });
var showInProjectLabel = new VisualElement()
{
classList = new ClassList("titleBarItemLabel"),
content = new GUIContent("Show in project")
};
showInProjectItem.AddChild(showInProjectLabel);
showInProjectItem.AddChild(new VisualElement() { classList = new ClassList("titleBarItemBorder") });
leftContainer.AddChild(showInProjectItem);
this.dataProvider = dataProvider;
}

27
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/TitleBar.uss


flex-direction: row;
justify-content: space-between;
align-items: stretch;
background-color: #212121;
background-color: rgba(33, 33, 33, 0.5);
margin-left: 1;
/*margin-top: -1;*/
flex: 1;
height: 16;
flex: 1;
align-items: stretch;
flex-direction: row;
justify-content: flex-start;
#TitleBar #left {
align-items: center;
.titleBarItem {
margin-left: 5;
#TitleBar #title {
background-color: #f00;
font-style: bold;
.titleBarItemBorder {
background-color: rgba(33, 33, 33, 0.5);
width: 1;
}
.titleBarItemLabel {
text-color: rgba(255, 255, 255, 0.6);
font-size: 9;
text-alignment: middle-left;
padding-left: 5;
}
正在加载...
取消
保存