您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
42 行
1.3 KiB
42 行
1.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEditor.Experimental.UIElements.GraphView;
|
|
using UnityEngine.MaterialGraph;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.MaterialGraph.Drawing
|
|
{
|
|
class MasterNodeControlPresenter : GraphControlPresenter
|
|
{
|
|
public override void OnGUIHandler()
|
|
{
|
|
base.OnGUIHandler();
|
|
|
|
var masterNode = node as AbstractMasterNode;
|
|
if (masterNode == null || !masterNode.canBeActiveMaster)
|
|
return;
|
|
|
|
using (new EditorGUI.DisabledScope(masterNode.isActiveMaster))
|
|
masterNode.isActiveMaster |= GUILayout.Button("Set active");
|
|
}
|
|
|
|
public override float GetHeight()
|
|
{
|
|
var masterNode = node as AbstractMasterNode;
|
|
if (masterNode == null || !masterNode.canBeActiveMaster)
|
|
return 0f;
|
|
return EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class MasterNodePresenter : MaterialNodePresenter
|
|
{
|
|
protected override IEnumerable<GraphControlPresenter> GetControlData()
|
|
{
|
|
var instance = CreateInstance<MasterNodeControlPresenter>();
|
|
instance.Initialize(node);
|
|
return new List<GraphControlPresenter> { instance };
|
|
}
|
|
}
|
|
}
|