Peter Bay Bastian
7 年前
当前提交
485654b6
共有 11 个文件被更改,包括 172 次插入 和 19 次删除
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/GraphEditorDrawer.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/MaterialNodeDrawer.cs
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphView.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/NodeInspectors/BasicNodeInspector.cs
-
24MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
23MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
-
46MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/GraphInspectorPresenter.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/GraphInspectorPresenter.cs.meta
-
60MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphInspectorView.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphInspectorView.cs.meta
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEditor.Graphing.Util; |
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
public class GraphInspectorPresenter : ScriptableObject |
|||
{ |
|||
[SerializeField] |
|||
List<AbstractNodeInspector> m_Inspectors; |
|||
|
|||
public List<AbstractNodeInspector> inspectors |
|||
{ |
|||
get { return m_Inspectors; } |
|||
set { m_Inspectors = value; } |
|||
} |
|||
|
|||
ScriptableObjectFactory<INode, AbstractNodeInspector, BasicNodeInspector> m_InspectorFactory; |
|||
|
|||
public void Initialize() |
|||
{ |
|||
inspectors = new List<AbstractNodeInspector>(); |
|||
m_InspectorFactory = new ScriptableObjectFactory<INode, AbstractNodeInspector, BasicNodeInspector>(new[] |
|||
{ |
|||
new TypeMapping(typeof(AbstractSurfaceMasterNode), typeof(SurfaceMasterNodeInspector)), |
|||
new TypeMapping(typeof(PropertyNode), typeof(PropertyNodeInspector)), |
|||
new TypeMapping(typeof(SubGraphInputNode), typeof(SubgraphInputNodeInspector)), |
|||
new TypeMapping(typeof(SubGraphOutputNode), typeof(SubgraphOutputNodeInspector)) |
|||
}); |
|||
} |
|||
|
|||
public void UpdateSelection(IEnumerable<INode> nodes) |
|||
{ |
|||
m_Inspectors.Clear(); |
|||
foreach (var node in nodes.OfType<SerializableNode>()) |
|||
{ |
|||
var inspector = m_InspectorFactory.Create(node); |
|||
inspector.Initialize(node); |
|||
m_Inspectors.Add(inspector); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 215d826e4a644dc0bde2fa9ba68f4096 |
|||
timeCreated: 1502956093 |
|
|||
using System; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Views |
|||
{ |
|||
public class GraphInspectorView : DataWatchContainer |
|||
{ |
|||
[SerializeField] |
|||
GraphInspectorPresenter m_Presenter; |
|||
|
|||
IMGUIContainer m_ImguiContainer; |
|||
|
|||
public GraphInspectorView() |
|||
{ |
|||
AddStyleSheetPath("Styles/MaterialGraph"); |
|||
Add(m_ImguiContainer = new IMGUIContainer(OnGUIHandler)); |
|||
} |
|||
|
|||
void OnGUIHandler() |
|||
{ |
|||
if (m_Presenter == null) |
|||
return; |
|||
|
|||
foreach (var inspector in presenter.inspectors) |
|||
{ |
|||
inspector.OnInspectorGUI(); |
|||
} |
|||
} |
|||
|
|||
public override void OnDataChanged() |
|||
{ |
|||
if (presenter == null) |
|||
return; |
|||
Dirty(ChangeType.Repaint); |
|||
} |
|||
|
|||
public GraphInspectorPresenter presenter |
|||
{ |
|||
get { return m_Presenter; } |
|||
set |
|||
{ |
|||
if (m_Presenter == value) |
|||
return; |
|||
RemoveWatch(); |
|||
m_Presenter = value; |
|||
// m_ImguiContainer.executionContext = presenter.GetInstanceID();
|
|||
OnDataChanged(); |
|||
AddWatch(); |
|||
} |
|||
} |
|||
|
|||
protected override Object[] toWatch |
|||
{ |
|||
get { return new Object[] {m_Presenter}; } |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d80d2409e2484dbea449768bbdd267b9 |
|||
timeCreated: 1502956197 |
撰写
预览
正在加载...
取消
保存
Reference in new issue