| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 | 
							- // Amplify Shader Editor - Visual Shader Editing Tool
 
- // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
 
- using System;
 
- using UnityEngine;
 
- namespace AmplifyShaderEditor
 
- {
 
- 	public enum WireStatus
 
- 	{
 
- 		Default = 0,
 
- 		Highlighted,
 
- 		Selected
 
- 	}
 
- 	[Serializable]
 
- 	public sealed class WireReference
 
- 	{
 
- 		private WireStatus m_status = WireStatus.Default;
 
- 		[SerializeField]
 
- 		private int m_nodeId = -1;
 
- 		[SerializeField]
 
- 		private int m_portId = -1;
 
- 		[SerializeField]
 
- 		private WirePortDataType m_dataType = WirePortDataType.FLOAT;
 
- 		[SerializeField]
 
- 		private bool m_typeLocked = false;
 
- 		
 
- 		
 
- 		
 
- 		public WireReference()
 
- 		{
 
- 			m_nodeId = -1;
 
- 			m_portId = -1;
 
- 			m_dataType = WirePortDataType.FLOAT;
 
- 			m_typeLocked = false;
 
- 			m_status = WireStatus.Default;
 
- 		}
 
- 		public WireReference( int nodeId, int portId, WirePortDataType dataType, bool typeLocked )
 
- 		{
 
- 			m_portId = portId;
 
- 			m_nodeId = nodeId;
 
- 			m_dataType = dataType;
 
- 			m_typeLocked = typeLocked;
 
- 			m_status = WireStatus.Default;
 
- 		}
 
- 		public void Invalidate()
 
- 		{
 
- 			m_nodeId = -1;
 
- 			m_portId = -1;
 
- 			m_typeLocked = false;
 
- 			m_status = WireStatus.Default;
 
- 		}
 
- 		public void SetReference( int nodeId, int portId, WirePortDataType dataType, bool typeLocked )
 
- 		{
 
- 			m_nodeId = nodeId;
 
- 			m_portId = portId;
 
- 			m_dataType = dataType;
 
- 			m_typeLocked = typeLocked;
 
- 		}
 
- 		public void SetReference( WirePort port )
 
- 		{
 
- 			m_nodeId = port.NodeId;
 
- 			m_portId = port.PortId;
 
- 			m_dataType = port.DataType;
 
- 		}
 
- 		public bool IsValid
 
- 		{
 
- 			get { return ( m_nodeId != -1 && m_portId != -1 ); }
 
- 		}
 
- 		public int NodeId
 
- 		{
 
- 			get { return m_nodeId; }
 
- 		}
 
- 		public int PortId
 
- 		{
 
- 			get { return m_portId; }
 
- 			set { m_portId = value; }
 
- 		}
 
- 		public WirePortDataType DataType
 
- 		{
 
- 			get { return m_dataType; }
 
- 			set { m_dataType = value; }
 
- 		}
 
- 		public bool TypeLocked
 
- 		{
 
- 			get { return m_typeLocked; }
 
- 		}
 
- 		public WireStatus WireStatus
 
- 		{
 
- 			get { return m_status; }
 
- 			set { m_status = value; }
 
- 		}
 
- 		public override string ToString()
 
- 		{
 
- 			string dump = "";
 
- 			dump += "* Wire Reference *\n";
 
- 			dump += "NodeId : " + m_nodeId + "\n";
 
- 			dump += "PortId : " + m_portId + "\n";
 
- 			dump += "DataType " + m_dataType + "\n"; ;
 
- 			return dump;
 
- 		}
 
- 		public void WriteToString( ref string myString )
 
- 		{
 
- 			IOUtils.AddFieldToString( ref myString, "PortId", m_portId );
 
- 			IOUtils.AddFieldToString( ref myString, "NodeID", m_nodeId );
 
- 			IOUtils.AddFieldToString( ref myString, "DataType", m_dataType );
 
- 			IOUtils.AddFieldToString( ref myString, "TypeLocked", m_typeLocked );
 
- 		}
 
- 	}
 
- }
 
 
  |