Peter Bay Bastian
7 年前
当前提交
fcbee16f
共有 20 个文件被更改,包括 0 次插入 和 721 次删除
-
150MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/ConvolutionFilterNodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/ConvolutionFilterNodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/CubemapNodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/CustomCodeNodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/MasterNodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/RemapInputNodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/ScatterNodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/TextureLODNodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/TextureNodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/SamplerAssetNodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/TextureSamplerNodePresenter.cs.meta
-
51MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/CubemapNodePresenter.cs
-
101MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/CustomCodeNodePresenter.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/MasterNodePresenter.cs
-
42MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/RemapInputNodePresenter.cs
-
51MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/SamplerAssetNodePresenter.cs
-
42MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/ScatterNodePresenter.cs
-
51MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/TextureLODNodePresenter.cs
-
51MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/TextureNodePresenter.cs
-
52MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/TextureSamplerNodePresenter.cs
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine.MaterialGraph; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
/*class ConvolutionFilterControlPresenter : GraphControlPresenter |
|||
{ |
|||
enum KernelPresets |
|||
{ |
|||
Presets, |
|||
BoxBlur, |
|||
GaussianBlur, |
|||
EdgesDetection, |
|||
EnhanceEdges, |
|||
Sharpen, |
|||
Emboss, |
|||
}; |
|||
|
|||
private void ApplyPreset(KernelPresets preset, ref float[,] values, ref float divisor) |
|||
{ |
|||
if (preset == KernelPresets.BoxBlur) |
|||
{ |
|||
values = new float[,] { {1,1,1,1,1}, |
|||
{1,1,1,1,1}, |
|||
{1,1,1,1,1}, |
|||
{1,1,1,1,1}, |
|||
{1,1,1,1,1} }; |
|||
divisor = 25; |
|||
} |
|||
if (preset == KernelPresets.GaussianBlur) |
|||
{ |
|||
values = new float[,] { { 1, 4, 6, 4, 1}, |
|||
{ 4,16,24,16, 4}, |
|||
{ 6,24,36,24, 6}, |
|||
{ 4,16,24,16, 4}, |
|||
{ 1, 4, 6, 4, 1} }; |
|||
divisor = 256; |
|||
} |
|||
if (preset == KernelPresets.EdgesDetection) |
|||
{ |
|||
values = new float[,] { {-1,-1,-1, -1,-1}, |
|||
{-1,-2,-2, -2,-1}, |
|||
{-1,-2, 33,-2,-1}, |
|||
{-1,-2,-2, -2,-1}, |
|||
{-1,-1,-1, -1,-1} }; |
|||
divisor = 1; |
|||
} |
|||
if (preset == KernelPresets.EnhanceEdges) |
|||
{ |
|||
values = new float[,] { { 0, 0, 0, 0, 0}, |
|||
{ 0, 1, 1, 1, 0}, |
|||
{ 0, 1,-7, 1, 0}, |
|||
{ 0, 1, 1, 1, 0}, |
|||
{ 0, 0, 0, 0, 0} }; |
|||
divisor = 1; |
|||
} |
|||
if (preset == KernelPresets.Sharpen) |
|||
{ |
|||
values = new float[,] { {-1,-1,-1, -1,-1}, |
|||
{-1, 2, 2, 2,-1}, |
|||
{-1, 2, 8, 2,-1}, |
|||
{-1, 2, 2, 2,-1}, |
|||
{-1,-1,-1, -1,-1} }; |
|||
divisor = 8; |
|||
} |
|||
if (preset == KernelPresets.Emboss) |
|||
{ |
|||
values = new float[,] { {-1,-1,-1,-1, 0}, |
|||
{-1,-1,-1, 0, 1}, |
|||
{-1,-1, 0, 1, 1}, |
|||
{-1, 0, 1, 1, 1}, |
|||
{ 0, 1, 1, 1, 1} }; |
|||
divisor = 1; |
|||
} |
|||
} |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as ConvolutionFilterNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
float divisor = tNode.GetConvolutionDivisor(); |
|||
float[,] values = new float[5,5]; |
|||
for (int row = 0; row < 5; ++row) |
|||
{ |
|||
for (int col = 0; col < 5; ++col) |
|||
{ |
|||
values[row,col] = tNode.GetConvolutionWeight(row,col); |
|||
} |
|||
} |
|||
|
|||
EditorGUILayout.BeginVertical(); |
|||
EditorGUI.BeginChangeCheck(); |
|||
|
|||
EditorGUILayout.LabelField("Kernel"); |
|||
KernelPresets kernelPresets = KernelPresets.Presets; |
|||
kernelPresets = (KernelPresets)EditorGUILayout.EnumPopup(kernelPresets); |
|||
ApplyPreset(kernelPresets, ref values, ref divisor); |
|||
|
|||
for (int col = 0; col < 5; ++col) |
|||
{ |
|||
EditorGUILayout.BeginHorizontal(); |
|||
for (int row = 0; row < 5; ++row) |
|||
{ |
|||
values[row, col] = EditorGUILayout.FloatField(values[row, col], GUILayout.Width(35)); |
|||
} |
|||
EditorGUILayout.EndHorizontal(); |
|||
} |
|||
EditorGUILayout.Space(); |
|||
|
|||
divisor = EditorGUILayout.FloatField("Divisor", divisor); |
|||
|
|||
EditorGUILayout.EndVertical(); |
|||
|
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
tNode.SetConvolutionDivisor(divisor); |
|||
for (int row = 0; row < 5; ++row) |
|||
{ |
|||
for (int col = 0; col < 5; ++col) |
|||
{ |
|||
tNode.SetConvolutionWeight(row, col, values[row, col]); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 10 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class ConvolutionFilterNodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<ConvolutionFilterControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
}*/ |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f3a416c372d21b6479241e837d4257da |
|||
timeCreated: 1495705790 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: fc62d7d14c85243dca60985fa3d87d64 |
|||
timeCreated: 1476707366 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 2c8cc961345e3fa4591080689cce37f0 |
|||
timeCreated: 1495617692 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: a3d64c3b654d7469d806bcde8f88388d |
|||
timeCreated: 1482246324 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 23e3fdefb76b26c428d70b010425e7af |
|||
timeCreated: 1481189699 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 324b6873762a09544a3cebd0f0c7721d |
|||
timeCreated: 1495713547 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: b88516d1f6b67f04a829309466d6aa50 |
|||
timeCreated: 1495479478 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 24386574a4b805d4d803fb786c8f846f |
|||
timeCreated: 1476707366 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ec47786947b3100438fbe355a2a23000 |
|||
timeCreated: 1495754404 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 86fe3d2371b24d34399f4b116a238d45 |
|||
timeCreated: 1495638407 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
/* class CubeContolPresenter : GraphControlPresenter |
|||
{ |
|||
//private string[] m_TextureTypeNames;
|
|||
//private string[] textureTypeNames
|
|||
/* { |
|||
get |
|||
{ |
|||
if (m_TextureTypeNames == null) |
|||
m_TextureTypeNames = Enum.GetNames(typeof(TextureType)); |
|||
return m_TextureTypeNames; |
|||
} |
|||
}* |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.CubemapNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState); |
|||
tNode.defaultCube = EditorGUILayout.MiniThumbnailObjectField(new GUIContent("Cubemap"), tNode.defaultCube, typeof(Cubemap), null) as Cubemap; |
|||
//tNode.textureType = (TextureType)EditorGUILayout.Popup((int)tNode.textureType, textureTypeNames, EditorStyles.popup);
|
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return 3 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class CubeNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<CubeContolPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphControlPresenter> { instance }; |
|||
} |
|||
}*/ |
|||
} |
|
|||
using System; |
|||
using System.Linq; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
/*class CustomCodeControlPresenter : GraphControlPresenter |
|||
{ |
|||
public class CodeEditorPopup : PopupWindowContent |
|||
{ |
|||
private CustomCodeNode m_customCodeNode = null; |
|||
private Vector2 m_scroll; |
|||
|
|||
private bool m_isOpen = false; |
|||
public bool IsOpen |
|||
{ |
|||
get { return m_isOpen; } |
|||
} |
|||
|
|||
public CodeEditorPopup(CustomCodeNode customCodeNode) |
|||
{ |
|||
m_customCodeNode = customCodeNode; |
|||
} |
|||
|
|||
public override Vector2 GetWindowSize() |
|||
{ |
|||
return new Vector2(300, 300); |
|||
} |
|||
|
|||
public override void OnGUI(Rect rect) |
|||
{ |
|||
GUILayout.Label("Custom Code Editor", EditorStyles.boldLabel); |
|||
m_scroll = EditorGUILayout.BeginScrollView(m_scroll); |
|||
m_customCodeNode.Code = EditorGUILayout.TextArea(m_customCodeNode.Code, GUILayout.Height(GetWindowSize().y - 30)); |
|||
EditorGUILayout.EndScrollView(); |
|||
} |
|||
|
|||
public override void OnOpen() |
|||
{ |
|||
Debug.Log("Popup opened: " + this); |
|||
m_isOpen = true; |
|||
} |
|||
|
|||
public override void OnClose() |
|||
{ |
|||
Debug.Log("Popup closed: " + this); |
|||
if (m_isOpen) |
|||
{ |
|||
m_customCodeNode.UpdateInputAndOuputSlots(); |
|||
} |
|||
m_isOpen = false; |
|||
} |
|||
} |
|||
|
|||
private CodeEditorPopup codeEditorPopup = null; |
|||
Rect buttonRect; |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.CustomCodeNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
if (codeEditorPopup == null) |
|||
{ |
|||
codeEditorPopup = new CodeEditorPopup(tNode); |
|||
if (string.IsNullOrEmpty(tNode.Code)) |
|||
{ |
|||
tNode.Code = "//Write your function below.\r\nvoid test(float a, float b, out float c)\r\n{\r\n\tc = a + b;\r\n}\r\n"; |
|||
} |
|||
} |
|||
|
|||
string buttonText = codeEditorPopup.IsOpen ? "Close Code Editor" : "Open Code Editor"; |
|||
if (GUILayout.Button(buttonText)) |
|||
{ |
|||
PopupWindow.Show(buttonRect, codeEditorPopup); |
|||
} |
|||
if (Event.current.type == EventType.Repaint) buttonRect = GUILayoutUtility.GetLastRect(); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class CustomCodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<CustomCodeControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
}*/ |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine.MaterialGraph; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
|
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
/* [Serializable] |
|||
class RemapInputControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var remapNode = node as MasterRemapInputNode; |
|||
if (remapNode == null) |
|||
return; |
|||
|
|||
if (GUILayout.Button("Add Slot")) |
|||
remapNode.AddSlot(); |
|||
if (GUILayout.Button("Remove Slot")) |
|||
remapNode.RemoveSlot(); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return EditorGUIUtility.singleLineHeight * 2 + 3 * EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class RemapInputNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<RemapInputControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphControlPresenter> { instance }; |
|||
} |
|||
}*/ |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
/*class SamplerAssetControlPresenter : GraphControlPresenter |
|||
{ |
|||
private string[] m_TextureTypeNames; |
|||
private string[] textureTypeNames |
|||
{ |
|||
get |
|||
{ |
|||
if (m_TextureTypeNames == null) |
|||
m_TextureTypeNames = Enum.GetNames(typeof(TextureType)); |
|||
return m_TextureTypeNames; |
|||
} |
|||
} |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.SamplerAssetNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState); |
|||
tNode.defaultTexture = EditorGUILayout.MiniThumbnailObjectField(new GUIContent("Texture"), tNode.defaultTexture, typeof(Texture), null) as Texture; |
|||
tNode.textureType = (TextureType)EditorGUILayout.Popup((int)tNode.textureType, textureTypeNames, EditorStyles.popup); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return 3 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class SamplerAssetNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<SamplerAssetControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter> { instance }; |
|||
} |
|||
}*/ |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
|
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
/* [Serializable] |
|||
class ScatterContolPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var cNode = node as UnityEngine.MaterialGraph.ScatterNode; |
|||
if (cNode == null) |
|||
return; |
|||
|
|||
cNode.num = EditorGUILayout.IntField(cNode.num, "Number", null); |
|||
cNode.num = Math.Min(cNode.num, 50); //prevent infinite => hang!
|
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
|
|||
} |
|||
|
|||
[Serializable] |
|||
public class ScatterNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<ScatterContolPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter> { instance }; |
|||
} |
|||
} |
|||
|
|||
*/ |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
/* class TextureLODContolPresenter : GraphControlPresenter |
|||
{ |
|||
private string[] m_TextureTypeNames; |
|||
private string[] textureTypeNames |
|||
{ |
|||
get |
|||
{ |
|||
if (m_TextureTypeNames == null) |
|||
m_TextureTypeNames = Enum.GetNames(typeof(TextureType)); |
|||
return m_TextureTypeNames; |
|||
} |
|||
} |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.TextureLODNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState); |
|||
tNode.defaultTexture = EditorGUILayout.MiniThumbnailObjectField(new GUIContent("Texture"), tNode.defaultTexture, typeof(Texture), null) as Texture; |
|||
tNode.textureType = (TextureType)EditorGUILayout.Popup((int)tNode.textureType, textureTypeNames, EditorStyles.popup); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return 3 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class TextureLODNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<TextureLODContolPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphControlPresenter> { instance }; |
|||
} |
|||
}*/ |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
/* class TextureContolPresenter : GraphControlPresenter |
|||
{ |
|||
private string[] m_TextureTypeNames; |
|||
private string[] textureTypeNames |
|||
{ |
|||
get |
|||
{ |
|||
if (m_TextureTypeNames == null) |
|||
m_TextureTypeNames = Enum.GetNames(typeof(TextureType)); |
|||
return m_TextureTypeNames; |
|||
} |
|||
} |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.TextureNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState); |
|||
tNode.defaultTexture = EditorGUILayout.MiniThumbnailObjectField(new GUIContent("Texture"), tNode.defaultTexture, typeof(Texture), null) as Texture; |
|||
tNode.textureType = (TextureType)EditorGUILayout.Popup((int)tNode.textureType, textureTypeNames, EditorStyles.popup); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return 3 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class TextureNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<TextureContolPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter> { instance }; |
|||
} |
|||
}*/ |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
/* |
|||
class TextureSamplerContolPresenter : GraphControlPresenter |
|||
{ |
|||
private string[] m_TextureTypeNames; |
|||
private string[] textureTypeNames |
|||
{ |
|||
get |
|||
{ |
|||
if (m_TextureTypeNames == null) |
|||
m_TextureTypeNames = Enum.GetNames(typeof(TextureType)); |
|||
return m_TextureTypeNames; |
|||
} |
|||
} |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.Texture2DNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode.exposedState = (PropertyNode.ExposedState)EditorGUILayout.EnumPopup(new GUIContent("Exposed"), tNode.exposedState); |
|||
tNode.defaultTexture = EditorGUILayout.MiniThumbnailObjectField(new GUIContent("Texture"), tNode.defaultTexture, typeof(Texture), null) as Texture; |
|||
tNode.textureType = (TextureType)EditorGUILayout.Popup((int)tNode.textureType, textureTypeNames, EditorStyles.popup); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return 3 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class TextureSamplerNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<TextureSamplerContolPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphControlPresenter> { instance }; |
|||
} |
|||
}*/ |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue