GitHub
7 年前
当前提交
849d3ecb
共有 16 个文件被更改,包括 328 次插入 和 70 次删除
-
3MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Implementation/SerializableGraph.cs
-
4MaterialGraphProject/Assets/SRP/PostProcessing/PostProcessing/Runtime/Utils/TextureFormatUtilities.cs
-
81MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/MaterialSlot.cs
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/Texture2DInputMaterialSlot.cs
-
23MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
-
1MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs
-
55MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
-
85MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
-
34MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
-
2MaterialGraphProject/ProjectSettings/ProjectVersion.txt
-
59MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PortInputView.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PortInputView.cs.meta
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/Slots.meta
-
35MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/Slots/TextureSlotControlView.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/Slots/TextureSlotControlView.cs.meta
|
|||
m_EditorVersion: 2018.1.0a1 |
|||
m_EditorVersion: 2018.1.0a3 |
|
|||
using System; |
|||
using UnityEditor.Experimental.UIElements; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEditor.Graphing; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
public class PortInputView : GraphElement, IDisposable |
|||
{ |
|||
MaterialSlot m_Slot; |
|||
ConcreteSlotValueType m_SlotType; |
|||
VisualElement m_Control; |
|||
VisualElement m_ControlContainer; |
|||
|
|||
public PortInputView(MaterialSlot slot) |
|||
{ |
|||
m_Slot = slot; |
|||
ClearClassList(); |
|||
m_SlotType = slot.concreteValueType; |
|||
m_ControlContainer = new VisualElement { name = "controlContainer" }; |
|||
Add(m_ControlContainer); |
|||
m_Control = m_Slot.InstantiateControl(); |
|||
if (m_Control != null) |
|||
m_ControlContainer.Add(m_Control); |
|||
else |
|||
m_ControlContainer.visible = false; |
|||
} |
|||
|
|||
public void UpdateSlotType() |
|||
{ |
|||
if (m_Slot.concreteValueType != m_SlotType) |
|||
{ |
|||
m_SlotType = m_Slot.concreteValueType; |
|||
if (m_Control != null) |
|||
{ |
|||
var disposable = m_Control as IDisposable; |
|||
if (disposable != null) |
|||
disposable.Dispose(); |
|||
m_ControlContainer.Remove(m_Control); |
|||
} |
|||
m_Control = m_Slot.InstantiateControl(); |
|||
m_ControlContainer.visible = true; |
|||
if (m_Control != null) |
|||
m_ControlContainer.Add(m_Control); |
|||
else |
|||
m_ControlContainer.visible = false; |
|||
} |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
var disposable = m_Control as IDisposable; |
|||
if (disposable != null) |
|||
disposable.Dispose(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9f69414f1afe45f794ec4b5d5bc2bcb5 |
|||
timeCreated: 1509629683 |
|
|||
fileFormatVersion: 2 |
|||
guid: 56e544af973b458ea7e8051cd0848d24 |
|||
timeCreated: 1509718923 |
|
|||
using System; |
|||
using UnityEditor.Experimental.UIElements; |
|||
using UnityEditor.Graphing; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using UnityEngine.Experimental.UIElements.StyleSheets; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing.Slots |
|||
{ |
|||
public class TextureSlotControlView : VisualElement |
|||
{ |
|||
Texture2DInputMaterialSlot m_Slot; |
|||
|
|||
public TextureSlotControlView(Texture2DInputMaterialSlot slot) |
|||
{ |
|||
m_Slot = slot; |
|||
var objectField = new ObjectField { objectType = typeof(Texture), value = m_Slot.texture }; |
|||
objectField.OnValueChanged(OnValueChanged); |
|||
Add(objectField); |
|||
} |
|||
|
|||
void OnValueChanged(ChangeEvent<Object> evt) |
|||
{ |
|||
var texture = evt.newValue as Texture2D; |
|||
if (texture != m_Slot.texture) |
|||
{ |
|||
m_Slot.owner.owner.owner.RegisterCompleteObjectUndo("Change Texture"); |
|||
m_Slot.texture = texture; |
|||
if (m_Slot.owner.onModified != null) |
|||
m_Slot.owner.onModified(m_Slot.owner, ModificationScope.Node); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 49f18880b4854ccc8f383c55a7bc47b3 |
|||
timeCreated: 1509718979 |
撰写
预览
正在加载...
取消
保存
Reference in new issue