Peter Bay Bastian
7 年前
当前提交
7bb42428
共有 12 个文件被更改,包括 115 次插入 和 269 次删除
-
46MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix2Node.cs
-
56MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix3Node.cs
-
62MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix4Node.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Matrix2NodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Matrix3NodePresenter.cs.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Matrix4NodePresenter.cs.meta
-
39MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Matrix2NodePresenter.cs
-
40MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Matrix3NodePresenter.cs
-
41MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/Matrix4NodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/PropertyNodePresenter.cs.meta
-
49MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/PropertyNodePresenter.cs
|
|||
fileFormatVersion: 2 |
|||
guid: 7a56e192798ff9a45a01f10c9113e539 |
|||
timeCreated: 1476871291 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 8cb077290891de74d905d2361f73441b |
|||
timeCreated: 1476871291 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 8183008b69a6d79419dc9f1f08d12f4d |
|||
timeCreated: 1476871291 |
|||
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 Matrix2ControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.Matrix2Node; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode[0] = EditorGUILayout.Vector2Field("", tNode[0]); |
|||
tNode[1] = EditorGUILayout.Vector2Field("", tNode[1]); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class Matrix2NodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<Matrix2ControlPresenter>(); |
|||
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 Matrix3ControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.Matrix3Node; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode[0] = EditorGUILayout.Vector3Field("", tNode[0]); |
|||
tNode[1] = EditorGUILayout.Vector3Field("", tNode[1]); |
|||
tNode[2] = EditorGUILayout.Vector3Field("", tNode[2]); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class Matrix3NodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<Matrix3ControlPresenter>(); |
|||
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 Matrix4ControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.Matrix4Node; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode[0] = EditorGUILayout.Vector4Field("", tNode[0]); |
|||
tNode[1] = EditorGUILayout.Vector4Field("", tNode[1]); |
|||
tNode[2] = EditorGUILayout.Vector4Field("", tNode[2]); |
|||
tNode[3] = EditorGUILayout.Vector4Field("", tNode[3]); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class Matrix4NodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<Matrix4ControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphControlPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: eaa1f14b82a26aa49b8a51ce08653c87 |
|||
timeCreated: 1477985625 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
public class PropertyControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as PropertyNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
var graph = node.owner as AbstractMaterialGraph; |
|||
|
|||
var currentGUID = tNode.propertyGuid; |
|||
var properties = graph.properties.ToList(); |
|||
var propertiesGUID = properties.Select(x => x.guid).ToList(); |
|||
var currentSelectedIndex = propertiesGUID.IndexOf(currentGUID); |
|||
|
|||
var newIndex = EditorGUILayout.Popup("Property", currentSelectedIndex, properties.Select(x => x.displayName).ToArray()); |
|||
|
|||
if (newIndex != currentSelectedIndex) |
|||
tNode.propertyGuid = propertiesGUID[newIndex]; |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 2 + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class PropertyNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<PropertyControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphControlPresenter> { instance }; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue