浏览代码

New attribute-based system for node controls

/main
Peter Bay Bastian 7 年前
当前提交
ff8de4d3
共有 30 个文件被更改,包括 223 次插入266 次删除
  1. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector1Node.cs
  2. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector2Node.cs
  3. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector3Node.cs
  4. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector4Node.cs
  5. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
  6. 40
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
  7. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls.meta
  8. 38
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ColorControl.cs
  9. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ColorControl.cs.meta
  10. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/DefaultControl.cs
  11. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/DefaultControl.cs.meta
  12. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/IControlAttribute.cs
  13. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/IControlAttribute.cs.meta
  14. 35
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector1Control.cs
  15. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector1Control.cs.meta
  16. 25
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector2Control.cs
  17. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector2Control.cs.meta
  18. 25
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector3Control.cs
  19. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector3Control.cs.meta
  20. 25
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector4Control.cs
  21. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector4Control.cs.meta
  22. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector1NodePresenter.cs.meta
  23. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector2NodePresenter.cs.meta
  24. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector3NodePresenter.cs.meta
  25. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector4NodePresenter.cs.meta
  26. 38
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector2NodePresenter.cs
  27. 38
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector3NodePresenter.cs
  28. 38
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector4NodePresenter.cs
  29. 83
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector1NodePresenter.cs

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector1Node.cs


using System.Collections.Generic;
using UnityEditor.MaterialGraph.Drawing.Controls;
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph

