浏览代码
Working remap node (wood wood) probably still needs a bunch of love. but something is working :)
/main
Working remap node (wood wood) probably still needs a bunch of love. but something is working :)
/main
Tim Cooper
7 年前
当前提交
97cfbe75
共有 27 个文件被更改,包括 319 次插入 和 186 次删除
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateRemapGraph.cs
-
1MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/AbstractMaterialGraphEditWindow.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
61MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Nodes/RemapMasterNodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewSystem.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Importers/MasterRemapGraphImporter.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightSubshaderPBR.template
-
17MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractMaterialGraph.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractShaderProperty.cs
-
1MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/IShaderProperty.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/MaterialGraph.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/Vector2ShaderProperty.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/Vector3ShaderProperty.cs
-
74MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/AbstractLightweightMasterNode.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/AbstractLightweightPBRMasterNode.cs
-
17MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightMetallicMasterNode.cs
-
15MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/LightweightSpecularMasterNode.cs
-
23MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MasterNode.cs
-
60MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/AbstractSubGraphNode.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/MaterialSubGraphAsset.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/SubGraphNode.cs
-
15MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Remapper/MasterRemapGraphAsset.cs
-
98MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/MasterRemapNode.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/MasterRemapNode.cs.meta
-
32MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Remapper/MasterRemapInputNode.cs
-
19MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Remapper/MaterialRemapAsset.cs
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Remapper/MasterRemapGraphAsset.cs.meta
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
/* [Serializable] |
|||
class RemapMasterControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
[Serializable] |
|||
class RemapContolPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
var remapNode = node as RemapMasterNode; |
|||
if (remapNode == null) |
|||
return; |
|||
var remapNode = node as MasterRemapNode; |
|||
if (remapNode == null) |
|||
return; |
|||
remapNode.remapAsset = (MaterialRemapAsset)EditorGUILayout.MiniThumbnailObjectField( |
|||
new GUIContent("Remap Asset"), |
|||
remapNode.remapAsset, |
|||
typeof(MaterialRemapAsset), null); |
|||
} |
|||
remapNode.remapGraphAsset = (MasterRemapGraphAsset)EditorGUILayout.MiniThumbnailObjectField( |
|||
new GUIContent("Remap"), |
|||
remapNode.remapGraphAsset, |
|||
typeof(MasterRemapGraphAsset), null); |
|||
} |
|||
public override float GetHeight() |
|||
{ |
|||
return EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
public override float GetHeight() |
|||
{ |
|||
return EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
[Serializable] |
|||
public class RemapMasterNodePresenter : MasterNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<RemapMasterControlPresenter>(); |
|||
instance.Initialize(node); |
|||
var controls = new List<GraphControlPresenter>(base.GetControlData()); |
|||
controls.Add(instance); |
|||
return controls; |
|||
} |
|||
}*/ |
|||
[Serializable] |
|||
public class MasterRemapNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphControlPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<RemapContolPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphControlPresenter> { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
public class MasterRemapGraphAsset : ScriptableObject |
|||
{ |
|||
[SerializeField] |
|||
private MasterRemapGraph m_RemapGraph = new MasterRemapGraph(); |
|||
|
|||
public MasterRemapGraph remapGraph |
|||
{ |
|||
get { return m_RemapGraph; } |
|||
set { m_RemapGraph = value; } |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEditor; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Master/Remap-Node")] |
|||
public class MasterRemapNode : AbstractSubGraphNode, IMasterNode |
|||
{ |
|||
[SerializeField] |
|||
protected SurfaceMaterialOptions m_MaterialOptions = new SurfaceMaterialOptions(); |
|||
|
|||
public SurfaceMaterialOptions options |
|||
{ |
|||
get { return m_MaterialOptions; } |
|||
} |
|||
|
|||
public virtual PreviewMode previewMode |
|||
{ |
|||
get { return PreviewMode.Preview3D; } |
|||
} |
|||
|
|||
[SerializeField] |
|||
private string m_SerializedRemapGraph = string.Empty; |
|||
|
|||
[Serializable] |
|||
private class RemapGraphHelper |
|||
{ |
|||
public MasterRemapGraphAsset remapGraph; |
|||
} |
|||
|
|||
protected override AbstractSubGraph referencedGraph |
|||
{ |
|||
get |
|||
{ |
|||
if (remapGraphAsset == null) |
|||
return null; |
|||
|
|||
return remapGraphAsset.remapGraph; |
|||
} |
|||
} |
|||
|
|||
#if UNITY_EDITOR
|
|||
public MasterRemapGraphAsset remapGraphAsset |
|||
{ |
|||
get |
|||
{ |
|||
if (string.IsNullOrEmpty(m_SerializedRemapGraph)) |
|||
return null; |
|||
|
|||
var helper = new RemapGraphHelper(); |
|||
EditorJsonUtility.FromJsonOverwrite(m_SerializedRemapGraph, helper); |
|||
return helper.remapGraph; |
|||
} |
|||
set |
|||
{ |
|||
if (remapGraphAsset == value) |
|||
return; |
|||
|
|||
var helper = new RemapGraphHelper(); |
|||
helper.remapGraph = value; |
|||
m_SerializedRemapGraph = EditorJsonUtility.ToJson(helper, true); |
|||
OnEnable(); |
|||
|
|||
if (onModified != null) |
|||
onModified(this, ModificationScope.Topological); |
|||
} |
|||
} |
|||
#else
|
|||
public MaterialSubGraphAsset subGraphAsset {get; set; } |
|||
#endif
|
|||
|
|||
public MasterRemapNode() |
|||
{ |
|||
name = "RemapMaster"; |
|||
} |
|||
|
|||
public IEnumerable<string> GetSubshader(ShaderGraphRequirements graphRequirements, MasterRemapGraph remapper) |
|||
{ |
|||
|
|||
if (referencedGraph == null) |
|||
return new string[]{}; |
|||
|
|||
var masterNodes = referencedGraph.activeNodes.OfType<IMasterNode>().ToList(); |
|||
|
|||
if (masterNodes.Count == 0) |
|||
return new string[]{}; |
|||
|
|||
var results = new List<string>(); |
|||
foreach (var master in masterNodes) |
|||
results.AddRange(master.GetSubshader(graphRequirements, referencedGraph as MasterRemapGraph)); |
|||
|
|||
return results; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 861139fc6f60415cae2eb9a9625aaeb8 |
|||
timeCreated: 1506873607 |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Remapper/Remap Input Node")] |
|||
public class MasterRemapInputNode : AbstractSubGraphIONode |
|||
{ |
|||
public MasterRemapInputNode() |
|||
{ |
|||
name = "Inputs"; |
|||
} |
|||
|
|||
public override int AddSlot() |
|||
{ |
|||
var index = GetInputSlots<ISlot>().Count() + 1; |
|||
AddSlot(new MaterialSlot(index, "Output " + index, "Output" + index, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|||
return index; |
|||
} |
|||
|
|||
public override void RemoveSlot() |
|||
{ |
|||
var index = GetInputSlots<ISlot>().Count(); |
|||
if (index == 0) |
|||
return; |
|||
|
|||
RemoveSlot(index); |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
public class MasterRemapGraphAsset : ScriptableObject |
|||
{ |
|||
[SerializeField] |
|||
private MasterRemapGraph m_RemapGraph = new MasterRemapGraph(); |
|||
|
|||
public MasterRemapGraph remapGraph |
|||
{ |
|||
get { return m_RemapGraph; } |
|||
set { m_RemapGraph = value; } |
|||
} |
|||
} |
|||
|
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue