Peter Bay Bastian
7 年前
当前提交
ff8de4d3
共有 30 个文件被更改,包括 223 次插入 和 266 次删除
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector1Node.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector2Node.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector3Node.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector4Node.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
40MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls.meta
-
38MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ColorControl.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ColorControl.cs.meta
-
9MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/DefaultControl.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/DefaultControl.cs.meta
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/IControlAttribute.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/IControlAttribute.cs.meta
-
35MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector1Control.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector1Control.cs.meta
-
25MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector2Control.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector2Control.cs.meta
-
25MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector3Control.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector3Control.cs.meta
-
25MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector4Control.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/Vector4Control.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector1NodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector2NodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector3NodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector4NodePresenter.cs.meta
-
38MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector2NodePresenter.cs
-
38MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector3NodePresenter.cs
-
38MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector4NodePresenter.cs
-
83MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Vector1NodePresenter.cs
|
|||
fileFormatVersion: 2 |
|||
guid: 29309be0e1004fad967256187775c528 |
|||
timeCreated: 1507642261 |
|
|||
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); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 34e77444559b414f9fe81f9775229abf |
|||
timeCreated: 1507733396 |
|
|||
using System; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Controls |
|||
{ |
|||
public class DefaultControlAttribute : Attribute |
|||
{ |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 20e01cb163f347c7819ae286c33baf85 |
|||
timeCreated: 1507642280 |
|
|||
using System.Reflection; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing.Controls |
|||
{ |
|||
public interface IControlAttribute |
|||
{ |
|||
VisualElement InstantiateControl(AbstractMaterialNode node, PropertyInfo propertyInfo); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5f008211c3394775bdefde0b20e5c8ff |
|||
timeCreated: 1507642348 |
|
|||
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())))); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 52014e64fe13479795aba91b9c4069e1 |
|||
timeCreated: 1507732539 |
|
|||
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())))); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6d54d25de2204da2af41c34b22d88846 |
|||
timeCreated: 1507732510 |
|
|||
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())))); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7ae88210793e490d9bd7e96feba8b429 |
|||
timeCreated: 1507732444 |
|
|||
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())))); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8a515dc1bacc453b870777d8da9a7211 |
|||
timeCreated: 1507642288 |
|
|||
fileFormatVersion: 2 |
|||
guid: aaea57ca317a64a9a811d6ac4a069a64 |
|||
timeCreated: 1476732809 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 6018b93ef62914859a707349fee5d50e |
|||
timeCreated: 1476871291 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: e8f2d0e687af5483fa604cf5b2843284 |
|||
timeCreated: 1476877473 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c63e4f4ffa1734ea8a3dd6ee0099314e |
|||
timeCreated: 1476877473 |
|||
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 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 }; |
|||
} |
|||
} |
|||
} |
|
|||
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 }; |
|||
} |
|||
} |
|||
} |
|
|||
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 }; |
|||
} |
|||
} |
|||
} |
|
|||
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 }; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue