Florent Guinier
8 年前
当前提交
7ae13517
共有 4 个文件被更改,包括 100 次插入 和 32 次删除
-
1MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
72MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/SwizzleNode.cs
-
47MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/SwizzleNodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/SwizzleNodePresenter.cs.meta
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
class SwizzleControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as SwizzleNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
SwizzleNode.SwizzleChannel[] newSwizzleChannels = (SwizzleNode.SwizzleChannel[])tNode.swizzleChannels.Clone(); |
|||
EditorGUI.BeginChangeCheck(); |
|||
newSwizzleChannels[0] = (SwizzleNode.SwizzleChannel)EditorGUILayout.EnumPopup("Red output:", newSwizzleChannels[0]); |
|||
newSwizzleChannels[1] = (SwizzleNode.SwizzleChannel)EditorGUILayout.EnumPopup("Green output:", newSwizzleChannels[1]); |
|||
newSwizzleChannels[2] = (SwizzleNode.SwizzleChannel)EditorGUILayout.EnumPopup("Blue output:", newSwizzleChannels[2]); |
|||
newSwizzleChannels[3] = (SwizzleNode.SwizzleChannel)EditorGUILayout.EnumPopup("Alpha output:", newSwizzleChannels[3]); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
tNode.swizzleChannels = newSwizzleChannels; |
|||
} |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class SwizzleNodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<SwizzleControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 53bfb9e60f364eb44a4f0e0fc53f4325 |
|||
timeCreated: 1495474251 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue