diff options
Diffstat (limited to 'Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators')
24 files changed, 0 insertions, 1438 deletions
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs deleted file mode 100644 index dab5a159..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs +++ /dev/null @@ -1,293 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System; -using System.CodeDom; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Compare", "Logical Operators", "Compare A to B given the selected operator. If comparison is true return value of True else return value of False", tags: "If Ternary Compare Less Equal Not Greater" )] - public sealed class Compare : ParentNode - { - private static readonly string[] LabelsSTR = { "Equal", "Not Equal", "Greater", "Greater Or Equal", "Less", "Less Or Equal" }; - - enum Comparision - { - Equal, - NotEqual, - Greater, - GreaterOrEqual, - Less, - LessOrEqual, - } - - private WirePortDataType m_mainInputType = WirePortDataType.FLOAT; - private WirePortDataType m_mainOutputType = WirePortDataType.FLOAT; - - private int m_cachedOperatorId = -1; - - [SerializeField] - private Comparision m_comparision = Comparision.Equal; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "A" ); - AddInputPort( WirePortDataType.FLOAT, false, "B" ); - AddInputPort( WirePortDataType.FLOAT, false, "True" ); - AddInputPort( WirePortDataType.FLOAT, false, "False" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_inputPorts[ 0 ].AutoDrawInternalData = true; - m_inputPorts[ 1 ].AutoDrawInternalData = true; - m_inputPorts[ 2 ].AutoDrawInternalData = true; - m_inputPorts[ 3 ].AutoDrawInternalData = true; - m_textLabelWidth = 100; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "381937898f0c15747af1da09a751890c"; - UpdateTitle(); - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_comparision = (Comparision)m_upperLeftWidget.DrawWidget( this, (int)m_comparision, LabelsSTR ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateTitle(); - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_cachedOperatorId == -1 ) - m_cachedOperatorId = Shader.PropertyToID( "_Operator" ); - - PreviewMaterial.SetInt( m_cachedOperatorId, (int)m_comparision ); - } - - void UpdateTitle() - { - switch( m_comparision ) - { - default: - case Comparision.Equal: - m_additionalContent.text = "( A = B )"; - break; - case Comparision.NotEqual: - m_additionalContent.text = "( A \u2260 B )"; - break; - case Comparision.Greater: - m_additionalContent.text = "( A > B )"; - break; - case Comparision.GreaterOrEqual: - m_additionalContent.text = "( A \u2265 B )"; - break; - case Comparision.Less: - m_additionalContent.text = "( A < B )"; - break; - case Comparision.LessOrEqual: - m_additionalContent.text = "( A \u2264 B )"; - break; - } - m_sizeIsDirty = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_comparision = (Comparision)EditorGUILayoutEnumPopup( "", m_comparision ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateTitle(); - } - - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].ValidInternalData && !m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].Visible ) - { - m_inputPorts[ i ].ShowInternalData( this ); - } - } - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); - UpdateConnection( inputPortId ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnection( portId ); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - - int otherPortId = 0; - if( portId < 2 ) - { - otherPortId = ( portId == 0 ) ? 1 : 0; - if( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainInputType = m_inputPorts[ otherPortId ].DataType; - m_inputPorts[ portId ].ChangeType( m_mainInputType, false ); - } - } - else - { - otherPortId = ( portId == 2 ) ? 3 : 2; - if( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainOutputType = m_inputPorts[ otherPortId ].DataType; - m_inputPorts[ portId ].ChangeType( m_mainOutputType, false ); - m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); - } - } - } - - public void UpdateConnection( int portId ) - { - m_inputPorts[ portId ].MatchPortToConnection(); - int otherPortId = 0; - WirePortDataType otherPortType = WirePortDataType.FLOAT; - if( portId < 2 ) - { - otherPortId = ( portId == 0 ) ? 1 : 0; - otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; - m_mainInputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; - if( !m_inputPorts[ otherPortId ].IsConnected ) - { - m_inputPorts[ otherPortId ].ChangeType( m_mainInputType, false ); - } - } - else - { - otherPortId = ( portId == 2 ) ? 3 : 2; - otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; - m_mainOutputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; - - m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); - - if( !m_inputPorts[ otherPortId ].IsConnected ) - { - m_inputPorts[ otherPortId ].ChangeType( m_mainOutputType, false ); - } - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - //Conditional Operator ?: has some shenanigans - //If the first operand is of type bool, one of the following must hold for the second and third operands: - //Both operands have compatible structure types. - //Both operands are scalars with numeric or bool type. - //Both operands are vectors with numeric or bool type, where the two vectors are of the same size, which is less than or equal to four. - //If the first operand is a packed vector of bool, then the conditional selection is performed on an elementwise basis.Both the second and third operands must be numeric vectors of the same size as the first operand. - WirePortDataType compatibleInputType = m_mainInputType; - if( m_mainInputType != WirePortDataType.FLOAT && m_mainInputType != WirePortDataType.INT && m_mainInputType != m_mainOutputType ) - { - compatibleInputType = m_mainOutputType; - } - - string a = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); - string b = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); - string op = string.Empty; - switch( m_comparision ) - { - default: - case Comparision.Equal: - op = "=="; - break; - case Comparision.NotEqual: - op = "!="; - break; - case Comparision.Greater: - op = ">"; - break; - case Comparision.GreaterOrEqual: - op = ">="; - break; - case Comparision.Less: - op = "<"; - break; - case Comparision.LessOrEqual: - op = "<="; - break; - } - string T = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); - string F = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); - return CreateOutputLocalVariable( 0, string.Format( "( {0} {2} {1} ? {3} : {4} )", a, b, op, T, F ), ref dataCollector ); - } - - public override void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) - { - base.ReadFromDeprecated( ref nodeParams, oldType ); - - if( oldType == typeof( TFHCCompareEqual ) ) - { - m_comparision = Comparision.Equal; - } - else - if( oldType == typeof( TFHCCompareNotEqual ) ) - { - m_comparision = Comparision.NotEqual; - } - else - if( oldType == typeof( TFHCCompareGreater ) ) - { - m_comparision = Comparision.Greater; - } - else - if( oldType == typeof( TFHCCompareGreaterEqual ) ) - { - m_comparision = Comparision.GreaterOrEqual; - } - else - if( oldType == typeof( TFHCCompareLower ) ) - { - m_comparision = Comparision.Less; - } - else - if( oldType == typeof( TFHCCompareLowerEqual ) ) - { - m_comparision = Comparision.LessOrEqual; - } - - UpdateTitle(); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - - m_comparision = (Comparision)Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - UpdateTitle(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - - IOUtils.AddFieldValueToString( ref nodeInfo, (int)m_comparision ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs.meta deleted file mode 100644 index b8307fa4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ab308ada4f120144b8d44aef5c834fe6 -timeCreated: 1588859716 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs deleted file mode 100644 index d42d9708..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs +++ /dev/null @@ -1,297 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; -//using System.Collections.Generic; -//using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "If", "Logical Operators", "Conditional comparison between A with B." )] - public sealed class ConditionalIfNode : ParentNode - { - private const string UseUnityBranchesStr = "Dynamic Branching"; - private const string UnityBranchStr = "UNITY_BRANCH "; - - private readonly string[] IfOps = { "if( {0} > {1} )", - "if( {0} == {1} )", - "if( {0} < {1} )", - "if( {0} >= {1} )", - "if( {0} <= {1} )", - "if( {0} != {1} )" }; - - //private WirePortDataType m_inputMainDataType = WirePortDataType.FLOAT; - private WirePortDataType m_outputMainDataType = WirePortDataType.FLOAT; - private string[] m_results = { string.Empty, string.Empty, string.Empty }; - - [SerializeField] - private bool m_useUnityBranch = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "A" ); - AddInputPort( WirePortDataType.FLOAT, false, "B" ); - m_inputPorts[ 0 ].AddPortRestrictions( WirePortDataType.FLOAT, WirePortDataType.INT ); - m_inputPorts[ 1 ].AddPortRestrictions( WirePortDataType.FLOAT, WirePortDataType.INT ); - - AddInputPort( WirePortDataType.FLOAT, false, "A > B" ); - AddInputPort( WirePortDataType.FLOAT, false, "A == B" ); - AddInputPort( WirePortDataType.FLOAT, false, "A < B" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_inputPorts[ 0 ].AutoDrawInternalData = true; - m_inputPorts[ 1 ].AutoDrawInternalData = true; - m_textLabelWidth = 131; - //m_useInternalPortData = true; - m_autoWrapProperties = true; - m_previewShaderGUID = "f6fb4d46bddf29e45a8a3ddfed75d0c0"; - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); - UpdateConnection( inputPortId ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnection( portId ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( !m_inputPorts[ 0 ].IsConnected ) - m_inputPorts[ 0 ].FloatInternalData = EditorGUILayoutFloatField( m_inputPorts[ 0 ].Name, m_inputPorts[ 0 ].FloatInternalData ); - if( !m_inputPorts[ 1 ].IsConnected ) - m_inputPorts[ 1 ].FloatInternalData = EditorGUILayoutFloatField( m_inputPorts[ 1 ].Name, m_inputPorts[ 1 ].FloatInternalData ); - m_useUnityBranch = EditorGUILayoutToggle( UseUnityBranchesStr, m_useUnityBranch ); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdateConnection( portId ); - } - - //void TestMainInputDataType() - //{ - // WirePortDataType newType = WirePortDataType.FLOAT; - // if ( m_inputPorts[ 0 ].IsConnected && UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( newType ) ) - // { - // newType = m_inputPorts[ 0 ].DataType; - // } - - // if ( m_inputPorts[ 1 ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) > UIUtils.GetPriority( newType ) ) ) - // { - // newType = m_inputPorts[ 1 ].DataType; - // } - - // m_inputMainDataType = newType; - //} - - void TestMainOutputDataType() - { - WirePortDataType newType = WirePortDataType.FLOAT; - for( int i = 2; i < 5; i++ ) - { - if( m_inputPorts[ i ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ i ].DataType ) > UIUtils.GetPriority( newType ) ) ) - { - newType = m_inputPorts[ i ].DataType; - } - } - - if( newType != m_outputMainDataType ) - { - m_outputMainDataType = newType; - } - m_outputPorts[ 0 ].ChangeType( m_outputMainDataType, false ); - } - - public void UpdateConnection( int portId ) - { - m_inputPorts[ portId ].MatchPortToConnection(); - switch( portId ) - { - //case 0: - //case 1: - //{ - // TestMainInputDataType(); - //} - //break; - case 2: - case 3: - case 4: - { - TestMainOutputDataType(); - } - break; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - string AValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector); - string BValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - m_results[ 0 ] = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); - m_results[ 1 ] = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); - m_results[ 2 ] = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); - - string localVarName = "ifLocalVar" + OutputId; - string localVarDec = string.Format( "{0} {1} = 0;", UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), localVarName ); - - bool lequal = false; - bool greater = false; - bool lesser = false; - bool gequal = false; - bool equal = false; - bool nequal = false; - bool welse = false; - bool midCon = false; - - if( m_inputPorts[ 2 ].IsConnected ) - { - greater = true; - } - - if( m_inputPorts[ 4 ].IsConnected ) - { - lesser = true; - } - - if( greater && m_inputPorts[ 2 ].GetOutputConnection() == m_inputPorts[ 3 ].GetOutputConnection() ) - { - gequal = true; - } - - if( lesser && m_inputPorts[ 4 ].GetOutputConnection() == m_inputPorts[ 3 ].GetOutputConnection() ) - { - lequal = true; - } - - if( m_inputPorts[ 2 ].GetOutputConnection() == m_inputPorts[ 4 ].GetOutputConnection() ) - { - if( m_inputPorts[ 3 ].IsConnected ) - equal = true; - else if( m_inputPorts[ 2 ].IsConnected ) - nequal = true; - } - - if( m_inputPorts[ 3 ].IsConnected ) - { - midCon = true; - - if( greater && lesser ) - welse = true; - } - - dataCollector.AddLocalVariable( UniqueId, localVarDec, true ); - if ( m_useUnityBranch && !( lequal && gequal ) && !( !greater && !midCon && !lesser ) ) - dataCollector.AddLocalVariable( UniqueId, UnityBranchStr, true ); - - if( lequal && gequal ) // all equal - { - dataCollector.AddLocalVariable( UniqueId, string.Format( "{0} = {1};", localVarName, m_results[ 1 ] ), true ); - } - else if( !lequal && gequal ) // greater or equal - { - dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 3 ], AValue, BValue ), true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); - - if( welse ) - { - dataCollector.AddLocalVariable( UniqueId, "else", true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 2 ] ), true ); - } - } - else if( lequal && !gequal )// lesser or equal - { - dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 4 ], AValue, BValue ), true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 2 ] ), true ); - - if( welse ) - { - dataCollector.AddLocalVariable( UniqueId, "else", true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); - } - } - else if( nequal )// not equal - { - dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 5 ], AValue, BValue ), true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); - } - else if( equal )// equal - { - dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 1 ], AValue, BValue ), true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 1 ] ), true ); - - if( welse ) - { - dataCollector.AddLocalVariable( UniqueId, "else", true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); - } - } - else if( lesser && !midCon && !greater ) // lesser - { - dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 2 ], AValue, BValue ), true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 2 ] ), true ); - } - else if( greater && !midCon && !lesser ) // greater - { - dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 0 ], AValue, BValue ), true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); - } - else if( !greater && !midCon && !lesser ) // none - { - //dataCollector.AddLocalVariable( UniqueId, localVarDec ); - } - else // all different - { - bool ifStarted = false; - if( greater ) - { - dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 0 ], AValue, BValue ), true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); - ifStarted = true; - } - - if( midCon ) - { - dataCollector.AddLocalVariable( UniqueId, ( ifStarted ? "else " : string.Empty ) +string.Format( IfOps[ 1 ], AValue, BValue ), true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 1 ] ), true ); - ifStarted = true; - } - - if( lesser ) - { - dataCollector.AddLocalVariable( UniqueId, "else " + string.Format( IfOps[ 2 ], AValue, BValue ), true ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 2 ] ), true ); - } - } - - m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory ); - return localVarName; - } - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 4103 ) - { - m_useUnityBranch = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_useUnityBranch ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs.meta deleted file mode 100644 index 930b353a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3deb719c04d269e49bcd2a2c365da6fb -timeCreated: 1486405023 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs deleted file mode 100644 index 23650365..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Keyword Switch", "Logical Operators", "Attributes a value according to the existance of a selected keyword", Deprecated = true, DeprecatedAlternativeType = typeof(StaticSwitch), DeprecatedAlternative = "Static Switch" )] - public sealed class KeywordSwitchNode : ParentNode - { - private const string KeywordStr = "Keyword"; - private const string CustomStr = "Custom"; - - [SerializeField] - private string m_currentKeyword = string.Empty; - - [SerializeField] - private int m_currentKeywordId = 0; - - [SerializeField] - private WirePortDataType m_mainPortType = WirePortDataType.FLOAT; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "True" ); - AddInputPort( WirePortDataType.FLOAT, false, "False" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_textLabelWidth = 65; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_currentKeywordId = EditorGUILayoutPopup( KeywordStr, m_currentKeywordId, UIUtils.AvailableKeywords ); - if ( EditorGUI.EndChangeCheck() ) - { - if ( m_currentKeywordId != 0 ) - { - m_currentKeyword = UIUtils.AvailableKeywords[ m_currentKeywordId ]; - } - } - if ( m_currentKeywordId == 0 ) - { - m_currentKeyword = EditorGUILayoutTextField( CustomStr, m_currentKeyword ); - } - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnected( portId ); - } - - public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); - UpdateConnected( portId ); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdateDisconnected( portId ); - } - - void UpdateConnected( int portId ) - { - m_inputPorts[ portId ].MatchPortToConnection(); - int otherPortId = ( portId + 1 ) % 2; - if ( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainPortType = ( UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( m_inputPorts[ otherPortId ].DataType ) ) ? - m_inputPorts[ portId ].DataType : - m_inputPorts[ otherPortId ].DataType; - } - else - { - m_mainPortType = m_inputPorts[ portId ].DataType; - m_inputPorts[ otherPortId ].ChangeType( m_mainPortType, false ); - } - m_outputPorts[ 0 ].ChangeType( m_mainPortType, false ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - string trueCode = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string falseCode = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - string localVarName = "simpleKeywordVar"+OutputId; - string outType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - dataCollector.AddLocalVariable( UniqueId, "#ifdef " + m_currentKeyword, true ); - dataCollector.AddLocalVariable( UniqueId, outType + " " + localVarName + " = " + trueCode + ";", true ); - dataCollector.AddLocalVariable( UniqueId, "#else", true ); - dataCollector.AddLocalVariable( UniqueId, outType + " " + localVarName + " = " + falseCode + ";", true ); - dataCollector.AddLocalVariable( UniqueId, "#endif", true ); - m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - void UpdateDisconnected( int portId ) - { - int otherPortId = ( portId + 1 ) % 2; - if ( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainPortType = m_inputPorts[ otherPortId ].DataType; - m_inputPorts[ portId ].ChangeType( m_mainPortType, false ); - } - m_outputPorts[ 0 ].ChangeType( m_mainPortType, false ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_currentKeyword = GetCurrentParam( ref nodeParams ); - m_currentKeywordId = UIUtils.GetKeywordId( m_currentKeyword ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentKeyword ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs.meta deleted file mode 100644 index 7549755e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 04eb50f45d1416e4bb61902a49f06d58 -timeCreated: 1500648134 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs deleted file mode 100644 index dea9b145..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Compare (A == B) -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Compare (A = B)", "Logical Operators", "Check if A is equal to B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCCompareEqual : TFHCStub - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = "A"; - m_inputPorts[ 1 ].Name = "B"; - AddInputPort( WirePortDataType.FLOAT, false, "True" ); - AddInputPort( WirePortDataType.FLOAT, false, "False" ); - m_textLabelWidth = 100; - m_useInternalPortData = true; - m_previewShaderGUID = "6904de6cf8c08e7439672390b425ab50"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - GetInputData( ref dataCollector, ignoreLocalvar ); - string strout = "(( " + m_inputDataPort0 + " == " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs.meta deleted file mode 100644 index d8255b8d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d6d04219b3c5c5a4282aa9a763b9ad3c -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs deleted file mode 100644 index 3d6db6a0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Compare (A > B) -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes("Compare (A > B)", "Logical Operators", "Check if A is greater than B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCCompareGreater : TFHCStub - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = "A"; - m_inputPorts[ 1 ].Name = "B"; - AddInputPort( WirePortDataType.FLOAT, false, "True" ); - AddInputPort( WirePortDataType.FLOAT, false, "False" ); - m_textLabelWidth = 100; - m_useInternalPortData = true; - m_previewShaderGUID = "363192dbd019ad2478f2fe6c277b7e48"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - GetInputData( ref dataCollector, ignoreLocalvar ); - string strout = "(( " + m_inputDataPort0 + " > " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; - //Debug.Log(strout); - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs.meta deleted file mode 100644 index 7d1c5723..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ff04934859005cd41ac644f2a9349e8b -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs deleted file mode 100644 index 5dc0fe6f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Compare (A >= B) -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes("Compare (A \u2265 B)", "Logical Operators", "Check if A is greater than or equal to B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof(Compare), "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCCompareGreaterEqual : TFHCStub - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = "A"; - m_inputPorts[ 1 ].Name = "B"; - AddInputPort( WirePortDataType.FLOAT, false, "True" ); - AddInputPort( WirePortDataType.FLOAT, false, "False" ); - m_textLabelWidth = 100; - m_useInternalPortData = true; - m_previewShaderGUID = "f4ff76282a117c2429a1bcd8ba3a9112"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - GetInputData( ref dataCollector, ignoreLocalvar ); - string strout = "(( " + m_inputDataPort0 + " >= " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; - //Debug.Log(strout); - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs.meta deleted file mode 100644 index d8713713..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b2792c240940c3349bdef401f5683f70 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs deleted file mode 100644 index 8f989472..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Compare (A < B) -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes("Compare (A < B)", "Logical Operators", "Check if A is lower than B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCCompareLower : TFHCStub - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = "A"; - m_inputPorts[ 1 ].Name = "B"; - AddInputPort( WirePortDataType.FLOAT, false, "True" ); - AddInputPort( WirePortDataType.FLOAT, false, "False" ); - m_textLabelWidth = 100; - m_useInternalPortData = true; - m_previewShaderGUID = "8024509244392ed44b37c28473e66a8a"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - GetInputData( ref dataCollector, ignoreLocalvar ); - string strout = "(( " + m_inputDataPort0 + " < " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs.meta deleted file mode 100644 index e5abcf64..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1a70dcf76fe65a64ca70400d6d08563d -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs deleted file mode 100644 index d9bcafde..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Compare (A <= B) -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes("Compare (A \u2264 B)", "Logical Operators", "Check if A is lower than or equal to B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCCompareLowerEqual : TFHCStub - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = "A"; - m_inputPorts[ 1 ].Name = "B"; - AddInputPort( WirePortDataType.FLOAT, false, "True" ); - AddInputPort( WirePortDataType.FLOAT, false, "False" ); - m_textLabelWidth = 100; - m_useInternalPortData = true; - m_previewShaderGUID = "9a3e17508793b9d42b1efaaf5bcd2554"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - GetInputData( ref dataCollector, ignoreLocalvar ); - string strout = "(( " + m_inputDataPort0 + " <= " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs.meta deleted file mode 100644 index 4fd5beef..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e1e66ddf48770134b806dd1f397e4ac3 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs deleted file mode 100644 index 98ec281b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Compare (A != B) -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes("Compare (A \u2260 B)", "Logical Operators", "Check if A is not equal to B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCCompareNotEqual : TFHCStub - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = "A"; - m_inputPorts[ 1 ].Name = "B"; - AddInputPort( WirePortDataType.FLOAT, false, "True" ); - AddInputPort( WirePortDataType.FLOAT, false, "False" ); - m_textLabelWidth = 100; - m_useInternalPortData = true; - m_previewShaderGUID = "75f433376eef1ad4a881d99124e08008"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - GetInputData( ref dataCollector, ignoreLocalvar ); - string strout = "(( " + m_inputDataPort0 + " != " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs.meta deleted file mode 100644 index 77f259df..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 48f885e2f5fa775409b9f50be6aaf80a -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs deleted file mode 100644 index efd0d409..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Compare With Range -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Compare With Range", "Logical Operators", "Check if A is in the range between Range Min and Range Max. If true return value of True else return value of False", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCCompareWithRange : DynamicTypeNode - { - private WirePortDataType m_mainInputType = WirePortDataType.FLOAT; - private WirePortDataType m_mainOutputType = WirePortDataType.FLOAT; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = "Value"; - m_inputPorts[ 1 ].Name = "Range Min"; - AddInputPort( WirePortDataType.FLOAT, false, "Range Max" ); - AddInputPort( WirePortDataType.FLOAT, false, "True" ); - AddInputPort( WirePortDataType.FLOAT, false, "False" ); - m_textLabelWidth = 100; - m_useInternalPortData = true; - m_previewShaderGUID = "127d114eed178d7409f900134a6c00d1"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - UpdateConnections( portId ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - UpdateConnections( outputPortId ); - } - - public override void OnInputPortDisconnected( int portId ) - { - if ( portId < 3 ) - { - if ( portId > 0 ) - { - m_inputPorts[ portId ].ChangeType( m_mainInputType, false ); - } - } - else - { - int otherPortId = ( portId == 3 ) ? 4 : 3; - if ( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainOutputType = m_inputPorts[ otherPortId ].DataType; - m_inputPorts[ portId ].ChangeType( m_mainOutputType, false ); - m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); - } - } - } - - void UpdateConnections( int portId ) - { - m_inputPorts[ portId ].MatchPortToConnection(); - int otherPortId = 0; - WirePortDataType otherPortType = WirePortDataType.FLOAT; - if ( portId < 3 ) - { - if ( portId == 0 ) - { - m_mainInputType = m_inputPorts[ 0 ].DataType; - for ( int i = 1; i < 3; i++ ) - { - if ( !m_inputPorts[ i ].IsConnected ) - { - m_inputPorts[ i ].ChangeType( m_mainInputType, false ); - } - } - } - } - else - { - otherPortId = ( portId == 3 ) ? 4 : 3; - otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; - m_mainOutputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; - - m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); - - if ( !m_inputPorts[ otherPortId ].IsConnected ) - { - m_inputPorts[ otherPortId ].ChangeType( m_mainOutputType, false ); - } - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - //Conditional Operator ?: has some shenanigans - //If the first operand is of type bool, one of the following must hold for the second and third operands: - //Both operands have compatible structure types. - //Both operands are scalars with numeric or bool type. - //Both operands are vectors with numeric or bool type, where the two vectors are of the same size, which is less than or equal to four. - //If the first operand is a packed vector of bool, then the conditional selection is performed on an elementwise basis.Both the second and third operands must be numeric vectors of the same size as the first operand. - WirePortDataType compatibleInputType = m_mainInputType; - if ( m_mainInputType != WirePortDataType.FLOAT && m_mainInputType != WirePortDataType.INT && m_mainInputType != m_mainOutputType ) - { - compatibleInputType = m_mainOutputType; - } - - //Check if VALUE is in range between MIN and MAX. If true return VALUE IF TRUE else VALUE IF FALSE" - string a = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); - string b = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); - string c = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); - string d = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); - string e = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); - string strout = "(( " + a + " >= " + b + " && " + a + " <= " + c + " ) ? " + d + " : " + e + " )"; - //Debug.Log(strout); - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs.meta deleted file mode 100644 index 9cef3a3f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e7d30ad11b781804ebd54834781a32d9 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs deleted file mode 100644 index 7ed72724..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node If -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "If [Community]", "Logical Operators", "Compare A with B. If A is greater than B output the value of A > B port. If A is equal to B output the value of A == B port. If A is lower than B output the value of A < B port. Equal Threshold parameter will be used to check A == B adding and subtracting this value to A.", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCIf : ParentNode - { - private WirePortDataType m_inputMainDataType = WirePortDataType.FLOAT; - private WirePortDataType m_outputMainDataType = WirePortDataType.FLOAT; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "A" ); - AddInputPort( WirePortDataType.FLOAT, false, "B" ); - AddInputPort( WirePortDataType.FLOAT, false, "A > B" ); - AddInputPort( WirePortDataType.FLOAT, false, "A == B" ); - AddInputPort( WirePortDataType.FLOAT, false, "A < B" ); - AddInputPort( WirePortDataType.FLOAT, false, "Equal Threshold" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_textLabelWidth = 110; - m_useInternalPortData = true; - m_previewShaderGUID = "5c7bc7e3cab81da499e4864ace0d86c5"; - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); - UpdateConnection( inputPortId ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnection( portId ); - } - - public override void OnInputPortDisconnected( int portId ) - { - UpdateConnection( portId ); - } - - void TestMainInputDataType() - { - WirePortDataType newType = WirePortDataType.FLOAT; - if( m_inputPorts[ 0 ].IsConnected && UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( newType ) ) - { - newType = m_inputPorts[ 0 ].DataType; - } - - if( m_inputPorts[ 1 ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) > UIUtils.GetPriority( newType ) ) ) - { - newType = m_inputPorts[ 1 ].DataType; - } - - if( m_inputPorts[ 5 ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ 5 ].DataType ) > UIUtils.GetPriority( newType ) ) ) - { - newType = m_inputPorts[ 5 ].DataType; - } - - m_inputMainDataType = newType; - } - - void TestMainOutputDataType() - { - WirePortDataType newType = WirePortDataType.FLOAT; - for( int i = 2; i < 5; i++ ) - { - if( m_inputPorts[ i ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ i ].DataType ) > UIUtils.GetPriority( newType ) ) ) - { - newType = m_inputPorts[ i ].DataType; - } - } - - if( newType != m_outputMainDataType ) - { - m_outputMainDataType = newType; - m_outputPorts[ 0 ].ChangeType( m_outputMainDataType, false ); - } - } - - public void UpdateConnection( int portId ) - { - m_inputPorts[ portId ].MatchPortToConnection(); - switch( portId ) - { - case 0: - case 1: - case 5: - { - TestMainInputDataType(); - } - break; - case 2: - case 3: - case 4: - { - TestMainOutputDataType(); - } - break; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string a = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_inputMainDataType, ignoreLocalvar, true ); - string b = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_inputMainDataType, ignoreLocalvar, true ); - string r1 = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); - string r2 = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); - string r3 = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); - string tr = m_inputPorts[ 5 ].GenerateShaderForOutput( ref dataCollector, m_inputMainDataType, ignoreLocalvar, true ); - - // No Equal Threshold parameter - //(a > b ? r1 : a == b ? r2 : r3 ) - //string strout = " ( " + a + " > " + b + " ? " + r1 + " : " + a + " == " + b + " ? " + r2 + " : " + r3 + " ) "; - - // With Equal Threshold parameter - // ( a - tr > b ? r1 : a - tr <= b && a + tr >= b ? r2 : r3 ) - string strout = " ( " + a + " - " + tr + " > " + b + " ? " + r1 + " : " + a + " - " + tr + " <= " + b + " && " + a + " + " + tr + " >= " + b + " ? " + r2 + " : " + r3 + " ) "; - - //Debug.Log( strout ); - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs.meta deleted file mode 100644 index 8d6fe583..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1a3d561a45c21114c99f52c5432b25e9 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs deleted file mode 100644 index 38dd4052..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - - -namespace AmplifyShaderEditor -{ - [System.Serializable] - public class TFHCStub : DynamicTypeNode - { - protected WirePortDataType m_mainInputType = WirePortDataType.FLOAT; - protected WirePortDataType m_mainOutputType = WirePortDataType.FLOAT; - protected string m_inputDataPort0 = string.Empty; - protected string m_inputDataPort1 = string.Empty; - protected string m_inputDataPort2 = string.Empty; - protected string m_inputDataPort3 = string.Empty; - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - UpdateConnections( portId ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - UpdateConnections( outputPortId ); - } - - public override void OnInputPortDisconnected( int portId ) - { - int otherPortId = 0; - if ( portId < 2 ) - { - otherPortId = ( portId == 0 ) ? 1 : 0; - if ( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainInputType = m_inputPorts[ otherPortId ].DataType; - m_inputPorts[ portId ].ChangeType( m_mainInputType, false ); - } - } - else - { - otherPortId = ( portId == 2 ) ? 3 : 2; - if ( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainOutputType = m_inputPorts[ otherPortId ].DataType; - m_inputPorts[ portId ].ChangeType( m_mainOutputType, false ); - m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); - } - } - } - - public void GetInputData( ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - //Conditional Operator ?: has some shenanigans - //If the first operand is of type bool, one of the following must hold for the second and third operands: - //Both operands have compatible structure types. - //Both operands are scalars with numeric or bool type. - //Both operands are vectors with numeric or bool type, where the two vectors are of the same size, which is less than or equal to four. - //If the first operand is a packed vector of bool, then the conditional selection is performed on an elementwise basis.Both the second and third operands must be numeric vectors of the same size as the first operand. - WirePortDataType compatibleInputType = m_mainInputType; - if ( m_mainInputType != WirePortDataType.FLOAT && m_mainInputType != WirePortDataType.INT && m_mainInputType != m_mainOutputType ) - { - compatibleInputType = m_mainOutputType; - } - - m_inputDataPort0 = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); - m_inputDataPort1 = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); - - - m_inputDataPort2 = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); - m_inputDataPort3 = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); - } - - void UpdateConnections( int portId ) - { - m_inputPorts[ portId ].MatchPortToConnection(); - int otherPortId = 0; - WirePortDataType otherPortType = WirePortDataType.FLOAT; - if ( portId < 2 ) - { - otherPortId = ( portId == 0 ) ? 1 : 0; - otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; - m_mainInputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; - if ( !m_inputPorts[ otherPortId ].IsConnected ) - { - m_inputPorts[ otherPortId ].ChangeType( m_mainInputType, false ); - } - } - else - { - otherPortId = ( portId == 2 ) ? 3 : 2; - otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; - m_mainOutputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; - - m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); - - if ( !m_inputPorts[ otherPortId ].IsConnected ) - { - m_inputPorts[ otherPortId ].ChangeType( m_mainOutputType, false ); - } - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs.meta deleted file mode 100644 index ca618e77..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 67238b98f61049c45b496af625863edf -timeCreated: 1481646118 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: |