浏览代码

Remove last bit of toolbar

/main
Peter Bay Bastian 7 年前
当前提交
4a06bed4
共有 4 个文件被更改,包括 15 次插入71 次删除
  1. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
  2. 23
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
  3. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs.meta
  4. 39
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs


PersistentMesh m_PersistentMasterNodePreviewMesh;
public Action onUpdateAssetClick { get; set; }
public Action onShowInProjectClick { get; set; }
public GraphInspectorView(string assetName, PreviewManager previewManager, AbstractMaterialGraph graph)
{

{
var headerContainer = new VisualElement {name = "header"};
{
headerContainer.Add(new Label(assetName) {name = "title"});
var title = new Label(assetName) {name = "title"};
title.AddManipulator(new Clickable(() =>
{
if (onShowInProjectClick != null)
onShowInProjectClick();
}));
headerContainer.Add(title);
if (onUpdateAssetClick != null) onUpdateAssetClick();
if (onUpdateAssetClick != null)
onUpdateAssetClick();
}) { name = "save", text = "Save" });
}
topContainer.Add(headerContainer);

23
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs


{
MaterialGraphView m_GraphView;
GraphInspectorView m_GraphInspectorView;
ToolbarView m_ToolbarView;
AbstractMaterialGraph m_Graph;
PreviewManager m_PreviewManager;

set { m_SearchWindowProvider.onConvertToSubgraphClick = value; }
}
public Action onShowInProjectClick { get; set; }
public Action onShowInProjectClick
{
get { return m_GraphInspectorView.onShowInProjectClick; }
set { m_GraphInspectorView.onShowInProjectClick = value; }
}
public MaterialGraphView graphView
{

AddStyleSheetPath("Styles/MaterialGraph");
previewManager = new PreviewManager(graph);
m_ToolbarView = new ToolbarView { name = "TitleBar" };
{
m_ToolbarView.Add(new ToolbarSpaceView());
m_ToolbarView.Add(new ToolbarSeparatorView());
var showInProjectButton = new ToolbarButtonView { text = "Show in project" };
showInProjectButton.AddManipulator(new Clickable(() =>
{
if (onShowInProjectClick != null) onShowInProjectClick();
}));
m_ToolbarView.Add(showInProjectButton);
m_ToolbarView.Add(new ToolbarSeparatorView());
}
Add(m_ToolbarView);
var content = new VisualElement { name = "content" };
{

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs.meta


fileFormatVersion: 2
guid: ee180f58558e24c4eb35f9f5ed8c4470
timeCreated: 1478775744
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

39
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/ToolbarView.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEditor.Experimental.UIElements.GraphView;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.ShaderGraph.Drawing
{
public class ToolbarView : BaseTextElement
{
public ToolbarView()
{
AddStyleSheetPath("Styles/MaterialGraph");
}
}
public class ToolbarButtonView : BaseTextElement
{
public ToolbarButtonView()
{
AddStyleSheetPath("Styles/MaterialGraph");
}
}
public class ToolbarSeparatorView : BaseTextElement
{
public ToolbarSeparatorView()
{
AddStyleSheetPath("Styles/MaterialGraph");
}
}
public class ToolbarSpaceView : BaseTextElement
{
public ToolbarSpaceView()
{
AddStyleSheetPath("Styles/MaterialGraph");
}
}
}
正在加载...
取消
保存