RemoveSlotsNameNotMatching(new[] { OutputSlotId });
}
[Vector1Control]
public float value
{
get { return m_Value; }

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector2Node.cs


using System.Collections.Generic;
using UnityEditor.MaterialGraph.Drawing.Controls;
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph

RemoveSlotsNameNotMatching(new[] { OutputSlotId });
}
[Vector2Control]
public Vector2 value
{
get { return m_Value; }

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector3Node.cs


using System;
using System.Collections.Generic;
using UnityEditor.MaterialGraph.Drawing.Controls;
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph

RemoveSlotsNameNotMatching(new[] { OutputSlotId });
}
[Vector3Control]
public Vector3 value
{
get { return m_Value; }

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector4Node.cs


using System.Collections.Generic;
using UnityEditor.MaterialGraph.Drawing.Controls;
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph

RemoveSlotsNameNotMatching(new[] { OutputSlotId });
}
[Vector4Control]
public Vector4 value
{
get { return m_Value; }

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs


// typeMapper[typeof(CubemapNode)] = typeof(CubeNodePresenter);
// typeMapper[typeof(ToggleNode)] = typeof(ToggleNodePresenter);
typeMapper[typeof(UVNode)] = typeof(UVNodePresenter);
typeMapper[typeof(Vector1Node)] = typeof(Vector1NodePresenter);
typeMapper[typeof(Vector2Node)] = typeof(Vector2NodePresenter);
typeMapper[typeof(Vector3Node)] = typeof(Vector3NodePresenter);
typeMapper[typeof(Vector4Node)] = typeof(Vector4NodePresenter);
typeMapper[typeof(PropertyNode)] = typeof(PropertyNodePresenter);
/* typeMapper[typeof(ScaleOffsetNode)] = typeof(AnyNodePresenter); // anything derived from AnyNode should use the AnyNodePresenter

40
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor.MaterialGraph.Drawing.Controls;
using UnityEngine.Graphing;
using UnityEngine.MaterialGraph;
using UnityEngine;

public class MaterialNodeView : Node
{
VisualElement m_ControlsContainer;
List<GraphControlPresenter> m_CurrentControls;
List<VisualElement> m_ControlViews;
Guid m_NodeGuid;
VisualElement m_PreviewToggle;
Image m_PreviewImage;
bool m_IsScheduled;

name = "controls"
};
leftContainer.Add(m_ControlsContainer);
m_CurrentControls = new List<GraphControlPresenter>();
m_ControlViews = new List<VisualElement>();
m_PreviewToggle = new VisualElement { name = "toggle", text = "" };
m_PreviewToggle.AddManipulator(new Clickable(OnPreviewToggle));

void UpdateControls(MaterialNodePresenter nodeData)
{
if (nodeData.controls.SequenceEqual(m_CurrentControls) && nodeData.expanded)
return;
m_ControlsContainer.Clear();
m_CurrentControls.Clear();
Dirty(ChangeType.Layout);
if (!nodeData.node.guid.Equals(m_NodeGuid))
{
m_ControlViews.Clear();
foreach (var propertyInfo in nodeData.node.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
foreach (IControlAttribute attribute in propertyInfo.GetCustomAttributes(typeof(IControlAttribute), false))
m_ControlViews.Add(attribute.InstantiateControl(nodeData.node, propertyInfo));
}
}
return;
foreach (var controlData in nodeData.controls)
m_ControlsContainer.Add(new IMGUIContainer(controlData.OnGUIHandler)
{
name = "element"
});
m_CurrentControls.Add(controlData);
m_ControlsContainer.Clear();
}
else if (m_ControlsContainer.childCount != m_ControlViews.Count)
{
foreach (var view in m_ControlViews)
m_ControlsContainer.Add(view);
}
}

if (nodePresenter == null)
{
m_ControlsContainer.Clear();
m_CurrentControls.Clear();
m_ControlViews.Clear();
UpdatePreviewTexture(null);
return;
}

UpdateControls(nodePresenter);
UpdatePreviewTexture(nodePresenter.node.previewExpanded ? nodePresenter.previewTexture : null);
m_NodeGuid = nodePresenter.node.guid;
}
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls.meta


fileFormatVersion: 2
guid: 29309be0e1004fad967256187775c528
timeCreated: 1507642261

38
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ColorControl.cs


using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
using UnityEngine.Experimental.UIElements.StyleSheets;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing.Controls
{
public class ColorControlAttribute : Attribute, IControlAttribute
{
public VisualElement InstantiateControl(AbstractMaterialNode node, PropertyInfo propertyInfo)
{
return new ColorControlView(() => (Color) propertyInfo.GetValue(node, null), (value) => propertyInfo.SetValue(node, value, null));
}
}
public class ColorControlView : VisualElement
{
readonly Func<Color> m_Getter;
readonly Action<Color> m_Setter;
public ColorControlView(Func<Color> getter, Action<Color> setter)
{
m_Getter = getter;
m_Setter = setter;
Add(new IMGUIContainer(OnGUIHandler));
}
void OnGUIHandler()
{
var value = m_Getter();
var newValue = EditorGUILayout.ColorField("", value);
if (newValue != value)
m_Setter(newValue);
}
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ColorControl.cs.meta


fileFormatVersion: 2
guid: 34e77444559b414f9fe81f9775229abf
timeCreated: 1507733396

9
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/DefaultControl.cs


using System;
namespace UnityEditor.MaterialGraph.Drawing.Controls
{
public class DefaultControlAttribute : Attribute
{
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/DefaultControl.cs.meta


fileFormatVersion: 2
guid: 20e01cb163f347c7819ae286c33baf85
timeCreated: 1507642280

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/IControlAttribute.cs


using System.Reflection;
using UnityEngine.Experimental.UIElements;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing.Controls
{
public interface IControlAttribute
{
VisualElement InstantiateControl(AbstractMaterialNode node, PropertyInfo propertyInfo);
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/IControlAttribute.cs.meta


fileFormatVersion: 2
guid: 5f008211c3394775bdefde0b20e5c8ff
timeCreated: 1507642348

35
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector1Control.cs


using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
using UnityEngine.Experimental.UIElements.StyleSheets;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing.Controls
{
public class Vector1ControlAttribute : Attribute, IControlAttribute
{
readonly string m_Label;
public Vector1ControlAttribute(string label = "")
{
m_Label = label;
}
public VisualElement InstantiateControl(AbstractMaterialNode node, PropertyInfo propertyInfo)
{
return new Vector1ControlView(
() => (float) propertyInfo.GetValue(node, null),
(value) => propertyInfo.SetValue(node, value, null),
m_Label);
}
}
public class Vector1ControlView : VisualElement
{
public Vector1ControlView(Func<float> getter, Action<float> setter, string label)
{
Add(new IMGUIContainer(() => setter(EditorGUILayout.FloatField(label, getter()))));
}
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector1Control.cs.meta


fileFormatVersion: 2
guid: 52014e64fe13479795aba91b9c4069e1
timeCreated: 1507732539

25
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector2Control.cs


using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
using UnityEngine.Experimental.UIElements.StyleSheets;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing.Controls
{
public class Vector2ControlAttribute : Attribute, IControlAttribute
{
public VisualElement InstantiateControl(AbstractMaterialNode node, PropertyInfo propertyInfo)
{
return new Vector2ControlView(() => (Vector2) propertyInfo.GetValue(node, null), (value) => propertyInfo.SetValue(node, value, null));
}
}
public class Vector2ControlView : VisualElement
{
public Vector2ControlView(Func<Vector2> getter, Action<Vector2> setter)
{
Add(new IMGUIContainer(() => setter(EditorGUILayout.Vector2Field("", getter()))));
}
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector2Control.cs.meta


fileFormatVersion: 2
guid: 6d54d25de2204da2af41c34b22d88846
timeCreated: 1507732510

25
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector3Control.cs


using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
using UnityEngine.Experimental.UIElements.StyleSheets;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing.Controls
{
public class Vector3ControlAttribute : Attribute, IControlAttribute
{
public VisualElement InstantiateControl(AbstractMaterialNode node, PropertyInfo propertyInfo)
{
return new Vector3ControlView(() => (Vector3) propertyInfo.GetValue(node, null), (value) => propertyInfo.SetValue(node, value, null));
}
}
public class Vector3ControlView : VisualElement
{
public Vector3ControlView(Func<Vector3> getter, Action<Vector3> setter)
{
Add(new IMGUIContainer(() => setter(EditorGUILayout.Vector3Field("", getter()))));
}
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector3Control.cs.meta


fileFormatVersion: 2
guid: 7ae88210793e490d9bd7e96feba8b429
timeCreated: 1507732444

25
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector4Control.cs


using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
using UnityEngine.Experimental.UIElements.StyleSheets;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing.Controls
{
public class Vector4ControlAttribute : Attribute, IControlAttribute
{
public VisualElement InstantiateControl(AbstractMaterialNode node, PropertyInfo propertyInfo)
{
return new Vector4ControlView(() => (Vector4) propertyInfo.GetValue(node, null), (value) => propertyInfo.SetValue(node, value, null));
}
}
public class Vector4ControlView : VisualElement
{
public Vector4ControlView(Func<Vector4> getter, Action<Vector4> setter)
{
Add(new IMGUIContainer(() => setter(EditorGUILayout.Vector4Field("", getter()))));
}
}
}

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector4Control.cs.meta


fileFormatVersion: 2
guid: 8a515dc1bacc453b870777d8da9a7211
timeCreated: 1507642288

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector1NodePresenter.cs.meta


fileFormatVersion: 2
guid: aaea57ca317a64a9a811d6ac4a069a64
timeCreated: 1476732809
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector2NodePresenter.cs.meta


fileFormatVersion: 2
guid: 6018b93ef62914859a707349fee5d50e
timeCreated: 1476871291
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector3NodePresenter.cs.meta


fileFormatVersion: 2
guid: e8f2d0e687af5483fa604cf5b2843284
timeCreated: 1476877473
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector4NodePresenter.cs.meta


fileFormatVersion: 2
guid: c63e4f4ffa1734ea8a3dd6ee0099314e
timeCreated: 1476877473
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

38
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector2NodePresenter.cs


using System;
using System.Collections.Generic;
using UnityEditor.Experimental.UIElements.GraphView;
using UnityEngine;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing
{
class Vector2ControlPresenter : GraphControlPresenter
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var tNode = node as UnityEngine.MaterialGraph.Vector2Node;
if (tNode == null)
return;
tNode.value = EditorGUILayout.Vector2Field("", tNode.value);
}
public override float GetHeight()
{
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class Vector2NodePresenter : PropertyNodePresenter
{
protected override IEnumerable<GraphControlPresenter> GetControlData()
{
var instance = CreateInstance<Vector2ControlPresenter>();
instance.Initialize(node);
return new List<GraphControlPresenter>(base.GetControlData()) { instance };
}
}
}

38
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector3NodePresenter.cs


using System;
using System.Collections.Generic;
using UnityEditor.Experimental.UIElements.GraphView;
using UnityEngine;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing
{
class Vector3ControlPresenter : GraphControlPresenter
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var tNode = node as UnityEngine.MaterialGraph.Vector3Node;
if (tNode == null)
return;
tNode.value = EditorGUILayout.Vector3Field("", tNode.value);
}
public override float GetHeight()
{
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class Vector3NodePresenter : PropertyNodePresenter
{
protected override IEnumerable<GraphControlPresenter> GetControlData()
{
var instance = CreateInstance<Vector3ControlPresenter>();
instance.Initialize(node);
return new List<GraphControlPresenter>(base.GetControlData()) { instance };
}
}
}

38
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector4NodePresenter.cs


using System;
using System.Collections.Generic;
using UnityEditor.Experimental.UIElements.GraphView;
using UnityEngine;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing
{
class Vector4ControlPresenter : GraphControlPresenter
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var tNode = node as UnityEngine.MaterialGraph.Vector4Node;
if (tNode == null)
return;
tNode.value = EditorGUILayout.Vector4Field("", tNode.value);
}
public override float GetHeight()
{
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class Vector4NodePresenter : PropertyNodePresenter
{
protected override IEnumerable<GraphControlPresenter> GetControlData()
{
var instance = CreateInstance<Vector4ControlPresenter>();
instance.Initialize(node);
return new List<GraphControlPresenter>(base.GetControlData()) { instance };
}
}
}

83
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector1NodePresenter.cs


using System;
using System.Collections.Generic;
using UnityEditor.Experimental.UIElements.GraphView;
using UnityEngine.MaterialGraph;
using UnityEngine;
namespace UnityEditor.MaterialGraph.Drawing
{
class Vector1ControlPresenter : GraphControlPresenter
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var tNode = node as Vector1Node;
if (tNode == null)
return;
tNode.value = EditorGUILayout.FloatField("Value:", tNode.value);
/*
tNode.floatType = (FloatPropertyChunk.FloatType)EditorGUILayout.EnumPopup("Float", tNode.floatType);
Vector3 ranges = tNode.rangeValues;
switch (tNode.floatType)
{
case FloatPropertyChunk.FloatType.Float:
tNode.floatType = FloatPropertyChunk.FloatType.Float;
tNode.value = EditorGUILayout.FloatField("Value:", tNode.value);
break;
case FloatPropertyChunk.FloatType.Range:
tNode.floatType = FloatPropertyChunk.FloatType.Range;
tNode.value = EditorGUILayout.Slider(tNode.value, tNode.rangeValues.x, tNode.rangeValues.y);
EditorGUILayout.BeginHorizontal();
ranges.x = EditorGUILayout.FloatField(ranges.x);
//very dirty...
for (int i = 0; i < 15; i++)
{
EditorGUILayout.Space();
}
ranges.y = EditorGUILayout.FloatField(ranges.y);
EditorGUILayout.EndHorizontal();
tNode.rangeValues = ranges;
break;
case FloatPropertyChunk.FloatType.PowerSlider:
tNode.floatType = FloatPropertyChunk.FloatType.PowerSlider;
tNode.value = EditorGUILayout.Slider(tNode.value, tNode.rangeValues.x, tNode.rangeValues.y);
EditorGUILayout.BeginHorizontal();
ranges.x = EditorGUILayout.FloatField(ranges.x);
ranges.y = EditorGUILayout.FloatField(ranges.y);
//power needs to be name
ranges.z = EditorGUILayout.FloatField(ranges.z);
EditorGUILayout.EndHorizontal();
tNode.rangeValues = ranges;
break;
case FloatPropertyChunk.FloatType.Toggle:
bool toggleState = tNode.value == 0f ? false : true;
tNode.floatType = FloatPropertyChunk.FloatType.Toggle;
toggleState = EditorGUILayout.Toggle(toggleState);
tNode.value = toggleState == true ? 1f : 0f;
break;
}*/
}
public override float GetHeight()
{
return (EditorGUIUtility.singleLineHeight + 16 * EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class Vector1NodePresenter : PropertyNodePresenter
{
protected override IEnumerable<GraphControlPresenter> GetControlData()
{
var instance = CreateInstance<Vector1ControlPresenter>();
instance.Initialize(node);
return new List<GraphControlPresenter>(base.GetControlData()) { instance };
}
}
}
正在加载...
取消
保存