Matt Dean
7 年前
当前提交
fc0d26d6
共有 38 个文件被更改,包括 399 次插入 和 222 次删除
-
58MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/NodeUtils.cs
-
39MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/SerializableGraph.cs
-
8MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Util/ObjectPool.cs
-
44MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/AbstractMaterialGraphEditWindow.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/GraphEditorPresenter.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/NodePreviewPresenter.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
-
17MaterialGraphProject/Assets/UnityShaderEditor/Editor/Util/UIUtilities.cs
-
2MaterialGraphProject/ProjectSettings/ProjectVersion.txt
-
107MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/IMGUISlotEditorView.cs
-
87MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
-
31MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/AbstractNodeEditorView.cs
-
53MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/StandardNodeEditorView.cs
-
35MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/SurfaceMasterNodeEditorView.cs
-
25MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Util/QueuePool.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Util/QueuePool.cs.meta
-
25MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Util/StackPool.cs
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Util/StackPool.cs.meta
-
52MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorPresenter.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Presenters.meta
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/Views.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorPresenter.cs.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/IMGUISlotEditorView.cs.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/StandardNodeEditorView.cs.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/IMGUISlotEditorView.cs
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/AbstractNodeEditorView.cs
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/AbstractNodeEditorView.cs.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/SurfaceMasterNodeEditorView.cs.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/NodeEditorHeaderView.cs
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/NodeEditorHeaderView.cs.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/StandardNodeEditorView.cs
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/SurfaceMasterNodeEditorView.cs
|
|||
m_EditorVersion: 2017.3.0a4 |
|||
m_EditorVersion: 2017.3.0b1 |
|
|||
using System; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine.Graphing; |
|||
using Object = UnityEngine.Object; |
|||
public class IMGUISlotEditorView : DataWatchContainer |
|||
public class IMGUISlotEditorView : VisualElement |
|||
[SerializeField] |
|||
IMGUISlotEditorPresenter m_Presenter; |
|||
MaterialSlot m_Slot; |
|||
int m_SlotsHash; |
|||
ConcreteSlotValueType m_CurrentValueType = ConcreteSlotValueType.Error; |
|||
|
|||
public override void OnDataChanged() |
|||
public IMGUISlotEditorView(MaterialSlot slot) |
|||
if (presenter == null) |
|||
{ |
|||
Clear(); |
|||
return; |
|||
} |
|||
|
|||
if (presenter.slot.concreteValueType == m_CurrentValueType) |
|||
return; |
|||
|
|||
Clear(); |
|||
m_CurrentValueType = presenter.slot.concreteValueType; |
|||
|
|||
Action onGUIHandler; |
|||
if (presenter.slot.concreteValueType == ConcreteSlotValueType.Vector4) |
|||
onGUIHandler = Vector4OnGUIHandler; |
|||
else if (presenter.slot.concreteValueType == ConcreteSlotValueType.Vector3) |
|||
onGUIHandler = Vector3OnGUIHandler; |
|||
else if (presenter.slot.concreteValueType == ConcreteSlotValueType.Vector2) |
|||
onGUIHandler = Vector2OnGUIHandler; |
|||
else if (presenter.slot.concreteValueType == ConcreteSlotValueType.Vector1) |
|||
onGUIHandler = Vector1OnGUIHandler; |
|||
else |
|||
return; |
|||
|
|||
Add(new IMGUIContainer(onGUIHandler)); |
|||
m_Slot = slot; |
|||
Add(new IMGUIContainer(OnGUIHandler)); |
|||
void Vector4OnGUIHandler() |
|||
void OnGUIHandler() |
|||
if (presenter.slot == null) |
|||
if (m_Slot == null) |
|||
presenter.value = EditorGUILayout.Vector4Field(presenter.slot.displayName, presenter.value); |
|||
var newValue = SlotField(m_Slot); |
|||
if (newValue != m_Slot.currentValue) |
|||
{ |
|||
m_Slot.currentValue = newValue; |
|||
m_Slot.owner.onModified(m_Slot.owner, ModificationScope.Node); |
|||
} |
|||
void Vector3OnGUIHandler() |
|||
static Vector4 SlotField(MaterialSlot slot) |
|||
if (presenter.slot == null) |
|||
return; |
|||
var previousWideMode = EditorGUIUtility.wideMode; |
|||
EditorGUIUtility.wideMode = true; |
|||
presenter.value = EditorGUILayout.Vector3Field(presenter.slot.displayName, presenter.value); |
|||
EditorGUIUtility.wideMode = previousWideMode; |
|||
} |
|||
|
|||
void Vector2OnGUIHandler() |
|||
{ |
|||
if (presenter.slot == null) |
|||
return; |
|||
var previousWideMode = EditorGUIUtility.wideMode; |
|||
EditorGUIUtility.wideMode = true; |
|||
presenter.value = EditorGUILayout.Vector2Field(presenter.slot.displayName, presenter.value); |
|||
EditorGUIUtility.wideMode = previousWideMode; |
|||
} |
|||
|
|||
void Vector1OnGUIHandler() |
|||
{ |
|||
if (presenter.slot == null) |
|||
return; |
|||
var previousWideMode = EditorGUIUtility.wideMode; |
|||
EditorGUIUtility.wideMode = true; |
|||
presenter.value = new Vector4(EditorGUILayout.FloatField(presenter.slot.displayName, presenter.value.x), 0, 0, 0); |
|||
EditorGUIUtility.wideMode = previousWideMode; |
|||
} |
|||
|
|||
protected override Object[] toWatch |
|||
{ |
|||
get { return new Object[] { presenter }; } |
|||
} |
|||
|
|||
public IMGUISlotEditorPresenter presenter |
|||
{ |
|||
get { return m_Presenter; } |
|||
set |
|||
{ |
|||
if (value == m_Presenter) |
|||
return; |
|||
RemoveWatch(); |
|||
m_Presenter = value; |
|||
OnDataChanged(); |
|||
AddWatch(); |
|||
} |
|||
if (slot.concreteValueType == ConcreteSlotValueType.Vector1) |
|||
return new Vector4(EditorGUILayout.FloatField(slot.displayName, slot.currentValue.x), 0, 0, 0); |
|||
if (slot.concreteValueType == ConcreteSlotValueType.Vector2) |
|||
return EditorGUILayout.Vector2Field(slot.displayName, slot.currentValue); |
|||
if (slot.concreteValueType == ConcreteSlotValueType.Vector3) |
|||
return EditorGUILayout.Vector3Field(slot.displayName, slot.currentValue); |
|||
if (slot.concreteValueType == ConcreteSlotValueType.Vector4) |
|||
return EditorGUILayout.Vector4Field(slot.displayName, slot.currentValue); |
|||
return Vector4.zero; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using System; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using UnityEngine.Graphing; |
|||
public class AbstractNodeEditorView : DataWatchContainer |
|||
public abstract class AbstractNodeEditorView : VisualElement, IDisposable |
|||
[SerializeField] |
|||
AbstractNodeEditorPresenter m_Presenter; |
|||
public abstract INode node { get; set; } |
|||
public AbstractNodeEditorPresenter presenter |
|||
{ |
|||
get { return m_Presenter; } |
|||
set |
|||
{ |
|||
if (value == m_Presenter) |
|||
return; |
|||
RemoveWatch(); |
|||
m_Presenter = value; |
|||
m_ToWatch[0] = m_Presenter; |
|||
OnDataChanged(); |
|||
AddWatch(); |
|||
} |
|||
} |
|||
|
|||
Object[] m_ToWatch = { null }; |
|||
|
|||
protected override Object[] toWatch |
|||
{ |
|||
get { return m_ToWatch; } |
|||
} |
|||
public abstract void Dispose(); |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
|
|||
namespace UnityEngine.Graphing |
|||
{ |
|||
public static class QueuePool<T> |
|||
{ |
|||
// Object pool to avoid allocations.
|
|||
static readonly ObjectPool<Queue<T>> k_QueuePool = new ObjectPool<Queue<T>>(null, l => l.Clear()); |
|||
|
|||
public static Queue<T> Get() |
|||
{ |
|||
return k_QueuePool.Get(); |
|||
} |
|||
|
|||
public static PooledObject<Queue<T>> GetDisposable() |
|||
{ |
|||
return k_QueuePool.GetDisposable(); |
|||
} |
|||
|
|||
public static void Release(Queue<T> toRelease) |
|||
{ |
|||
k_QueuePool.Release(toRelease); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4e895afeaf2a438195fbc4de17a4bedc |
|||
timeCreated: 1505278549 |
|
|||
using System.Collections.Generic; |
|||
|
|||
namespace UnityEngine.Graphing |
|||
{ |
|||
public static class StackPool<T> |
|||
{ |
|||
// Object pool to avoid allocations.
|
|||
static readonly ObjectPool<Stack<T>> k_StackPool = new ObjectPool<Stack<T>>(null, l => l.Clear()); |
|||
|
|||
public static Stack<T> Get() |
|||
{ |
|||
return k_StackPool.Get(); |
|||
} |
|||
|
|||
public static PooledObject<Stack<T>> GetDisposable() |
|||
{ |
|||
return k_StackPool.GetDisposable(); |
|||
} |
|||
|
|||
public static void Release(Stack<T> toRelease) |
|||
{ |
|||
k_StackPool.Release(toRelease); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 93c41a4331c94d09a7561ea6b4983439 |
|||
timeCreated: 1505275069 |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Inspector |
|||
{ |
|||
public class GraphInspectorPresenter : ScriptableObject |
|||
{ |
|||
public IGraph graph { get; set; } |
|||
|
|||
public string assetName { get; set; } |
|||
|
|||
public List<INode> selectedNodes { get; set; } |
|||
|
|||
[Flags] |
|||
public enum ChangeType |
|||
{ |
|||
Graph = 1 << 0, |
|||
SelectedNodes = 1 << 1, |
|||
AssetName = 1 << 2, |
|||
All = -1 |
|||
} |
|||
|
|||
public delegate void OnChange(ChangeType changeType); |
|||
|
|||
public OnChange onChange; |
|||
|
|||
public void Initialize(string assetName, IGraph graph) |
|||
{ |
|||
this.graph = graph; |
|||
this.assetName = assetName; |
|||
selectedNodes = new List<INode>(); |
|||
|
|||
Change(ChangeType.Graph | ChangeType.SelectedNodes | ChangeType.AssetName); |
|||
} |
|||
|
|||
public void UpdateSelection(IEnumerable<INode> nodes) |
|||
{ |
|||
selectedNodes.Clear(); |
|||
selectedNodes.AddRange(nodes); |
|||
|
|||
Change(ChangeType.SelectedNodes); |
|||
} |
|||
|
|||
void Change(ChangeType changeType) |
|||
{ |
|||
if (onChange != null) |
|||
onChange(changeType); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2d08dfb360644031a5e64558d4a93263 |
|||
timeCreated: 1503663071 |
|
|||
fileFormatVersion: 2 |
|||
guid: 0969ff891b874694aa732e1240ee159b |
|||
timeCreated: 1503663067 |
撰写
预览
正在加载...
取消
保存
Reference in new issue