您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

62 行
1.9 KiB

using System;
using System.Collections.Generic;
using UnityEngine.MaterialGraph;
using UnityEditor.Experimental.UIElements.GraphView;
namespace UnityEditor.MaterialGraph.Drawing
{
[Serializable]
class SamplerStateControlPresenter : GraphControlPresenter
{
private string[] samplerFilterMode;
private string[] samplerWrapMode;
private string[] _samplerFilterMode
{
get
{
if (samplerFilterMode == null)
samplerFilterMode = Enum.GetNames(typeof(TextureSamplerState.FilterMode));
return samplerFilterMode;
}
}
private string[] _samplerWrapMode
{
get
{
if (samplerWrapMode == null)
samplerWrapMode = Enum.GetNames(typeof(TextureSamplerState.WrapMode));
return samplerWrapMode;
}
}
public override void OnGUIHandler()
{
base.OnGUIHandler();
var cNode = node as SamplerStateNode;
if (cNode == null)
return;
cNode.filter = (TextureSamplerState.FilterMode)EditorGUILayout.Popup((int)cNode.filter, _samplerFilterMode, EditorStyles.popup);
cNode.wrap = (TextureSamplerState.WrapMode)EditorGUILayout.Popup((int)cNode.wrap, _samplerWrapMode, EditorStyles.popup);
}
public override float GetHeight()
{
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class SamplerStateNodePresenter : MaterialNodePresenter
{
protected override IEnumerable<GraphControlPresenter> GetControlData()
{
var instance = CreateInstance<SamplerStateControlPresenter>();
instance.Initialize(node);
return new List<GraphControlPresenter> { instance };
}
}
}