浏览代码

Rename *Drawer to *View

/main
Peter Bay Bastian 7 年前
当前提交
45e02be9
共有 23 个文件被更改,包括 102 次插入39 次删除
  1. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs
  2. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
  3. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/TitleBar.uss
  4. 10
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs
  5. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/NodePreviewView.cs
  6. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarButtonView.cs
  7. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarView.cs
  8. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
  9. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views.meta
  10. 69
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
  11. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer.meta
  12. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs.meta
  13. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs
  14. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs.meta
  15. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/NodePreviewView.cs.meta
  16. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/NodePreviewView.cs
  17. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs.meta
  18. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarButtonView.cs
  19. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarButtonView.cs.meta
  20. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarView.cs
  21. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarView.cs.meta
  22. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs

10
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs


[SerializeField]
MaterialGraphAsset m_InMemoryAsset;
GraphEditorDrawer m_GraphEditorDrawer;
GraphEditorView m_GraphEditorView;
public IGraphAsset inMemoryAsset
{

void OnEnable()
{
m_GraphEditorDrawer = new GraphEditorDrawer(CreateGraphView());
rootVisualContainer.Add(m_GraphEditorDrawer);
m_GraphEditorView = new GraphEditorView(CreateGraphView());
rootVisualContainer.Add(m_GraphEditorView);
m_GraphEditorDrawer.presenter = source;
m_GraphEditorView.presenter = source;
}
void OnDisable()

var source = CreateDataSource();
source.Initialize(inMemoryAsset, this);
m_GraphEditorDrawer.presenter = source;
m_GraphEditorView.presenter = source;
//m_GraphView.StretchToParentSize();
Repaint();

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss


GraphEditorDrawer {
GraphEditorView {
GraphEditorDrawer #TitleBar {
GraphEditorView #TitleBar {
GraphEditorDrawer #content {
GraphEditorView #content {
GraphEditorDrawer #content #GraphView {
GraphEditorView #content #GraphView {
GraphEditorDrawer #content GraphInspectorView {
GraphEditorView #content GraphInspectorView {
width: 300;
padding-left: 10;
padding-right: 10;

GraphEditorDrawer #content GraphInspectorView IMGUIContainer {
GraphEditorView #content GraphInspectorView IMGUIContainer {
flex: 1;
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/TitleBar.uss


TitleBarDrawer {
TitleBarView {
flex-direction: row;
justify-content: space-between;
align-items: stretch;

}
TitleBarDrawer #left,
TitleBarDrawer #right {
TitleBarView #left,
TitleBarView #right {
flex: 1;
height: 16;
background-color: #3d3d3d;

TitleBarDrawer #left {
TitleBarView #left {
TitleBarDrawer #right {
TitleBarView #right {
justify-content: flex-end;
}

text-alignment: middle-left;
padding-left: 5;
padding-right: 5;
}
}

10
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs


RegisterCallback<MouseUpEvent>(DoContextMenu);
typeFactory[typeof(MaterialNodePresenter)] = typeof(MaterialNodeDrawer);
typeFactory[typeof(MaterialNodePresenter)] = typeof(MaterialNodeView);
typeFactory[typeof(GraphAnchorPresenter)] = typeof(NodeAnchor);
typeFactory[typeof(EdgePresenter)] = typeof(Edge);

return EventPropagation.Stop;
nodalViewData.RemoveElements(
selection.OfType<MaterialNodeDrawer>().Select(x => x.GetPresenter<MaterialNodePresenter>()),
selection.OfType<MaterialNodeView>().Select(x => x.GetPresenter<MaterialNodePresenter>()),
selection.OfType<Edge>().Select(x => x.GetPresenter<GraphEdgePresenter>())
);

return;
var graphAsset = graphDataSource.graphAsset;
if (graphAsset == null || graphAsset.drawingData.selection.SequenceEqual(selection.OfType<MaterialNodeDrawer>().Select(d => ((MaterialNodePresenter) d.presenter).node.guid))) return;
if (graphAsset == null || graphAsset.drawingData.selection.SequenceEqual(selection.OfType<MaterialNodeView>().Select(d => ((MaterialNodePresenter) d.presenter).node.guid))) return;
.OfType<MaterialNodeDrawer>()
.OfType<MaterialNodeView>()
.FirstOrDefault(drawer => ((MaterialNodePresenter) drawer.presenter).node.guid == guid))
.ToList();

if (graphDataSource == null)
return;
var selectedNodes = selection.OfType<MaterialNodeDrawer>().Select(x => (MaterialNodePresenter) x.presenter);
var selectedNodes = selection.OfType<MaterialNodeView>().Select(x => (MaterialNodePresenter) x.presenter);
graphDataSource.UpdateSelection(selectedNodes);
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/NodePreviewView.cs


namespace UnityEditor.MaterialGraph.Drawing
{
public class NodePreviewDrawer : Image
public class NodePreviewView : Image
{
public NodePreviewPresenter data;

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarButtonView.cs


namespace UnityEditor.MaterialGraph.Drawing
{
public class TitleBarButtonDrawer : DataWatchContainer
public class TitleBarButtonView : DataWatchContainer
{
TitleBarButtonPresenter m_dataProvider;
Clicker m_clicker;

}
}
public TitleBarButtonDrawer(TitleBarButtonPresenter dataProvider)
public TitleBarButtonView(TitleBarButtonPresenter dataProvider)
{
AddToClassList("titleBarItem");

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarView.cs


namespace UnityEditor.MaterialGraph.Drawing
{
// TODO JOCE: we should not need a title bar drawer. It should just be a visual element in the nodedrawer.
public class TitleBarDrawer : DataWatchContainer
public class TitleBarView : DataWatchContainer
{
TitleBarPresenter m_DataProvider;
VisualContainer m_LeftContainer;

}
}
public TitleBarDrawer()
public TitleBarView()
{
name = "TitleBar";

{
container.ClearChildren();
foreach (var itemPresenter in itemDatas)
container.AddChild(new TitleBarButtonDrawer(itemPresenter));
container.AddChild(new TitleBarButtonView(itemPresenter));
}
protected override Object[] toWatch

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs


namespace UnityEditor.MaterialGraph.Drawing
{
public class MaterialNodeDrawer : Node
public class MaterialNodeView : Node
{
VisualContainer m_ControlsContainer;
List<GraphControlPresenter> m_CurrentControlPresenter;

public MaterialNodeDrawer()
public MaterialNodeView()
{
CreateContainers();

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views.meta


fileFormatVersion: 2
guid: a24ff57a99e64e33b4f88b1e81d84e97
timeCreated: 1502955833

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


using UnityEditor.Experimental.UIElements.GraphView;
using UnityEditor.MaterialGraph.Drawing;
using UnityEditor.MaterialGraph.Drawing.Views;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.MaterialGraph.Drawing
{
// TODO JOCE: Maybe this needs to derive from something we already have?
public class GraphEditorView : DataWatchContainer
{
GraphView m_GraphView;
GraphInspectorView m_GraphInspectorView;
public GraphView graphView
{
get { return m_GraphView; }
}
private TitleBarView m_TitleBarView;
// TODO: Create graphView from here rather than have it passed in through constructor
public GraphEditorView(GraphView graphView)
{
AddStyleSheetPath("Styles/MaterialGraph");
m_GraphView = graphView;
m_GraphView.name = "GraphView";
m_TitleBarView = new TitleBarView();
m_TitleBarView.name = "TitleBar";
m_GraphInspectorView = new GraphInspectorView();
Add(m_TitleBarView);
var contentContainer = new VisualElement() { m_GraphView, m_GraphInspectorView };
contentContainer.name = "content";
Add(contentContainer);
}
public override void OnDataChanged()
{
m_GraphView.presenter = m_Presenter;
m_TitleBarView.dataProvider = m_Presenter.titleBar;
m_GraphInspectorView.presenter = m_Presenter.graphInspectorPresenter;
}
MaterialGraphPresenter m_Presenter;
public MaterialGraphPresenter presenter
{
get { return m_Presenter; }
set
{
if (m_Presenter == value)
return;
RemoveWatch();
m_Presenter = value;
OnDataChanged();
AddWatch();
}
}
protected override Object[] toWatch
{
get { return new Object[]{m_Presenter}; }
}
}
}

9
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer.meta


fileFormatVersion: 2
guid: 7887abd697bcde24596ec729cd7e3c3e
folderAsset: yes
timeCreated: 1476708485
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphView.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphView.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/MaterialNodeDrawer.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/NodePreviewDrawer.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/NodePreviewView.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/NodePreviewDrawer.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/NodePreviewView.cs

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/GraphEditorDrawer.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/TitleBarButtonDrawer.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarButtonView.cs

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/TitleBarButtonDrawer.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarButtonView.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/TitleBarDrawer.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarView.cs

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/TitleBarDrawer.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/TitleBarView.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/MaterialNodeDrawer.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs

正在加载...
取消
保存