diff options
author | chai <chaifix@163.com> | 2020-10-23 13:08:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-23 13:08:43 +0800 |
commit | b82da95b5181ac8bbae38efb13e950d5e88a4caa (patch) | |
tree | 48a6f3269276484bbc7cfc95f0651f40a2176aa1 /Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs | |
parent | 917e9e0b320775634dc2e710f7deac74fd0822f0 (diff) |
*移动amplify shader editor到third party目录
Diffstat (limited to 'Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs')
-rw-r--r-- | Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs new file mode 100644 index 00000000..1fffc290 --- /dev/null +++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs @@ -0,0 +1,90 @@ +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class OutputNode : SignalGeneratorNode + { + public static int LOD_SUBSHADER_VERSION = 17200; + [SerializeField] + protected bool m_isMainOutputNode = false; + + [SerializeField] + protected int m_lodIndex = -1; + + public OutputNode() : base() { } + public OutputNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + public override void ResetNodeData() + { + base.ResetNodeData(); + m_graphDepth = -1; + } + + public virtual void SetupNodeCategories() + { + ContainerGraph.ResetNodesData(); + //int count = m_inputPorts.Count; + //for( int i = 0; i < count; i++ ) + //{ + // if( m_inputPorts[ i ].IsConnected ) + // { + // NodeData nodeData = new NodeData( m_inputPorts[ i ].Category ); + // ParentNode node = m_inputPorts[ i ].GetOutputNode(); + // node.PropagateNodeData( nodeData, ref collector ); + // } + //} + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_isMainOutputNode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_lodIndex ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_isMainOutputNode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > LOD_SUBSHADER_VERSION ) + { + m_lodIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( IsLODMainMasterNode && !ContainerGraph.IsDuplicating ) + { + ContainerGraph.AssignMasterNode( this, true ); + } + } + + public override void AfterDuplication() + { + base.AfterDuplication(); + m_isMainOutputNode = false; + } + + public bool IsMainOutputNode + { + get { return m_isMainOutputNode; } + set + { + if( value != m_isMainOutputNode ) + { + m_isMainOutputNode = value; + if( m_isMainOutputNode ) + { + GenerateSignalPropagation(); + } + else + { + GenerateSignalInibitor(); + } + } + } + } + + public int LODIndex { get { return m_lodIndex; } set { m_lodIndex = value; } } + public bool IsLODMainMasterNode { get { return m_isMainOutputNode && m_lodIndex == -1; } } + } +} |