initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.Graphing
|
||||
{
|
||||
[Serializable]
|
||||
struct DrawState
|
||||
{
|
||||
[SerializeField]
|
||||
private bool m_Expanded;
|
||||
|
||||
[SerializeField]
|
||||
private Rect m_Position;
|
||||
|
||||
public bool expanded
|
||||
{
|
||||
get { return m_Expanded; }
|
||||
set { m_Expanded = value; }
|
||||
}
|
||||
|
||||
public Rect position
|
||||
{
|
||||
get { return m_Position; }
|
||||
set { m_Position = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c85b5b63a005833438cd315d952735de
|
||||
timeCreated: 1464272094
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.Graphing
|
||||
{
|
||||
[Serializable]
|
||||
class GraphDrawingData : ISerializationCallbackReceiver
|
||||
{
|
||||
[SerializeField]
|
||||
private List<string> m_SerializableSelection = new List<string>();
|
||||
|
||||
[NonSerialized]
|
||||
private List<Guid> m_Selection = new List<Guid>();
|
||||
|
||||
public IEnumerable<Guid> selection
|
||||
{
|
||||
get { return m_Selection; }
|
||||
set
|
||||
{
|
||||
m_Selection.Clear();
|
||||
m_Selection.AddRange(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
m_SerializableSelection.Clear();
|
||||
m_SerializableSelection.AddRange(m_Selection.Select(x => x.ToString()));
|
||||
}
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
selection = m_SerializableSelection.Select(x => new Guid(x));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4bc9112caeee14b29b0a521463985007
|
||||
timeCreated: 1482330187
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace UnityEditor.Graphing
|
||||
{
|
||||
interface IEdge : IEquatable<IEdge>
|
||||
{
|
||||
SlotReference outputSlot { get; }
|
||||
SlotReference inputSlot { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2f67813c9628ef14a839d0c546f6ab25
|
||||
timeCreated: 1464264924
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.ShaderGraph;
|
||||
|
||||
namespace UnityEditor.Graphing
|
||||
{
|
||||
enum ModificationScope
|
||||
{
|
||||
Nothing = 0,
|
||||
Node = 1,
|
||||
Graph = 2,
|
||||
Topological = 3,
|
||||
Layout = 4
|
||||
}
|
||||
|
||||
delegate void OnNodeModified(AbstractMaterialNode node, ModificationScope scope);
|
||||
|
||||
static class NodeExtensions
|
||||
{
|
||||
public static IEnumerable<T> GetSlots<T>(this AbstractMaterialNode node) where T : MaterialSlot
|
||||
{
|
||||
var slots = new List<T>();
|
||||
node.GetSlots(slots);
|
||||
return slots;
|
||||
}
|
||||
|
||||
public static IEnumerable<T> GetInputSlots<T>(this AbstractMaterialNode node) where T : MaterialSlot
|
||||
{
|
||||
var slots = new List<T>();
|
||||
node.GetInputSlots(slots);
|
||||
return slots;
|
||||
}
|
||||
|
||||
public static IEnumerable<T> GetInputSlots<T>(this AbstractMaterialNode node, MaterialSlot startingSlot) where T : MaterialSlot
|
||||
{
|
||||
var slots = new List<T>();
|
||||
node.GetInputSlots(startingSlot, slots);
|
||||
return slots;
|
||||
}
|
||||
|
||||
public static IEnumerable<T> GetOutputSlots<T>(this AbstractMaterialNode node) where T : MaterialSlot
|
||||
{
|
||||
var slots = new List<T>();
|
||||
node.GetOutputSlots(slots);
|
||||
return slots;
|
||||
}
|
||||
|
||||
public static IEnumerable<T> GetOutputSlots<T>(this AbstractMaterialNode node, MaterialSlot startingSlot) where T : MaterialSlot
|
||||
{
|
||||
var slots = new List<T>();
|
||||
node.GetOutputSlots(startingSlot, slots);
|
||||
return slots;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b16d3bd20d4d2c644969258425ff071a
|
||||
timeCreated: 1464264925
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,7 @@
|
|||
namespace UnityEditor.Graphing
|
||||
{
|
||||
interface IOnAssetEnabled
|
||||
{
|
||||
void OnEnable();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ed722b1f9c66a7441b3893cec3e3ff4d
|
||||
timeCreated: 1468409044
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using UnityEditor.ShaderGraph;
|
||||
using UnityEditor.ShaderGraph.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.Graphing
|
||||
{
|
||||
[Serializable]
|
||||
struct SlotReference : IEquatable<SlotReference>, IComparable<SlotReference>
|
||||
{
|
||||
[SerializeField]
|
||||
JsonRef<AbstractMaterialNode> m_Node;
|
||||
|
||||
[SerializeField]
|
||||
int m_SlotId;
|
||||
|
||||
public SlotReference(AbstractMaterialNode node, int slotId)
|
||||
{
|
||||
m_Node = node;
|
||||
m_SlotId = slotId;
|
||||
}
|
||||
|
||||
public AbstractMaterialNode node => m_Node;
|
||||
|
||||
// public Guid nodeGuid => m_Node.value.guid;
|
||||
|
||||
public int slotId => m_SlotId;
|
||||
|
||||
public MaterialSlot slot => m_Node.value?.FindSlot<MaterialSlot>(m_SlotId);
|
||||
|
||||
public bool Equals(SlotReference other) => m_SlotId == other.m_SlotId && m_Node.value == other.m_Node.value;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
return obj.GetType() == GetType() && Equals((SlotReference)obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return (m_SlotId * 397) ^ m_Node.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public int CompareTo(SlotReference other)
|
||||
{
|
||||
var nodeIdComparison = m_Node.value.objectId.CompareTo(other.m_Node.value.objectId);
|
||||
if (nodeIdComparison != 0)
|
||||
{
|
||||
return nodeIdComparison;
|
||||
}
|
||||
|
||||
return m_SlotId.CompareTo(other.m_SlotId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a7b6f306850f6cc449bc71d8d2384146
|
||||
timeCreated: 1464264925
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue